diff --git a/components/iframe_forms/iframe-application-form.html b/components/iframe_forms/iframe-application-form.html index 7c5a3f63..0cd6f476 100644 --- a/components/iframe_forms/iframe-application-form.html +++ b/components/iframe_forms/iframe-application-form.html @@ -437,23 +437,27 @@ For further questions, contact us through bitvid’s Nostr support channels. const ephemeralPubHex = getPublicKey(ephemeralPriv); log("Ephemeral pubkey: " + ephemeralPubHex.slice(0, 16) + "..."); - // Encrypt the application content. - log("Encrypting application content (nip04)..."); - const ciphertext = await nip04.encrypt( - ephemeralPriv, - targetPubHex, - applicationContent - ); - log("[DEBUG] Ciphertext: " + ciphertext); - log("Encryption done."); - - // Build the Nostr event template. + // Build a structured bitvid submission (kind 30083, PUBLIC — no + // encryption). Published from the ephemeral key; the admin's + // Submissions tab lists these and can approve → add to whitelist. const now = Math.floor(Date.now() / 1000); + const submissionId = + "sub-" + + now.toString(36) + + "-" + + Math.random().toString(36).slice(2, 10); const eventTemplate = { - kind: 4, + kind: 30083, created_at: now, - tags: [["p", targetPubHex]], - content: ciphertext, + tags: [ + ["d", submissionId], + ["k", "application"], + ["applicant", applicantNpub], + ["p", targetPubHex], + ["t", "bitvid-submission"], + ["client", "bitvid"], + ], + content: applicationContent, }; log( "[DEBUG] Event template before finalizing: " + @@ -473,7 +477,7 @@ For further questions, contact us through bitvid’s Nostr support channels. for (const url of RELAYS) { log("Connecting to " + url + " for subscription..."); const relay = await Relay.connect(url); - relay.subscribe([{ authors: [ephemeralPubHex], kinds: [4] }], { + relay.subscribe([{ authors: [ephemeralPubHex], kinds: [30083] }], { onEvent(foundEvent) { if (foundEvent.id === event.id) { log( diff --git a/components/iframe_forms/iframe-bug-fix-form.html b/components/iframe_forms/iframe-bug-fix-form.html index 13704d9a..5bf8117f 100644 --- a/components/iframe_forms/iframe-bug-fix-form.html +++ b/components/iframe_forms/iframe-bug-fix-form.html @@ -417,23 +417,31 @@ For urgent issues, contact us through bitvid’s Nostr support channels. const ephemeralPubHex = getPublicKey(ephemeralPriv); log("Ephemeral pubkey: " + ephemeralPubHex.slice(0, 16) + "..."); - // Encrypt the bug report content. - log("Encrypting bug report content (nip04)..."); - const ciphertext = await nip04.encrypt( - ephemeralPriv, - targetPubHex, - bugReportContent - ); - log("[DEBUG] Ciphertext: " + ciphertext); - log("Encryption done."); - - // Build the event template. + // Build a structured bitvid submission (kind 30083, PUBLIC — no + // encryption). Published from the ephemeral key. const now = Math.floor(Date.now() / 1000); + const submissionId = + "sub-" + + now.toString(36) + + "-" + + Math.random().toString(36).slice(2, 10); + const tags = [ + ["d", submissionId], + ["k", "bug"], + ]; + if (userNpub) { + tags.push(["applicant", userNpub]); + } + tags.push( + ["p", targetPubHex], + ["t", "bitvid-submission"], + ["client", "bitvid"] + ); const eventTemplate = { - kind: 4, + kind: 30083, created_at: now, - tags: [["p", targetPubHex]], - content: ciphertext, + tags, + content: bugReportContent, }; log( "[DEBUG] Event template before finalizing: " + @@ -453,7 +461,7 @@ For urgent issues, contact us through bitvid’s Nostr support channels. for (const url of RELAYS) { log("Connecting to " + url + " for subscription..."); const relay = await Relay.connect(url); - relay.subscribe([{ authors: [ephemeralPubHex], kinds: [4] }], { + relay.subscribe([{ authors: [ephemeralPubHex], kinds: [30083] }], { onEvent(foundEvent) { if (foundEvent.id === event.id) { log( diff --git a/components/iframe_forms/iframe-content-appeals-form.html b/components/iframe_forms/iframe-content-appeals-form.html index 56c2a228..ed50c4b7 100644 --- a/components/iframe_forms/iframe-content-appeals-form.html +++ b/components/iframe_forms/iframe-content-appeals-form.html @@ -317,21 +317,25 @@ For further questions, reach out through bitvid’s Nostr support channels. // Encrypt the appeal content. log("Encrypting appeal content (nip04)..."); - const ciphertext = await nip04.encrypt( - ephemeralPriv, - targetPubHex, - appealContent - ); - log("[DEBUG] Ciphertext: " + ciphertext); - log("Encryption done."); - - // Build the event template. + // Build a structured bitvid submission (kind 30083, PUBLIC — no + // encryption). Published from the ephemeral key. const now = Math.floor(Date.now() / 1000); + const submissionId = + "sub-" + + now.toString(36) + + "-" + + Math.random().toString(36).slice(2, 10); const eventTemplate = { - kind: 4, + kind: 30083, created_at: now, - tags: [["p", targetPubHex]], - content: ciphertext, + tags: [ + ["d", submissionId], + ["k", "appeal"], + ["p", targetPubHex], + ["t", "bitvid-submission"], + ["client", "bitvid"], + ], + content: appealContent, }; log( "[DEBUG] Event template before finalizing: " + @@ -351,7 +355,7 @@ For further questions, reach out through bitvid’s Nostr support channels. for (const url of RELAYS) { log("Connecting to " + url + " for subscription..."); const relay = await Relay.connect(url); - relay.subscribe([{ authors: [ephemeralPubHex], kinds: [4] }], { + relay.subscribe([{ authors: [ephemeralPubHex], kinds: [30083] }], { onEvent(foundEvent) { if (foundEvent.id === event.id) { log( diff --git a/components/iframe_forms/iframe-feedback-form.html b/components/iframe_forms/iframe-feedback-form.html index 5e568548..770ec1bf 100644 --- a/components/iframe_forms/iframe-feedback-form.html +++ b/components/iframe_forms/iframe-feedback-form.html @@ -318,21 +318,31 @@ For additional discussions, reach out via bitvid’s Nostr support channels. // Encrypt the feedback content. log("Encrypting feedback content (nip04)..."); - const ciphertext = await nip04.encrypt( - ephemeralPriv, - targetPubHex, - feedbackContent - ); - log("[DEBUG] Ciphertext: " + ciphertext); - log("Encryption done."); - - // Build the event template. + // Build a structured bitvid submission (kind 30083, PUBLIC — no + // encryption). Published from the ephemeral key. const now = Math.floor(Date.now() / 1000); + const submissionId = + "sub-" + + now.toString(36) + + "-" + + Math.random().toString(36).slice(2, 10); + const tags = [ + ["d", submissionId], + ["k", "feedback"], + ]; + if (userNpub) { + tags.push(["applicant", userNpub]); + } + tags.push( + ["p", targetPubHex], + ["t", "bitvid-submission"], + ["client", "bitvid"] + ); const eventTemplate = { - kind: 4, + kind: 30083, created_at: now, - tags: [["p", targetPubHex]], - content: ciphertext, + tags, + content: feedbackContent, }; log( "[DEBUG] Event template before finalizing: " + @@ -352,7 +362,7 @@ For additional discussions, reach out via bitvid’s Nostr support channels. for (const url of RELAYS) { log("Connecting to " + url + " for subscription..."); const relay = await Relay.connect(url); - relay.subscribe([{ authors: [ephemeralPubHex], kinds: [4] }], { + relay.subscribe([{ authors: [ephemeralPubHex], kinds: [30083] }], { onEvent(foundEvent) { if (foundEvent.id === event.id) { log( diff --git a/components/iframe_forms/iframe-request-form.html b/components/iframe_forms/iframe-request-form.html index 8c76a281..9218be15 100644 --- a/components/iframe_forms/iframe-request-form.html +++ b/components/iframe_forms/iframe-request-form.html @@ -360,21 +360,31 @@ For further discussions, reach out through bitvid’s Nostr support channels. // Encrypt the feature request content log("Encrypting feature request content (nip04)..."); - const ciphertext = await nip04.encrypt( - ephemeralPriv, - targetPubHex, - featureRequestContent - ); - log("[DEBUG] Ciphertext: " + ciphertext); - log("Encryption done."); - - // Build the event template + // Build a structured bitvid submission (kind 30083, PUBLIC — no + // encryption). Published from the ephemeral key. const now = Math.floor(Date.now() / 1000); + const submissionId = + "sub-" + + now.toString(36) + + "-" + + Math.random().toString(36).slice(2, 10); + const tags = [ + ["d", submissionId], + ["k", "feature"], + ]; + if (userNpub) { + tags.push(["applicant", userNpub]); + } + tags.push( + ["p", targetPubHex], + ["t", "bitvid-submission"], + ["client", "bitvid"] + ); const eventTemplate = { - kind: 4, + kind: 30083, created_at: now, - tags: [["p", targetPubHex]], - content: ciphertext, + tags, + content: featureRequestContent, }; log( "[DEBUG] Event template before finalizing: " + @@ -394,7 +404,7 @@ For further discussions, reach out through bitvid’s Nostr support channels. for (const url of RELAYS) { log("Connecting to " + url + " for subscription..."); const relay = await Relay.connect(url); - relay.subscribe([{ authors: [ephemeralPubHex], kinds: [4] }], { + relay.subscribe([{ authors: [ephemeralPubHex], kinds: [30083] }], { onEvent(foundEvent) { if (foundEvent.id === event.id) { log(