diff --git a/src/web/management/mod.rs b/src/web/management/mod.rs index 31c4541..1ecc8db 100644 --- a/src/web/management/mod.rs +++ b/src/web/management/mod.rs @@ -18,6 +18,13 @@ struct EventResult { reason: Option, } +#[derive(Serialize)] +struct FullEventResult { + event: String, + #[serde(skip_serializing_if = "Option::is_none")] + reason: Option, +} + #[derive(Serialize)] struct PubkeyResult { pubkey: String, @@ -128,6 +135,7 @@ pub fn handle_inner(pubkey: Pubkey, command: Value) -> Result, Err "listallowedevents", "listbannedevents", + "listbannedevents2", "listallowedpubkeys", "listbannedpubkeys", @@ -283,6 +291,25 @@ pub fn handle_inner(pubkey: Pubkey, command: Value) -> Result, Err "result": ids }))) } + "listbannedevents2" => { + let approvals = crate::dump_event_approvals(GLOBALS.store.get().unwrap())?; + let mut results: Vec = Vec::new(); + for (id, appr) in approvals.iter() { + if ! *appr { + if let Some(event) = GLOBALS.store.get().unwrap().get_event_by_id(*id)? { + results.push( + FullEventResult { + event: format!("{event}"), + reason: None, + } + ); + } + } + } + Ok(Some(json!({ + "result": results + }))) + } "listallowedpubkeys" => { let approvals = crate::dump_pubkey_approvals(GLOBALS.store.get().unwrap())?; let pubkeys: Vec = approvals