chore: update nostr sdk
This commit is contained in:
393
Cargo.lock
generated
393
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -163,7 +163,7 @@ impl ChatRegistry {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
match message {
|
match *message {
|
||||||
RelayMessage::Event { event, .. } => {
|
RelayMessage::Event { event, .. } => {
|
||||||
// Keep track of which relays have seen this event
|
// Keep track of which relays have seen this event
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -201,15 +201,12 @@ impl ChatPanel {
|
|||||||
let mut notifications = client.notifications();
|
let mut notifications = client.notifications();
|
||||||
|
|
||||||
while let Some(notification) = notifications.next().await {
|
while let Some(notification) = notifications.next().await {
|
||||||
if let ClientNotification::Message {
|
if let ClientNotification::Message { message, relay_url } = notification
|
||||||
message:
|
&& let RelayMessage::Ok {
|
||||||
RelayMessage::Ok {
|
event_id,
|
||||||
event_id,
|
status,
|
||||||
status,
|
message,
|
||||||
message,
|
} = *message
|
||||||
},
|
|
||||||
relay_url,
|
|
||||||
} = notification
|
|
||||||
{
|
{
|
||||||
let sent_ids = sent_ids.read().await;
|
let sent_ids = sent_ids.read().await;
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ fn main() {
|
|||||||
cx.set_menus(vec![Menu {
|
cx.set_menus(vec![Menu {
|
||||||
name: "Coop".into(),
|
name: "Coop".into(),
|
||||||
items: vec![MenuItem::action("Quit", Quit)],
|
items: vec![MenuItem::action("Quit", Quit)],
|
||||||
|
disabled: false,
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
// Set up the window bounds
|
// Set up the window bounds
|
||||||
|
|||||||
@@ -149,10 +149,8 @@ impl DeviceRegistry {
|
|||||||
let mut processed_events = HashSet::new();
|
let mut processed_events = HashSet::new();
|
||||||
|
|
||||||
while let Some(notification) = notifications.next().await {
|
while let Some(notification) = notifications.next().await {
|
||||||
if let ClientNotification::Message {
|
if let ClientNotification::Message { message, .. } = notification
|
||||||
message: RelayMessage::Event { event, .. },
|
&& let RelayMessage::Event { event, .. } = *message
|
||||||
..
|
|
||||||
} = notification
|
|
||||||
{
|
{
|
||||||
if !processed_events.insert(event.id) {
|
if !processed_events.insert(event.id) {
|
||||||
// Skip if the event has already been processed
|
// Skip if the event has already been processed
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ impl PersonRegistry {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
if let RelayMessage::Event { event, .. } = message {
|
if let RelayMessage::Event { event, .. } = *message {
|
||||||
// Skip if the event has already been processed
|
// Skip if the event has already been processed
|
||||||
if !processed.insert(event.id) {
|
if !processed.insert(event.id) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ impl RelayAuth {
|
|||||||
|
|
||||||
while let Some(notification) = notifications.next().await {
|
while let Some(notification) = notifications.next().await {
|
||||||
if let ClientNotification::Message { relay_url, message } = notification {
|
if let ClientNotification::Message { relay_url, message } = notification {
|
||||||
match message {
|
match *message {
|
||||||
RelayMessage::Auth { challenge } => {
|
RelayMessage::Auth { challenge } => {
|
||||||
if challenges.insert(challenge.clone()) {
|
if challenges.insert(challenge.clone()) {
|
||||||
let request = Arc::new(AuthRequest::new(challenge, relay_url));
|
let request = Arc::new(AuthRequest::new(challenge, relay_url));
|
||||||
@@ -221,31 +221,31 @@ impl RelayAuth {
|
|||||||
|
|
||||||
while let Some(notification) = notifications.next().await {
|
while let Some(notification) = notifications.next().await {
|
||||||
match notification {
|
match notification {
|
||||||
RelayNotification::Message {
|
RelayNotification::Message { message } => {
|
||||||
message: RelayMessage::Ok { event_id, .. },
|
if let RelayMessage::Ok { event_id, .. } = *message {
|
||||||
} => {
|
if id != event_id {
|
||||||
if id != event_id {
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all subscriptions
|
|
||||||
let subscriptions = relay.subscriptions().await;
|
|
||||||
|
|
||||||
// Re-subscribe to previous subscriptions
|
|
||||||
for (id, filters) in subscriptions.into_iter() {
|
|
||||||
if !filters.is_empty() {
|
|
||||||
relay.send_msg(ClientMessage::req(id, filters)).await?;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Re-send pending events
|
// Get all subscriptions
|
||||||
for id in pending_events {
|
let subscriptions = relay.subscriptions().await;
|
||||||
if let Some(event) = client.database().event_by_id(&id).await? {
|
|
||||||
relay.send_event(&event).await?;
|
// Re-subscribe to previous subscriptions
|
||||||
|
for (id, filters) in subscriptions.into_iter() {
|
||||||
|
if !filters.is_empty() {
|
||||||
|
relay.send_msg(ClientMessage::req(id, filters)).await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(());
|
// Re-send pending events
|
||||||
|
for id in pending_events {
|
||||||
|
if let Some(event) = client.database().event_by_id(&id).await? {
|
||||||
|
relay.send_event(&event).await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RelayNotification::AuthenticationFailed => break,
|
RelayNotification::AuthenticationFailed => break,
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|||||||
Reference in New Issue
Block a user