2.10.6: security level 1 - reported in heartbeat, server info and Welcome; log warning when the keymaster marks the server outdated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 20:12:10 +02:00
co-authored by Claude Opus 5.5
parent 7d2ce98f1e
commit 9e795a7802
5 changed files with 51 additions and 7 deletions
+9 -5
View File
@@ -22,7 +22,8 @@ public sealed class MasterClient
public bool Unreachable { get; init; }
}
record HeartbeatBody(string Key, string Name, string Description, string Address, int Port, int Players, int MaxPlayers,
string Version, bool Public, bool RequireSteam, List<string> Tags, List<ModInfo> Mods);
string Version, bool Public, bool RequireSteam, List<string> Tags, List<ModInfo> Mods,
string ServerVersion, int Security);
/// <summary>Mod des Servers für die Serverliste (die Dateien selbst bekommen Spieler direkt vom Server).</summary>
public sealed record ModInfo(string Id, string Name, string Version);
@@ -56,8 +57,9 @@ public sealed class MasterClient
/// Antwort auf den Heartbeat. Status: HTTP-Code, 0 = Master nicht erreichbar, 401 = Schlüssel ungültig.
/// Reachable: ob der Master den Server von außen erreicht (null = Prüfung läuft noch).
/// </summary>
public sealed record HeartbeatResult(int Status, bool? Reachable, bool Listed, string Address, int Port);
record HeartbeatReply(bool? Reachable, bool Listed, string Address, int Port);
/// <summary>Outdated: dem Server fehlen Sicherheitsupdates (Stufe unter MinSecurity) - neue Spieler treten nicht bei.</summary>
public sealed record HeartbeatResult(int Status, bool? Reachable, bool Listed, string Address, int Port, bool Outdated = false, int MinSecurity = 0);
record HeartbeatReply(bool? Reachable, bool Listed, string Address, int Port, bool Outdated, int MinSecurity);
public sealed record RemoteCommand(string Id, string Command, string By);
public sealed record RemoteResult(string Id, string Output);
@@ -95,14 +97,16 @@ public sealed class MasterClient
{
var body = new HeartbeatBody(config.LicenseKey, config.Name, config.Description, config.PublicAddress, config.Port,
players, config.MaxPlayers, version, config.Public, config.RequireSteam,
ServerConfig.NormalizeTags(config.Tags, out _), mods ?? new List<ModInfo>());
ServerConfig.NormalizeTags(config.Tags, out _), mods ?? new List<ModInfo>(),
Updater.CurrentVersion, GameServer.SecurityLevel);
var response = await http.PostAsJsonAsync(baseUrl + "/api/servers/heartbeat", body);
int status = (int)response.StatusCode;
if (!response.IsSuccessStatusCode) return new HeartbeatResult(status, null, false, null, 0);
HeartbeatReply reply = null;
try { reply = await response.Content.ReadFromJsonAsync<HeartbeatReply>(); } catch { }
return new HeartbeatResult(status, reply?.Reachable, reply?.Listed ?? false, reply?.Address, reply?.Port ?? 0);
return new HeartbeatResult(status, reply?.Reachable, reply?.Listed ?? false, reply?.Address, reply?.Port ?? 0,
reply?.Outdated ?? false, reply?.MinSecurity ?? 0);
}
catch
{