mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 00:18:39 +00:00
Implement checking for the Patchwork user agent, move logout into standalone method
This commit is contained in:
parent
df7ebf977a
commit
68dbf50253
7 changed files with 72 additions and 8 deletions
|
@ -0,0 +1,20 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Helpers;
|
||||
|
||||
public static class PatchworkHelper
|
||||
{
|
||||
static int patchworkMajorVer = ServerConfiguration.Instance.PatchworkMajorVersionMinimum;
|
||||
static int patchworkMinorVer = ServerConfiguration.Instance.PatchworkMinorVersionMinimum;
|
||||
public static bool userHasValidPatchworkUserAgent(string userAgent)
|
||||
{
|
||||
if (userAgent.StartsWith("PatchworkLBP"))
|
||||
return false;
|
||||
|
||||
string[] patchworkVer = userAgent.Split(' ')[1].Split('.');
|
||||
if (int.Parse(patchworkVer[0]) >= patchworkMajorVer && int.Parse(patchworkVer[1]) >= patchworkMinorVer)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue