Server updates from the web panel with progress screen

- Updater checks git.mbm.wtf every 6 h (and on demand) for a newer <Version>
  on main, shows the new commits and the required mod version
- Install: download the source, build it with dotnet publish into
  data/app/current, warn players and restart (exit code 75 for Docker/systemd,
  self-relaunch on Windows). At startup a newer installed update is loaded in
  its own AssemblyLoadContext; after 3 failed starts the built-in version runs
- Panel: Update page, sidebar badge, full-screen progress overlay (download,
  build, install, restart) that survives the restart and reloads the panel
- Panel sessions survive restarts (hashed tokens in data/panel_sessions.json)
- Docker image is based on the .NET SDK so it can build updates
- Version 2.9.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 21:07:09 +02:00
co-authored by Claude Opus 5.5
parent 1a2431db3a
commit 1ab9a01efb
12 changed files with 1084 additions and 13 deletions
+5 -2
View File
@@ -6,6 +6,8 @@ using MSCO.Server;
string dataDir = ArgValue("--data") ?? Environment.GetEnvironmentVariable("MSCO_DATA") ?? AppContext.BaseDirectory;
dataDir = Path.GetFullPath(dataDir);
Directory.CreateDirectory(dataDir);
// Im Panel installiertes, neueres Update (DATA/app/current)? Dann läuft stattdessen das.
if (Array.IndexOf(args, "--cmd") < 0 && Updater.RunInstalled(args, dataDir) is int updatedExit) return updatedExit;
string configPath = Path.Combine(dataDir, "server.json");
string commandFile = Path.Combine(dataDir, "commands.in");
@@ -22,7 +24,7 @@ if (Array.IndexOf(args, "--cmd") >= 0)
}
try { Console.Title = "MSCO Server"; } catch { } // nicht jedes Terminal unterstützt einen Titel
GameServer.Log("MSCO dedicated server " + GameServer.ModVersion + " (" + RuntimeInformation.OSDescription + ")");
GameServer.Log("MSCO dedicated server " + Updater.CurrentVersion + " for MSCO mod " + GameServer.ModVersion + " (" + RuntimeInformation.OSDescription + ")");
GameServer.Log("Data folder: " + dataDir);
GameServer.Log("Master server: " + MasterServer.Url);
@@ -138,7 +140,8 @@ using var sigterm = PosixSignalRegistration.Create(PosixSignal.SIGTERM, ctx => {
using var sigquit = PosixSignalRegistration.Create(PosixSignal.SIGQUIT, ctx => { ctx.Cancel = true; host.RequestExit(); });
int exitCode = host.Run();
if (exitCode != 0) Pause();
if (exitCode == Updater.RestartExitCode) Updater.Relaunch(args);
else if (exitCode != 0) Pause();
return exitCode;
string ArgValue(string name)