feat: add support for NIP-29 (#56)

Reviewed-on: reya/coop#56
This commit is contained in:
2026-10-01 04:23:18 +00:00
parent 21f96c7bbe
commit 1f350f511e
50 changed files with 6574 additions and 8181 deletions
-18
View File
@@ -46,11 +46,8 @@ setting_accessors! {
pub nip4e: bool,
pub trusted_relays: Vec<String>,
pub file_server: Url,
pub recent_communities: Vec<String>,
}
const RECENT_COMMUNITIES_CAP: usize = 10;
/// Signer kind
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub enum SignerKind {
@@ -133,10 +130,6 @@ pub struct Settings {
/// Server for blossom media attachments
pub file_server: Url,
/// Recently opened community ids, newest first
#[serde(default)]
pub recent_communities: Vec<String>,
}
impl Default for Settings {
@@ -149,7 +142,6 @@ impl Default for Settings {
nip4e: false,
trusted_relays: vec![],
file_server: Url::parse(DEFAULT_FILE_SERVER).unwrap(),
recent_communities: vec![],
}
}
}
@@ -332,14 +324,4 @@ impl AppSettings {
}
});
}
/// Move a community to the front of the recently opened list
pub fn record_recent_community(&mut self, id: String, cx: &mut Context<Self>) {
self.inner.update(cx, |this, cx| {
this.recent_communities.retain(|existing| existing != &id);
this.recent_communities.insert(0, id);
this.recent_communities.truncate(RECENT_COMMUNITIES_CAP);
cx.notify();
});
}
}