diff options
| author | Adam Soltys <[email protected]> | 2026-10-07 08:27:37 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-07 08:27:37 -0700 |
| commit | d31bdc6067841e0707baf7e2ad3bf90a823e730a (patch) | |
| tree | 207053241198cb386342674cd308c329245b0862 /src/features | |
| parent | 190d27995e751ad3f64d84832ea3358765bc5c63 (diff) | |
| download | coinosv3-d31bdc6067841e0707baf7e2ad3bf90a823e730a.tar.gz coinosv3-d31bdc6067841e0707baf7e2ad3bf90a823e730a.zip | |
Popular: the single file opened from a disk does not ask file:///api/feed
The shared Popular snapshot is fetched from a relative /api/feed. Opened
from disk (dist/standalone.html) that is file:///api/feed, a request for a
file beside it that never exists (standalone-file-test: 'nothing looked
for beside the file'). Only ask when served over http(s); the relay path
covers the rest, as it already did for a failed fetch.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/features')
| -rw-r--r-- | src/features/messages.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 241ab5c..1a28adb 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -4806,8 +4806,9 @@ export function messagesFeature(ctx) { const curateFeed = (evs) => { const lang = getLang(); return evs.filter((e) => !isMachinePost(e.content) && inLanguage(e.content, lang)); }; async function popularPass(extra, merge, c, def) { // Only the default public feed shares a snapshot. Custom relays and older - // pages keep their own queries. A static/offline install falls back quickly. - if (extra.until == null && !feedRelays(def)) { + // pages keep their own queries. A static/offline install falls back quickly; + // the single file opened from a disk has no server to ask at all. + if (extra.until == null && !feedRelays(def) && /^https?:$/.test(location.protocol)) { try { const response = await fetch('/api/feed', { signal: AbortSignal.timeout(1500) }); if (!response.ok || !response.headers.get('content-type')?.includes('application/json')) throw new Error('No feed cache'); |
