Panel: unticking 'web panel enabled' + restart panel really turns it off (2.9.5)

The restart used to refuse when the panel was disabled, so it stayed
reachable. Now it stops the panel (also the relay on the game port);
'panel on|off' in the console turns it on/off and saves server.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 21:07:18 +02:00
co-authored by Claude Opus 5.5
parent 905d191807
commit 835d3ce998
6 changed files with 67 additions and 6 deletions
+8 -1
View File
@@ -667,7 +667,14 @@ public sealed class AdminPanel
{
var fresh = host.LoadConfigForRestart();
if (fresh == null) return Error(500, "Could not read server.json");
if (!fresh.PanelEnabled) return Error(400, "The panel is turned off in the settings - turn it on again or edit server.json by hand");
if (!fresh.PanelEnabled)
{
// "Web-Panel an" abgehakt: das Panel wird wirklich ausgeschaltet
GameServer.Log($"[panel] {by} turns the web panel off");
_ = Task.Run(async () => { await Task.Delay(700); host.RestartPanel(fresh, by); });
return Results.Json(new { ok = true, disabled = true,
message = "The web panel is turned off - turn it on again with 'panel on' in the server console or PanelEnabled in server.json" });
}
bool shares = fresh.PanelPort <= 0 || fresh.PanelPort == fresh.Port;
int port = shares ? fresh.Port : fresh.PanelPort;
string basePath = (fresh.PanelBasePath ?? "").Trim().TrimEnd('/');