mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-19 11:41:30 +00:00
Implement LBP1 tags, stricter resource checking, and more (#463)
* Add LBP1 tags, more strict resource checking, and more. * Fix unit tests * Add more length checking to dependency parser * Online editor problems * Fix tests pt 2 * Self code review and fixed digest bugs * Don't add content length if it was already set * Fix status endpoint * Fix review bug and simplify review serialization * Fix a typo in review serialization * Remove duplicated code and fix search * Remove duplicate database call
This commit is contained in:
parent
58c340aff8
commit
d640c000aa
32 changed files with 735 additions and 209 deletions
|
@ -0,0 +1,42 @@
|
|||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData.Profiles;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("LITTLEBIGPLANETPS3_XML/goodbye")]
|
||||
[Produces("text/xml")]
|
||||
public class LogoutController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly Database database;
|
||||
|
||||
public LogoutController(Database database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> OnPost()
|
||||
{
|
||||
GameToken? token = await this.database.GameTokenFromRequest(this.Request);
|
||||
if (token == null) return this.StatusCode(403, "");
|
||||
|
||||
User? user = await this.database.Users.Where(u => u.UserId == token.UserId).FirstOrDefaultAsync();
|
||||
if (user == null) return this.StatusCode(403, "");
|
||||
|
||||
user.LastLogout = TimeHelper.TimestampMillis;
|
||||
|
||||
this.database.GameTokens.RemoveWhere(t => t.TokenId == token.TokenId);
|
||||
this.database.LastContacts.RemoveWhere(c => c.UserId == token.UserId);
|
||||
await this.database.SaveChangesAsync();
|
||||
|
||||
return this.Ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue