2.1 KiB
tssbot backend
Rust backend API service for Toothless' TSS Bot.
It reads two SQLite databases:
TSS_BATTLES_DBfortss_battles.db(matches, players, and thematch_logstable)TSS_TEAMS_DBfortss_teams.dbTSS_TOURNAMENTS_DBfortss_tournaments.db
If any of these are unset, the backend first looks under STORAGE_VOL_PATH
before falling back to the current working directory.
BACKEND_HOSTbind host, default127.0.0.1BACKEND_ALLOWED_ORIGINScomma-separated browser origins allowed by CORS
Both paths can be absolute or relative to the repo root when run through the root scripts/systemd units.
Vehicle translation + icons
At startup the backend loads two cache files (built by the bots, shared under
STORAGE/CACHE) into memory to translate player_games_hist.vehicle_internal
(the WT cdk) into localized vehicle names and icon filenames for the game scoreboard:
VEHICLE_TRANSLATIONS_JSON→vehicle_translations.json({ cdk: { en, ru, ... } }). The/api/tss/games/:idendpoint honors?lang=(defaulten), falling backlang → en → raw cdk.VEHICLE_DATA_CACHE_JSON→vehicle_data_cache_all.json([cdk, name, icon, tags]), used for icon filenames (fallback<cdk>.png).
The icon PNGs themselves are served statically by the frontend at /vehicle-icons
(deploy-time copy/symlink of SHARED/ICONS/VEHICLES).
It currently exposes:
GET /healthGET /api/tss/leaderboard/teams?limit=100GET /api/tss/leaderboard/players?limit=100GET /api/tss/games/recent?limit=50GET /api/tss/games/:session_id?lang=en— scoreboard (teams, players, vehicle lineup)GET /api/tss/games/:session_id/logs— chat + battle logs frommatch_logsGET /api/tss/teams/resolve?name=...GET /api/tss/teams/search?q=...&limit=10GET /api/tss/teams/:teamGET /api/tss/teams/:team/historyGET /api/tss/teams/:team/gamesGET /api/tss/player/:uid
Local development
npm run dev:backend
The backend listens on http://127.0.0.1:6000 by default. Override with BACKEND_PORT and BACKEND_HOST.
Production build
npm run build:backend