Own server tags in the web panel (Settings) and server.json

Tags (max. 6, normalized like the keymaster) are sent with the heartbeat;
official and featured are only given by the MSCO admins and are refused with
a note. MSCO_TAGS environment variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 21:20:06 +02:00
co-authored by Claude Opus 5.5
parent 1ab9a01efb
commit e523e5e17b
6 changed files with 63 additions and 4 deletions
+11 -2
View File
@@ -10,6 +10,7 @@ public static class ConfigEditor
{
name = config.Name,
description = config.Description,
tags = string.Join(", ", config.Tags ?? new()),
maxPlayers = config.MaxPlayers,
isPublic = config.Public,
requireSteam = config.RequireSteam,
@@ -63,6 +64,13 @@ public static class ConfigEditor
if (name.Length == 0) return "The server name cannot be empty";
config.Name = name;
config.Description = Text("description", config.Description, 300);
string tagNote = "";
if (b.TryGetProperty("tags", out var tagValue) && tagValue.ValueKind == System.Text.Json.JsonValueKind.String)
{
var tags = ServerConfig.NormalizeTags(tagValue.GetString().Split(','), out var reserved);
if (!tags.SequenceEqual(config.Tags ?? new())) { config.Tags = tags; changed.Add("tags"); }
if (reserved.Count > 0) tagNote = $" - the tag {string.Join(", ", reserved)} is only given by the MSCO admins";
}
config.MaxPlayers = Number("maxPlayers", config.MaxPlayers, 1, 64);
config.Public = Flag("isPublic", config.Public);
config.RequireSteam = Flag("requireSteam", config.RequireSteam);
@@ -93,7 +101,7 @@ public static class ConfigEditor
restartNeeded = true;
}
if (changed.Count == 0) return "Nothing changed";
if (changed.Count == 0) return "Nothing changed" + tagNote;
try { config.Save(configPath); }
catch (Exception e) { return "Could not save server.json: " + e.Message; }
GameServer.Log($"Settings changed by {by}: {string.Join(", ", changed)}");
@@ -101,6 +109,7 @@ public static class ConfigEditor
return "Settings saved" +
(portChanged ? " - the new port only applies after the whole program restarts (docker compose restart); in Docker publish it in docker-compose.yml first"
: restartNeeded ? " - some changes need a restart" : "") +
(overridden.Count > 0 ? " (note: " + string.Join(", ", overridden) + " is also set by an environment variable, which wins on restart)" : "");
(overridden.Count > 0 ? " (note: " + string.Join(", ", overridden) + " is also set by an environment variable, which wins on restart)" : "") +
tagNote;
}
}