Admin pubkey now can delete any event
This commit is contained in:
parent
5b2726e66d
commit
025ba52a81
12 changed files with 274 additions and 125 deletions
|
@ -24,8 +24,8 @@ pub async fn client_connection(
|
|||
let mut client_receiver = UnboundedReceiverStream::new(client_receiver);
|
||||
|
||||
// Create and Add to the Context new Client and set its sender
|
||||
let ip = if real_client_ip.is_some() {
|
||||
real_client_ip.unwrap().to_string()
|
||||
let ip = if let Some(ip) = real_client_ip {
|
||||
ip.to_string()
|
||||
} else {
|
||||
"".to_string()
|
||||
};
|
||||
|
@ -78,9 +78,11 @@ pub async fn client_connection(
|
|||
}
|
||||
}
|
||||
}
|
||||
crate::bussy::Command::DbResOkWithStatus(status) => {
|
||||
if let Some(sender) = &client.client_connection {
|
||||
sender.send(Ok(Message::text(status))).unwrap();
|
||||
crate::bussy::Command::DbResOkWithStatus(client_id, status) => {
|
||||
if client.client_id == client_id {
|
||||
if let Some(sender) = &client.client_connection {
|
||||
sender.send(Ok(Message::text(status.as_json()))).unwrap();
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => ()
|
||||
|
@ -220,6 +222,20 @@ async fn handle_msg(context: &Context, client: &mut Client, client_message: Clie
|
|||
async fn handle_event(context: &Context, client: &Client, event: Box<Event>) {
|
||||
log::debug!("handle_event is processing new event");
|
||||
|
||||
if let Err(err) = event.verify() {
|
||||
let relay_message =
|
||||
nostr::RelayMessage::new_ok(event.id, false, "Failed to verify event signature");
|
||||
let message = crate::bussy::Message {
|
||||
source: channels::MSG_RELAY,
|
||||
content: crate::bussy::Command::PipelineResRelayMessageOk(
|
||||
client.client_id,
|
||||
relay_message,
|
||||
),
|
||||
};
|
||||
context.pubsub.publish(channels::MSG_RELAY, message).await;
|
||||
return;
|
||||
}
|
||||
|
||||
context
|
||||
.pubsub
|
||||
.publish(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue