mirror of
https://github.com/aljazceru/blastr.git
synced 2025-12-18 22:44:22 +01:00
env fixes and more logs
This commit is contained in:
16
src/lib.rs
16
src/lib.rs
@@ -1,4 +1,4 @@
|
|||||||
use crate::nostr::{try_queue_client_msg, NOSTR_QUEUE};
|
pub(crate) use crate::nostr::{try_queue_client_msg, NOSTR_QUEUE};
|
||||||
use ::nostr::{ClientMessage, Event};
|
use ::nostr::{ClientMessage, Event};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use worker::*;
|
use worker::*;
|
||||||
@@ -34,10 +34,16 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
|
|||||||
router
|
router
|
||||||
.post_async("/event", |mut req, ctx| async move {
|
.post_async("/event", |mut req, ctx| async move {
|
||||||
// for any adhoc POST event
|
// for any adhoc POST event
|
||||||
let request_text = req.text().await?;
|
match req.text().await {
|
||||||
if let Ok(client_msg) = ClientMessage::from_json(request_text) {
|
Ok(request_text) => {
|
||||||
let nostr_queue = ctx.env.queue(NOSTR_QUEUE).expect("get queue");
|
if let Ok(client_msg) = ClientMessage::from_json(request_text) {
|
||||||
try_queue_client_msg(client_msg, nostr_queue).await
|
let nostr_queue = ctx.env.queue(NOSTR_QUEUE).expect("get queue");
|
||||||
|
try_queue_client_msg(client_msg, nostr_queue).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
console_log!("could not get request text: {}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch()
|
fetch()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ main = "build/worker/shim.mjs"
|
|||||||
compatibility_date = "2022-01-20"
|
compatibility_date = "2022-01-20"
|
||||||
|
|
||||||
routes = [
|
routes = [
|
||||||
{ pattern = "nostr.mutinywallet.com", zone_id = "2b9268714ce8d1c4431e8046d4ba55d3" } # replace with your info
|
{ pattern = "nostr.mutinywallet.com/*", zone_id = "2b9268714ce8d1c4431e8046d4ba55d3" } # replace with your info
|
||||||
]
|
]
|
||||||
|
|
||||||
[vars]
|
[vars]
|
||||||
|
|||||||
Reference in New Issue
Block a user