mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-13 21:32:28 +00:00
* 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
42 lines
No EOL
1.2 KiB
C#
42 lines
No EOL
1.2 KiB
C#
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();
|
|
}
|
|
|
|
|
|
} |