Files
minecraft_launcher/src/server/routes/index.ts
claude-bot 8fd7cfaaef Build music-quiz installer and management site per spec
Implements the full spec described in README.md:

Management site (Node + TypeScript + Express + EJS):
- Public main page lists packs registered in manifest.json.
- /op login (account.json, internal-only), /op/dashboard manages packs
  with horizontal-scroll cards, add/select-and-delete flow, and the
  /op/dashboard/:packName editor (Mojang release dropdown, dynamic
  mods/resourcepacks lists, platform/RAM fields, file rename).
- Routes for /manifest.json (public) and /file/* (server pack files).
- Middleware blocks /account.json and /manifest/* directory access.

Installer (Electron):
- Five page renderer driven by IPC (preload contextBridge API):
  pack pick → single/multi → server install (path no-Korean check, JDK
  detect, file download, EULA, RAM gating, local web config editor,
  UPnP/port-forward check) → client install (.mc_custom mods +
  resourcepacks + launcher_profiles.json gameDir/javaArgs) → finish
  toggles (server folder, shortcut, server start, launcher start).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 21:34:27 +09:00

24 lines
722 B
TypeScript

import { Router } from 'express'
import { listPackKeys, loadPackDefinition, readManifest } from '../../shared/store'
export const indexRouter = Router()
indexRouter.get('/', async (_req, res, next) => {
try {
const manifest = await readManifest()
const definitionMap = new Map<string, Awaited<ReturnType<typeof loadPackDefinition>>>()
const keys = await listPackKeys()
for (const key of keys) {
definitionMap.set(key, await loadPackDefinition(key))
}
const packs = manifest.packs.map((entry) => ({
name: entry.name,
file: entry.file,
definition: definitionMap.get(entry.file) ?? null
}))
res.render('index', { packs })
} catch (error) {
next(error)
}
})