mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
submissions(#23): forms publish structured kind-30083 instead of kind-4 DMs
All 5 iframe forms now publish a PUBLIC, structured bitvid submission (kind 30083) from their ephemeral key instead of a NIP-04 encrypted kind-4 DM — so the admin Submissions tab can list + approve/deny them. - application → k=application (+ applicant = the required npub) - bug-fix → k=bug, feedback → k=feedback, request → k=feature (each includes applicant only when the optional npub is filled in) - content-appeals → k=appeal (no npub field) Each tags ['d', <id>], ['k', <type>], ['p', <admin hex>], ['t','bitvid-submission'], ['client','bitvid']; the form body goes in plaintext content. The post-publish verification subscription now watches kind 30083. No encryption anywhere. Lint + build clean. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
2a21756842
commit
878f01b819
5 files changed
+105
-69
No files matched your search
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user