Skip to content

fix(web): support source search over insecure LAN HTTP - #738

Merged
hectorqin merged 1 commit into
mainfrom
devin/1795658374-insecure-context-ids
Nov 26, 2026
Merged

hectorqin merged 1 commit into
mainfrom
devin/1795658374-insecure-context-ids

Conversation

@hectorqin

@hectorqin hectorqin commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #736. Over LAN plain HTTP the page is not a secure context, so crypto.randomUUID is undefined. Source search called it after setBusy(true) but before its try block. The resulting TypeError meant the request was never sent and the page stayed on 正在搜索 forever.

  • SourceCatalogPage, SourcesPage and the native queue in player.ts now use the existing newId() from core/id.ts. It falls back to getRandomValues, which works over HTTP.
  • Search setup now runs inside try/catch/finally. If anything throws before the request, the page shows an error and clears busy/searching instead of hanging.
  • test/id.test.ts fails if any file in web/src other than core/id.ts references crypto.randomUUID. The repo has no ESLint, so this test is the guard.
  • Clipboard copy (annotation toolbar, notes export) checks whether navigator.clipboard.writeText exists. If it does not, a visible message suggests system copy, download or HTTPS, instead of failing silently.
  • Audit of other secure-context-only APIs: service worker, fullscreen and orientation are already guarded. crypto.subtle, mediaDevices, share and wakeLock are not used.

Tested in headful Chromium against the real server on http://<LAN IP>:5890/, where isSecureContext === false and randomUUID is undefined. Search on the sources page, an empty search and catalog search all reached the server (200 event-stream) and completed, with no page errors. New tests stub out randomUUID and cover success, empty, request-error and setup-error/retry on both pages.

sources results over HTTP


Julia opened this PR for Qin
Implemented in session Review reader project and suggest improvements
Review with Devin · Open in Devin Desktop


Use the existing ID fallback for source searches and native queues, and protect search request setup with error handling and cleanup. Guard source callers with a recursive UUID scan and missing-API UI tests; clarify clipboard fallback guidance.

Fixes #736

Co-Authored-By: qin hector <hectorq.me@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@hectorqin
hectorqin merged commit 23ebdc5 into main Nov 26, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

局域网明文 HTTP 访问时点搜索无任何反应(crypto.randomUUID 在非安全上下文不可用)

1 participant