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:
+26
-1
@@ -15,6 +15,13 @@ public sealed class GameServer
|
||||
/// <summary>Netzwerk-Version (= MSCO.ProtocolVersion der Mod). Mods 2.8.x passen dazu (kleine Updates).</summary>
|
||||
public const string ModVersion = "2.8";
|
||||
|
||||
/// <summary>
|
||||
/// Sicherheitsstufe dieses Servers - steigt mit jedem Sicherheitsupdate (gleiche Zählung wie MSCO.SecurityLevel in
|
||||
/// der Mod). Aktuelle Mods treten Servern unter ihrem Minimum nicht bei; der Keymaster markiert sie als veraltet.
|
||||
/// 1 = Oktober 2026 (Paket-Prüfung, Chat/Admin-Nachrichten, sichere Mod-Downloads).
|
||||
/// </summary>
|
||||
public const int SecurityLevel = 1;
|
||||
|
||||
/// <summary>"2.8.3" -> "2.8": kleine Mod-Updates (dritte Stelle) sind kompatibel.</summary>
|
||||
public static string Protocol(string version)
|
||||
{
|
||||
@@ -393,7 +400,7 @@ public sealed class GameServer
|
||||
heartbeat = null;
|
||||
OnLicenseResult(result.Status);
|
||||
if (result.Status == 0 || result.Status >= 500) Log("Master server not reachable - server is not listed right now.");
|
||||
else if (result.Status >= 200 && result.Status < 300) ReportReachability(result);
|
||||
else if (result.Status >= 200 && result.Status < 300) { ReportReachability(result); ReportSecurity(result); }
|
||||
}
|
||||
if (!offline && now >= nextHeartbeat && heartbeat == null)
|
||||
{
|
||||
@@ -403,6 +410,18 @@ public sealed class GameServer
|
||||
}
|
||||
}
|
||||
|
||||
bool? lastOutdated;
|
||||
|
||||
/// <summary>Fehlen Sicherheitsupdates (laut Keymaster)? Nur bei Änderung melden.</summary>
|
||||
void ReportSecurity(MasterClient.HeartbeatResult r)
|
||||
{
|
||||
if (r.Outdated == lastOutdated) return;
|
||||
lastOutdated = r.Outdated;
|
||||
if (r.Outdated)
|
||||
Log($"!!! This server is OUTDATED: security level {SecurityLevel}, required {r.MinSecurity}. Players with a current MSCO " +
|
||||
"cannot join until you update (web panel -> Update, or git pull + rebuild).");
|
||||
}
|
||||
|
||||
/// <summary>Erreichbarkeit laut Master nur bei Änderung ausgeben.</summary>
|
||||
void ReportReachability(MasterClient.HeartbeatResult r)
|
||||
{
|
||||
@@ -448,6 +467,9 @@ public sealed class GameServer
|
||||
var names = clients.Values.Where(x => x.State == ClientState.Joined).Select(x => x.Name).ToList();
|
||||
w.Write(names.Count);
|
||||
foreach (string n in names) w.Write(n);
|
||||
// Erweiterung 2: Programmversion und Sicherheitsstufe (Mods prüfen sie vor dem Beitreten)
|
||||
w.Write(Updater.CurrentVersion);
|
||||
w.Write(SecurityLevel);
|
||||
}));
|
||||
c.Conn.CloseAfterSend("Info query");
|
||||
return;
|
||||
@@ -694,6 +716,9 @@ public sealed class GameServer
|
||||
w.Write(true); // dedizierter Server
|
||||
w.Write(joined.Count);
|
||||
foreach (var p in joined) { w.Write(p.Id); w.Write(p.Name); }
|
||||
// Sicherheitsstufe und Version (neuere Mods verlassen Server unter ihrem Minimum, ältere lesen nicht weiter)
|
||||
w.Write(SecurityLevel);
|
||||
w.Write(Updater.CurrentVersion);
|
||||
}));
|
||||
Broadcast(MsgType.PlayerJoined, Wire.Build(w => { w.Write(c.Id); w.Write(c.Name); }), c.Id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user