diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Login/LoginController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Login/LoginController.cs index 31cc050d..be047229 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Login/LoginController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Login/LoginController.cs @@ -67,9 +67,12 @@ public class LoginController : ControllerBase UserEntity? user; - if (!PatchworkHelper.UserHasValidPatchworkUserAgent(this.Request.Headers.UserAgent.ToString())) + if (ServerConfiguration.Instance.Authentication.RequirePatchworkUserAgent) { - return this.Forbid(); + if (!PatchworkHelper.UserHasValidPatchworkUserAgent(this.Request.Headers.UserAgent.ToString())) + { + return this.Forbid(); + } } switch (npTicket.Platform) diff --git a/ProjectLighthouse/Configuration/ConfigurationCategories/AuthenticationConfiguration.cs b/ProjectLighthouse/Configuration/ConfigurationCategories/AuthenticationConfiguration.cs index 4c3abb36..399759c6 100644 --- a/ProjectLighthouse/Configuration/ConfigurationCategories/AuthenticationConfiguration.cs +++ b/ProjectLighthouse/Configuration/ConfigurationCategories/AuthenticationConfiguration.cs @@ -9,5 +9,11 @@ public class AuthenticationConfiguration public bool AllowRPCNSignup { get; set; } = true; public bool AllowPSNSignup { get; set; } = true; + + // Require use of Zaprit's "Patchwork" prx plugin's user agent when connecting to the server + // Major and minor version minimums can be left alone if patchwork is not required + public bool RequirePatchworkUserAgent { get; set; } = false; + public int PatchworkMajorVersionMinimum { get; set; } = 0; + public int PatchworkMinorVersionMinimum { get; set; } = 0; } \ No newline at end of file diff --git a/ProjectLighthouse/Configuration/ServerConfiguration.cs b/ProjectLighthouse/Configuration/ServerConfiguration.cs index 382c9d47..25f22cf6 100644 --- a/ProjectLighthouse/Configuration/ServerConfiguration.cs +++ b/ProjectLighthouse/Configuration/ServerConfiguration.cs @@ -11,7 +11,7 @@ public class ServerConfiguration : ConfigurationBase // This is so Lighthouse can properly identify outdated configurations and update them with newer settings accordingly. // If you are modifying anything here, this value MUST be incremented. // Thanks for listening~ - public override int ConfigVersion { get; set; } = 28; + public override int ConfigVersion { get; set; } = 29; public override string ConfigName { get; set; } = "lighthouse.yml"; public string WebsiteListenUrl { get; set; } = "http://localhost:10060"; @@ -31,12 +31,6 @@ public class ServerConfiguration : ConfigurationBase public bool CheckForUnsafeFiles { get; set; } = true; public bool LogChatFiltering { get; set; } = false; public bool LogChatMessages { get; set; } = false; - - // Require use of Zaprit's "Patchwork" prx plugin's user agent when connecting to the server - // Major and minor version minimums can be left alone if patchwork is not required - public bool RequirePatchworkUserAgent { get; set; } = false; - public int PatchworkMajorVersionMinimum { get; set; } = 0; - public int PatchworkMinorVersionMinimum { get; set; } = 0; public AuthenticationConfiguration Authentication { get; set; } = new(); public CaptchaConfiguration Captcha { get; set; } = new(); public DigestKeyConfiguration DigestKey { get; set; } = new();