Adds the server side of the admin and the automatic game discovery. The catalog stays JSON in this repo; the Worker writes it as a GitHub App (GraphQL createCommitOnBranch with expectedHeadOid: verified commits, retried on a race) and keeps only the review queue in D1. - worker/admin.ts: /api/admin/* (queue list, approve/reject, add, edit the three maintainer fields, remove with reason + R2 cover cleanup, restore) and the /admin shell with its own CSP. Every request re-verifies the Cloudflare Access JWT (aud + maintainer email + same-origin writes). Approving commits to scripts/temp_link.json, which starts update.yml. The maintainer's email goes to the D1 audit log only, never a commit. - worker/ingest.ts: POST /api/ingest for the browser extension (Access service token, per-client rate limit, Idempotency-Key replay, <= 150 items / 64 KB), replacing its PAT commits. - worker/suggest.ts: public POST /api/suggest (same-origin, per-IP rate limit, Turnstile siteverify, canonical itch.io URL) into the queue. - worker/discover.ts + scheduled(): every 4 h, one itch.io RSS feed (round-robin, 6 h back-off on 429) into the queue, then reconcile (queued -> ingested / failed) and retention (idempotency 7 d, form notes 180 d). - worker/queue.ts: URL classification (catalog, pending, deleted, blocklist) and the D1 store; worker/repo.ts builds each admin commit from the files at the head of main, byte-compatible with the Python pipeline (golden fixtures). - wrangler.jsonc: D1 (bound by name; migrations applied by hand), rate limits, cron, non-secret settings as vars (empty until setup: features answer 503 until configured), staging env without the cron. `npm run cf:types` ignores .dev.vars so the committed types are stable. - Tests: 159 passing; the SQL runs against a real local D1 (workerd via wrangler's platform proxy). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
22 lines
576 B
JSON
22 lines
576 B
JSON
{
|
|
"compilerOptions": {
|
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
|
|
"target": "es2024",
|
|
"lib": ["ES2024"],
|
|
"module": "esnext",
|
|
"moduleResolution": "bundler",
|
|
"resolveJsonModule": true,
|
|
"types": [],
|
|
"skipLibCheck": true,
|
|
"strict": true,
|
|
"verbatimModuleSyntax": true,
|
|
"moduleDetection": "force",
|
|
"noEmit": true,
|
|
"noUnusedLocals": true,
|
|
"noUnusedParameters": true,
|
|
"erasableSyntaxOnly": true,
|
|
"noFallthroughCasesInSwitch": true
|
|
},
|
|
"include": ["worker", "worker-configuration.d.ts"]
|
|
}
|