Repository navigation
Conversation
…low-up) `String(env.PUBLIC || "").toLowerCase() === "true"` was copied into worker.js and twice into node.js, and node.js re-derived core's "PUBLIC wins over tokens" rule for its startup log. Core now exports parsePublic and proxyMode, uses proxyMode itself, and both shells call them. Behaviour is unchanged: only "true" (any case) opens the proxy; anything else fails closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Deploy Preview for savrlist ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #125 (#124), from its code review. This is a refactor with no behaviour change.
String(env.PUBLIC || "").toLowerCase() === "true"was copied three times: once inworker.jsand twice innode.js.node.jsalso re-implemented core's "PUBLICwins overPROXY_TOKENS" rule for its startup log line, so the shells could drift from core.Change
core.jsexports two new helpers:parsePublic(raw): only"true"(any case) opens the proxy. Anything else fails closed, as before, including stray whitespace (ADR 0002).proxyMode({ tokens, isPublic })returns"public","locked"or"unconfigured".handleRequestnow branches onproxyMode. This covers the setup page, the token check and health'sauthRequired.worker.jsandnode.jsuseparsePublic. The Node startup log usesproxyMode, and now printslockedinstead oftoken-locked.Tests
parsePublicandproxyModeinworker.test.mjs. They failed before the change (missing exports).node --testininfra/cors-worker: 103/103, including the shared suite on both shells.node.jswith each configuration logs the expected mode.This touches
core.js, so it changes the Cloudflare bundle. The behaviour is covered by the existing Cloudflare tests.🤖 Generated with Claude Code