diff --git a/Robust.Server/ServerStatus/StatusHost.Handlers.cs b/Robust.Server/ServerStatus/StatusHost.Handlers.cs index 5ab298643..5641586cb 100644 --- a/Robust.Server/ServerStatus/StatusHost.Handlers.cs +++ b/Robust.Server/ServerStatus/StatusHost.Handlers.cs @@ -103,6 +103,22 @@ namespace Robust.Server.ServerStatus ["desc"] = _serverDescCache, }; + var privacyPolicyLink = _cfg.GetCVar(CVars.StatusPrivacyPolicyLink); + var privacyPolicyIdentifier = _cfg.GetCVar(CVars.StatusPrivacyPolicyIdentifier); + var privacyPolicyVersion = _cfg.GetCVar(CVars.StatusPrivacyPolicyVersion); + + if (!string.IsNullOrEmpty(privacyPolicyLink) + && !string.IsNullOrEmpty(privacyPolicyIdentifier) + && !string.IsNullOrEmpty(privacyPolicyVersion)) + { + jObject["privacy_policy"] = new JsonObject + { + ["identifier"] = privacyPolicyIdentifier, + ["version"] = privacyPolicyVersion, + ["link"] = privacyPolicyLink, + }; + } + OnInfoRequest?.Invoke(jObject); await context.RespondJsonAsync(jObject); diff --git a/Robust.Shared/CVars.cs b/Robust.Shared/CVars.cs index d276d0fea..0a0f0d4fc 100644 --- a/Robust.Shared/CVars.cs +++ b/Robust.Shared/CVars.cs @@ -628,6 +628,43 @@ namespace Robust.Shared public static readonly CVarDef StatusConnectAddress = CVarDef.Create("status.connectaddress", "", CVar.ARCHIVE | CVar.SERVERONLY); + /// + /// HTTP(S) link to a privacy policy that the user must accept to connect to the server. + /// + /// + /// This must be set along with and + /// for the user to be prompted about a privacy policy. + /// + public static readonly CVarDef StatusPrivacyPolicyLink = + CVarDef.Create("status.privacy_policy_link", "https://example.com/privacy", CVar.SERVER | CVar.REPLICATED); + + /// + /// An identifier for privacy policy specified by . + /// This must be globally unique. + /// + /// + /// + /// This value must be globally unique per server community. Servers that want to enforce a + /// privacy policy should set this to a value that is unique to their server and, preferably, recognizable. + /// + /// + /// This value is stored by the launcher to keep track of what privacy policies a player has accepted. + /// + /// + public static readonly CVarDef StatusPrivacyPolicyIdentifier = + CVarDef.Create("status.privacy_policy_identifier", "", CVar.SERVER | CVar.REPLICATED); + + /// + /// A "version" for the privacy policy specified by . + /// + /// + /// + /// This parameter is stored by the launcher and should be modified whenever your server's privacy policy changes. + /// + /// + public static readonly CVarDef StatusPrivacyPolicyVersion = + CVarDef.Create("status.privacy_policy_version", "", CVar.SERVER | CVar.REPLICATED); + /* * BUILD */