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:
Josh 2022-08-31 20:38:58 -05:00 committed by GitHub
parent 58c340aff8
commit d640c000aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 735 additions and 209 deletions

View file

@ -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();
}
}