From d31bdc6067841e0707baf7e2ad3bf90a823e730a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 7 Oct 2026 08:27:37 -0700 Subject: 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 --- src/features/messages.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/features') 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'); -- cgit v1.2.3