mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 08:28:39 +00:00
Refactor Database class (#616)
Refactor Database into DatabaseContext Moved into separate folder so it actually has a namespace instead sitting in the root
This commit is contained in:
parent
2aff26f83d
commit
64b95e807d
246 changed files with 1211 additions and 965 deletions
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Admin;
|
||||
|
@ -7,9 +8,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Admin;
|
|||
[Route("/admin")]
|
||||
public class AdminPanelController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public AdminPanelController(Database database)
|
||||
public AdminPanelController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Files;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -11,9 +12,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Admin;
|
|||
[Route("/moderation/report/{id:int}")]
|
||||
public class AdminReportController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public AdminReportController(Database database)
|
||||
public AdminReportController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Files;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -15,9 +16,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Admin;
|
|||
[Route("moderation/user/{id:int}")]
|
||||
public class AdminUserController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public AdminUserController(Database database)
|
||||
public AdminUserController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -9,9 +10,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Debug;
|
|||
[Route("debug/roomVisualizer")]
|
||||
public class RoomVisualizerController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public RoomVisualizerController(Database database)
|
||||
public RoomVisualizerController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
||||
|
@ -11,9 +12,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.ExternalAuth;
|
|||
[Route("/authentication")]
|
||||
public class AuthenticationController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public AuthenticationController(Database database)
|
||||
public AuthenticationController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using LBPUnion.ProjectLighthouse.Administration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -10,9 +10,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Moderator;
|
|||
[Route("moderation/case/{id:int}")]
|
||||
public class ModerationCaseController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public ModerationCaseController(Database database)
|
||||
public ModerationCaseController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -9,9 +10,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Moderator;
|
|||
[Route("moderation")]
|
||||
public class ModerationRemovalController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public ModerationRemovalController(Database database)
|
||||
public ModerationRemovalController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -12,9 +13,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Moderator;
|
|||
[Route("moderation/slot/{id:int}")]
|
||||
public class ModerationSlotController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public ModerationSlotController(Database database)
|
||||
public ModerationSlotController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
|
@ -19,9 +20,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers;
|
|||
[Route("slot/{id:int}")]
|
||||
public class SlotPageController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public SlotPageController(Database database)
|
||||
public SlotPageController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -13,9 +14,9 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers;
|
|||
[Route("user/{id:int}")]
|
||||
public class UserPageController : ControllerBase
|
||||
{
|
||||
private readonly Database database;
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public UserPageController(Database database)
|
||||
public UserPageController(DatabaseContext database)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Middlewares;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
|
@ -11,7 +12,7 @@ public class UserRequiredRedirectMiddleware : MiddlewareDBContext
|
|||
public UserRequiredRedirectMiddleware(RequestDelegate next) : base(next)
|
||||
{ }
|
||||
|
||||
public override async Task InvokeAsync(HttpContext ctx, Database database)
|
||||
public override async Task InvokeAsync(HttpContext ctx, DatabaseContext database)
|
||||
{
|
||||
WebToken? token = database.WebTokenFromRequest(ctx.Request);
|
||||
if (token == null || pathContains(ctx, "/logout"))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -11,7 +12,7 @@ public class AdminApiKeyPageModel : BaseLayout
|
|||
public List<ApiKey> ApiKeys = new();
|
||||
public int KeyCount;
|
||||
|
||||
public AdminApiKeyPageModel(Database database) : base(database)
|
||||
public AdminApiKeyPageModel(DatabaseContext database) : base(database)
|
||||
{ }
|
||||
|
||||
public async Task<IActionResult> OnGet()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Administration.Maintenance;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
|
@ -14,7 +15,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin;
|
|||
public class AdminPanelPage : BaseLayout
|
||||
{
|
||||
public List<ICommand> Commands = MaintenanceHelper.Commands;
|
||||
public AdminPanelPage(Database database) : base(database)
|
||||
public AdminPanelPage(DatabaseContext database) : base(database)
|
||||
{ }
|
||||
|
||||
public List<AdminPanelStatistic> Statistics = new();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -11,7 +12,7 @@ public class AdminPanelUsersPage : BaseLayout
|
|||
public int UserCount;
|
||||
|
||||
public List<User> Users = new();
|
||||
public AdminPanelUsersPage(Database database) : base(database)
|
||||
public AdminPanelUsersPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public async Task<IActionResult> OnGet()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -8,7 +9,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin;
|
|||
|
||||
public class AdminSetGrantedSlotsPage : BaseLayout
|
||||
{
|
||||
public AdminSetGrantedSlotsPage(Database database) : base(database)
|
||||
public AdminSetGrantedSlotsPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public User? TargetedUser;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#if DEBUG
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
#endif
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
@ -9,7 +10,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Debug;
|
|||
|
||||
public class FilterTestPage : BaseLayout
|
||||
{
|
||||
public FilterTestPage(Database database) : base(database)
|
||||
public FilterTestPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public string? FilteredText;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
#if !DEBUG
|
||||
|
@ -10,7 +11,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Debug;
|
|||
|
||||
public class RoomVisualizerPage : BaseLayout
|
||||
{
|
||||
public RoomVisualizerPage(Database database) : base(database)
|
||||
public RoomVisualizerPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public IActionResult OnGet()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
@ -5,7 +6,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Debug;
|
|||
|
||||
public class VersionInfoPage : BaseLayout
|
||||
{
|
||||
public VersionInfoPage(Database database) : base(database)
|
||||
public VersionInfoPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
public IActionResult OnGet() => this.Page();
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -11,7 +12,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Email;
|
|||
|
||||
public class CompleteEmailVerificationPage : BaseLayout
|
||||
{
|
||||
public CompleteEmailVerificationPage(Database database) : base(database)
|
||||
public CompleteEmailVerificationPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public string? Error;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -9,7 +10,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Email;
|
|||
|
||||
public class SendVerificationEmailPage : BaseLayout
|
||||
{
|
||||
public SendVerificationEmailPage(Database database) : base(database)
|
||||
public SendVerificationEmailPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public bool Success { get; set; }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#nullable enable
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
|
@ -13,7 +14,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Email;
|
|||
|
||||
public class SetEmailForm : BaseLayout
|
||||
{
|
||||
public SetEmailForm(Database database) : base(database)
|
||||
public SetEmailForm(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public string? Error { get; private set; }
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
@ -5,7 +6,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Errors;
|
|||
|
||||
public class NotFoundPage : BaseLayout
|
||||
{
|
||||
public NotFoundPage(Database database) : base(database)
|
||||
public NotFoundPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public IActionResult OnGet() => this.Page();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using System.Net;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -12,7 +13,7 @@ public class AuthenticationPage : BaseLayout
|
|||
public List<PlatformLinkAttempt> LinkAttempts = new();
|
||||
|
||||
public IPAddress? IpAddress;
|
||||
public AuthenticationPage(Database database) : base(database)
|
||||
public AuthenticationPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public IActionResult OnGet()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
|
@ -12,7 +13,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages;
|
|||
|
||||
public class LandingPage : BaseLayout
|
||||
{
|
||||
public LandingPage(Database database) : base(database)
|
||||
public LandingPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public int PendingAuthAttempts;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Localization;
|
||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Types;
|
||||
|
@ -11,7 +12,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
|||
|
||||
public class BaseLayout : PageModel
|
||||
{
|
||||
public readonly Database Database;
|
||||
public readonly DatabaseContext Database;
|
||||
|
||||
public readonly List<PageNavigationItem> NavigationItems = new();
|
||||
|
||||
|
@ -25,7 +26,7 @@ public class BaseLayout : PageModel
|
|||
public string Title = string.Empty;
|
||||
|
||||
private User? user;
|
||||
public BaseLayout(Database database)
|
||||
public BaseLayout(DatabaseContext database)
|
||||
{
|
||||
this.Database = database;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Web;
|
||||
using JetBrains.Annotations;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
|
@ -17,7 +18,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login;
|
|||
|
||||
public class LoginForm : BaseLayout
|
||||
{
|
||||
public LoginForm(Database database) : base(database)
|
||||
public LoginForm(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public string? Error { get; private set; }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -7,7 +8,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login;
|
|||
|
||||
public class LogoutPage : BaseLayout
|
||||
{
|
||||
public LogoutPage(Database database) : base(database)
|
||||
public LogoutPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
public async Task<IActionResult> OnGet()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#nullable enable
|
||||
using JetBrains.Annotations;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -10,7 +11,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login;
|
|||
|
||||
public class PasswordResetPage : BaseLayout
|
||||
{
|
||||
public PasswordResetPage(Database database) : base(database)
|
||||
public PasswordResetPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public string? Error { get; private set; }
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using JetBrains.Annotations;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -16,7 +17,7 @@ public class PasswordResetRequestForm : BaseLayout
|
|||
|
||||
public string? Status { get; private set; }
|
||||
|
||||
public PasswordResetRequestForm(Database database) : base(database)
|
||||
public PasswordResetRequestForm(DatabaseContext database) : base(database)
|
||||
{ }
|
||||
|
||||
[UsedImplicitly]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -7,7 +8,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login;
|
|||
|
||||
public class PasswordResetRequiredPage : BaseLayout
|
||||
{
|
||||
public PasswordResetRequiredPage(Database database) : base(database)
|
||||
public PasswordResetRequiredPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public bool WasResetRequest { get; private set; }
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -6,7 +7,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login;
|
|||
|
||||
public class PirateSignupPage : BaseLayout
|
||||
{
|
||||
public PirateSignupPage(Database database) : base(database)
|
||||
public PirateSignupPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public IActionResult OnGet()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using JetBrains.Annotations;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
|
@ -14,7 +15,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login;
|
|||
|
||||
public class RegisterForm : BaseLayout
|
||||
{
|
||||
public RegisterForm(Database database) : base(database)
|
||||
public RegisterForm(DatabaseContext database) : base(database)
|
||||
{ }
|
||||
|
||||
public string? Error { get; private set; }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
|
@ -9,7 +10,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Moderation;
|
|||
|
||||
public class BannedUsersPage : BaseLayout
|
||||
{
|
||||
public BannedUsersPage(Database database) : base(database)
|
||||
public BannedUsersPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public List<User> Users = new();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -9,7 +10,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Moderation;
|
|||
|
||||
public class CasePage : BaseLayout
|
||||
{
|
||||
public CasePage(Database database) : base(database)
|
||||
public CasePage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public List<ModerationCase> Cases = new();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
|
@ -9,7 +10,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Moderation;
|
|||
|
||||
public class HiddenLevelsPage : BaseLayout
|
||||
{
|
||||
public HiddenLevelsPage(Database database) : base(database)
|
||||
public HiddenLevelsPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public int PageAmount;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@page "/moderation"
|
||||
@using System.Diagnostics
|
||||
@using LBPUnion.ProjectLighthouse.Administration
|
||||
@using LBPUnion.ProjectLighthouse.Extensions
|
||||
@using LBPUnion.ProjectLighthouse.Localization.StringLists
|
||||
@using LBPUnion.ProjectLighthouse.Servers.Website.Types
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Types;
|
||||
|
@ -8,7 +9,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Moderation;
|
|||
|
||||
public class ModPanelPage : BaseLayout
|
||||
{
|
||||
public ModPanelPage(Database database) : base(database)
|
||||
public ModPanelPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public List<AdminPanelStatistic> Statistics = new();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -8,7 +9,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Moderation;
|
|||
|
||||
public class NewCasePage : BaseLayout
|
||||
{
|
||||
public NewCasePage(Database database) : base(database)
|
||||
public NewCasePage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public CaseType Type { get; set; }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Text.Json;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -10,7 +11,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Moderation;
|
|||
|
||||
public class ReportPage : BaseLayout
|
||||
{
|
||||
public ReportPage(Database database) : base(database)
|
||||
public ReportPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public GriefReport Report = null!; // Report is not used if it's null in OnGet
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#nullable enable
|
||||
using System.Text.Json;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -22,7 +23,7 @@ public class ReportsPage : BaseLayout
|
|||
|
||||
public string SearchValue = "";
|
||||
|
||||
public ReportsPage(Database database) : base(database)
|
||||
public ReportsPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string? name)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@using LBPUnion.ProjectLighthouse
|
||||
@using LBPUnion.ProjectLighthouse.Database
|
||||
@using LBPUnion.ProjectLighthouse.Localization
|
||||
@using LBPUnion.ProjectLighthouse.Servers.Website.Extensions
|
||||
@using LBPUnion.ProjectLighthouse.Types.Entities.Level
|
||||
|
@ -25,7 +25,7 @@
|
|||
{
|
||||
Score score = Model.Scores[i];
|
||||
string[] playerIds = score.PlayerIds;
|
||||
Database database = Model.Database;
|
||||
DatabaseContext database = Model.Database;
|
||||
<div class="item">
|
||||
<span class="ui large text">
|
||||
@if(canDelete)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
@using System.Diagnostics
|
||||
@using LBPUnion.ProjectLighthouse
|
||||
@using LBPUnion.ProjectLighthouse.Database
|
||||
@using LBPUnion.ProjectLighthouse.Types.Entities.Level
|
||||
@using LBPUnion.ProjectLighthouse.Types.Entities.Profile
|
||||
@using LBPUnion.ProjectLighthouse.Types.Moderation.Cases
|
||||
@model LBPUnion.ProjectLighthouse.Types.Entities.Moderation.ModerationCase
|
||||
|
||||
@{
|
||||
Database database = new();
|
||||
DatabaseContext database = new();
|
||||
string color = "blue";
|
||||
|
||||
string timeZone = (string?)ViewData["TimeZone"] ?? TimeZoneInfo.Local.Id;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@using System.Web
|
||||
@using LBPUnion.ProjectLighthouse
|
||||
@using LBPUnion.ProjectLighthouse.Configuration
|
||||
@using LBPUnion.ProjectLighthouse.Database
|
||||
@using LBPUnion.ProjectLighthouse.Localization
|
||||
@using LBPUnion.ProjectLighthouse.Servers.Website.Extensions
|
||||
@using LBPUnion.ProjectLighthouse.Types.Entities.Profile
|
||||
|
@ -11,7 +11,7 @@
|
|||
@{
|
||||
User? user = (User?)ViewData["User"];
|
||||
|
||||
await using Database database = new();
|
||||
await using DatabaseContext database = new();
|
||||
|
||||
string slotName = HttpUtility.HtmlDecode(string.IsNullOrEmpty(Model!.Name) ? "Unnamed Level" : Model.Name);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -19,7 +20,7 @@ public class PhotosPage : BaseLayout
|
|||
public List<Photo> Photos = new();
|
||||
|
||||
public string? SearchValue;
|
||||
public PhotosPage(Database database) : base(database)
|
||||
public PhotosPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string? name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Interaction;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
|
@ -22,7 +23,7 @@ public class SlotPage : BaseLayout
|
|||
public readonly bool ReviewsEnabled = ServerConfiguration.Instance.UserGeneratedContentLimits.LevelReviewsEnabled;
|
||||
|
||||
public Slot? Slot;
|
||||
public SlotPage(Database database) : base(database)
|
||||
public SlotPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public async Task<IActionResult> OnGet([FromRoute] int id)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Files;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
|
@ -12,7 +13,7 @@ public class SlotSettingsPage : BaseLayout
|
|||
{
|
||||
|
||||
public Slot? Slot;
|
||||
public SlotSettingsPage(Database database) : base(database)
|
||||
public SlotSettingsPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public async Task<IActionResult> OnPost([FromRoute] int slotId, [FromForm] string? avatar, [FromForm] string? name, [FromForm] string? description, string? labels)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#nullable enable
|
||||
using System.Text;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||
|
@ -23,7 +24,7 @@ public class SlotsPage : BaseLayout
|
|||
|
||||
public string? SearchValue;
|
||||
|
||||
public SlotsPage(Database database) : base(database)
|
||||
public SlotsPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string? name)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
|
@ -9,7 +10,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.TwoFactor;
|
|||
|
||||
public class DisableTwoFactorPage : BaseLayout
|
||||
{
|
||||
public DisableTwoFactorPage(Database database) : base(database) { }
|
||||
public DisableTwoFactorPage(DatabaseContext database) : base(database) { }
|
||||
|
||||
public string Error { get; set; } = "";
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Security.Cryptography;
|
|||
using System.Text;
|
||||
using System.Web;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
|
@ -19,7 +20,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.TwoFactor;
|
|||
|
||||
public class SetupTwoFactorPage : BaseLayout
|
||||
{
|
||||
public SetupTwoFactorPage(Database database) : base(database)
|
||||
public SetupTwoFactorPage(DatabaseContext database) : base(database)
|
||||
{ }
|
||||
|
||||
public string QrCode { get; set; } = "";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
|
@ -11,7 +12,7 @@ namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.TwoFactor;
|
|||
|
||||
public class TwoFactorLoginPage : BaseLayout
|
||||
{
|
||||
public TwoFactorLoginPage(Database database) : base(database)
|
||||
public TwoFactorLoginPage(DatabaseContext database) : base(database)
|
||||
{ }
|
||||
|
||||
public string Error { get; set; } = "";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Interaction;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
|
@ -28,7 +29,7 @@ public class UserPage : BaseLayout
|
|||
public List<Slot>? QueuedSlots;
|
||||
|
||||
public User? ProfileUser;
|
||||
public UserPage(Database database) : base(database)
|
||||
public UserPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public async Task<IActionResult> OnGet([FromRoute] int userId)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#nullable enable
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Files;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Localization;
|
||||
|
@ -15,7 +16,7 @@ public class UserSettingsPage : BaseLayout
|
|||
{
|
||||
|
||||
public User? ProfileUser;
|
||||
public UserSettingsPage(Database database) : base(database)
|
||||
public UserSettingsPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
[SuppressMessage("ReSharper", "SpecifyStringComparison")]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
||||
|
@ -20,7 +21,7 @@ public class UsersPage : BaseLayout
|
|||
|
||||
public string? SearchValue;
|
||||
|
||||
public UsersPage(Database database) : base(database)
|
||||
public UsersPage(DatabaseContext database) : base(database)
|
||||
{}
|
||||
|
||||
public async Task<IActionResult> OnGet([FromRoute] int pageNumber, [FromQuery] string? name)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Globalization;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Localization;
|
||||
using LBPUnion.ProjectLighthouse.Middlewares;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Middlewares;
|
||||
|
@ -40,7 +41,7 @@ public class WebsiteStartup
|
|||
services.AddRazorPages().WithRazorPagesAtContentRoot();
|
||||
#endif
|
||||
|
||||
services.AddDbContext<Database>();
|
||||
services.AddDbContext<DatabaseContext>();
|
||||
|
||||
services.Configure<ForwardedHeadersOptions>
|
||||
(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue