Skip to content

修复 /setup 页面被 API 别名拦截:GET /setup 返回 405 - #129

Merged
todosdev[bot] merged 1 commit into
mainfrom
tds/conv-01a14dff-25af-7399-b5d8-263e3d21fecb
Oct 18, 2026
Merged

todosdev[bot] merged 1 commit into
mainfrom
tds/conv-01a14dff-25af-7399-b5d8-263e3d21fecb

Conversation

@todosdev

@todosdev todosdev Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • GET /setup was being swallowed by the setup router's GET /* 405 fallback, so the SPA initialization page (added in chore(deps): update pnpm/action-setup action to v6 #13) could never load — production returned 405 JSON.
  • Removes the /setup backward-compatible API alias so /setup serves only the SPA page; the setup API stays exclusively under /api/setup (no historical compatibility retained).

Changes

  • apps/worker/src/index.ts — dropped app.route('/setup', setupRoutes), keeping only app.route('/api/setup', setupRoutes); /setup now falls through the reserved-slug check to the SPA fallback.
  • apps/worker/src/routes/setup.ts — unchanged; internal paths (GET /state, GET /* 405, POST /) remain as-is and only mount under /api/setup.
  • apps/worker/test/setup.test.ts — removed the POST /setup alias and GET /setup/* 405 tests; added a GET /setup test asserting a 200 SPA response with text/html (not JSON). All /api/setup/* and /api/admin/setup tests remain.
  • CLAUDE.md, README.md, README.zh-CN.md — removed the (legacy alias /setup) wording and documented that the initialization page lives at /setup while the API is POST /api/setup, GET /api/setup/state, and POST /api/admin/setup.

Testing

  • pnpm check (biome), pnpm typecheck, pnpm build, and pnpm test all pass.
  • Local wrangler dev verification: GET /setup → 200 text/html SPA HTML; POST /api/setup on a fresh D1 → 200 with both migrations applied; GET /api/setup/state → {"enabled":true}; GET /api/setup/* → 405 with Allow: POST.

- drop app.route('/setup', setupRoutes); /setup is now SPA-only
- keep /api/setup routes (POST /, GET /state, GET /* 405) unchanged
- update setup tests and README/README.zh-CN/CLAUDE docs accordingly

Checkpoint: Tbu9TOL8fykR0LXO-GSor
@todosdev
todosdev Bot merged commit e89de7b into main Oct 18, 2026
4 checks passed
@mapxn
mapxn deleted the tds/conv-01a14dff-25af-7399-b5d8-263e3d21fecb branch October 18, 2026 08:56
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.

0 participants