From d32994e50f348cdce1f7a3c3fe2ca414ca79c0f9 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Tue, 30 Sep 2025 21:43:17 -0400 Subject: [PATCH] Mark session actor view events --- js/nostr.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/js/nostr.js b/js/nostr.js index 1a55107f..b3111727 100644 --- a/js/nostr.js +++ b/js/nostr.js @@ -2005,6 +2005,13 @@ class NostrClient { ? Math.floor(options.created_at) : Math.floor(Date.now() / 1000); + const normalizedActor = + typeof actorPubkey === "string" ? actorPubkey.toLowerCase() : ""; + const normalizedLogged = + typeof this.pubkey === "string" ? this.pubkey.toLowerCase() : ""; + const usingSessionActor = + normalizedActor && normalizedActor !== normalizedLogged; + const additionalTags = Array.isArray(options.additionalTags) ? options.additionalTags.filter( (tag) => Array.isArray(tag) && typeof tag[0] === "string" @@ -2017,6 +2024,12 @@ class NostrClient { ...additionalTags, ]; + if ( + usingSessionActor && + !tags.some((tag) => tag[0] === "session" && tag[1] === "true") + ) { + tags.push(["session", "true"]); + } const content = typeof options.content === "string" ? options.content : ""; @@ -2029,9 +2042,6 @@ class NostrClient { }; let signedEvent = null; - const normalizedActor = actorPubkey.toLowerCase(); - const normalizedLogged = - typeof this.pubkey === "string" ? this.pubkey.toLowerCase() : ""; if ( normalizedActor &&