using Newtonsoft.Json.Linq; namespace XFEWarframe.Core.Services; public static class ServerIdentity { public const int ApiVersion = 3; public static string Name(JObject state, ServerOptions options) => (state["config"] as JObject)?.Value("serverName") ?? options.ServerName; public static string ValidateName(string name) { name = name.Trim(); if (name.Length is < 1 or > 64 || name.Any(c => char.IsControl(c) || c is '<' or '>')) throw new ApiException(400, "服务器名称须为 1–64 个字符,不能包含控制字符或尖括号。"); return name; } public static object Health(JObject state, ServerOptions options, bool maintenance) => new { status = maintenance ? "maintenance" : "ok", service = "XFEWarframe", apiOnly = true, apiVersion = ApiVersion, serverName = Name(state, options), gameUrl = options.GamePublicUrl ?? options.PublicUrl, capabilities = new[] { "player-accounts", "mail", "game-news", "server-identity", "game-login-202608", "ship-module-recovery" } }; }