Repository navigation
feat: view shared links at /log behind cloudflare access - #12
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cess Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Adds a page for reading the optional shared-link log, so the owner of a deployment can see the links that
GET /?url=produced.Behaviour
/logis served only when theSHARED_LINKSbinding exists; otherwise it falls through to the share-link route and answers404, as before.ctx.accessthe page answers403and never touches KV. The Worker does not verify JWTs itself; it relies on the runtime-providedctx.access. Access must protect only the/logpath, because protecting the whole Worker would also block share links and/media/.listper view.?day=YYYY-MM-DD(default: today, UTC) becomes the key prefix. The free plan writes at most 1,000 keys a day and onelistreturns up to 1,000 keys, so a day fits in one call; list requests are capped at 1,000 a day on the free plan, so there is no cross-day paging or search. An invalid day answers400before listing.get). URLs are HTML-escaped. Responses carryCache-Control: no-store,X-Robots-Tag: noindexandReferrer-Policy: no-referrer. A failinglistanswers503.Specs
docs/spec/shared-link-log-page-behind-access.md, verified bytest/shared-link-log-page-behind-access.test.ts. Six deliberate mutations (no Access check, no escaping, nono-store, no newest-first, no day round-trip check, no503) each turned a test red.Verification
bun run checkpasses: 586 tests, typecheck clean.cf devlocally:/loganswers403withLOG_SHARED_LINKS=1and404without it.200path with a real Access login. The docs do not say whether a path-scoped self-hosted Access application populatesctx.access; check after deploying with Access on/log.🤖 Generated with Claude Code
Summary by CodeRabbit
/log路徑,避免影響共享連結及媒體功能。