Cloudflare Worker modules for the existing ban log API, archive UI, and a daily incremental crawl of DCInside's PC management/block page.
-
Replace the D1 and KV placeholder IDs in
wrangler.jsoncwith the existing resources. -
Set
GALLERIES_JSON, for example:[{"id":"onshinproject","path":"mgallery"}]pathmay bemgallery,gallery, orminiand determines the management URL path segment. -
Add secrets without putting credentials in source control:
npx wrangler secret put VIEW_TOKEN npx wrangler secret put INGEST_TOKEN npx wrangler secret put ADMIN_TOKEN npx wrangler secret put DC_USER_ID npx wrangler secret put DC_PASSWORD
In the Cloudflare dashboard, open Workers & Pages → dcbanlist → Settings → Variables and Secrets and add the runtime variable
SELF_WORKER_URLwith the production URL, for examplehttps://dcbanlist.<account-subdomain>.workers.dev. This URL is not a secret; keepADMIN_TOKENas a secret. The Cron refresh uses this URL to call the authenticated/admin/purge-cacheroute after rebuilding the snapshot. Theglobal_fetch_strictly_publiccompatibility flag enables the Worker-to-Worker HTTPS request; the code restricts the configured destination to an HTTPSworkers.devURL. SetSELF_WORKER_URLbefore deploying. Wrangler is configured withkeep_vars: trueso this dashboard variable is retained on future deploys. -
Install dependencies and deploy:
npm install npm run deploy
The cron is 17 20 * * * UTC (05:17 KST). Change it in wrangler.jsonc if needed.
- Reads page 1 first and compares records against D1's newest row using the same seven fields as the Java app.
- Stops at the first exact field match, then writes only newly observed rows.
- If no stored latest row exists, imports page 1 only as the initial baseline; it intentionally does not backfill old pages.
- If the latest row is not found within the page cap, or login/fetch/parsing fails, no partial rows are ingested. The KV status is set to
failedand the previous snapshot remains intact. - Successful D1 ingestion rebuilds the existing
snapshotKV key.refresh-statusstores progress/result separately. - The crawl page cap is deliberately conservative and configurable through
MAX_CRAWL_PAGES.
The login flow fetches the current sign-in page to obtain ci_t, then posts the configured credentials. DCInside may change its login flow or require additional verification; in that case the status endpoint will report the crawl failure without modifying the current snapshot.
The prior UI, /data.json, /admin/verify, /admin/delete, /refresh, and app actions (ingest, getLatestData, searchIdentifier) remain available. GET /refresh-status.json?token=... returns the latest crawl status.