diff options
| author | Adam Soltys <[email protected]> | 2026-11-23 09:22:47 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-11-23 09:22:47 -0700 |
| commit | 2cd42f811d33a74c3ca28094176c009c0388da9b (patch) | |
| tree | b2b4127f00cbd7fef990596e7f92511dbf308380 /build.js | |
| parent | 7711115f1e2a7f8cd73017d548274d4fab9f3d86 (diff) | |
| download | coinosv3-2cd42f811d33a74c3ca28094176c009c0388da9b.tar.gz coinosv3-2cd42f811d33a74c3ca28094176c009c0388da9b.zip | |
A coinos name has a public pay page: v3.coinos.io/<name>/receive. "The old Coinos I could point this link onto my website give people the ability to Donate/Pay in Bitcoin and Lighting - https://coinos.io/JuryImagePro/receive - I'm not seeing an option to do this thru V3, am I missing something?" (JuryImagePro, relayed by Adam 2026-11-23). v3 had no page a visitor could pay a name from: tapping pay on a profile asks a visitor to sign in. /<name>/receive and /<name>/pay now open a small page of their own (dist/pay/index.html from src/pay-page.js, 39 KB, not the app): the name's face, a LNURL QR any Lightning wallet can pay with an amount picked there, the address to copy, and a form for a set amount and a note that makes an invoice (QR, copy, open in wallet). When coinos' node minted the invoice the page says Paid once it settles (LUD-21 verify, coinosv3-server e40c5eb); when the recipient's own wallet minted it, the page says to pay it from the wallet. ?amount= fills in the amount. Lightning only: a v3 name publishes no on-chain address. Receive → More options → Payment page shows the link with Copy and Open page. nginx on cs routes the two paths to the page; the service worker leaves them alone. New pay-page-test (set amount + note, Paid, no-verify invoice, minimum, unknown name) and names-pay-page-link-test pass; names-invoice-expiry, features-smoke and feature-registry-check pass.HEADmaster
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6Upic5L6MMJzkTn8zg
Diffstat (limited to 'build.js')
| -rw-r--r-- | build.js | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -105,6 +105,8 @@ self.addEventListener('fetch', (e) => { if (u.pathname.startsWith('/live/') || u.pathname.startsWith('/vmedia/hls')) return; // The developer docs are their own page, not the app: never the offline shell. if (u.pathname === '/docs' || u.pathname.startsWith('/docs/')) return; + // Nor is a name's pay page (/<name>/receive): a visitor's page from the server. + if (/^\\/[^/]+\\/(receive|pay)\\/?$/i.test(u.pathname) || u.pathname.startsWith('/pay/')) return; if (req.mode === 'navigate') { // Opening the app (/, the installed app's and the Android app's start @@ -242,6 +244,19 @@ export async function buildJsQr({ minify = true } = {}) { return iife(await result.outputs[0].text()); } +// The public pay page (v3.coinos.io/<name>/receive): its own small +// document with the script inline, not the app. See src/pay-page.js. +export async function buildPayPage({ minify = true } = {}) { + const result = await Bun.build({ entrypoints: ['./src/pay-page.js'], target: 'browser', minify }); + if (!result.success) { + for (const log of result.logs) console.error(log); + throw new Error('pay page bundle failed'); + } + const js = iife(await result.outputs[0].text()).replace(/<\/script/gi, '<\\/script'); + const tpl = await Bun.file('./src/pay-page.html').text(); + return tpl.replace('/*PAY_PAGE_JS*/', () => js); +} + // Standalone bundle for the NIP-46 remote-signer client — loaded on demand by // nostr-login.js the first time a bunker/nostrconnect login happens. export async function buildNip46({ minify = true } = {}) { @@ -623,6 +638,8 @@ if (import.meta.main) { for (const f of readdirSync('static/' + d)) await Bun.write(`dist/${d}/${f}`, Bun.file(`static/${d}/${f}`)); // the developer docs, a plain page at /docs/ for (const f of readdirSync('static/docs')) await Bun.write(`dist/docs/${f}`, Bun.file(`static/docs/${f}`)); + // the public pay page, served by nginx for /<name>/receive and /<name>/pay + await Bun.write('dist/pay/index.html', await buildPayPage()); const kb = (Buffer.byteLength(html) / 1024).toFixed(0); const jkb = (Buffer.byteLength(rawJs) / 1024).toFixed(0); |
