This commit is contained in:
2025-02-02 20:56:58 -05:00
parent 082626deea
commit 9e7ada605e

View File

@@ -14,7 +14,6 @@
color: #fff; color: #fff;
font-family: system-ui, -apple-system, sans-serif; font-family: system-ui, -apple-system, sans-serif;
margin: 20px; margin: 20px;
/* Removed max-width */
} }
/* Override the .container to use the full available width */ /* Override the .container to use the full available width */
@@ -130,10 +129,8 @@
decisions will be communicated back to you. decisions will be communicated back to you.
</p> </p>
<form id="dm-form"> <form id="dm-form">
<!-- NPUB input removed as the recipient is now set by the code -->
<h2>1. User Information</h2> <h2>1. User Information</h2>
<label for="npubInput">Nostr Public Key (npub):</label>
<input type="text" id="npubInput" placeholder="Enter your npub" required />
<label for="contactMethod">Contact Method (if applicable):</label> <label for="contactMethod">Contact Method (if applicable):</label>
<input type="text" id="contactMethod" placeholder="Nostr DM, email, or other" /> <input type="text" id="contactMethod" placeholder="Nostr DM, email, or other" />
@@ -216,30 +213,25 @@
log("NostrTools not loaded. Check console or ad-blockers.", "error"); log("NostrTools not loaded. Check console or ad-blockers.", "error");
return; return;
} }
const { const { generateSecretKey, getPublicKey, finalizeEvent, nip04, nip19, SimplePool, Relay } = window.NostrTools;
generateSecretKey,
getPublicKey, // Set the recipient's NPUB (your personal NPUB) here.
finalizeEvent, const recipientNpub = "npub13yarr7j6vjqjjkahd63dmr27curypehx45ucue286ac7sft27y0srnpmpe";
nip04,
nip19,
SimplePool,
Relay,
} = window.NostrTools;
const RELAYS = [ const RELAYS = [
"wss://relay.snort.social", "wss://relay.snort.social",
"wss://relay.damus.io", "wss://relay.damus.io",
"wss://relay.primal.net", "wss://relay.primal.net"
]; ];
const pool = new SimplePool(); const pool = new SimplePool();
document.getElementById("dm-form").addEventListener("submit", async (ev) => { document.getElementById("dm-form").addEventListener("submit", async (ev) => {
ev.preventDefault(); ev.preventDefault();
clear(); clear();
try { try {
// Retrieve user input. // Note: The customer's NPUB input is removed.
const npub = document.getElementById("npubInput").value.trim(); // Use the recipientNpub constant to get the public key.
if (!npub.startsWith("npub")) {
throw new Error("Target must start with npub.");
}
const contactMethod = document.getElementById("contactMethod").value.trim(); const contactMethod = document.getElementById("contactMethod").value.trim();
const videoTitle = document.getElementById("videoTitle").value.trim(); const videoTitle = document.getElementById("videoTitle").value.trim();
const magnetLink = document.getElementById("magnetLink").value.trim(); const magnetLink = document.getElementById("magnetLink").value.trim();
@@ -259,7 +251,6 @@
# **bitvid Content Appeals Form** # **bitvid Content Appeals Form**
**1. User Information** **1. User Information**
- **Nostr Public Key (npub):** ${npub}
- **Contact Method:** ${contactMethod || "N/A"} - **Contact Method:** ${contactMethod || "N/A"}
**2. Content Details** **2. Content Details**
@@ -303,15 +294,15 @@ For further questions, reach out through bitvids Nostr support channels.
log("[DEBUG] Constructed appeal content:\n" + appealContent); log("[DEBUG] Constructed appeal content:\n" + appealContent);
// Decode the target npub to get the public key. // Decode the recipient NPUB to get the public key.
log("Decoding target npub..."); log("Decoding recipient npub...");
const decoded = nip19.decode(npub); const decoded = nip19.decode(recipientNpub);
log("[DEBUG] Decoded npub: " + JSON.stringify(decoded)); log("[DEBUG] Decoded npub: " + JSON.stringify(decoded));
if (decoded.type !== "npub") { if (decoded.type !== "npub") {
throw new Error("Decoded type is not npub."); throw new Error("Decoded type is not npub.");
} }
const targetPubHex = decoded.data; const targetPubHex = decoded.data;
log("Target pubkey: " + targetPubHex.slice(0, 16) + "..."); log("Recipient pubkey: " + targetPubHex.slice(0, 16) + "...");
// Generate an ephemeral key pair. // Generate an ephemeral key pair.
log("Generating ephemeral key..."); log("Generating ephemeral key...");