diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Login/LoginController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Login/LoginController.cs index 2d0e58ef..f981cf34 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Login/LoginController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Login/LoginController.cs @@ -215,7 +215,7 @@ public class LoginController : ControllerBase if (ServerConfiguration.Instance.Authentication.RequirePatchworkUserAgent) { - if (!PatchworkHelper.UserHasValidPatchworkUserAgent(token, this.Request.Headers.UserAgent.ToString())) + if (!PatchworkHelper.UserHasValidPatchworkUserAgent(this.Request.Headers.UserAgent.ToString())) { return this.Forbid(); } diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs index 43ea5b03..cccc9b48 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs @@ -54,10 +54,6 @@ along with this program. If not, see ."; public async Task Announce() { GameTokenEntity token = this.GetToken(); - UserEntity? user = await this.database.UserFromGameToken(token); - - if (user == null) - return this.Forbid(); string username = await this.database.UsernameFromGameToken(token); diff --git a/ProjectLighthouse.Servers.GameServer/Helpers/PatchworkHelper.cs b/ProjectLighthouse.Servers.GameServer/Helpers/PatchworkHelper.cs index 4a5eaa8f..6b39ebe7 100644 --- a/ProjectLighthouse.Servers.GameServer/Helpers/PatchworkHelper.cs +++ b/ProjectLighthouse.Servers.GameServer/Helpers/PatchworkHelper.cs @@ -9,7 +9,7 @@ public static class PatchworkHelper { static int patchworkMajorVer = ServerConfiguration.Instance.Authentication.PatchworkMajorVersionMinimum; static int patchworkMinorVer = ServerConfiguration.Instance.Authentication.PatchworkMinorVersionMinimum; - public static bool UserHasValidPatchworkUserAgent(GameTokenEntity token, string userAgent) + public static bool UserHasValidPatchworkUserAgent(string userAgent) { string userAgentPrefix = "PatchworkLBP"; char gameVersion = userAgent[userAgentPrefix.Length]; @@ -27,10 +27,7 @@ public static class PatchworkHelper numericVersion = gameVersion - '0'; // Don't want it to be 0 still because of Unknown (-1) in GameVersion - if (numericVersion == 0) - return false; - - if (numericVersion - 1 != (int)token.GameVersion && !Enum.IsDefined(typeof(GameVersion), numericVersion)) + if (numericVersion - 1 == 0 || !Enum.IsDefined(typeof(GameVersion), numericVersion)) return false; string[] patchworkVer = userAgent.Split(' ')[1].Split('.'); diff --git a/ProjectLighthouse/Configuration/ConfigurationCategories/AuthenticationConfiguration.cs b/ProjectLighthouse/Configuration/ConfigurationCategories/AuthenticationConfiguration.cs index 399759c6..057485ec 100644 --- a/ProjectLighthouse/Configuration/ConfigurationCategories/AuthenticationConfiguration.cs +++ b/ProjectLighthouse/Configuration/ConfigurationCategories/AuthenticationConfiguration.cs @@ -13,7 +13,7 @@ public class AuthenticationConfiguration // 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 PatchworkMajorVersionMinimum { get; set; } = 1; 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 25f22cf6..d9c66dee 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; } = 29; + public override int ConfigVersion { get; set; } = 30; public override string ConfigName { get; set; } = "lighthouse.yml"; public string WebsiteListenUrl { get; set; } = "http://localhost:10060";