Skip to content

Allow sign-in from reportbase.github.io; deploy automatically on merge - #2

Merged
reportbase merged 2 commits into
mainfrom
claude/nifty-hawking-y3gd52
Oct 4, 2026
Merged

reportbase merged 2 commits into
mainfrom
claude/nifty-hawking-y3gd52

Conversation

@reportbase

@reportbase reportbase commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Sign-in failed from the GitHub Pages site: the gateway answers redirect_uri is missing or its origin is not in ALLOWED_ORIGINS. This PR fixes that and makes merges deploy automatically. One commit each.

1. Allow the Pages site

  • wrangler.toml: add https://reportbase.github.io to ALLOWED_ORIGINS.

    • An origin is only scheme and host, so this one entry covers games (the chess coach), draw (the AI button) and 3d (describe it).
    • A comment warns never to use *.github.io, which would let anyone's GitHub Pages site spend the key.
  • Tests now run. npm test looked for test/*.test.mjs importing ../src/, but the files were at the root, so it ran nothing. They move to test/ and import from the root.

  • New test. It reads ALLOWED_ORIGINS from wrangler.toml and checks:

    • the Pages site is allowed
    • other github.io sites, look-alike hosts and plain http:// are refused

    It fails without the new entry. All 30 tests pass.

2. Deploy on merge

Same setup as flare:

  • Deploy workflow: on push to main (or by hand from the Actions tab), it runs the tests, then npm ci and wrangler deploy with the CLOUDFLARE_API_TOKEN repository secret. Without the secret it skips the deploy with a warning.
  • Tests workflow: runs npm test on every PR.
  • wrangler ^4 is now a devDependency with a lockfile, so a deploy installs a known version.
  • README explains making the token.
  • Checked: npm ci plus wrangler deploy --dry-run builds the Worker, with the D1 binding and every var in place.
  • Not touched by a deploy: the Worker's secrets (Anthropic key, session secret, Google/Apple keys) and the D1 data.

To make it live

  1. Add the repository secret CLOUDFLARE_API_TOKEN (Settings → Secrets and variables → Actions). The token made for flare works, if you kept it; otherwise make another from the "Edit Cloudflare Workers" template.
  2. Merge. The Deploy run in Actions should end with https://login.tangent.workers.dev.

🤖 Generated with Claude Code

https://claude.ai/code/session_015yy9hSCgHQ5WYRZu4JMuW9

claude added 2 commits October 4, 2026 18:44
Sign-in failed from the GitHub Pages site: ALLOWED_ORIGINS held only
tangent.fit and localhost, so the gateway refused to hand a session back to
https://reportbase.github.io, where games (the chess coach), draw (the AI
button) and 3d (describe it) live. One entry covers all three, since an
origin is only scheme and host. A comment warns against ever widening it to
*.github.io, which would let anyone's GitHub Pages site use the key.

npm test looked for test/*.test.mjs importing ../src/, but the files sit at
the root, so it ran nothing. The test and its D1 stand-in move to test/ and
import from the root. A new test reads ALLOWED_ORIGINS from wrangler.toml
itself and checks the Pages site is allowed while other github.io sites and
look-alike hosts are not. 30 tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015yy9hSCgHQ5WYRZu4JMuW9
.github/workflows/deploy.yml: on push to main (or by hand from the Actions
tab), run the tests, then npm ci and wrangler deploy, using the
CLOUDFLARE_API_TOKEN repository secret, the same setup flare uses. Without
the secret the deploy is skipped with a warning. A deploy sends the code and
wrangler.toml; the Worker's secrets and the D1 data are untouched.

.github/workflows/test.yml runs npm test on pull requests and on main.
wrangler ^4 is now a devDependency with a lockfile, so a deploy installs a
known version. README explains making the token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015yy9hSCgHQ5WYRZu4JMuW9
@reportbase reportbase changed the title Allow sign-in from reportbase.github.io; make the tests runnable Allow sign-in from reportbase.github.io; deploy automatically on merge Oct 4, 2026
@reportbase
reportbase merged commit 2633d01 into main Oct 4, 2026
2 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.

2 participants