fix(import): read VITE_CORS_PROXY from a Secret too; bypass YouTube consent gate - #137
Merged
Merged
Conversation
…onsent gate
Two follow-ups from live testing of the worker:
1. The worker was deployed and VITE_CORS_PROXY was set, but as a repo *Secret*
while deploy.yml only read `vars.VITE_CORS_PROXY` — so the build baked in
nothing and the live site kept falling back to the public proxy. Read it from
either place: `${{ vars.VITE_CORS_PROXY || secrets.VITE_CORS_PROXY }}`.
2. YouTube's EU/UK "before you continue" consent page (consent.youtube.com/m…)
3xx-redirected the fetch away from the playlist, breaking recording imports.
Send a consent cookie (SOCS=CAI; CONSENT=YES+…) for youtube.com/youtu.be in
both the worker and the Vite dev proxy so the playlist page loads directly.
Verified the cookie keeps ytInitialData + watch links intact.
Docs (worker README) updated: VITE_CORS_PROXY may be a Variable or a Secret.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Two fixes found while testing the deployed worker on the live site.
1. The live site wasn't using the worker (the main fix)
The worker was deployed and
VITE_CORS_PROXYwas set — but as a repository Secret, while the deploy workflow only read it as a Variable (${{ vars.VITE_CORS_PROXY }}). Sovars.was empty, the build baked in nothing, and the site kept falling back to the publicproxy.cors.sh.Fix: read it from either place —
Robust and future-proof; no matter which tab it's set in, the build picks it up.
2. YouTube consent gate broke recording imports
In the EU/UK, YouTube 3xx-redirects the playlist fetch to its "before you continue" consent interstitial (
consent.youtube.com/m…), which has no CORS header — so the import failed. Fix: send a consent cookie (SOCS=CAI; CONSENT=YES+…) foryoutube.com/youtu.berequests in both the Cloudflare Worker and the Vite dev proxy, so the playlist page loads directly. Verified the cookie keepsytInitialDataand watch links intact (it only affects EU/UK regions; harmless elsewhere). This is a server-side-only fix, so it needs the worker (public proxies can't attach the cookie).Verification
Local gates green: typecheck, lint (0 warnings), format, importer tests (186), worker syntax-checked.
After merge
Re-run Deploy to GitHub Pages — the build will then bake in your
VITE_CORS_PROXY(from the Secret) and the site will use your worker: Cheesefork fast, YouTube working.🤖 Generated with Claude Code