MC versioning overhaul: calendar scheme + DB-backed versions (REQ-2026-04-16-mc-versioning)

Migration 145: mc_versions table with java_version, paper/forge/neoforge/fabric
support flags, seeded with 11 known versions for immediate use.

New: src/services/mcVersionSync.js
- javaVersionForMC() handles both 1.x.y legacy and 26.x.y calendar schemes
- Daily 3AM pg-boss cron fetches Paper API + Modrinth /tag/game_version, upserts
  mc_versions with correct loader flags and Java version mapping
- getVersions(filter) for DB-backed lookups with loader filtering
- semver.rcompare for proper version sorting across both schemes

Routes: GET /admin/modpack-installer/mc-versions — JSON endpoint for dynamic
version dropdowns, filterable by loader (paper/forge/neoforge/fabric), with
hardcoded fallback if DB is unavailable.

Views updated:
- _vanilla_form.ejs: MC version dropdown loaded dynamically (Paper-only filter),
  Java auto-select reads java_version from DB row
- index.ejs: search filter version dropdown loaded dynamically from mc_versions
- _pack_details.ejs: client-side Java logic handles major >= 26

index.js: registers mc-version-sync cron via pg-boss after queue init.
package.json: added semver ^7.6.3.
ACTIVE_CONTEXT updated.
This commit is contained in:
Claude Code
2026-04-16 02:40:50 -05:00
parent ed1ae82825
commit e891a304e0
10 changed files with 297 additions and 30 deletions

View File

@@ -5,7 +5,7 @@
Local Nitro (Windows 11) at `C:\Users\mkrau\firefrost-services`. Git remote: Gitea. Identity: `Claude Code <claude@firefrostgaming.com>`.
## Current Focus
Bridge queue empty. Seven features shipped tonight, all pending deploy by Michael.
Bridge queue empty. Eight features shipped tonight, all pending deploy by Michael.
## Session 2026-04-16
@@ -35,6 +35,15 @@ Bridge queue empty. Seven features shipped tonight, all pending deploy by Michae
- `index.ejs`: "New Vanilla / Paper Server" button loads vanilla form directly (skips pack search)
- No migrations. **Deploy:** standard restart only, ensure `standard-plugins/1.21.1/` populated in NextCloud before first vanilla install
- **MC Versioning Overhaul** (REQ-2026-04-16-mc-versioning)
- Migration 145: `mc_versions` table with loader support flags, seeded with 11 known versions
- `mcVersionSync.js`: new `javaVersionForMC()` handles both legacy 1.x.y and calendar 26.x.y schemes; daily 3AM pg-boss cron syncs from Paper API + Modrinth `/tag/game_version`; `getVersions(filter)` for DB-backed lookups
- `/mc-versions` endpoint returns cached versions (filterable by loader), with hardcoded fallback
- `_vanilla_form.ejs` + `index.ejs` search filter: replaced hardcoded version dropdowns with dynamic fetch from mc_versions
- `_pack_details.ejs`: updated client-side Java auto-select for calendar versioning
- Added `semver ^7.6.3` to package.json
- **Deploy:** `npm install` (semver) + run migration 145 + restart
- **Discord Action Log — Issue #1** (`49f8f79`, +263 lines)
- Migration 142: `discord_action_log` table
- `discordActionLog.js` service (silent-fail logAction)