Files
languard-servers-manager/CLAUDE.md
Tran G. (Revernomad) Khoa fe3bd81cae docs: update API.md, FRONTEND.md, MODULES.md, CLAUDE.md for Phase 1 and 2 completion
- API.md: add GET /config/schema endpoint docs; add GET|PUT /missions/rotation endpoints;
  fix mission response shape (name/filename/size_bytes/terrain); mark Phase 1+2 as done
- FRONTEND.md: add TagListEditor, useServerConfigSchema, useServerMissionRotation,
  useUpdateMissionRotation; update Mission/Mod type notes; remove planned hooks now live
- MODULES.md: update config_generator and missions_router descriptions
- CLAUDE.md: mark Phase 1 and 2 as Done
2026-04-17 20:35:39 +07:00

4.4 KiB

Languard Server Manager

Quick Start

# Backend (from backend/)
python -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload

# Frontend (from frontend/)
npx vite --host

Architecture

FastAPI + SQLite backend, React 19 + TypeScript + Vite frontend. See ARCHITECTURE.md for full details.

Key Rules

  • Frontend types must match API response shapes, NOT database schema columns
  • There is no REST endpoint for logs — logs are only pushed via WebSocket events
  • WebSocket onEvent callback is the mechanism for receiving real-time log entries
  • Config updates use optimistic locking (config_version) — 409 on conflict
  • Sensitive config fields are encrypted at rest with Fernet

Current Implementation Status

Backend: Fully implemented (42+ endpoints)

All routers, services, repositories, game adapter system, WebSocket, background threads, and scheduled cleanup are complete.

Frontend: Fully implemented (baseline)

Route Status Notes
/login Complete Zod + react-hook-form validation
/ Complete Dashboard with server grid + Start/Stop/Restart quick actions
/servers/:id Complete 7-tab detail page (overview, config, players, bans, missions, mods, logs)
/servers/new Complete 4-step wizard with per-step validation via trigger()
/settings Complete Password change + admin user management

Frontend Type Mapping (API → Frontend)

Types below reflect the current API shape. Fields marked (planned) will be added during the UX enhancement plan.

API Resource Frontend Type Key Fields
Server (enriched) Server in useServers.ts game_port, current_players, max_players, cpu_percent, ram_mb
Mission Mission in useServerDetail.ts name, filename, size_bytes, terrain (planned)
Mod Mod in useServerDetail.ts name, path, size_bytes, enabled, display_name (planned), workshop_id (planned)
Ban Ban in useServerDetail.ts id, server_id, guid, name, reason, banned_by, banned_at, expires_at, is_active, game_data
Player Player in useServerDetail.ts id, slot_id, name, guid, ip, ping

Upcoming: UX Enhancement Plan

Plan file: .claude/plan/arma3-ux-enhancement.md — approved, ready to implement.

Phase Feature Status
1 Config field UI widgets (textarea/toggle/select/tag-list per field) Done
2 Mission rotation table + multi-file upload Done
3 Mod display names (mod.cpp) + split-pane selector Pending
4 Player Kick/Ban from Players tab via RCon Pending
5 Historical log file browser + live log level filter Pending

New endpoints added by the plan:

  • GET /api/servers/{id}/config/schema — per-field widget hints (implemented)
  • GET|PUT /api/servers/{id}/missions/rotation — mission rotation (implemented)
  • POST /api/servers/{id}/players/{slot_id}/kick
  • POST /api/servers/{id}/players/{slot_id}/ban
  • GET /api/servers/{id}/logfiles
  • GET /api/servers/{id}/logfiles/{filename}/download
  • DELETE /api/servers/{id}/logfiles/{filename}

New backend additions:

  • Arma3ConfigGenerator.get_ui_schema() — widget schema per config field
  • PlayerRepository.get_by_slot() — lookup player by slot_id
  • ThreadRegistry.get_rcon_client() — expose live RCon client for kick/ban
  • RPTParser.list_log_files() / get_log_file_path() — historical log access

Test Commands

# Frontend unit tests
cd frontend && npx vitest run

# Frontend type check
cd frontend && npx tsc --noEmit

# Backend (no test suite yet)

Key Implementation Notes

  • BanRepository.create() takes expires_at (ISO string), not duration_minutes — convert in service
  • slot_id is stored as a string in the players table — cast with str(slot_id) in queries
  • Config field names in ServerConfig Pydantic model: password_admin (not admin_password), battleye (not battle_eye), disable_von (not von)
  • Log directory defaults to ARMA3_LOG_DIR env var, falls back to {server_dir}/logs