bug fixing and deploy and build diagnostics
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use nostr_sdk::prelude::*;
|
||||
use nostr_sdk::pool;
|
||||
use std::net::SocketAddr;
|
||||
use std::path::Path;
|
||||
use tokio::fs;
|
||||
@@ -146,51 +145,6 @@ pub async fn revoke_if_needed(identity_dir: &Path, tor_proxy: Option<&str>) -> R
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Publish node identity to Nostr relays for discovery.
|
||||
/// Content: { did, node_address, version }
|
||||
/// Only call when relays are non-empty (opt-in).
|
||||
/// When tor_proxy is set, routes through Tor to prevent IP exposure.
|
||||
/// Skips if nostr_revoked sentinel exists (revocation must not be overwritten).
|
||||
pub async fn publish_node_identity(
|
||||
identity_dir: &Path,
|
||||
did: &str,
|
||||
node_address: &str,
|
||||
version: &str,
|
||||
relays: &[String],
|
||||
tor_proxy: Option<&str>,
|
||||
) -> Result<pool::Output<EventId>> {
|
||||
if relays.is_empty() {
|
||||
anyhow::bail!("No relays configured for Nostr discovery");
|
||||
}
|
||||
if identity_dir.join(NOSTR_REVOKED_FILE).exists() {
|
||||
tracing::debug!("Nostr discovery: skipping publish (revoked)");
|
||||
return Err(anyhow::anyhow!("Nostr discovery revoked"));
|
||||
}
|
||||
|
||||
let keys = load_or_create_nostr_keys(identity_dir).await?;
|
||||
let client = build_nostr_client(keys, tor_proxy)?;
|
||||
|
||||
let content = serde_json::json!({
|
||||
"did": did,
|
||||
"node_address": node_address,
|
||||
"version": version,
|
||||
})
|
||||
.to_string();
|
||||
|
||||
for url in relays {
|
||||
let _ = client.add_relay(url).await;
|
||||
}
|
||||
client.connect().await;
|
||||
|
||||
let builder = EventBuilder::new(Kind::Custom(ARCHIPELAGO_KIND as u16), content)
|
||||
.tag(Tag::identifier(D_TAG));
|
||||
let output = client.send_event_builder(builder).await?;
|
||||
|
||||
client.disconnect().await;
|
||||
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
/// Get Nostr public key for this node (hex).
|
||||
pub async fn get_nostr_pubkey(identity_dir: &Path) -> Result<String> {
|
||||
let keys = load_or_create_nostr_keys(identity_dir).await?;
|
||||
|
||||
Reference in New Issue
Block a user