fix: 7 bug fixes + port config with auto-restart
- HTTPException import added (was causing 500 on missing dashboard) - game_manager.remove_plugin() restored (was AttributeError) - api.js checks HTTP status codes, fails fast on errors - sidebar game highlight only matches selected gameId - scene resize handler uses stored canvas dims (was NaN) - forwarder socket properly closed on listener stop - telemetry port: use_unified_port toggle, off = per-game port, auto-restart on switch
This commit is contained in:
@@ -3,6 +3,7 @@ const Sidebar = {
|
||||
_gameListEl: null,
|
||||
_gameToggleEl: null,
|
||||
_gameLabelEl: null,
|
||||
_gameData: [],
|
||||
|
||||
init() {
|
||||
this._el = document.getElementById('sidebar');
|
||||
@@ -44,6 +45,7 @@ const Sidebar = {
|
||||
|
||||
async _loadGames() {
|
||||
const games = await API.getGames();
|
||||
this._gameData = games;
|
||||
this._gameListEl.innerHTML = '';
|
||||
|
||||
if (!Array.isArray(games) || games.length === 0) {
|
||||
@@ -80,11 +82,17 @@ const Sidebar = {
|
||||
|
||||
async _selectGame(gameId) {
|
||||
await API.updateConfig({ selected_game_id: gameId });
|
||||
const cfg = await API.getConfig();
|
||||
const game = this._gameData.find(g => g.id === gameId);
|
||||
if (game && !cfg.use_unified_port && game.default_port) {
|
||||
await API.updateConfig({ telemetry_port: game.default_port });
|
||||
}
|
||||
await API.stopTelemetry();
|
||||
await API.startTelemetry();
|
||||
this._gameListEl.querySelectorAll('.nav-item').forEach(el => el.classList.remove('active'));
|
||||
const items = this._gameListEl.querySelectorAll('.nav-item');
|
||||
items.forEach(item => {
|
||||
if (item.textContent.trim()) item.classList.add('active');
|
||||
items.forEach((item, idx) => {
|
||||
if (this._gameData[idx] && this._gameData[idx].id === gameId) item.classList.add('active');
|
||||
});
|
||||
const games = await API.getGames();
|
||||
this._updateGameLabel(gameId, games);
|
||||
|
||||
Reference in New Issue
Block a user