Skip to content

About

Cloudflare Worker for dcbanlist

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

30 Commits

Folders and files

Repository files navigation

DC Ban List Worker

Cloudflare Worker modules for the existing ban log API, archive UI, and a daily incremental crawl of DCInside's PC management/block page.

Configure

  1. Replace the D1 and KV placeholder IDs in wrangler.jsonc with the existing resources.

  2. Set GALLERIES_JSON, for example:

    [{"id":"onshinproject","path":"mgallery"}]

    path may be mgallery, gallery, or mini and determines the management URL path segment.

  3. 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_URL with the production URL, for example https://dcbanlist.<account-subdomain>.workers.dev. This URL is not a secret; keep ADMIN_TOKEN as a secret. The Cron refresh uses this URL to call the authenticated /admin/purge-cache route after rebuilding the snapshot. The global_fetch_strictly_public compatibility flag enables the Worker-to-Worker HTTPS request; the code restricts the configured destination to an HTTPS workers.dev URL. Set SELF_WORKER_URL before deploying. Wrangler is configured with keep_vars: true so this dashboard variable is retained on future deploys.

  4. 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.

Crawl behavior

  • 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 failed and the previous snapshot remains intact.
  • Successful D1 ingestion rebuilds the existing snapshot KV key. refresh-status stores 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.

Existing routes

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.

About

Cloudflare Worker for dcbanlist

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages