mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-27 23:48:39 +00:00
Quick fixes (awesome name)
This commit is contained in:
parent
68dbf50253
commit
0c8ff50176
5 changed files with 15 additions and 13 deletions
|
@ -214,12 +214,6 @@ public class LoginController : ControllerBase
|
||||||
|
|
||||||
Logger.Success($"Successfully logged in user {user.Username} as {token.GameVersion} client", LogArea.Login);
|
Logger.Success($"Successfully logged in user {user.Username} as {token.GameVersion} client", LogArea.Login);
|
||||||
|
|
||||||
string userAgent = this.Request.Headers.UserAgent.ToString();
|
|
||||||
if (!String.IsNullOrWhiteSpace(userAgent))
|
|
||||||
{
|
|
||||||
user.UserAgent = userAgent;
|
|
||||||
}
|
|
||||||
|
|
||||||
await database.SaveChangesAsync();
|
await database.SaveChangesAsync();
|
||||||
|
|
||||||
// Create a new room on LBP2/3/Vita
|
// Create a new room on LBP2/3/Vita
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using LBPUnion.ProjectLighthouse.Database;
|
using LBPUnion.ProjectLighthouse.Database;
|
||||||
using LBPUnion.ProjectLighthouse.Extensions;
|
using LBPUnion.ProjectLighthouse.Extensions;
|
||||||
using LBPUnion.ProjectLighthouse.Servers.GameServer.Helpers;
|
using LBPUnion.ProjectLighthouse.Servers.GameServer.Helpers;
|
||||||
|
using LBPUnion.ProjectLighthouse.Helpers;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
@ -32,6 +33,8 @@ public class LogoutController : ControllerBase
|
||||||
|
|
||||||
await LogoutHelper.Logout(token, user, database);
|
await LogoutHelper.Logout(token, user, database);
|
||||||
|
|
||||||
|
user.LastLogin = TimeHelper.TimestampMillis;
|
||||||
|
|
||||||
return this.Ok();
|
return this.Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,12 +77,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.";
|
||||||
{
|
{
|
||||||
announceText.Append("This server instance requires the use of the Patchwork plugin for LBP.\n\n");
|
announceText.Append("This server instance requires the use of the Patchwork plugin for LBP.\n\n");
|
||||||
|
|
||||||
if (PatchworkHelper.userHasValidPatchworkUserAgent(user.UserAgent))
|
if (!PatchworkHelper.UserHasValidPatchworkUserAgent(this.Request.Headers.UserAgent.ToString()))
|
||||||
{
|
{
|
||||||
announceText.Append("It appears you do not have the Patchwork plugin installed correctly." +
|
announceText.Append("It appears you do not have the Patchwork plugin installed correctly." +
|
||||||
"Since this server instance requires it, you will not be able to play until you so.");
|
"Since this server instance requires it, you will not be able to play until you so.");
|
||||||
|
|
||||||
|
await LogoutHelper.Logout(token, user, database);
|
||||||
}
|
}
|
||||||
await LogoutHelper.Logout(token, user, database);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
|
@ -6,9 +6,15 @@ public static class PatchworkHelper
|
||||||
{
|
{
|
||||||
static int patchworkMajorVer = ServerConfiguration.Instance.PatchworkMajorVersionMinimum;
|
static int patchworkMajorVer = ServerConfiguration.Instance.PatchworkMajorVersionMinimum;
|
||||||
static int patchworkMinorVer = ServerConfiguration.Instance.PatchworkMinorVersionMinimum;
|
static int patchworkMinorVer = ServerConfiguration.Instance.PatchworkMinorVersionMinimum;
|
||||||
public static bool userHasValidPatchworkUserAgent(string userAgent)
|
public static bool UserHasValidPatchworkUserAgent(string userAgent)
|
||||||
{
|
{
|
||||||
if (userAgent.StartsWith("PatchworkLBP"))
|
string userAgentPrefix = "PatchworkLBP";
|
||||||
|
char gameVersion = userAgent[userAgentPrefix.Length];
|
||||||
|
|
||||||
|
if (userAgent.StartsWith(userAgentPrefix))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (gameVersion is not '1' or '2' or '3' or 'V')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string[] patchworkVer = userAgent.Split(' ')[1].Split('.');
|
string[] patchworkVer = userAgent.Split(' ')[1].Split('.');
|
||||||
|
|
|
@ -28,8 +28,6 @@ public class UserEntity
|
||||||
|
|
||||||
public string IconHash { get; set; }
|
public string IconHash { get; set; }
|
||||||
|
|
||||||
public string UserAgent { get; set;}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Markup that displays the username next to a polaroid with the user's icon.
|
/// Markup that displays the username next to a polaroid with the user's icon.
|
||||||
/// This can be used everywhere markup works ingame, e.g. news or notifications
|
/// This can be used everywhere markup works ingame, e.g. news or notifications
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue