Commit Graph

93 Commits

Author SHA1 Message Date
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
1480138e15 Report Worker errors to Sentry and drop Sentry from the Node CLI
Both Workers and their Durable Objects are wrapped with @sentry/cloudflare, so the shared
code's @sentry/core calls (failed updaters, social posts, archive snapshots) reach Sentry.
A lane run that fails outright, a failed credential renewal and a failed archive compression
are reported too. Durable Object RPC methods use instrumentPrototypeMethods; without it they
run with no Sentry client and their events are dropped.

The Node runner and the compressor's container no longer use Sentry; @sentry/node is gone.
POST /sentry-test sends one test event from the updater Worker and one from a Durable Object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 14:05:01 -08:00
Matt Isenhower
c053372361 Compress archive days in a Cloudflare Container
A separate compressor Worker runs app/data/ArchiveCompressor.mjs in a container (standard-1)
once a day at 00:30 UTC, against the archive Space. Its Durable Object starts the container
and keeps the last 30 runs with their log lines. An alarm every few seconds collects the
container's output from its log server and ends the run when the container reports its exit
code, so a run survives the object being evicted from memory.

Only dev is deployed; production waits until spectre stops compressing at the same time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 13:11:24 -08:00
Matt Isenhower
e7388fce6a Archive data snapshots from the Worker to DigitalOcean Spaces
With ARCHIVE_DATA set, the Worker writes each published data file to the
archive Space, at the same YYYY/MM/DD/<date>.<time>.<name>.json keys, ACL,
and content type as the Node uploader (DataArchiver):

- S3ArchiveStorage signs PUTs with aws4fetch, tries three times with
  backoff, and stops early on errors that will not improve.
- A snapshot that cannot be written is a warning and a Sentry event, never
  a failed update.
- The fast lane holds its snapshots until after social posts (even failed
  ones) and then uploads the newest copy of each key, so a slow archive
  bucket never delays a post. The slow lane uploads as it goes, to avoid
  holding large X-Rank files in memory.
- Dev writes to its own Space (splatoon3ink-archive-test); production has
  no archive settings until cutover. Daily compression is still to come.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 22:47:38 -08:00
Matt Isenhower
c2666b27ca Add an admin panel to the updater Worker
A small Vue + Tailwind app in workers/updater/admin, served by the updater
Worker on its own hostname (admin.splatoon3.ink, admin.dev.splatoon3.ink)
behind Cloudflare Access:

- Timeline: both lanes, credential renewals, and social posts on one time
  axis, a filterable run list, run details with per-updater timings and
  the run's own log lines, lane controls (run now, pause, scheduling),
  credential renewal, and a combined text log.
- Social: the post log with errors, per-account posting switches, when
  each status last went to each account, and a preview that can post one
  status by hand after a confirmation.
- Data: freshness of the core data files, the published file list, a
  check that the site serves the new data, and a cache purge.

Worker side:

- src/admin: the Access JWT check (jose; fails closed and only answers on
  ADMIN_HOSTNAME) and the API. Actions must be same-origin JSON POSTs, and
  the app is served with a strict CSP from the ADMIN_ASSETS binding.
- Runs capture their console output (AsyncLocalStorage), so log lines
  belong to the run that printed them. The Scheduler keeps a post log and
  serves run details and log lines; RegionAuth keeps its last 24 renewals.
- A manual run from the panel only posts to social when asked to.

Shared code:

- StatusGeneratorManager records what was posted or failed, and skips
  accounts turned off in private settings/social.json (the Node runner
  honours this too). app/social/admin.mjs previews and posts one status.
- Updater results include their duration.

Also: npm run admin:dev runs the panel against a simulated API, deploy
scripts build the panel first, the dev environment's assets move to
dev-assets.splatoon3.ink, and the lockfile drops entries nothing depends
on any more.

Not yet run against a deployed Worker or a real Access application.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 12:59:36 -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
6df93806c2 Prepare the backend for Cloudflare Workers
Groundwork for running the existing updaters and social posters in a Worker:

- Derive IDs with @noble/hashes shake256; the Workers runtime's node:crypto
  lacks shake256. A test pins an ID produced by node:crypto.
- Split updaters into fast (schedules, gear, co-op, festivals, stages; run
  concurrently) and slow (X-Rank, Splatfest rankings; run one at a time).
  The cron posts after the fast updaters, before the slow ones.
- Fetch X-Rank seasons and detail types sequentially, cutting peak heap per
  division from ~85 MB to ~38 MB.
- Move Splatfest rankings into FestivalRankingsUpdater, driven by the
  published festivals data, so results never wait on ranking pagination.
- Coalesce concurrent downloads of the same SplatNet image.
- Bring over the Browser-binding screenshot work from develop (f7293b6):
  Cloudflare captures use the BROWSER binding with retries, Browserless is
  removed, and workers/screenshots offers capture-only local testing. The
  local driver keeps puppeteer-core with an installed Chrome, always serves
  dist/, and fails on page-reported screenshot errors.
- Remove the Docker image, compose files, and GHCR deploy workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:40:51 -08:00
Matt Isenhower
61fb95df77 Make the social post comparison reproducible 2026-10-17 12:55:55 -07:00
Matt Isenhower
9eaf7ad84e Remove social post character counting 2026-10-17 12:04:24 -07:00
Matt Isenhower
058f23cfc1 Add separate Japanese social accounts and local post previews 2026-10-17 11:57:28 -07:00
Matt Isenhower
8f315aaf92 Add credential-enabled Buffer driver for X posting 2026-10-17 10:57:46 -07:00
Matt Isenhower
e4f452231f Update nxapi for Coral 3.5.0 authentication 2026-09-26 10:37:39 -07:00
Matt Isenhower
f89226fbbb Remove asset browser after shared Worker migration 2026-09-13 12:17:36 -07:00
Matt Isenhower
3def89b0e1 Upgrade to Node.js 24 2026-08-31 21:26:28 -07:00
Matt Isenhower
e785401f8d Add virtual data archive browser 2026-08-31 21:14:59 -07:00
Matt Isenhower
57e46c3121 Automate asset browser deployment 2026-08-30 20:15:50 -07:00
Matt Isenhower
8d157963f0 Remove Worker TypeScript tooling 2026-08-30 19:56:22 -07:00
Matt Isenhower
b85c990921 Add R2 asset directory browser 2026-08-30 19:34:42 -07: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
Matt Isenhower
5dd2bbf172 Resolve npm audit vulnerabilities 2026-08-30 16:43:01 -07:00
Matt Isenhower
ac6e374e97 Update npm dependencies 2026-08-30 16:15:53 -07:00
TenviLi
968d0033c2 chore(deps): upgrade Vite 7 to 8 and related toolchain
Dependency bumps:
- vite: 7.3.1 -> 8.2.2 (Rolldown + Oxc replace esbuild + Rollup)
- vitest: 4.0.18 -> 4.1.11
- @vitejs/plugin-vue: 6.0.4 -> 6.0.8
- @tailwindcss/vite & tailwindcss: 4.1.18 -> 4.3.3
- @intlify/unplugin-vue-i18n: 11.0.3 -> 11.2.5 (moved to devDependencies)
- vue: 3.5.28 -> 3.5.42
- vue-i18n: 11.2.8 -> 11.4.10

Config migration for Vite 8:
- Move the multi-page entry points to the top-level `input` option,
  replacing the deprecated `build.rollupOptions.input`
- Replace `__dirname` with `import.meta.dirname` for compatibility with
  Vite's upcoming native config loader
2026-08-31 02:35:13 +08:00
Matt Isenhower
b3f46b8e25 Separate archive verification and repair 2026-08-22 11:47:08 -07:00
Matt Isenhower
08570dfa43 Add verified archive pruning command 2026-08-22 08:58:55 -07:00
Matt Isenhower
660eb824e9 Add archive compression statistics 2026-08-18 22:54:23 -07:00
Matt Isenhower
aa7dfdfc4b Rename archive generator to compressor 2026-08-18 19:50:12 -07:00
Matt Isenhower
e690a10da8 Add archive generator dry run 2026-08-18 14:12:15 -07:00
Matt Isenhower
ea787f6dbb Add daily archive generator 2026-08-18 14:04:25 -07:00
Matt Isenhower
c1664590b5 Auto-update social media avatars
Some checks failed
Build frontend / build (22.x) (push) Has been cancelled
Deploy / deploy-frontend (push) Has been cancelled
Deploy / deploy-backend (push) Has been cancelled
Fix code styles / build (push) Has been cancelled
Tests / test (22.x) (push) Has been cancelled
2026-02-20 08:56:19 -08:00
Matt Isenhower
1b8a866548 Update Threads client 2026-02-17 22:20:51 -08:00
Matt Isenhower
7084b3c5ae Set up Vitest and CI workflow for unit tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:45:20 -08:00
Matt Isenhower
5bff658212 Revert eslint 2026-02-15 16:36:53 -08:00
Matt Isenhower
f8707b7e9a Update Vite to v7, @vitejs/plugin-vue, and @eslint/js to 10.0.1
Vite 7: No code changes needed for this project's config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:25:48 -08:00
Matt Isenhower
bb78a7e6e2 Update ESLint and @eslint/js to v10
No config changes needed — already using flat config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:23:27 -08:00
Matt Isenhower
ff6ce5a0a1 Update nxapi to latest next release (1.6.1-next.248)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:20:33 -08:00
Matt Isenhower
d625a2dc90 Update pinia to v3 and vue-router to v5
Both are non-breaking upgrades for this project's usage patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:17:56 -08:00
Matt Isenhower
e8714d335a Update dotenv to v17, p-limit to v7, p-queue to v9
dotenv v17: Added quiet option to suppress new default logging.
p-limit v7 and p-queue v9: No code changes needed (only dropped older Node).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:10:14 -08:00
Matt Isenhower
af526403a1 Update cron to v4 and ical-generator to v10
cron v4: No code changes needed (positional constructor args still supported).
ical-generator v10: Removed `new` keyword (now a factory function) and
switched from `attachments` property to `createAttachment()` method.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:09:19 -08:00
Matt Isenhower
6bf8696746 Update minor dependencies
- dotenv: 16.4.5 → 16.6.1
- p-limit: 6.1.0 → 6.2.0
- p-queue: 8.0.1 → 8.1.1
- nxapi: 1.6.1-next.170 → 1.6.1 (pre-release → stable)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:02:47 -08:00
Matt Isenhower
8b11900905 Revert jsonpath-plus back to jsonpath
jsonpath v1.2.1 (published Feb 2025) fixed the security vulnerability
that prompted the switch to jsonpath-plus. Reverting to the original
package simplifies the code by removing the jsonpathQuery/jsonpathApply
wrapper functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:56:05 -08:00
Matt Isenhower
29482689f4 Migrate Tailwind CSS from v3 to v4
- Replace JS config (tailwind.config.js) with CSS @theme block in base.css
- Switch from PostCSS to @tailwindcss/vite plugin
- Convert all bg-opacity-*/border-opacity-* to slash syntax (e.g. bg-zinc-900/70)
- Add @custom-variant for mobile and ss variants
- Add @reference to Vue scoped styles using @apply
- Rename v3 utilities: rounded→rounded-sm, backdrop-blur-sm→backdrop-blur-xs,
  drop-shadow→drop-shadow-sm, rotate-[25deg]→rotate-25
- Delete obsolete tailwind.config.js and postcss.config.js
- Rename vite.config.js to .mjs for ESM compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 13:52:27 -08:00
Matt Isenhower
8780463c66 Replace deprecated and unmaintained packages
- Removed mkdirp in favor of native fs.mkdir({ recursive: true })
- Replaced ecstatic (unmaintained since 2021) with sirv
- Replaced jsonpath (security vulnerability) with jsonpath-plus
  - Added jsonpathQuery/jsonpathApply helpers in app/common/util.mjs
- Updated sharp: 0.32.6 → 0.34.5
- Updated puppeteer-core: 23.8.0 → 24.37.3

Vulnerabilities reduced from 40 to 1 (only remaining: axios in
threads-api transitive dependency).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 11:05:49 -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
d5c97a5bf6 Update vue-i18n from v9 to v11
vue-i18n: 9.10.2 → 11.2.8

Resolves XSS and prototype pollution vulnerabilities in vue-i18n v9.
Total vulnerabilities now down to 1 (axios in threads-api transitive
dependency).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:58:39 -08:00
Matt Isenhower
0462cc2d8c Update Vite from v3 to v6
- vite: 3.2.8 → 6.4.1
- @vitejs/plugin-vue: 3.2.0 → 5.2.4
- Replaced @intlify/vite-plugin-vue-i18n with @intlify/unplugin-vue-i18n
- Narrowed i18n include pattern to *.json to avoid parsing .mjs files

This resolves the esbuild moderate severity vulnerability that was
present in Vite <=6.1.6.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:58:07 -08:00
Matt Isenhower
7c901f9ae7 Update social media API SDKs
- @atproto/api (Bluesky): 0.11.2 → 0.18.21
- masto (Mastodon): 6.7.0 → 7.10.1
- twitter-api-v2: 1.18.1 → 1.29.0

threads-api left at 1.6.3 (no newer version available; vulnerable
axios dependency is a transitive issue in that package).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:52:07 -08:00
Matt Isenhower
89daffe6c1 Update Sentry from v7 to v10
@sentry/node: 7.107.0 → 10.38.0

The project uses only Sentry.init() and Sentry.captureException(),
which are compatible across versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:48:28 -08:00
Matt Isenhower
4a5a2aca42 Update Vue ecosystem packages
- vue: 3.4.21 → 3.5.28
- vue-router: 4.3.0 → 4.5.0
- pinia: 2.2.2 → 2.3.1
- @headlessui/vue: 1.7.19 → 1.7.23
- @heroicons/vue: 2.1.1 → 2.2.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:47:26 -08:00