Response to Tony's review

This commit is contained in:
benthecarman
2023-02-21 11:26:06 -06:00
parent 41d7b380c9
commit 69b1ab320d
2 changed files with 6 additions and 13 deletions

View File

@@ -14,6 +14,7 @@ cfg-if = "0.1.2"
# Need the queue feature
worker = { git = "https://github.com/cloudflare/workers-rs", rev = "b4b9cd1f15feac412b6f9e9e9209458cd3b98430", features = ["queue"] }
futures = "0.3.26"
# Needed for serde serializaters
nostr = { git = "https://github.com/benthecarman/nostr", rev = "6c238ac72651671bcfd6666ddcd731767d1643b8" }
serde = { version = "^1.0", features = ["derive"] }

View File

@@ -191,28 +191,20 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
{
Ok(_) => {
console_log!("saved published note: {}", event.id);
let relay_msg =
RelayMessage::new_ok(event.id, true, "");
server
.send_with_str(&relay_msg.as_json())
.expect("failed to send response");
}
Err(e) => {
console_log!(
"could not save published note: {} - {e:?}",
event.id
);
let relay_msg = RelayMessage::new_ok(
event.id,
false,
"error: could not save published note",
);
}
}
let relay_msg = RelayMessage::new_ok(event.id, true, "");
server
.send_with_str(&relay_msg.as_json())
.expect("failed to send response");
}
}
}
_ => {
console_log!("ignoring other nostr client message types");
}