diff options
| -rw-r--r-- | dev.js | 4 | ||||
| -rw-r--r-- | src/asset-url.js | 6 | ||||
| -rw-r--r-- | tools/concord-live-delivery-test.js | 34 |
3 files changed, 8 insertions, 36 deletions
@@ -63,6 +63,10 @@ Bun.serve({ ? new Response(file, { headers: { 'content-type': 'image/webp', 'cache-control': NO_STORE } }) : new Response('Not found', { status: 404 }); } + if (/^\/icon(-maskable)?(-\d+)?\.(png|svg)$/.test(path)) { + const file = Bun.file('static' + path); + if (await file.exists()) return new Response(file, { headers: { 'cache-control': NO_STORE } }); + } const loc = path.match(/^\/locales\/([a-z]{2})\.json$/); if (loc) { const f = Bun.file('src/locales/' + loc[1] + '.json'); diff --git a/src/asset-url.js b/src/asset-url.js index bd80240..89ad1ea 100644 --- a/src/asset-url.js +++ b/src/asset-url.js @@ -1,6 +1,8 @@ // The standalone wallet (standalone.html opened from a disk) has no files // beside it: punks, the lazy modules and the language packs come from the -// site instead. Served from anywhere else, paths stay relative. +// site instead. Served from anywhere else, paths are from the site root: +// relative ones resolved against a deep page (/feed/…, /nevent1…, /chat) +// and fetched the app's HTML instead (the coinos community's logo broke). export const SITE = 'https://v3.coinos.io/'; const fromDisk = () => typeof location !== 'undefined' && location.protocol === 'file:'; -export const assetUrl = (path) => fromDisk() ? SITE + path.replace(/^\//, '') : path; +export const assetUrl = (path) => (fromDisk() ? SITE : '/') + path.replace(/^\//, ''); diff --git a/tools/concord-live-delivery-test.js b/tools/concord-live-delivery-test.js deleted file mode 100644 index 5f4733d..0000000 --- a/tools/concord-live-delivery-test.js +++ /dev/null @@ -1,34 +0,0 @@ -// Publish one labeled test message to coinos #general via the Concord -// protocol, exactly as hal would, from a throwaway key — used to test -// live delivery into an already-open client. -import { channelKey, wrapRumor, msTags } from '../src/concord.js'; -import { getPublicKey, finalizeEvent, generateSecretKey } from 'nostr-tools/pure'; -import { getEventHash } from 'nostr-tools/pure'; -import { SimplePool } from 'nostr-tools/pool'; - -const hexToBytes = (s) => Uint8Array.from(s.match(/../g).map((b) => parseInt(b, 16))); -const root = hexToBytes('58b2ce26eba30fbd19d9a57bce4c61e65838686998f10bba1d3e822fb72b372e'); -const CH = '56bf8b96c1a3768c85444873df507cdbc3275fcbc21996af09e60003f850f85c'; -const stream = channelKey(root, CH, 0); - -const sk = generateSecretKey(); -const pubkey = getPublicKey(sk); -const signer = { - pubkey, - signEvent: async (e) => finalizeEvent(e, sk), -}; - -const { created_at, ms } = msTags(Date.now()); -const rumor = { - kind: 9, pubkey, content: '🤖 delivery test (claude, debugging) — ignore', - tags: [['channel', CH], ['epoch', '0'], ms], created_at, -}; -rumor.id = getEventHash({ ...rumor }); - -const wrap = await wrapRumor(rumor, signer, stream); -const pool = new SimplePool(); -const relays = ['wss://relay.coinos.io', 'wss://nos.lol']; -const res = await Promise.allSettled(pool.publish(relays, wrap)); -console.log('published wrap', wrap.id.slice(0, 12), res.map((r) => r.status)); -pool.close(relays); -process.exit(0); |
