aboutsummaryrefslogtreecommitdiffstats
path: root/src/recipient-search.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-01 16:34:55 -0700
committerAdam Soltys <[email protected]>2026-10-01 16:34:55 -0700
commit66d41d1aa1f5c60cd63b1691ba6bf70e88cf78fa (patch)
treeb26348dfe27873e9bd610b67a5880de00cf3db72 /src/recipient-search.js
parenta7806172f7ede9be345750c93e5fa72e10e9b953 (diff)
downloadcoinosv3-66d41d1aa1f5c60cd63b1691ba6bf70e88cf78fa.tar.gz
coinosv3-66d41d1aa1f5c60cd63b1691ba6bf70e88cf78fa.zip
The standalone wallet opened from a disk shows its avatars, font and languages.
With no files beside it, relative punks/, locales/, nip46.js and jsqr.js looked on the disk. From file:// they now come from v3.coinos.io (images and scripts need no CORS; /locales/ now sends Access-Control-Allow-Origin on the server), and standalone.html carries Public Sans inline. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VP5Ljqk7EYcm5QQAbzDwog
Diffstat (limited to 'src/recipient-search.js')
-rw-r--r--src/recipient-search.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/recipient-search.js b/src/recipient-search.js
index e0339ca..20083ee 100644
--- a/src/recipient-search.js
+++ b/src/recipient-search.js
@@ -9,6 +9,7 @@
// prefixes already seen.
import { queryOn, parseNostrPubkey, npubOf, PROFILE_RELAYS } from './nostr.js';
+import { assetUrl } from './asset-url.js';
// coinos punks: the deterministic default avatar — same formula the coinos
// app uses (last byte of the pubkey picks one of 64). Initials show through
@@ -16,8 +17,7 @@ import { queryOn, parseNostrPubkey, npubOf, PROFILE_RELAYS } from './nostr.js';
// Self-hosted (dist/punks) — coinos.io's own copies 502 for a third of the
// set. Same deterministic formula the coinos app uses.
const punkN = (pk) => Math.floor((parseInt(pk.slice(-2), 16) / 256) * 64) + 1;
-export const punkImageUrl = (n, small = false) =>
- `${typeof location !== 'undefined' && location.protocol === 'file:' ? '' : '/'}punks${small ? '-sm' : ''}/${n}.webp`;
+export const punkImageUrl = (n, small = false) => assetUrl(`/punks${small ? '-sm' : ''}/${n}.webp`);
export const punkUrl = (pk) => punkImageUrl(punkN(pk));
// The art is 240px, which is what a punk published as someone's nostr
// picture should be — and eight times what a 30px circle needs. We ship a