Commit Graph

34 Commits

Author SHA1 Message Date
Matt Isenhower
db2e68b847 Add the Cloudflare updater Worker with fast and slow lanes
Run the shared app/ updaters and social posters from workers/updater:

- Scheduler Durable Object lanes: "fast" keeps the Node cron cadence
  (quick at :00-:04, default at :05/:10/:15/:20/:30/:45) and posts to
  social after checking SITE_URL serves the new data; "slow" runs X-Rank,
  Splatfest rankings, and avatar updates hourly. Bounded retries, queued
  manual runs, pause, and persisted automatic-scheduling state.
- RegionAuth Durable Object per region: the single owner of each
  Nintendo login, serving bullet tokens to both lanes and renewing them
  hourly at :35-:38.
- A five-minute cron watchdog that only re-arms alarms, bearer-token
  control endpoints, and dev/production environments. DO migrations keep
  Scheduler at v1 to match the earlier dev deployment.
- Per-run limits (RunLimits) and per-account NsoClient locks instead of
  module-level limiters, since Durable Objects sharing an isolate cannot
  share in-flight requests. Updaters without localization rules no longer
  rewrite locale files.
- 20 workerd tests (npm run updater:test, included in npm test) with all
  network access blocked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 22:13:30 -08:00
Matt Isenhower
21a4f5d85c Route backend file access through storage and auth seams
Prepare the shared updater and social code to run against R2 in a Worker
while keeping the local Node runner working:

- Add app/common/storage with public, private, and archive areas keyed like
  the R2 objects. FilesystemStorage maps them onto dist/ and storage/ for
  Node; BucketStorage wraps R2 bindings. Storage is configured once per
  process; only image existence is cached, so JSON reads are always fresh.
- Move ValueCache, DataUpdater (data, calendars, archive snapshots),
  ImageProcessor, LocalizationProcessor, festival updaters, status
  generators, social translations, ImageWriter, and Buffer/Threads image
  hosting onto storage. Query hashes are a JSON import.
- Add app/splatnet/auth.mjs: the existing bullet-token code behind auth(),
  so the Worker can route token requests to per-region Durable Objects.
  warmCaches uses auth().refresh().
- Remove the S3/R2 sync, vfs, the dual upload, the sync commands, and
  s3-sync-client. Local runs no longer read from or write to remote buckets.
- Give every test fresh in-memory storage via app/test/setup.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 16:03:33 -08:00
Matt Isenhower
a2403c0680 Serialize bullet token acquisition per account 2026-11-08 07:56:02 -08:00
Matt Isenhower
f45a4654d1 Extract shared cache expiry calculation to utility function
Deduplicate identical _calculateCacheExpiry methods from
SplatNet3Client and NsoClient into a shared calculateCacheExpiry
function in util.mjs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:04:23 -08:00
Matt Isenhower
10c082a1c2 Retrieve localizations in parallel 2024-11-20 21:13:40 -08:00
Matt Isenhower
2736996f05 Tweak Splatfest updater to handle new paginated query 2024-09-05 08:01:12 -07:00
Matt Isenhower
37ee0c4dc9 Prefer single quotes and enforce semicolons 2024-03-17 10:20:17 -07:00
Matt Isenhower
e87a4b241d lint-fix 2024-03-17 10:15:18 -07:00
Matt Isenhower
f75382875b Add user agent string to Splatnet requests 2023-09-16 12:12:59 -04:00
Matt Isenhower
e7333cd157 Use the webview version from the query hashes file 2023-08-21 16:54:29 -07:00
Matt Isenhower
3ba15199ee Pull query hashes from a lookup table
Data provided via imink.
2023-08-13 20:43:11 -07:00
Matt Isenhower
10ee1f862a Fix festival ranking updater 2023-08-13 19:46:16 -07:00
Matt Isenhower
8cf1b1b659 Update X-Rank query IDs 2023-08-02 18:15:10 -07:00
Matt Isenhower
e4e6051999 Run linter 2023-06-25 20:59:43 -07:00
Inkception
143d187474 Update webViewVersion and StageScheduleQuery 2023-06-01 15:29:23 +02:00
Matt Isenhower
14f89d3eb8 Add stages.json 2023-04-20 09:49:42 -07:00
Matt Isenhower
949f522861 Update Splatnet query IDs 2023-02-27 16:59:34 -08:00
Matt Isenhower
8b2cd71e5f Add X-Rank leaderboard data 2023-02-12 09:07:02 -08:00
Samuel Elliott
5455788cbe Fetch all fest ranking holders 2022-12-31 08:41:53 +00:00
Matt Isenhower
590e7d5767 Update query IDs 2022-11-30 18:32:28 -08:00
Matt Isenhower
f74f84fef5 Update webview version 2022-11-30 16:04:52 -08:00
Matt Isenhower
c14e4a0502 Add festival ranking data 2022-11-15 13:32:50 -05:00
Matt Isenhower
d5560477a2 Prepare data updaters for multi-locale support 2022-10-17 17:56:01 -07:00
Matt Isenhower
1cd4e3a137 Update SplatNet query hashes 2022-09-26 22:46:30 -04:00
Matt Isenhower
2e1136852b Add "current festival" data updater just in case 2022-09-22 18:33:58 -04:00
Matt Isenhower
c2df39acea Get detailed data for each Splatfest 2022-09-19 15:03:46 -07:00
Matt Isenhower
866509a4d8 Add festival data updater 2022-09-16 12:51:23 -07:00
Matt Isenhower
42520b20f5 Enable multi-account support 2022-09-16 12:40:36 -07:00
Matt Isenhower
ef5e9675fb Add co-op data updater 2022-09-15 17:55:31 -07:00
Matt Isenhower
7498f4599e Add SplatNet gear updater 2022-09-10 14:56:22 -07:00
Matt Isenhower
f7dafefc31 Add data updater structure and a basic schedule updater 2022-09-10 13:02:39 -07:00
Matt Isenhower
231681bdac Improve logging 2022-09-10 12:56:21 -07:00
Matt Isenhower
400347e277 Add cache warming 2022-09-09 17:43:48 -07:00
Matt Isenhower
349980d3a6 Add SplatNet 3 client 2022-09-09 16:02:55 -07:00