69 Commits

Author SHA1 Message Date
Matt Isenhower
cf9c30ad63 Accept bullet tokens uploaded from the iPad and show them on the timeline
splat-mitmproxy now PUTs the captured /api/bullet_tokens response to
/bullet-token on each updater Worker, authenticated with its own
TOKEN_UPLOAD_TOKEN. The Worker caches it for the TOKEN_UPLOAD_REGION
account (US) and records an "iPad upload" event on the Nintendo auth row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:32:05 -08:00
Matt Isenhower
8806239511 Remove the server's scheduler, cache warming and archive uploader
The Worker's lanes, RegionAuth renewals and direct archive writes replace
app/cron.mjs, warmCaches and DataArchiver, which only spectre used. Local
runs keep every updater, social, screenshot and archive tool; there is no
local scheduler, and local snapshots stay in storage/archive/.

ARCHIVE_DATA now has to be "true": any value, including the "false" in
.env.example, used to turn archiving on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 09:51:51 -08:00
Matt Isenhower
a406f73622 Add switches for renewals and compression; judge renewals by their result
A credential renewal now counts as failed only when it ends without a new
bullet token. A step that failed and was made up for by a later one (znca
briefly unavailable, say) is kept as a warning and no longer goes to
Sentry.

Everything that runs on its own now has a switch in the admin panel:
scheduled renewals (one switch for every region) and the daily archive
compression join the lanes' scheduling switches. The compressor's starts
from AUTOMATIC_SCHEDULING_ENABLED: on in dev, off in production, so the
production compressor can be deployed before spectre stops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 09:08:10 -08:00
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
8a02e2bfdc Make the shared backend code run in Cloudflare Workers
Replace the remaining Node-only dependencies so the updaters and social
posters bundle and run in workerd, while the Node runner keeps working:

- Replace nxapi with app/splatnet/coral.mjs (fetch + WebCrypto), aligned
  with nxapi 1.6.1-next.257: znca compatibility 3.5.0, the current client
  version, and the slimmer Login parameter. Use one znca-api client per
  Nintendo account, since its token binds to the first account it serves.
  Cache the remote config in private storage instead of restarting daily.
  Sessions cached by the nxapi package trigger a fresh login.
- Convert images through #image-converter: sharp in Node, the Images
  binding in Workers. Read Bluesky aspect ratios from the PNG header.
- Replace twitter-api-v2 with OAuth 1.0a signed fetch; TwitterClient now
  only updates the seasonal X profile (posts go through Buffer).
- Load avatars through #avatars (bundled as Data modules in Workers) and
  keep the local Chrome driver out of Worker bundles via
  #local-screenshot-driver.
- prefixedConsole forwards to the global console; shared code reports to
  Sentry through @sentry/core.

Verified live: full credential refresh for all four regions in Node, and
the complete Coral → bullet token → GraphQL chain for EU inside workerd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 16:51:54 -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
a142a4f3b5 Preserve nxapi prerelease dependency
Some checks failed
Deploy / deploy-frontend (push) Has been cancelled
Deploy / deploy-backend (push) Has been cancelled
Build frontend / build (22.x) (push) Has been cancelled
Lint / lint (push) Has been cancelled
Tests / test (22.x) (push) Has been cancelled
The prerelease caret range selected stable 1.6.1, which does not export setClientAuthentication. Pin the current prerelease and cover the native ESM import used by the SplatNet command.
2026-08-30 18:34:14 -07:00
misenhower
de256a9891 Update query hashes 2026-08-20 02:01:50 +00:00
misenhower
ae0fe6f936 Update query hashes 2026-06-11 03:49:23 +00:00
misenhower
f49f4bd424 Update query hashes 2026-03-19 02:21:14 +00:00
misenhower
feba392d6e Update query hashes 2026-02-25 08:49:30 +00:00
Matt Isenhower
79c7325f1a Add nxapi-auth support 2026-02-16 16:32:46 -08:00
Matt Isenhower
e6004154b9 Migrate ESLint to v9 with flat config
- eslint: 8.57.0 → 9.39.2
- eslint-plugin-vue: 9.23.0 → 10.8.0
- eslint-plugin-jsdoc: 48.2.1 → 62.5.5
- Replaced .eslintrc.cjs with eslint.config.mjs (flat config)
- Removed @vue/eslint-config-airbnb and eslint-plugin-import
- Added @eslint/js, globals, vue-eslint-parser, typescript as deps
- Removed stale eslint-disable comments for import/no-unresolved
- Simplified lint script (ESLint 9 handles extensions/ignores via config)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 11:02:09 -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
misenhower
bf106dd8da Update query hashes 2026-01-29 02:20:12 +00:00
misenhower
79def4da32 Update query hashes 2026-01-12 03:12:41 +00:00
Matt Isenhower
e084122255 Update query hashes 2026-01-11 09:53:16 -08:00
Matt Isenhower
664f7546b8 Add a limit for the NSO APIs 2024-11-21 22:08:51 -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
misenhower
bfdb9c0870 Update query hashes 2024-08-30 02:42:00 +00:00
misenhower
687bf2b316 Update query hashes 2024-07-09 05:02:12 +00:00
misenhower
2f0e883c1b Update query hashes 2024-05-31 02:36:10 +00:00
misenhower
7e2a786313 Update query hashes 2024-04-18 03:30:18 +00: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
c6091d822e Fix import errors 2024-03-17 10:12:13 -07:00
misenhower
7dff15c1c7 Update query hashes 2024-02-22 02:30:14 +00:00
misenhower
4ead5167eb Update query hashes 2023-12-13 02:35:00 +00:00
Matt Isenhower
6909cfb864 Cleanup 2023-12-02 10:21:29 -08:00
misenhower
fad4e2de31 Update query hashes 2023-11-30 03:30:27 +00:00
misenhower
fa87162a52 Update query hashes 2023-11-18 00:44:10 +00:00
misenhower
02f3f06d5f Update query hashes 2023-09-21 07:30:39 +00:00
Matt Isenhower
f75382875b Add user agent string to Splatnet requests 2023-09-16 12:12:59 -04:00
misenhower
01153c9d68 Update query hashes 2023-09-02 07:30:22 +00:00
Matt Isenhower
32a447caf4 Update query hashes 2023-08-31 17:19:42 -07:00
Matt Isenhower
e35437460e Merge pull request #55 from misenhower/update-query-hashes
Update query hashes
2023-08-21 16:54:45 -07:00
Matt Isenhower
e7333cd157 Use the webview version from the query hashes file 2023-08-21 16:54:29 -07:00
misenhower
2263434311 Update query hashes 2023-08-21 04:30:31 +00:00
misenhower
05844cc7b6 Update query hashes 2023-08-14 03:53:01 +00:00
Matt Isenhower
ad1820501d Manual test 2023-08-13 20:51:26 -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