diff --git a/frontend/src/lib/nostr-auth.ts b/frontend/src/lib/nostr-auth.ts index b261e05..7855f5d 100644 --- a/frontend/src/lib/nostr-auth.ts +++ b/frontend/src/lib/nostr-auth.ts @@ -68,19 +68,21 @@ export async function buildNip98Token( let signedEvent: Record - const signer = (window as { nostr?: NostrSigner }).nostr - if (signer) { - // Sign via NIP-07 extension or Amber - signedEvent = await signer.signEvent(unsignedEvent) - } else if (secretKeyHex) { - // Sign locally with secret key + if (secretKeyHex) { + // Sign locally with provided secret key — always prefer explicit key over extension const { hexToBytes } = await import('nostr-tools/utils') const { finalizeEvent } = await import('nostr-tools') const sk = hexToBytes(secretKeyHex) const event = finalizeEvent(unsignedEvent, sk) signedEvent = event as unknown as Record } else { - throw new Error('No Nostr signer available. Install a NIP-07 extension or use a saved key.') + const signer = (window as { nostr?: NostrSigner }).nostr + if (signer) { + // Sign via NIP-07 extension or Amber + signedEvent = await signer.signEvent(unsignedEvent) + } else { + throw new Error('No Nostr signer available. Install a NIP-07 extension or use a saved key.') + } } return btoa(JSON.stringify(signedEvent)) diff --git a/frontend/src/pages/JoinBoutPage.vue b/frontend/src/pages/JoinBoutPage.vue index 79dd72b..db04d93 100644 --- a/frontend/src/pages/JoinBoutPage.vue +++ b/frontend/src/pages/JoinBoutPage.vue @@ -523,12 +523,21 @@ async function confirmPolling() { } } +function setupDocPath() { + return connectionMode.value === 'polling' ? '/docs/BOTFIGHTS-POLLING.md' : '/docs/BOTFIGHTS-WEBHOOK.md' +} + +function setupDocName() { + return connectionMode.value === 'polling' ? 'BOTFIGHTS-POLLING.md' : 'BOTFIGHTS-WEBHOOK.md' +} + function downloadSetupGuide() { - window.open('/docs/BOTFIGHTS.md', '_blank') + window.open(setupDocPath(), '_blank') } function copyFullPrompt() { - const text = `Read BOTFIGHTS.md and follow the setup instructions. Here are my credentials:\nBOT_ID=${botId.value}\nBOT_SECRET=${botSecret.value}` + const docName = setupDocName() + const text = `Read ${docName} and follow the setup instructions. Here are my credentials:\nBOT_ID=${botId.value}\nBOT_SECRET=${botSecret.value}` navigator.clipboard.writeText(text) setupGuideCopied.value = true setTimeout(() => { setupGuideCopied.value = false }, 2000) @@ -1336,13 +1345,13 @@ function handleSignOut() {
1
-

Download BOTFIGHTS.md into your workspace

+

Download {{ setupDocName() }} into your workspace

@@ -1353,7 +1362,7 @@ function handleSignOut() {

Tell your AI this:

-

Read BOTFIGHTS.md and follow the setup instructions. Here are my credentials:

+

Read {{ setupDocName() }} and follow the setup instructions. Here are my credentials:

BOT_ID={{ botId }}
BOT_SECRET={{ botSecret }}