feat: improve compose modal
This commit is contained in:
@@ -12,4 +12,4 @@ pub const ALL_MESSAGES_SUB_ID: &str = "listen_all_giftwraps";
|
||||
pub const IMAGE_SERVICE: &str = "https://wsrv.nl";
|
||||
|
||||
/// NIP96 Media Server
|
||||
pub const NIP96_SERVER: &str = "https://nostrcheck.me";
|
||||
pub const NIP96_SERVER: &str = "https://nostrmedia.com";
|
||||
|
||||
@@ -7,6 +7,18 @@ pub struct NostrProfile {
|
||||
metadata: Metadata,
|
||||
}
|
||||
|
||||
impl AsRef<PublicKey> for NostrProfile {
|
||||
fn as_ref(&self) -> &PublicKey {
|
||||
&self.public_key
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<Metadata> for NostrProfile {
|
||||
fn as_ref(&self) -> &Metadata {
|
||||
&self.metadata
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for NostrProfile {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.public_key() == other.public_key()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::constants::NIP96_SERVER;
|
||||
use chrono::{Datelike, Local, TimeZone};
|
||||
use itertools::Itertools;
|
||||
use nostr_sdk::prelude::*;
|
||||
use rnglib::{Language, RNG};
|
||||
use std::{
|
||||
@@ -7,6 +8,13 @@ use std::{
|
||||
hash::{DefaultHasher, Hash, Hasher},
|
||||
};
|
||||
|
||||
pub async fn signer_public_key(client: &Client) -> anyhow::Result<PublicKey, anyhow::Error> {
|
||||
let signer = client.signer().await?;
|
||||
let public_key = signer.get_public_key().await?;
|
||||
|
||||
Ok(public_key)
|
||||
}
|
||||
|
||||
pub async fn nip96_upload(client: &Client, file: Vec<u8>) -> anyhow::Result<Url, anyhow::Error> {
|
||||
let signer = client.signer().await?;
|
||||
let server_url = Url::parse(NIP96_SERVER)?;
|
||||
@@ -18,8 +26,9 @@ pub async fn nip96_upload(client: &Client, file: Vec<u8>) -> anyhow::Result<Url,
|
||||
}
|
||||
|
||||
pub fn room_hash(tags: &Tags) -> u64 {
|
||||
let pubkeys: Vec<PublicKey> = tags.public_keys().copied().collect();
|
||||
let pubkeys: Vec<&PublicKey> = tags.public_keys().unique_by(|&pubkey| pubkey).collect();
|
||||
let mut hasher = DefaultHasher::new();
|
||||
|
||||
// Generate unique hash
|
||||
pubkeys.hash(&mut hasher);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user