mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-05 18:22:27 +00:00
The Great Formatting of 2022
This commit is contained in:
parent
59cc7f02fb
commit
35f50f5f8c
162 changed files with 6609 additions and 6809 deletions
|
@ -6,8 +6,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ProjectLighthouse.Tests.GameApiTests
|
namespace ProjectLighthouse.Tests.GameApiTests;
|
||||||
{
|
|
||||||
public class AuthenticationTests : LighthouseServerTest
|
public class AuthenticationTests : LighthouseServerTest
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -64,4 +64,3 @@ namespace ProjectLighthouse.Tests.GameApiTests
|
||||||
Assert.True(response.StatusCode == HttpStatusCode.Forbidden);
|
Assert.True(response.StatusCode == HttpStatusCode.Forbidden);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using LBPUnion.ProjectLighthouse.Tests;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ProjectLighthouse.Tests.GameApiTests
|
namespace ProjectLighthouse.Tests.GameApiTests;
|
||||||
{
|
|
||||||
public class DatabaseTests : LighthouseServerTest
|
public class DatabaseTests : LighthouseServerTest
|
||||||
{
|
{
|
||||||
[DatabaseFact]
|
[DatabaseFact]
|
||||||
|
@ -25,4 +25,3 @@ namespace ProjectLighthouse.Tests.GameApiTests
|
||||||
await database.RemoveUser(userA); // Only remove userA since userA and userB are the same user
|
await database.RemoveUser(userA); // Only remove userA since userA and userB are the same user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -8,8 +8,8 @@ using LBPUnion.ProjectLighthouse.Tests;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ProjectLighthouse.Tests.GameApiTests
|
namespace ProjectLighthouse.Tests.GameApiTests;
|
||||||
{
|
|
||||||
public class MatchTests : LighthouseServerTest
|
public class MatchTests : LighthouseServerTest
|
||||||
{
|
{
|
||||||
private static readonly SemaphoreSlim semaphore = new(1, 1);
|
private static readonly SemaphoreSlim semaphore = new(1, 1);
|
||||||
|
@ -59,4 +59,3 @@ namespace ProjectLighthouse.Tests.GameApiTests
|
||||||
Assert.Equal(oldPlayerCount + 1, playerCount);
|
Assert.Equal(oldPlayerCount + 1, playerCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -9,8 +9,8 @@ using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ProjectLighthouse.Tests.GameApiTests
|
namespace ProjectLighthouse.Tests.GameApiTests;
|
||||||
{
|
|
||||||
public class SlotTests : LighthouseServerTest
|
public class SlotTests : LighthouseServerTest
|
||||||
{
|
{
|
||||||
[DatabaseFact]
|
[DatabaseFact]
|
||||||
|
@ -90,4 +90,3 @@ namespace ProjectLighthouse.Tests.GameApiTests
|
||||||
await database.SaveChangesAsync();
|
await database.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using System.Threading.Tasks;
|
||||||
using LBPUnion.ProjectLighthouse.Tests;
|
using LBPUnion.ProjectLighthouse.Tests;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ProjectLighthouse.Tests.GameApiTests
|
namespace ProjectLighthouse.Tests.GameApiTests;
|
||||||
{
|
|
||||||
public class UploadTests : LighthouseServerTest
|
public class UploadTests : LighthouseServerTest
|
||||||
{
|
{
|
||||||
public UploadTests()
|
public UploadTests()
|
||||||
|
@ -56,4 +56,3 @@ namespace ProjectLighthouse.Tests.GameApiTests
|
||||||
Assert.True(response.IsSuccessStatusCode);
|
Assert.True(response.IsSuccessStatusCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -7,8 +7,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ProjectLighthouse.Tests.WebsiteTests
|
namespace ProjectLighthouse.Tests.WebsiteTests;
|
||||||
{
|
|
||||||
public class AdminTests : LighthouseWebTest
|
public class AdminTests : LighthouseWebTest
|
||||||
{
|
{
|
||||||
public const string AdminPanelButtonXPath = "/html/body/div/header/div/div/div/a[2]";
|
public const string AdminPanelButtonXPath = "/html/body/div/header/div/div/div/a[2]";
|
||||||
|
@ -61,4 +61,3 @@ namespace ProjectLighthouse.Tests.WebsiteTests
|
||||||
Assert.DoesNotContain("Admin Panel", this.Driver.FindElement(By.XPath(AdminPanelButtonXPath)).Text);
|
Assert.DoesNotContain("Admin Panel", this.Driver.FindElement(By.XPath(AdminPanelButtonXPath)).Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -9,8 +9,8 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ProjectLighthouse.Tests.WebsiteTests
|
namespace ProjectLighthouse.Tests.WebsiteTests;
|
||||||
{
|
|
||||||
public class AuthenticationTests : LighthouseWebTest
|
public class AuthenticationTests : LighthouseWebTest
|
||||||
{
|
{
|
||||||
[DatabaseFact]
|
[DatabaseFact]
|
||||||
|
@ -103,4 +103,3 @@ namespace ProjectLighthouse.Tests.WebsiteTests
|
||||||
await database.RemoveUser(user);
|
await database.RemoveUser(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -7,21 +7,21 @@ using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Chrome;
|
using OpenQA.Selenium.Chrome;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ProjectLighthouse.Tests.WebsiteTests
|
namespace ProjectLighthouse.Tests.WebsiteTests;
|
||||||
{
|
|
||||||
[Collection(nameof(LighthouseWebTest))]
|
[Collection(nameof(LighthouseWebTest))]
|
||||||
public class LighthouseWebTest : IDisposable
|
public class LighthouseWebTest : IDisposable
|
||||||
{
|
{
|
||||||
public readonly IWebHost WebHost = new WebHostBuilder().UseKestrel().UseStartup<TestStartup>().UseWebRoot("StaticFiles").Build();
|
|
||||||
public readonly string BaseAddress;
|
public readonly string BaseAddress;
|
||||||
|
|
||||||
public readonly IWebDriver Driver;
|
public readonly IWebDriver Driver;
|
||||||
|
public readonly IWebHost WebHost = new WebHostBuilder().UseKestrel().UseStartup<TestStartup>().UseWebRoot("StaticFiles").Build();
|
||||||
|
|
||||||
public LighthouseWebTest()
|
public LighthouseWebTest()
|
||||||
{
|
{
|
||||||
this.WebHost.Start();
|
this.WebHost.Start();
|
||||||
|
|
||||||
IServerAddressesFeature? serverAddressesFeature = WebHost.ServerFeatures.Get<IServerAddressesFeature>();
|
IServerAddressesFeature? serverAddressesFeature = this.WebHost.ServerFeatures.Get<IServerAddressesFeature>();
|
||||||
if (serverAddressesFeature == null) throw new ArgumentNullException();
|
if (serverAddressesFeature == null) throw new ArgumentNullException();
|
||||||
|
|
||||||
this.BaseAddress = serverAddressesFeature.Addresses.First();
|
this.BaseAddress = serverAddressesFeature.Addresses.First();
|
||||||
|
@ -47,4 +47,3 @@ namespace ProjectLighthouse.Tests.WebsiteTests
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -9,8 +9,8 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace ProjectLighthouse.Tests.WebsiteTests
|
namespace ProjectLighthouse.Tests.WebsiteTests;
|
||||||
{
|
|
||||||
public class RegisterTests : LighthouseWebTest
|
public class RegisterTests : LighthouseWebTest
|
||||||
{
|
{
|
||||||
[DatabaseFact]
|
[DatabaseFact]
|
||||||
|
@ -81,4 +81,3 @@ namespace ProjectLighthouse.Tests.WebsiteTests
|
||||||
Assert.Contains("The username you've chosen is already taken.", this.Driver.PageSource);
|
Assert.Contains("The username you've chosen is already taken.", this.Driver.PageSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Tests
|
namespace LBPUnion.ProjectLighthouse.Tests;
|
||||||
{
|
|
||||||
public sealed class DatabaseFactAttribute : FactAttribute
|
public sealed class DatabaseFactAttribute : FactAttribute
|
||||||
{
|
{
|
||||||
private static readonly object migrateLock = new();
|
private static readonly object migrateLock = new();
|
||||||
|
@ -12,12 +12,8 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
||||||
{
|
{
|
||||||
ServerSettings.Instance = new ServerSettings();
|
ServerSettings.Instance = new ServerSettings();
|
||||||
ServerSettings.Instance.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
ServerSettings.Instance.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
||||||
if (!ServerStatics.DbConnected)
|
if (!ServerStatics.DbConnected) this.Skip = "Database not available";
|
||||||
{
|
|
||||||
this.Skip = "Database not available";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
lock(migrateLock)
|
lock(migrateLock)
|
||||||
{
|
{
|
||||||
using Database database = new();
|
using Database database = new();
|
||||||
|
@ -25,5 +21,3 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,8 +4,8 @@ using System.Text;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Files;
|
using LBPUnion.ProjectLighthouse.Types.Files;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Tests
|
namespace LBPUnion.ProjectLighthouse.Tests;
|
||||||
{
|
|
||||||
public class FileTypeTests
|
public class FileTypeTests
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -58,4 +58,3 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
||||||
Assert.True(file.FileType == LbpFileType.Unknown);
|
Assert.True(file.FileType == LbpFileType.Unknown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -11,8 +11,8 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.TestHost;
|
using Microsoft.AspNetCore.TestHost;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Tests
|
namespace LBPUnion.ProjectLighthouse.Tests;
|
||||||
{
|
|
||||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
public class LighthouseServerTest
|
public class LighthouseServerTest
|
||||||
{
|
{
|
||||||
|
@ -26,10 +26,7 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
||||||
}
|
}
|
||||||
public async Task<HttpResponseMessage> AuthenticateResponse(int number = -1, bool createUser = true)
|
public async Task<HttpResponseMessage> AuthenticateResponse(int number = -1, bool createUser = true)
|
||||||
{
|
{
|
||||||
if (number == -1)
|
if (number == -1) number = new Random().Next();
|
||||||
{
|
|
||||||
number = new Random().Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
const string username = "unitTestUser";
|
const string username = "unitTestUser";
|
||||||
if (createUser)
|
if (createUser)
|
||||||
|
@ -77,8 +74,7 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
||||||
public async Task<HttpResponseMessage> UploadFileRequest(string endpoint, string filePath)
|
public async Task<HttpResponseMessage> UploadFileRequest(string endpoint, string filePath)
|
||||||
=> await this.Client.PostAsync(endpoint, new StringContent(await File.ReadAllTextAsync(filePath)));
|
=> await this.Client.PostAsync(endpoint, new StringContent(await File.ReadAllTextAsync(filePath)));
|
||||||
|
|
||||||
public async Task<HttpResponseMessage> UploadDataRequest(string endpoint, byte[] data)
|
public async Task<HttpResponseMessage> UploadDataRequest(string endpoint, byte[] data) => await this.Client.PostAsync(endpoint, new ByteArrayContent(data));
|
||||||
=> await this.Client.PostAsync(endpoint, new ByteArrayContent(data));
|
|
||||||
|
|
||||||
public async Task<HttpResponseMessage> AuthenticatedUploadFileRequest(string endpoint, string filePath, string mmAuth)
|
public async Task<HttpResponseMessage> AuthenticatedUploadFileRequest(string endpoint, string filePath, string mmAuth)
|
||||||
{
|
{
|
||||||
|
@ -96,4 +92,3 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
||||||
return await this.Client.SendAsync(requestMessage);
|
return await this.Client.SendAsync(requestMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using System.Collections.Generic;
|
||||||
using LBPUnion.ProjectLighthouse.Serialization;
|
using LBPUnion.ProjectLighthouse.Serialization;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Tests
|
namespace LBPUnion.ProjectLighthouse.Tests;
|
||||||
{
|
|
||||||
public class SerializerTests
|
public class SerializerTests
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -40,4 +40,3 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -3,8 +3,8 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/plain")]
|
[Produces("text/plain")]
|
||||||
|
@ -45,4 +45,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok(ps.Serialize());
|
return this.Ok(ps.Serialize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ using LBPUnion.ProjectLighthouse.Types.Categories;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -117,4 +117,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -11,8 +11,8 @@ using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -80,4 +80,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok();
|
return this.Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
public class DeveloperController : Controller
|
public class DeveloperController : Controller
|
||||||
|
@ -9,4 +9,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
[HttpGet("/developer_videos")]
|
[HttpGet("/developer_videos")]
|
||||||
public IActionResult DeveloperVideos() => this.Ok();
|
public IActionResult DeveloperVideos() => this.Ok();
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -7,8 +7,8 @@ using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
// [Produces("text/plain")]
|
// [Produces("text/plain")]
|
||||||
|
@ -126,4 +126,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok();
|
return this.Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -11,8 +11,8 @@ using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
public class FriendsController : ControllerBase
|
public class FriendsController : ControllerBase
|
||||||
|
@ -95,4 +95,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok(LbpSerializer.StringElement("myFriends", friends));
|
return this.Ok(LbpSerializer.StringElement("myFriends", friends));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using System;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/tags")]
|
[Route("LITTLEBIGPLANETPS3_XML/tags")]
|
||||||
[Produces("text/plain")]
|
[Produces("text/plain")]
|
||||||
|
@ -24,4 +24,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok(string.Join(",", tags));
|
return this.Ok(string.Join(",", tags));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -9,8 +9,8 @@ using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -214,4 +214,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -11,8 +11,8 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/login")]
|
[Route("LITTLEBIGPLANETPS3_XML/login")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -151,4 +151,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -14,8 +14,8 @@ using LBPUnion.ProjectLighthouse.Types.Match;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -140,4 +140,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok("[{\"StatusCode\":200}]");
|
return this.Ok("[{\"StatusCode\":200}]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -8,8 +8,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/plain")]
|
[Produces("text/plain")]
|
||||||
|
@ -86,4 +86,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok(loggedText);
|
return this.Ok(loggedText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using LBPUnion.ProjectLighthouse.Serialization;
|
||||||
using LBPUnion.ProjectLighthouse.Types.News;
|
using LBPUnion.ProjectLighthouse.Types.News;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/news")]
|
[Route("LITTLEBIGPLANETPS3_XML/news")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -34,4 +34,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok(LbpSerializer.StringElement("news", newsEntry));
|
return this.Ok(LbpSerializer.StringElement("news", newsEntry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -13,8 +13,8 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -53,10 +53,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
photo.CreatorId = user.UserId;
|
photo.CreatorId = user.UserId;
|
||||||
photo.Creator = user;
|
photo.Creator = user;
|
||||||
|
|
||||||
if (photo.Subjects.Count > 4)
|
if (photo.Subjects.Count > 4) return this.BadRequest();
|
||||||
{
|
|
||||||
return this.BadRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (PhotoSubject subject in photo.Subjects)
|
foreach (PhotoSubject subject in photo.Subjects)
|
||||||
{
|
{
|
||||||
|
@ -76,10 +73,8 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
List<int> subjectUserIds = new(4);
|
List<int> subjectUserIds = new(4);
|
||||||
foreach (PhotoSubject subject in photo.Subjects)
|
foreach (PhotoSubject subject in photo.Subjects)
|
||||||
{
|
{
|
||||||
if (subjectUserIds.Contains(subject.UserId))
|
if (subjectUserIds.Contains(subject.UserId)) return this.BadRequest();
|
||||||
{
|
|
||||||
return this.BadRequest();
|
|
||||||
}
|
|
||||||
subjectUserIds.Add(subject.UserId);
|
subjectUserIds.Add(subject.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,4 +152,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok();
|
return this.Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -13,8 +13,8 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -191,4 +191,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -11,8 +11,8 @@ using LBPUnion.ProjectLighthouse.Types.Files;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using IOFile = System.IO.File;
|
using IOFile = System.IO.File;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML")]
|
[Route("LITTLEBIGPLANETPS3_XML")]
|
||||||
|
@ -86,4 +86,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok();
|
return this.Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -13,8 +13,8 @@ using LBPUnion.ProjectLighthouse.Types.Reviews;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/plain")]
|
[Produces("text/plain")]
|
||||||
|
@ -328,4 +328,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return review;
|
return review;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -11,8 +11,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -120,10 +120,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
);
|
);
|
||||||
|
|
||||||
// Find your score, since even if you aren't in the top list your score is pinned
|
// Find your score, since even if you aren't in the top list your score is pinned
|
||||||
var myScore = rankedScores.Where
|
var myScore = rankedScores.Where(rs => rs.Score.PlayerIdCollection.Contains(user.Username)).OrderByDescending(rs => rs.Score.Points).FirstOrDefault();
|
||||||
(rs => rs.Score.PlayerIdCollection.Contains(user.Username))
|
|
||||||
.OrderByDescending(rs => rs.Score.Points)
|
|
||||||
.FirstOrDefault();
|
|
||||||
|
|
||||||
// Paginated viewing: if not requesting pageStart, get results around user
|
// Paginated viewing: if not requesting pageStart, get results around user
|
||||||
var pagedScores = rankedScores.Skip(pageStart != -1 || myScore == null ? pageStart - 1 : myScore.Rank - 3).Take(Math.Min(pageSize, 30));
|
var pagedScores = rankedScores.Skip(pageStart != -1 || myScore == null ? pageStart - 1 : myScore.Rank - 3).Take(Math.Min(pageSize, 30));
|
||||||
|
@ -162,4 +159,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -7,8 +7,8 @@ using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -51,4 +51,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", dbQuery.Count()));
|
return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", dbQuery.Count()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -11,8 +11,8 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -93,7 +93,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
public async Task<IActionResult> Lbp1CoolSlots([FromQuery] int page)
|
public async Task<IActionResult> Lbp1CoolSlots([FromQuery] int page)
|
||||||
{
|
{
|
||||||
const int pageSize = 30;
|
const int pageSize = 30;
|
||||||
return await CoolSlots((page - 1) * pageSize, pageSize);
|
return await this.CoolSlots((page - 1) * pageSize, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("slots/lbp2cool")]
|
[HttpGet("slots/lbp2cool")]
|
||||||
|
@ -110,7 +110,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
int _pageStart = pageStart;
|
int _pageStart = pageStart;
|
||||||
if (page != null) _pageStart = (int)page * 30;
|
if (page != null) _pageStart = (int)page * 30;
|
||||||
// bit of a better placeholder until we can track average user interaction with /stream endpoint
|
// bit of a better placeholder until we can track average user interaction with /stream endpoint
|
||||||
return await ThumbsSlots(_pageStart, Math.Min(pageSize, 30), gameFilterType, players, move, "thisWeek");
|
return await this.ThumbsSlots(_pageStart, Math.Min(pageSize, 30), gameFilterType, players, move, "thisWeek");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("slots")]
|
[HttpGet("slots")]
|
||||||
|
@ -232,7 +232,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
{
|
{
|
||||||
Random rand = new();
|
Random rand = new();
|
||||||
|
|
||||||
IEnumerable<Slot> slots = FilterByRequest(gameFilterType, dateFilterType)
|
IEnumerable<Slot> slots = this.FilterByRequest(gameFilterType, dateFilterType)
|
||||||
.AsEnumerable()
|
.AsEnumerable()
|
||||||
.OrderByDescending(s => s.Thumbsup)
|
.OrderByDescending(s => s.Thumbsup)
|
||||||
.ThenBy(_ => rand.Next())
|
.ThenBy(_ => rand.Next())
|
||||||
|
@ -257,14 +257,14 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
{
|
{
|
||||||
Random rand = new();
|
Random rand = new();
|
||||||
|
|
||||||
IEnumerable<Slot> slots = FilterByRequest(gameFilterType, dateFilterType)
|
IEnumerable<Slot> slots = this.FilterByRequest(gameFilterType, dateFilterType)
|
||||||
.AsEnumerable()
|
.AsEnumerable()
|
||||||
.OrderByDescending
|
.OrderByDescending
|
||||||
(
|
(
|
||||||
s =>
|
s =>
|
||||||
{
|
{
|
||||||
// probably not the best way to do this?
|
// probably not the best way to do this?
|
||||||
return GetGameFilter(gameFilterType) switch
|
return this.GetGameFilter(gameFilterType) switch
|
||||||
{
|
{
|
||||||
GameVersion.LittleBigPlanet1 => s.PlaysLBP1Unique,
|
GameVersion.LittleBigPlanet1 => s.PlaysLBP1Unique,
|
||||||
GameVersion.LittleBigPlanet2 => s.PlaysLBP2Unique,
|
GameVersion.LittleBigPlanet2 => s.PlaysLBP2Unique,
|
||||||
|
@ -296,7 +296,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
{
|
{
|
||||||
Random rand = new();
|
Random rand = new();
|
||||||
|
|
||||||
IEnumerable<Slot> slots = FilterByRequest(gameFilterType, dateFilterType)
|
IEnumerable<Slot> slots = this.FilterByRequest(gameFilterType, dateFilterType)
|
||||||
.AsEnumerable()
|
.AsEnumerable()
|
||||||
.OrderByDescending(s => s.Hearts)
|
.OrderByDescending(s => s.Hearts)
|
||||||
.ThenBy(_ => rand.Next())
|
.ThenBy(_ => rand.Next())
|
||||||
|
@ -332,24 +332,19 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
_ => 0,
|
_ => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
GameVersion gameVersion = GetGameFilter(gameFilterType);
|
GameVersion gameVersion = this.GetGameFilter(gameFilterType);
|
||||||
|
|
||||||
IQueryable<Slot> whereSlots;
|
IQueryable<Slot> whereSlots;
|
||||||
|
|
||||||
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
|
||||||
if (gameFilterType == "both")
|
if (gameFilterType == "both")
|
||||||
{
|
|
||||||
// Get game versions less than the current version
|
// Get game versions less than the current version
|
||||||
// Needs support for LBP3 ("both" = LBP1+2)
|
// Needs support for LBP3 ("both" = LBP1+2)
|
||||||
whereSlots = this.database.Slots.Where(s => s.GameVersion <= gameVersion && s.FirstUploaded >= oldestTime);
|
whereSlots = this.database.Slots.Where(s => s.GameVersion <= gameVersion && s.FirstUploaded >= oldestTime);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
// Get game versions exactly equal to gamefiltertype
|
// Get game versions exactly equal to gamefiltertype
|
||||||
whereSlots = this.database.Slots.Where(s => s.GameVersion == gameVersion && s.FirstUploaded >= oldestTime);
|
whereSlots = this.database.Slots.Where(s => s.GameVersion == gameVersion && s.FirstUploaded >= oldestTime);
|
||||||
}
|
|
||||||
|
|
||||||
return whereSlots.Include(s => s.Creator).Include(s => s.Location);
|
return whereSlots.Include(s => s.Creator).Include(s => s.Location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -3,8 +3,8 @@ using LBPUnion.ProjectLighthouse.Helpers;
|
||||||
using LBPUnion.ProjectLighthouse.Serialization;
|
using LBPUnion.ProjectLighthouse.Serialization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/plain")]
|
[Produces("text/plain")]
|
||||||
|
@ -36,4 +36,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
[HttpGet("planetStats/totalLevelCount")]
|
[HttpGet("planetStats/totalLevelCount")]
|
||||||
public async Task<IActionResult> TotalLevelCount() => this.Ok((await StatisticsHelper.SlotCount()).ToString());
|
public async Task<IActionResult> TotalLevelCount() => this.Ok((await StatisticsHelper.SlotCount()).ToString());
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -10,4 +10,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
[HttpGet("promotions")]
|
[HttpGet("promotions")]
|
||||||
public IActionResult Promotions() => this.Ok();
|
public IActionResult Promotions() => this.Ok();
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -12,8 +12,8 @@ using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers
|
namespace LBPUnion.ProjectLighthouse.Controllers;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("LITTLEBIGPLANETPS3_XML/")]
|
[Route("LITTLEBIGPLANETPS3_XML/")]
|
||||||
[Produces("text/xml")]
|
[Produces("text/xml")]
|
||||||
|
@ -189,4 +189,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
return this.Ok("[{\"StatusCode\":200}]");
|
return this.Ok("[{\"StatusCode\":200}]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers.Website.Admin
|
namespace LBPUnion.ProjectLighthouse.Controllers.Website.Admin;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("admin/slot/{id:int}")]
|
[Route("admin/slot/{id:int}")]
|
||||||
public class AdminSlotController : ControllerBase
|
public class AdminSlotController : ControllerBase
|
||||||
|
@ -70,4 +70,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers.Website.Admin
|
||||||
return this.Ok();
|
return this.Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -4,8 +4,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers.Website.Admin
|
namespace LBPUnion.ProjectLighthouse.Controllers.Website.Admin;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("admin/user/{id:int}")]
|
[Route("admin/user/{id:int}")]
|
||||||
public class AdminUserController : ControllerBase
|
public class AdminUserController : ControllerBase
|
||||||
|
@ -34,4 +34,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers.Website.Admin
|
||||||
return this.Redirect($"/user/{targetedUser.UserId}");
|
return this.Redirect($"/user/{targetedUser.UserId}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,10 +1,5 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LBPUnion.ProjectLighthouse.Helpers;
|
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers.Website.Debug;
|
namespace LBPUnion.ProjectLighthouse.Controllers.Website.Debug;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers.Website.ExternalAuth
|
namespace LBPUnion.ProjectLighthouse.Controllers.Website.ExternalAuth;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("/authentication")]
|
[Route("/authentication")]
|
||||||
public class AuthenticationController : ControllerBase
|
public class AuthenticationController : ControllerBase
|
||||||
|
@ -88,4 +88,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers.Website.ExternalAuth
|
||||||
return this.Redirect("~/authentication");
|
return this.Redirect("~/authentication");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -4,8 +4,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers.Website.ExternalAuth
|
namespace LBPUnion.ProjectLighthouse.Controllers.Website.ExternalAuth;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("/authentication")]
|
[Route("/authentication")]
|
||||||
public class AutoApprovalController : ControllerBase
|
public class AutoApprovalController : ControllerBase
|
||||||
|
@ -64,4 +64,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers.Website.ExternalAuth
|
||||||
return this.Redirect("/authentication/autoApprovals");
|
return this.Redirect("/authentication/autoApprovals");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -10,8 +10,8 @@ using Microsoft.EntityFrameworkCore;
|
||||||
// TODO: Clean up this file
|
// TODO: Clean up this file
|
||||||
// - jvyden
|
// - jvyden
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers.Website
|
namespace LBPUnion.ProjectLighthouse.Controllers.Website;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("slot/{id:int}")]
|
[Route("slot/{id:int}")]
|
||||||
public class SlotPageController : ControllerBase
|
public class SlotPageController : ControllerBase
|
||||||
|
@ -87,4 +87,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers.Website
|
||||||
return this.Redirect(callbackUrl);
|
return this.Redirect(callbackUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -4,8 +4,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Controllers.Website
|
namespace LBPUnion.ProjectLighthouse.Controllers.Website;
|
||||||
{
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("user/{id:int}")]
|
[Route("user/{id:int}")]
|
||||||
public class UserPageController : ControllerBase
|
public class UserPageController : ControllerBase
|
||||||
|
@ -45,4 +45,3 @@ namespace LBPUnion.ProjectLighthouse.Controllers.Website
|
||||||
return this.Redirect("~/user/" + id);
|
return this.Redirect("~/user/" + id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -13,8 +13,8 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse
|
namespace LBPUnion.ProjectLighthouse;
|
||||||
{
|
|
||||||
public class Database : DbContext
|
public class Database : DbContext
|
||||||
{
|
{
|
||||||
public DbSet<User> Users { get; set; }
|
public DbSet<User> Users { get; set; }
|
||||||
|
@ -97,8 +97,7 @@ namespace LBPUnion.ProjectLighthouse
|
||||||
|
|
||||||
public async Task HeartUser(User user, User heartedUser)
|
public async Task HeartUser(User user, User heartedUser)
|
||||||
{
|
{
|
||||||
HeartedProfile? heartedProfile = await this.HeartedProfiles.FirstOrDefaultAsync
|
HeartedProfile? heartedProfile = await this.HeartedProfiles.FirstOrDefaultAsync(q => q.UserId == user.UserId && q.HeartedUserId == heartedUser.UserId);
|
||||||
(q => q.UserId == user.UserId && q.HeartedUserId == heartedUser.UserId);
|
|
||||||
if (heartedProfile != null) return;
|
if (heartedProfile != null) return;
|
||||||
|
|
||||||
this.HeartedProfiles.Add
|
this.HeartedProfiles.Add
|
||||||
|
@ -115,8 +114,7 @@ namespace LBPUnion.ProjectLighthouse
|
||||||
|
|
||||||
public async Task UnheartUser(User user, User heartedUser)
|
public async Task UnheartUser(User user, User heartedUser)
|
||||||
{
|
{
|
||||||
HeartedProfile? heartedProfile = await this.HeartedProfiles.FirstOrDefaultAsync
|
HeartedProfile? heartedProfile = await this.HeartedProfiles.FirstOrDefaultAsync(q => q.UserId == user.UserId && q.HeartedUserId == heartedUser.UserId);
|
||||||
(q => q.UserId == user.UserId && q.HeartedUserId == heartedUser.UserId);
|
|
||||||
if (heartedProfile != null) this.HeartedProfiles.Remove(heartedProfile);
|
if (heartedProfile != null) this.HeartedProfiles.Remove(heartedProfile);
|
||||||
|
|
||||||
await this.SaveChangesAsync();
|
await this.SaveChangesAsync();
|
||||||
|
@ -296,4 +294,3 @@ namespace LBPUnion.ProjectLighthouse
|
||||||
}
|
}
|
||||||
#nullable disable
|
#nullable disable
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse
|
namespace LBPUnion.ProjectLighthouse;
|
||||||
{
|
|
||||||
public class FakeRemoteIPAddressMiddleware
|
public class FakeRemoteIPAddressMiddleware
|
||||||
{
|
{
|
||||||
private readonly IPAddress fakeIpAddress = IPAddress.Parse("127.0.0.1");
|
private readonly IPAddress fakeIpAddress = IPAddress.Parse("127.0.0.1");
|
||||||
|
@ -21,4 +21,3 @@ namespace LBPUnion.ProjectLighthouse
|
||||||
await this.next(httpContext);
|
await this.next(httpContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using System.IO.Pipelines;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class BinaryHelper
|
public static class BinaryHelper
|
||||||
{
|
{
|
||||||
public static string ReadString(BinaryReader reader)
|
public static string ReadString(BinaryReader reader)
|
||||||
|
@ -62,4 +62,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
return data.ToArray();
|
return data.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Categories;
|
using LBPUnion.ProjectLighthouse.Types.Categories;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class CollectionHelper
|
public static class CollectionHelper
|
||||||
{
|
{
|
||||||
public static readonly List<Category> Categories = new();
|
public static readonly List<Category> Categories = new();
|
||||||
|
@ -18,4 +18,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
foreach (DatabaseCategory category in database.CustomCategories) Categories.Add(new CustomCategory(category));
|
foreach (DatabaseCategory category in database.CustomCategories) Categories.Add(new CustomCategory(category));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class DeniedAuthenticationHelper
|
public static class DeniedAuthenticationHelper
|
||||||
{
|
{
|
||||||
public static readonly Dictionary<string, long> IPAddressAndNameDeniedAt = new();
|
public static readonly Dictionary<string, long> IPAddressAndNameDeniedAt = new();
|
||||||
|
@ -35,4 +35,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
return attempts;
|
return attempts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class EulaHelper
|
public static class EulaHelper
|
||||||
{
|
{
|
||||||
public const string License = @"
|
public const string License = @"
|
||||||
|
@ -16,4 +16,3 @@ GNU Affero General Public License for more details.
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.";
|
along with this program. If not, see <https://www.gnu.org/licenses/>.";
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers.Extensions
|
namespace LBPUnion.ProjectLighthouse.Helpers.Extensions;
|
||||||
{
|
|
||||||
// https://stackoverflow.com/a/8039737
|
// https://stackoverflow.com/a/8039737
|
||||||
public static class ExceptionExtensions
|
public static class ExceptionExtensions
|
||||||
{
|
{
|
||||||
|
@ -25,4 +25,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers.Extensions
|
||||||
return string.Join("\n", fields);
|
return string.Join("\n", fields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using System.Text.RegularExpressions;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Net.Http.Headers;
|
using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers.Extensions
|
namespace LBPUnion.ProjectLighthouse.Helpers.Extensions;
|
||||||
{
|
|
||||||
// yoinked and adapted from https://stackoverflow.com/a/68641796
|
// yoinked and adapted from https://stackoverflow.com/a/68641796
|
||||||
public static class RequestExtensions
|
public static class RequestExtensions
|
||||||
{
|
{
|
||||||
|
@ -12,4 +12,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers.Extensions
|
||||||
|
|
||||||
public static bool IsMobile(this HttpRequest request) => mobileCheck.IsMatch(request.Headers[HeaderNames.UserAgent].ToString());
|
public static bool IsMobile(this HttpRequest request) => mobileCheck.IsMatch(request.Headers[HeaderNames.UserAgent].ToString());
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,10 +1,9 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers.Extensions
|
namespace LBPUnion.ProjectLighthouse.Helpers.Extensions;
|
||||||
{
|
|
||||||
public static class StringExtensions
|
public static class StringExtensions
|
||||||
{
|
{
|
||||||
public static string ToFileName(this string text) => Path.GetInvalidFileNameChars().Aggregate(text, (current, c) => current.Replace(c.ToString(), ""));
|
public static string ToFileName(this string text) => Path.GetInvalidFileNameChars().Aggregate(text, (current, c) => current.Replace(c.ToString(), ""));
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -5,8 +5,8 @@ using System.Text;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Files;
|
using LBPUnion.ProjectLighthouse.Types.Files;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class FileHelper
|
public static class FileHelper
|
||||||
{
|
{
|
||||||
public static readonly string ResourcePath = Path.Combine(Environment.CurrentDirectory, "r");
|
public static readonly string ResourcePath = Path.Combine(Environment.CurrentDirectory, "r");
|
||||||
|
@ -100,4 +100,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
|
|
||||||
public static string[] ResourcesNotUploaded(params string[] hashes) => hashes.Where(hash => !ResourceExists(hash)).ToArray();
|
public static string[] ResourcesNotUploaded(params string[] hashes) => hashes.Where(hash => !ResourceExists(hash)).ToArray();
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
[SuppressMessage("ReSharper", "CollectionNeverQueried.Global")]
|
[SuppressMessage("ReSharper", "CollectionNeverQueried.Global")]
|
||||||
public static class FriendHelper
|
public static class FriendHelper
|
||||||
|
@ -11,4 +11,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
public static readonly Dictionary<int, int[]> FriendIdsByUserId = new();
|
public static readonly Dictionary<int, int[]> FriendIdsByUserId = new();
|
||||||
public static readonly Dictionary<int, int[]> BlockedIdsByUserId = new();
|
public static readonly Dictionary<int, int[]> BlockedIdsByUserId = new();
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public class GameVersionHelper
|
public class GameVersionHelper
|
||||||
{
|
{
|
||||||
// https://www.serialstation.com/games/b89b4eb4-4e4c-4e54-b72b-f7f9dbfac125
|
// https://www.serialstation.com/games/b89b4eb4-4e4c-4e54-b72b-f7f9dbfac125
|
||||||
|
@ -99,4 +99,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
return GameVersion.LittleBigPlanet1;
|
return GameVersion.LittleBigPlanet1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
public static class HashHelper
|
public static class HashHelper
|
||||||
{
|
{
|
||||||
|
@ -80,4 +80,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using Kettu;
|
||||||
using LBPUnion.ProjectLighthouse.Logging;
|
using LBPUnion.ProjectLighthouse.Logging;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class InfluxHelper
|
public static class InfluxHelper
|
||||||
{
|
{
|
||||||
public static readonly InfluxDBClient Client = InfluxDBClientFactory.Create(ServerSettings.Instance.InfluxUrl, ServerSettings.Instance.InfluxToken);
|
public static readonly InfluxDBClient Client = InfluxDBClientFactory.Create(ServerSettings.Instance.InfluxUrl, ServerSettings.Instance.InfluxToken);
|
||||||
|
@ -47,4 +47,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
t.Start();
|
t.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -5,8 +5,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class LastContactHelper
|
public static class LastContactHelper
|
||||||
{
|
{
|
||||||
private static readonly Database database = new();
|
private static readonly Database database = new();
|
||||||
|
@ -32,4 +32,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
await database.SaveChangesAsync();
|
await database.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LBPUnion.ProjectLighthouse.Maintenance;
|
using LBPUnion.ProjectLighthouse.Maintenance;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class MaintenanceHelper
|
public static class MaintenanceHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -33,10 +33,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
{
|
{
|
||||||
if (args.Length < 1)
|
if (args.Length < 1)
|
||||||
throw new Exception
|
throw new Exception
|
||||||
(
|
("This should never happen. " + "If it did, its because you tried to run a command before validating that the user actually wants to run one.");
|
||||||
"This should never happen. " +
|
|
||||||
"If it did, its because you tried to run a command before validating that the user actually wants to run one."
|
|
||||||
);
|
|
||||||
|
|
||||||
string baseCmd = args[0];
|
string baseCmd = args[0];
|
||||||
args = args.Skip(1).ToArray();
|
args = args.Skip(1).ToArray();
|
||||||
|
@ -67,4 +64,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
await job.Run();
|
await job.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -7,8 +7,8 @@ using System.Text.Json;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Match;
|
using LBPUnion.ProjectLighthouse.Types.Match;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class MatchHelper
|
public static class MatchHelper
|
||||||
{
|
{
|
||||||
public static readonly Dictionary<int, string?> UserLocations = new();
|
public static readonly Dictionary<int, string?> UserLocations = new();
|
||||||
|
@ -73,4 +73,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -8,8 +8,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Match;
|
using LBPUnion.ProjectLighthouse.Types.Match;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public class RoomHelper
|
public class RoomHelper
|
||||||
{
|
{
|
||||||
public static readonly List<Room> Rooms = new();
|
public static readonly List<Room> Rooms = new();
|
||||||
|
@ -87,7 +87,6 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
|
||||||
response.Players.Add
|
response.Players.Add
|
||||||
(
|
(
|
||||||
new Player
|
new Player
|
||||||
|
@ -96,12 +95,8 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
User = user,
|
User = user,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
if (location == null)
|
if (location == null) response.Locations.Add(location);
|
||||||
{
|
|
||||||
response.Locations.Add(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
response.Slots = new List<List<int>>
|
response.Slots = new List<List<int>>
|
||||||
{
|
{
|
||||||
|
@ -151,9 +146,8 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
public static Room? FindRoomByUser(User user, GameVersion roomVersion, bool createIfDoesNotExist = false)
|
public static Room? FindRoomByUser(User user, GameVersion roomVersion, bool createIfDoesNotExist = false)
|
||||||
{
|
{
|
||||||
lock(Rooms)
|
lock(Rooms)
|
||||||
{
|
foreach (Room room in Rooms.Where(room => room.Players.Any(player => user == player)))
|
||||||
foreach (Room room in Rooms.Where(room => room.Players.Any(player => user == player))) return room;
|
return room;
|
||||||
}
|
|
||||||
|
|
||||||
return createIfDoesNotExist ? CreateRoom(user, roomVersion) : null;
|
return createIfDoesNotExist ? CreateRoom(user, roomVersion) : null;
|
||||||
}
|
}
|
||||||
|
@ -188,4 +182,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class StatisticsHelper
|
public static class StatisticsHelper
|
||||||
{
|
{
|
||||||
private static readonly Database database = new();
|
private static readonly Database database = new();
|
||||||
|
@ -16,4 +16,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
|
|
||||||
public static async Task<int> PhotoCount() => await database.Photos.CountAsync();
|
public static async Task<int> PhotoCount() => await database.Photos.CountAsync();
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,13 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class TimeHelper
|
public static class TimeHelper
|
||||||
{
|
{
|
||||||
public static long UnixTimeMilliseconds() => DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
public static long UnixTimeMilliseconds() => DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||||
public static long UnixTimeSeconds() => DateTimeOffset.Now.ToUnixTimeSeconds();
|
public static long UnixTimeSeconds() => DateTimeOffset.Now.ToUnixTimeSeconds();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 1397109686193
|
// 1397109686193
|
||||||
// 1635389749454
|
// 1635389749454
|
|
@ -1,11 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class TimestampHelper
|
public static class TimestampHelper
|
||||||
{
|
{
|
||||||
public static long Timestamp => (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
public static long Timestamp => (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
|
|
||||||
public static long TimestampMillis => (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds;
|
public static long TimestampMillis => (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds;
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -5,8 +5,8 @@ using Kettu;
|
||||||
using LBPUnion.ProjectLighthouse.Logging;
|
using LBPUnion.ProjectLighthouse.Logging;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Helpers
|
namespace LBPUnion.ProjectLighthouse.Helpers;
|
||||||
{
|
|
||||||
public static class VersionHelper
|
public static class VersionHelper
|
||||||
{
|
{
|
||||||
static VersionHelper()
|
static VersionHelper()
|
||||||
|
@ -80,4 +80,3 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
"Unknown";
|
"Unknown";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -3,8 +3,8 @@ using Kettu;
|
||||||
using LBPUnion.ProjectLighthouse.Helpers.Extensions;
|
using LBPUnion.ProjectLighthouse.Helpers.Extensions;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Logging
|
namespace LBPUnion.ProjectLighthouse.Logging;
|
||||||
{
|
|
||||||
public class AspNetToKettuLogger : ILogger
|
public class AspNetToKettuLogger : ILogger
|
||||||
{
|
{
|
||||||
public IDisposable BeginScope<TState>(TState state) => NullScope.Instance;
|
public IDisposable BeginScope<TState>(TState state) => NullScope.Instance;
|
||||||
|
@ -21,4 +21,3 @@ namespace LBPUnion.ProjectLighthouse.Logging
|
||||||
foreach (string line in lines) Logger.Log(line, loggerLevel);
|
foreach (string line in lines) Logger.Log(line, loggerLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Logging
|
namespace LBPUnion.ProjectLighthouse.Logging;
|
||||||
{
|
|
||||||
[ProviderAlias("Kettu")]
|
[ProviderAlias("Kettu")]
|
||||||
public class AspNetToKettuLoggerProvider : ILoggerProvider, IDisposable
|
public class AspNetToKettuLoggerProvider : ILoggerProvider, IDisposable
|
||||||
{
|
{
|
||||||
|
@ -13,4 +13,3 @@ namespace LBPUnion.ProjectLighthouse.Logging
|
||||||
|
|
||||||
public ILogger CreateLogger(string categoryName) => new AspNetToKettuLogger();
|
public ILogger CreateLogger(string categoryName) => new AspNetToKettuLogger();
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -4,8 +4,8 @@ using Kettu;
|
||||||
using LBPUnion.ProjectLighthouse.Helpers;
|
using LBPUnion.ProjectLighthouse.Helpers;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Logging
|
namespace LBPUnion.ProjectLighthouse.Logging;
|
||||||
{
|
|
||||||
public class InfluxLogger : LoggerBase
|
public class InfluxLogger : LoggerBase
|
||||||
{
|
{
|
||||||
public override bool AllowMultiple => false;
|
public override bool AllowMultiple => false;
|
||||||
|
@ -24,4 +24,3 @@ namespace LBPUnion.ProjectLighthouse.Logging
|
||||||
writeApi.WritePoint(ServerSettings.Instance.InfluxBucket, ServerSettings.Instance.InfluxOrg, point);
|
writeApi.WritePoint(ServerSettings.Instance.InfluxBucket, ServerSettings.Instance.InfluxOrg, point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -4,8 +4,8 @@ using Kettu;
|
||||||
using LBPUnion.ProjectLighthouse.Helpers;
|
using LBPUnion.ProjectLighthouse.Helpers;
|
||||||
using LBPUnion.ProjectLighthouse.Helpers.Extensions;
|
using LBPUnion.ProjectLighthouse.Helpers.Extensions;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Logging
|
namespace LBPUnion.ProjectLighthouse.Logging;
|
||||||
{
|
|
||||||
public class LighthouseFileLogger : LoggerBase
|
public class LighthouseFileLogger : LoggerBase
|
||||||
{
|
{
|
||||||
private static readonly string logsDirectory = Path.Combine(Environment.CurrentDirectory, "logs");
|
private static readonly string logsDirectory = Path.Combine(Environment.CurrentDirectory, "logs");
|
||||||
|
@ -29,4 +29,3 @@ namespace LBPUnion.ProjectLighthouse.Logging
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
using Kettu;
|
using Kettu;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Logging
|
namespace LBPUnion.ProjectLighthouse.Logging;
|
||||||
{
|
|
||||||
public class LoggerLevelStartup : LoggerLevel
|
public class LoggerLevelStartup : LoggerLevel
|
||||||
{
|
{
|
||||||
public static readonly LoggerLevelStartup Instance = new();
|
public static readonly LoggerLevelStartup Instance = new();
|
||||||
|
@ -78,4 +78,3 @@ namespace LBPUnion.ProjectLighthouse.Logging
|
||||||
public static readonly LoggerLevelCategory Instance = new();
|
public static readonly LoggerLevelCategory Instance = new();
|
||||||
public override string Name => "Category";
|
public override string Name => "Category";
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Logging
|
namespace LBPUnion.ProjectLighthouse.Logging;
|
||||||
{
|
|
||||||
public class NullScope : IDisposable
|
public class NullScope : IDisposable
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -14,4 +14,3 @@ namespace LBPUnion.ProjectLighthouse.Logging
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -7,8 +7,8 @@ using LBPUnion.ProjectLighthouse.Logging;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands;
|
||||||
{
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class CreateUserCommand : ICommand
|
public class CreateUserCommand : ICommand
|
||||||
{
|
{
|
||||||
|
@ -51,4 +51,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
||||||
|
|
||||||
public int RequiredArgs() => 2;
|
public int RequiredArgs() => 2;
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -5,8 +5,8 @@ using JetBrains.Annotations;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands;
|
||||||
{
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class DeleteUserCommand : ICommand
|
public class DeleteUserCommand : ICommand
|
||||||
{
|
{
|
||||||
|
@ -37,4 +37,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
||||||
await this.database.RemoveUser(user);
|
await this.database.RemoveUser(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -5,8 +5,8 @@ using JetBrains.Annotations;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands;
|
||||||
{
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class MakeUserAdminCommand : ICommand
|
public class MakeUserAdminCommand : ICommand
|
||||||
{
|
{
|
||||||
|
@ -42,4 +42,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
||||||
Console.WriteLine($"The user {user.Username} (id: {user.UserId}) is now an admin.");
|
Console.WriteLine($"The user {user.Username} (id: {user.UserId}) is now an admin.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using LBPUnion.ProjectLighthouse.Helpers;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands;
|
||||||
{
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class ResetPasswordCommand : ICommand
|
public class ResetPasswordCommand : ICommand
|
||||||
{
|
{
|
||||||
|
@ -46,4 +46,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
||||||
Console.WriteLine($"The password for user {user.Username} (id: {user.UserId}) has been reset.");
|
Console.WriteLine($"The password for user {user.Username} (id: {user.UserId}) has been reset.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -5,8 +5,8 @@ using System.Threading.Tasks;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands;
|
||||||
{
|
|
||||||
public class WipeTokensForUserCommand : ICommand
|
public class WipeTokensForUserCommand : ICommand
|
||||||
{
|
{
|
||||||
private readonly Database database = new();
|
private readonly Database database = new();
|
||||||
|
@ -42,4 +42,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
||||||
Console.WriteLine($"Deleted all tokens for {user.Username} (id: {user.UserId}).");
|
Console.WriteLine($"Deleted all tokens for {user.Username} (id: {user.UserId}).");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance
|
namespace LBPUnion.ProjectLighthouse.Maintenance;
|
||||||
{
|
|
||||||
public interface ICommand
|
public interface ICommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -16,4 +16,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance
|
||||||
|
|
||||||
public int RequiredArgs();
|
public int RequiredArgs();
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance
|
namespace LBPUnion.ProjectLighthouse.Maintenance;
|
||||||
{
|
|
||||||
public interface IMaintenanceJob
|
public interface IMaintenanceJob
|
||||||
{
|
{
|
||||||
public Task Run();
|
public Task Run();
|
||||||
|
@ -10,4 +10,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance
|
||||||
|
|
||||||
public string Description();
|
public string Description();
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -7,8 +7,8 @@ using LBPUnion.ProjectLighthouse.Helpers;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Files;
|
using LBPUnion.ProjectLighthouse.Types.Files;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs
|
namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs;
|
||||||
{
|
|
||||||
public class CleanupBrokenPhotosMaintenanceJob : IMaintenanceJob
|
public class CleanupBrokenPhotosMaintenanceJob : IMaintenanceJob
|
||||||
{
|
{
|
||||||
private readonly Database database = new();
|
private readonly Database database = new();
|
||||||
|
@ -89,4 +89,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -4,8 +4,8 @@ using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs
|
namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs;
|
||||||
{
|
|
||||||
public class CleanupUnusedLocationsMaintenanceJob : IMaintenanceJob
|
public class CleanupUnusedLocationsMaintenanceJob : IMaintenanceJob
|
||||||
{
|
{
|
||||||
private readonly Database database = new();
|
private readonly Database database = new();
|
||||||
|
@ -30,4 +30,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs
|
namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs;
|
||||||
{
|
|
||||||
public class DeleteAllTokensMaintenanceJob : IMaintenanceJob
|
public class DeleteAllTokensMaintenanceJob : IMaintenanceJob
|
||||||
{
|
{
|
||||||
private readonly Database database = new();
|
private readonly Database database = new();
|
||||||
|
@ -19,4 +19,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs
|
||||||
Console.WriteLine("Deleted ALL tokens.");
|
Console.WriteLine("Deleted ALL tokens.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs
|
namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs;
|
||||||
{
|
|
||||||
public class FixAllBrokenPlayerRequirementsMaintenanceJob : IMaintenanceJob
|
public class FixAllBrokenPlayerRequirementsMaintenanceJob : IMaintenanceJob
|
||||||
{
|
{
|
||||||
private readonly Database database = new();
|
private readonly Database database = new();
|
||||||
|
@ -28,4 +28,3 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.MaintenanceJobs
|
||||||
Console.WriteLine($"Fixed {count} broken player requirements.");
|
Console.WriteLine($"Fixed {count} broken player requirements.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -10,10 +10,10 @@ namespace LBPUnion.ProjectLighthouse.Pages.Admin;
|
||||||
|
|
||||||
public class AdminBanUserPage : BaseLayout
|
public class AdminBanUserPage : BaseLayout
|
||||||
{
|
{
|
||||||
public AdminBanUserPage(Database database) : base(database)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public User? TargetedUser;
|
public User? TargetedUser;
|
||||||
|
public AdminBanUserPage(Database database) : base(database)
|
||||||
|
{}
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet([FromRoute] int id)
|
public async Task<IActionResult> OnGet([FromRoute] int id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,12 +11,12 @@ namespace LBPUnion.ProjectLighthouse.Pages.Admin;
|
||||||
|
|
||||||
public class AdminPanelUsersPage : BaseLayout
|
public class AdminPanelUsersPage : BaseLayout
|
||||||
{
|
{
|
||||||
public AdminPanelUsersPage(Database database) : base(database)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public int UserCount;
|
public int UserCount;
|
||||||
|
|
||||||
public List<User> Users;
|
public List<User> Users;
|
||||||
|
public AdminPanelUsersPage(Database database) : base(database)
|
||||||
|
{}
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet()
|
public async Task<IActionResult> OnGet()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,8 +9,8 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth
|
namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth;
|
||||||
{
|
|
||||||
public class AuthenticationPage : BaseLayout
|
public class AuthenticationPage : BaseLayout
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -36,4 +36,3 @@ namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -7,14 +7,14 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth
|
namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth;
|
||||||
{
|
|
||||||
public class ManageUserApprovedIpAddressesPage : BaseLayout
|
public class ManageUserApprovedIpAddressesPage : BaseLayout
|
||||||
{
|
{
|
||||||
public ManageUserApprovedIpAddressesPage(Database database) : base(database)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public List<UserApprovedIpAddress> ApprovedIpAddresses;
|
public List<UserApprovedIpAddress> ApprovedIpAddresses;
|
||||||
|
public ManageUserApprovedIpAddressesPage(Database database) : base(database)
|
||||||
|
{}
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet()
|
public async Task<IActionResult> OnGet()
|
||||||
{
|
{
|
||||||
|
@ -26,4 +26,3 @@ namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -9,15 +9,15 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class LandingPage : BaseLayout
|
public class LandingPage : BaseLayout
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public int AuthenticationAttemptsCount;
|
||||||
public List<User> PlayersOnline;
|
public List<User> PlayersOnline;
|
||||||
|
|
||||||
public int PlayersOnlineCount;
|
public int PlayersOnlineCount;
|
||||||
|
|
||||||
public int AuthenticationAttemptsCount;
|
|
||||||
public LandingPage(Database database) : base(database)
|
public LandingPage(Database database) : base(database)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -30,11 +30,9 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
this.PlayersOnlineCount = await StatisticsHelper.RecentMatches();
|
this.PlayersOnlineCount = await StatisticsHelper.RecentMatches();
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
|
||||||
this.AuthenticationAttemptsCount = await this.Database.AuthenticationAttempts.Include
|
this.AuthenticationAttemptsCount = await this.Database.AuthenticationAttempts.Include
|
||||||
(a => a.GameToken)
|
(a => a.GameToken)
|
||||||
.CountAsync(a => a.GameToken.UserId == user.UserId);
|
.CountAsync(a => a.GameToken.UserId == user.UserId);
|
||||||
}
|
|
||||||
|
|
||||||
List<int> userIds = await this.Database.LastContacts.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).Select(l => l.UserId).ToListAsync();
|
List<int> userIds = await this.Database.LastContacts.Where(l => TimestampHelper.Timestamp - l.Timestamp < 300).Select(l => l.UserId).ToListAsync();
|
||||||
|
|
||||||
|
@ -42,4 +40,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -3,16 +3,10 @@ using System.Collections.Generic;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages.Layouts
|
namespace LBPUnion.ProjectLighthouse.Pages.Layouts;
|
||||||
{
|
|
||||||
public class BaseLayout : PageModel
|
public class BaseLayout : PageModel
|
||||||
{
|
{
|
||||||
public BaseLayout(Database database)
|
|
||||||
{
|
|
||||||
this.Database = database;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsMobile;
|
|
||||||
|
|
||||||
public readonly Database Database;
|
public readonly Database Database;
|
||||||
|
|
||||||
|
@ -24,13 +18,19 @@ namespace LBPUnion.ProjectLighthouse.Pages.Layouts
|
||||||
};
|
};
|
||||||
|
|
||||||
public readonly List<PageNavigationItem> NavigationItemsRight = new();
|
public readonly List<PageNavigationItem> NavigationItemsRight = new();
|
||||||
|
public string Description = string.Empty;
|
||||||
|
|
||||||
|
public bool IsMobile;
|
||||||
|
|
||||||
public bool ShowTitleInPage = true;
|
public bool ShowTitleInPage = true;
|
||||||
|
|
||||||
public string Title = string.Empty;
|
public string Title = string.Empty;
|
||||||
public string Description = string.Empty;
|
|
||||||
|
|
||||||
private User? user;
|
private User? user;
|
||||||
|
public BaseLayout(Database database)
|
||||||
|
{
|
||||||
|
this.Database = database;
|
||||||
|
}
|
||||||
|
|
||||||
public new User? User {
|
public new User? User {
|
||||||
get {
|
get {
|
||||||
|
@ -41,4 +41,3 @@ namespace LBPUnion.ProjectLighthouse.Pages.Layouts
|
||||||
set => this.user = value;
|
set => this.user = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -9,8 +9,8 @@ using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class LoginForm : BaseLayout
|
public class LoginForm : BaseLayout
|
||||||
{
|
{
|
||||||
public LoginForm(Database database) : base(database)
|
public LoginForm(Database database) : base(database)
|
||||||
|
@ -80,4 +80,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -4,8 +4,8 @@ using LBPUnion.ProjectLighthouse.Pages.Layouts;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class LogoutPage : BaseLayout
|
public class LogoutPage : BaseLayout
|
||||||
{
|
{
|
||||||
public LogoutPage(Database database) : base(database)
|
public LogoutPage(Database database) : base(database)
|
||||||
|
@ -23,4 +23,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using LBPUnion.ProjectLighthouse.Pages.Layouts;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class PasswordResetPage : BaseLayout
|
public class PasswordResetPage : BaseLayout
|
||||||
{
|
{
|
||||||
public PasswordResetPage(Database database) : base(database)
|
public PasswordResetPage(Database database) : base(database)
|
||||||
|
@ -50,4 +50,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -5,8 +5,8 @@ using LBPUnion.ProjectLighthouse.Pages.Layouts;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class PasswordResetRequiredPage : BaseLayout
|
public class PasswordResetRequiredPage : BaseLayout
|
||||||
{
|
{
|
||||||
public PasswordResetRequiredPage([NotNull] Database database) : base(database)
|
public PasswordResetRequiredPage([NotNull] Database database) : base(database)
|
||||||
|
@ -23,4 +23,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -10,17 +10,17 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class PhotosPage : BaseLayout
|
public class PhotosPage : BaseLayout
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public int PageAmount;
|
||||||
|
|
||||||
public int PageNumber;
|
public int PageNumber;
|
||||||
|
|
||||||
public int PhotoCount;
|
public int PhotoCount;
|
||||||
|
|
||||||
public int PageAmount;
|
|
||||||
|
|
||||||
public List<Photo> Photos;
|
public List<Photo> Photos;
|
||||||
public PhotosPage([NotNull] Database database) : base(database)
|
public PhotosPage([NotNull] Database database) : base(database)
|
||||||
{}
|
{}
|
||||||
|
@ -32,10 +32,7 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
this.PageNumber = pageNumber;
|
this.PageNumber = pageNumber;
|
||||||
this.PageAmount = (int)Math.Ceiling((double)this.PhotoCount / ServerStatics.PageSize);
|
this.PageAmount = (int)Math.Ceiling((double)this.PhotoCount / ServerStatics.PageSize);
|
||||||
|
|
||||||
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount)
|
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/photos/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
|
||||||
{
|
|
||||||
return this.Redirect($"/photos/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Photos = await this.Database.Photos.Include
|
this.Photos = await this.Database.Photos.Include
|
||||||
(p => p.Creator)
|
(p => p.Creator)
|
||||||
|
@ -47,4 +44,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -8,8 +8,8 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class RegisterForm : BaseLayout
|
public class RegisterForm : BaseLayout
|
||||||
{
|
{
|
||||||
public RegisterForm(Database database) : base(database)
|
public RegisterForm(Database database) : base(database)
|
||||||
|
@ -75,4 +75,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class SlotPage : BaseLayout
|
public class SlotPage : BaseLayout
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -25,4 +25,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -10,17 +10,17 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class SlotsPage : BaseLayout
|
public class SlotsPage : BaseLayout
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public int PageAmount;
|
||||||
|
|
||||||
public int PageNumber;
|
public int PageNumber;
|
||||||
|
|
||||||
public int SlotCount;
|
public int SlotCount;
|
||||||
|
|
||||||
public int PageAmount;
|
|
||||||
|
|
||||||
public List<Slot> Slots;
|
public List<Slot> Slots;
|
||||||
public SlotsPage([NotNull] Database database) : base(database)
|
public SlotsPage([NotNull] Database database) : base(database)
|
||||||
{}
|
{}
|
||||||
|
@ -32,10 +32,7 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
this.PageNumber = pageNumber;
|
this.PageNumber = pageNumber;
|
||||||
this.PageAmount = (int)Math.Ceiling((double)this.SlotCount / ServerStatics.PageSize);
|
this.PageAmount = (int)Math.Ceiling((double)this.SlotCount / ServerStatics.PageSize);
|
||||||
|
|
||||||
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount)
|
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/slots/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
|
||||||
{
|
|
||||||
return this.Redirect($"/slots/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Slots = await this.Database.Slots.Include
|
this.Slots = await this.Database.Slots.Include
|
||||||
(p => p.Creator)
|
(p => p.Creator)
|
||||||
|
@ -47,4 +44,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -125,9 +125,9 @@
|
||||||
@foreach (Comment comment in Model.Comments!)
|
@foreach (Comment comment in Model.Comments!)
|
||||||
{
|
{
|
||||||
DateTimeOffset timestamp = DateTimeOffset.FromUnixTimeSeconds(comment.Timestamp / 1000);
|
DateTimeOffset timestamp = DateTimeOffset.FromUnixTimeSeconds(comment.Timestamp / 1000);
|
||||||
StringWriter messageWriter = new StringWriter();
|
StringWriter messageWriter = new();
|
||||||
HttpUtility.HtmlDecode(comment.Message, messageWriter);
|
HttpUtility.HtmlDecode(comment.Message, messageWriter);
|
||||||
String decodedMessage = messageWriter.ToString();
|
string decodedMessage = messageWriter.ToString();
|
||||||
<div>
|
<div>
|
||||||
<b><a href="/user/@comment.PosterUserId">@comment.Poster.Username</a>: </b>
|
<b><a href="/user/@comment.PosterUserId">@comment.Poster.Username</a>: </b>
|
||||||
<span>@decodedMessage</span>
|
<span>@decodedMessage</span>
|
||||||
|
|
|
@ -8,8 +8,8 @@ using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Pages
|
namespace LBPUnion.ProjectLighthouse.Pages;
|
||||||
{
|
|
||||||
public class UserPage : BaseLayout
|
public class UserPage : BaseLayout
|
||||||
{
|
{
|
||||||
public List<Comment>? Comments;
|
public List<Comment>? Comments;
|
||||||
|
@ -44,4 +44,3 @@ namespace LBPUnion.ProjectLighthouse.Pages
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -12,8 +12,8 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse
|
namespace LBPUnion.ProjectLighthouse;
|
||||||
{
|
|
||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
|
@ -113,4 +113,3 @@ namespace LBPUnion.ProjectLighthouse
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Serialization
|
namespace LBPUnion.ProjectLighthouse.Serialization;
|
||||||
{
|
|
||||||
public class JsonOutputFormatter : StringOutputFormatter
|
public class JsonOutputFormatter : StringOutputFormatter
|
||||||
{
|
{
|
||||||
public JsonOutputFormatter()
|
public JsonOutputFormatter()
|
||||||
|
@ -10,4 +10,3 @@ namespace LBPUnion.ProjectLighthouse.Serialization
|
||||||
this.SupportedMediaTypes.Add("application/json");
|
this.SupportedMediaTypes.Add("application/json");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Serialization
|
namespace LBPUnion.ProjectLighthouse.Serialization;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// LBP doesn't like the XML serializer by C# that much, and it cant be controlled that much (cant have two root
|
/// LBP doesn't like the XML serializer by C# that much, and it cant be controlled that much (cant have two root
|
||||||
/// elements),
|
/// elements),
|
||||||
|
@ -33,4 +33,3 @@ namespace LBPUnion.ProjectLighthouse.Serialization
|
||||||
(params KeyValuePair<string, object>[] pairs)
|
(params KeyValuePair<string, object>[] pairs)
|
||||||
=> pairs.Aggregate(string.Empty, (current, pair) => current + StringElement(pair));
|
=> pairs.Aggregate(string.Empty, (current, pair) => current + StringElement(pair));
|
||||||
}
|
}
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue