mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-03 01:18:22 +00:00
Merge branch 'main' into mod-panel
This commit is contained in:
commit
f40c6ce894
27 changed files with 150 additions and 151 deletions
|
@ -7,6 +7,12 @@
|
||||||
"commands": [
|
"commands": [
|
||||||
"dotnet-ef"
|
"dotnet-ef"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"dotnet-trace": {
|
||||||
|
"version": "6.0.328102",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-trace"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,9 @@
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
|
<envs>
|
||||||
|
<env name="ASPNETCORE_ENVIRONMENT" value="Development" />
|
||||||
|
</envs>
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
<option name="USE_MONO" value="0" />
|
<option name="USE_MONO" value="0" />
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
|
<envs>
|
||||||
|
<env name="ASPNETCORE_ENVIRONMENT" value="Development" />
|
||||||
|
</envs>
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
<option name="USE_MONO" value="0" />
|
<option name="USE_MONO" value="0" />
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class LoginController : ControllerBase
|
||||||
|
|
||||||
if (ServerConfiguration.Instance.Authentication.UseExternalAuth)
|
if (ServerConfiguration.Instance.Authentication.UseExternalAuth)
|
||||||
{
|
{
|
||||||
if (this.database.UserApprovedIpAddresses.Where(a => a.UserId == user.UserId).Select(a => a.IpAddress).Contains(ipAddress))
|
if (user.ApprovedIPAddress == ipAddress)
|
||||||
{
|
{
|
||||||
token.Approved = true;
|
token.Approved = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class UserController : ControllerBase
|
||||||
|
|
||||||
if (update.Biography != null)
|
if (update.Biography != null)
|
||||||
{
|
{
|
||||||
if (update.Biography.Length > 100) return this.BadRequest();
|
if (update.Biography.Length > 512) return this.BadRequest();
|
||||||
|
|
||||||
user.Biography = update.Biography;
|
user.Biography = update.Biography;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,15 +32,8 @@ public class AutoApprovalController : ControllerBase
|
||||||
if (authAttempt.GameToken.UserId != user.UserId) return this.Redirect("/login");
|
if (authAttempt.GameToken.UserId != user.UserId) return this.Redirect("/login");
|
||||||
|
|
||||||
authAttempt.GameToken.Approved = true;
|
authAttempt.GameToken.Approved = true;
|
||||||
|
user.ApprovedIPAddress = authAttempt.IPAddress;
|
||||||
UserApprovedIpAddress approvedIpAddress = new()
|
|
||||||
{
|
|
||||||
UserId = user.UserId,
|
|
||||||
User = user,
|
|
||||||
IpAddress = authAttempt.IPAddress,
|
|
||||||
};
|
|
||||||
|
|
||||||
this.database.UserApprovedIpAddresses.Add(approvedIpAddress);
|
|
||||||
this.database.AuthenticationAttempts.Remove(authAttempt);
|
this.database.AuthenticationAttempts.Remove(authAttempt);
|
||||||
|
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
|
@ -48,20 +41,16 @@ public class AutoApprovalController : ControllerBase
|
||||||
return this.Redirect("/authentication");
|
return this.Redirect("/authentication");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("revokeAutoApproval/{id:int}")]
|
[HttpGet("revokeAutoApproval")]
|
||||||
public async Task<IActionResult> RevokeAutoApproval([FromRoute] int id)
|
public async Task<IActionResult> RevokeAutoApproval()
|
||||||
{
|
{
|
||||||
User? user = this.database.UserFromWebRequest(this.Request);
|
User? user = this.database.UserFromWebRequest(this.Request);
|
||||||
if (user == null) return this.Redirect("/login");
|
if (user == null) return this.Redirect("/login");
|
||||||
|
|
||||||
UserApprovedIpAddress? approvedIpAddress = await this.database.UserApprovedIpAddresses.FirstOrDefaultAsync(a => a.UserApprovedIpAddressId == id);
|
user.ApprovedIPAddress = null;
|
||||||
if (approvedIpAddress == null) return this.BadRequest();
|
|
||||||
if (approvedIpAddress.UserId != user.UserId) return this.Redirect("/login");
|
|
||||||
|
|
||||||
this.database.UserApprovedIpAddresses.Remove(approvedIpAddress);
|
|
||||||
|
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
|
|
||||||
return this.Redirect("/authentication/autoApprovals");
|
return this.Redirect("/authentication");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,18 +21,24 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<a href="/authentication/autoApprovals">
|
@if (Model.User!.ApprovedIPAddress != null)
|
||||||
<button class="ui small blue button">
|
{
|
||||||
<i class="cog icon"></i>
|
<a href="/authentication/revokeAutoApproval">
|
||||||
<span>Manage automatically approved IP addresses</span>
|
<button class="ui red button">
|
||||||
</button>
|
<i class="trash icon"></i>
|
||||||
</a>
|
<span>Revoke automatically approved IP Address (@Model.User!.ApprovedIPAddress)</span>
|
||||||
<a href="/authentication/denyAll">
|
</button>
|
||||||
<button class="ui small red button">
|
</a>
|
||||||
<i class="x icon"></i>
|
}
|
||||||
<span>Deny all</span>
|
@if (Model.AuthenticationAttempts.Count > 1)
|
||||||
</button>
|
{
|
||||||
</a>
|
<a href="/authentication/denyAll">
|
||||||
|
<button class="ui red button">
|
||||||
|
<i class="x icon"></i>
|
||||||
|
<span>Deny all</span>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
|
||||||
@foreach (AuthenticationAttempt authAttempt in Model.AuthenticationAttempts)
|
@foreach (AuthenticationAttempt authAttempt in Model.AuthenticationAttempts)
|
||||||
{
|
{
|
||||||
|
@ -41,19 +47,19 @@ else
|
||||||
<p>A <b>@authAttempt.Platform</b> authentication request was logged at <b>@timestamp.ToString("MM/dd/yyyy @ h:mm tt") UTC</b> from the IP address <b>@authAttempt.IPAddress</b>.</p>
|
<p>A <b>@authAttempt.Platform</b> authentication request was logged at <b>@timestamp.ToString("MM/dd/yyyy @ h:mm tt") UTC</b> from the IP address <b>@authAttempt.IPAddress</b>.</p>
|
||||||
<div>
|
<div>
|
||||||
<a href="/authentication/autoApprove/@authAttempt.AuthenticationAttemptId">
|
<a href="/authentication/autoApprove/@authAttempt.AuthenticationAttemptId">
|
||||||
<button class="ui tiny green button">
|
<button class="ui small green button">
|
||||||
<i class="check icon"></i>
|
<i class="check icon"></i>
|
||||||
<span>Automatically approve every time</span>
|
<span>Automatically approve every time</span>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href="/authentication/approve/@authAttempt.AuthenticationAttemptId">
|
<a href="/authentication/approve/@authAttempt.AuthenticationAttemptId">
|
||||||
<button class="ui tiny yellow button">
|
<button class="ui small yellow button">
|
||||||
<i class="check icon"></i>
|
<i class="check icon"></i>
|
||||||
<span>Approve this time</span>
|
<span>Approve this time</span>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href="/authentication/deny/@authAttempt.AuthenticationAttemptId">
|
<a href="/authentication/deny/@authAttempt.AuthenticationAttemptId">
|
||||||
<button class="ui tiny red button">
|
<button class="ui small red button">
|
||||||
<i class="x icon"></i>
|
<i class="x icon"></i>
|
||||||
<span>Deny</span>
|
<span>Deny</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
@page "/authentication/autoApprovals"
|
|
||||||
@using LBPUnion.ProjectLighthouse.PlayerData.Profiles
|
|
||||||
@using LBPUnion.ProjectLighthouse.Types
|
|
||||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.ExternalAuth.ManageUserApprovedIpAddressesPage
|
|
||||||
|
|
||||||
@{
|
|
||||||
Layout = "Layouts/BaseLayout";
|
|
||||||
Model.Title = "Automatically approved IP addresses";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@foreach (UserApprovedIpAddress approvedIpAddress in Model.ApprovedIpAddresses)
|
|
||||||
{
|
|
||||||
<div class="ui blue segment">
|
|
||||||
<p>@approvedIpAddress.IpAddress</p>
|
|
||||||
<a href="/authentication/revokeAutoApproval/@approvedIpAddress.UserApprovedIpAddressId">
|
|
||||||
<button class="ui red button">
|
|
||||||
<i class="trash icon"></i>
|
|
||||||
<span>Revoke</span>
|
|
||||||
</button>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
#nullable enable
|
|
||||||
using LBPUnion.ProjectLighthouse.PlayerData.Profiles;
|
|
||||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.ExternalAuth;
|
|
||||||
|
|
||||||
public class ManageUserApprovedIpAddressesPage : BaseLayout
|
|
||||||
{
|
|
||||||
public List<UserApprovedIpAddress> ApprovedIpAddresses = new();
|
|
||||||
|
|
||||||
public ManageUserApprovedIpAddressesPage(Database database) : base(database)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public async Task<IActionResult> OnGet()
|
|
||||||
{
|
|
||||||
User? user = this.Database.UserFromWebRequest(this.Request);
|
|
||||||
if (user == null) return this.Redirect("/login");
|
|
||||||
|
|
||||||
this.ApprovedIpAddresses = await this.Database.UserApprovedIpAddresses.Where(a => a.UserId == user.UserId).ToListAsync();
|
|
||||||
|
|
||||||
return this.Page();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -45,7 +45,7 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<br>
|
<br><br>
|
||||||
|
|
||||||
<div class="@(isMobile ? "" : "ui center aligned grid")">
|
<div class="@(isMobile ? "" : "ui center aligned grid")">
|
||||||
<div class="eight wide column">
|
<div class="eight wide column">
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
@using System.Web
|
||||||
@using LBPUnion.ProjectLighthouse
|
@using LBPUnion.ProjectLighthouse
|
||||||
@using LBPUnion.ProjectLighthouse.Configuration
|
@using LBPUnion.ProjectLighthouse.Configuration
|
||||||
@using LBPUnion.ProjectLighthouse.PlayerData
|
@using LBPUnion.ProjectLighthouse.PlayerData
|
||||||
|
@ -10,8 +11,8 @@
|
||||||
|
|
||||||
await using Database database = new();
|
await using Database database = new();
|
||||||
|
|
||||||
string slotName = string.IsNullOrEmpty(Model.Name) ? "Unnamed Level" : Model.Name;
|
string slotName = HttpUtility.HtmlDecode(string.IsNullOrEmpty(Model!.Name) ? "Unnamed Level" : Model.Name);
|
||||||
|
|
||||||
bool isMobile = (bool?)ViewData["IsMobile"] ?? false;
|
bool isMobile = (bool?)ViewData["IsMobile"] ?? false;
|
||||||
bool mini = (bool?)ViewData["IsMini"] ?? false;
|
bool mini = (bool?)ViewData["IsMini"] ?? false;
|
||||||
|
|
||||||
|
|
|
@ -4,15 +4,14 @@
|
||||||
@using LBPUnion.ProjectLighthouse.Configuration
|
@using LBPUnion.ProjectLighthouse.Configuration
|
||||||
@using LBPUnion.ProjectLighthouse.Extensions
|
@using LBPUnion.ProjectLighthouse.Extensions
|
||||||
@using LBPUnion.ProjectLighthouse.PlayerData.Reviews
|
@using LBPUnion.ProjectLighthouse.PlayerData.Reviews
|
||||||
@using LBPUnion.ProjectLighthouse.Types
|
|
||||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.SlotPage
|
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.SlotPage
|
||||||
|
|
||||||
@{
|
@{
|
||||||
Layout = "Layouts/BaseLayout";
|
Layout = "Layouts/BaseLayout";
|
||||||
Model.ShowTitleInPage = false;
|
Model.ShowTitleInPage = false;
|
||||||
|
|
||||||
Model.Title = Model.Slot?.Name ?? "";
|
Model.Title = HttpUtility.HtmlDecode(Model.Slot?.Name ?? "");
|
||||||
Model.Description = Model.Slot?.Description ?? "";
|
Model.Description = HttpUtility.HtmlDecode(Model.Slot?.Description ?? "");
|
||||||
|
|
||||||
bool isMobile = this.Request.IsMobile();
|
bool isMobile = this.Request.IsMobile();
|
||||||
}
|
}
|
||||||
|
@ -38,15 +37,14 @@
|
||||||
<div class="eight wide column">
|
<div class="eight wide column">
|
||||||
<div class="ui blue segment">
|
<div class="ui blue segment">
|
||||||
<h2>Description</h2>
|
<h2>Description</h2>
|
||||||
<p>@HttpUtility.HtmlDecode(string.IsNullOrEmpty(Model.Slot?.Description) ? "This level has no description." : Model.Slot.Description)</p>
|
<p style="overflow-wrap: anywhere">@HttpUtility.HtmlDecode(string.IsNullOrEmpty(Model.Slot?.Description) ? "This level has no description." : Model.Slot.Description)</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="eight wide column">
|
<div class="eight wide column">
|
||||||
<div class="ui red segment">
|
<div class="ui red segment">
|
||||||
<h2>Tags</h2>
|
<h2>Tags</h2>
|
||||||
@{
|
@{
|
||||||
string[] authorLabels = Model.Slot?.AuthorLabels.Split(",") ?? new string[]
|
string[] authorLabels = Model.Slot?.AuthorLabels.Split(",") ?? new string[]{};
|
||||||
{};
|
|
||||||
if (authorLabels.Length == 1) // ..?? ok c#
|
if (authorLabels.Length == 1) // ..?? ok c#
|
||||||
{
|
{
|
||||||
<p>This level has no tags.</p>
|
<p>This level has no tags.</p>
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||||
|
|
|
@ -58,7 +58,10 @@ public class WebsiteStartup
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
|
{
|
||||||
|
ServeUnknownFileTypes = true,
|
||||||
|
});
|
||||||
|
|
||||||
app.UseEndpoints(endpoints => endpoints.MapControllers());
|
app.UseEndpoints(endpoints => endpoints.MapControllers());
|
||||||
app.UseEndpoints(endpoints => endpoints.MapRazorPages());
|
app.UseEndpoints(endpoints => endpoints.MapRazorPages());
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
|
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.5">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.6">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
|
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.5">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.6">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
|
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.5">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.6">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
@ -41,7 +41,6 @@ public class Database : DbContext
|
||||||
public DbSet<AuthenticationAttempt> AuthenticationAttempts { get; set; }
|
public DbSet<AuthenticationAttempt> AuthenticationAttempts { get; set; }
|
||||||
public DbSet<Review> Reviews { get; set; }
|
public DbSet<Review> Reviews { get; set; }
|
||||||
public DbSet<RatedReview> RatedReviews { get; set; }
|
public DbSet<RatedReview> RatedReviews { get; set; }
|
||||||
public DbSet<UserApprovedIpAddress> UserApprovedIpAddresses { get; set; }
|
|
||||||
public DbSet<DatabaseCategory> CustomCategories { get; set; }
|
public DbSet<DatabaseCategory> CustomCategories { get; set; }
|
||||||
public DbSet<Reaction> Reactions { get; set; }
|
public DbSet<Reaction> Reactions { get; set; }
|
||||||
public DbSet<GriefReport> Reports { get; set; }
|
public DbSet<GriefReport> Reports { get; set; }
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
using LBPUnion.ProjectLighthouse;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ProjectLighthouse.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(Database))]
|
||||||
|
[Migration("20220611221819_OnlyAllowSingleApprovedIP")]
|
||||||
|
public class OnlyAllowSingleApprovedIP : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "UserApprovedIpAddresses");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ApprovedIPAddress",
|
||||||
|
table: "Users",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ApprovedIPAddress",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "UserApprovedIpAddresses",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
UserApprovedIpAddressId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
UserId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
IpAddress = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_UserApprovedIpAddresses", x => x.UserApprovedIpAddressId);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_UserApprovedIpAddresses_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "UserId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_UserApprovedIpAddresses_UserId",
|
||||||
|
table: "UserApprovedIpAddresses",
|
||||||
|
column: "UserId");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -150,6 +150,11 @@ public class User
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string? BannedReason { get; set; }
|
public string? BannedReason { get; set; }
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
[JsonIgnore]
|
||||||
|
public string? ApprovedIPAddress { get; set; }
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
public string Serialize(GameVersion gameVersion = GameVersion.LittleBigPlanet1)
|
public string Serialize(GameVersion gameVersion = GameVersion.LittleBigPlanet1)
|
||||||
{
|
{
|
||||||
string user = LbpSerializer.TaggedStringElement("npHandle", this.Username, "icon", this.IconHash) +
|
string user = LbpSerializer.TaggedStringElement("npHandle", this.Username, "icon", this.IconHash) +
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
namespace LBPUnion.ProjectLighthouse.PlayerData.Profiles;
|
|
||||||
|
|
||||||
public class UserApprovedIpAddress
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
public int UserApprovedIpAddressId { get; set; }
|
|
||||||
|
|
||||||
public int UserId { get; set; }
|
|
||||||
|
|
||||||
[ForeignKey(nameof(UserId))]
|
|
||||||
public User User { get; set; }
|
|
||||||
|
|
||||||
public string IpAddress { get; set; }
|
|
||||||
}
|
|
|
@ -14,9 +14,9 @@
|
||||||
<PackageReference Include="Discord.Net.Webhook" Version="3.7.2" />
|
<PackageReference Include="Discord.Net.Webhook" Version="3.7.2" />
|
||||||
<PackageReference Include="InfluxDB.Client" Version="4.2.0" />
|
<PackageReference Include="InfluxDB.Client" Version="4.2.0" />
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
|
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.5">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.6">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
@ -627,6 +627,12 @@ namespace ProjectLighthouse.Migrations
|
||||||
b.Property<int>("AdminGrantedSlots")
|
b.Property<int>("AdminGrantedSlots")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ApprovedIPAddress")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<bool>("Banned")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
b.Property<string>("BannedReason")
|
b.Property<string>("BannedReason")
|
||||||
.HasColumnType("longtext");
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
@ -689,25 +695,6 @@ namespace ProjectLighthouse.Migrations
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.PlayerData.Profiles.UserApprovedIpAddress", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("UserApprovedIpAddressId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("IpAddress")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("UserApprovedIpAddressId");
|
|
||||||
|
|
||||||
b.HasIndex("UserId");
|
|
||||||
|
|
||||||
b.ToTable("UserApprovedIpAddresses");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.PlayerData.Reaction", b =>
|
modelBuilder.Entity("LBPUnion.ProjectLighthouse.PlayerData.Reaction", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("RatingId")
|
b.Property<int>("RatingId")
|
||||||
|
@ -1076,17 +1063,6 @@ namespace ProjectLighthouse.Migrations
|
||||||
b.Navigation("Location");
|
b.Navigation("Location");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.PlayerData.Profiles.UserApprovedIpAddress", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("LBPUnion.ProjectLighthouse.PlayerData.Profiles.User", "User")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("UserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("User");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LBPUnion.ProjectLighthouse.PlayerData.Reviews.RatedReview", b =>
|
modelBuilder.Entity("LBPUnion.ProjectLighthouse.PlayerData.Reviews.RatedReview", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("LBPUnion.ProjectLighthouse.PlayerData.Reviews.Review", "Review")
|
b.HasOne("LBPUnion.ProjectLighthouse.PlayerData.Reviews.Review", "Review")
|
||||||
|
|
|
@ -27,6 +27,7 @@ canvas.hide-subjects {
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
# Build script for production
|
# Build script for production
|
||||||
#
|
#
|
||||||
# No arguments
|
# No arguments
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
# Startup script for production
|
# Startup script for production
|
||||||
#
|
#
|
||||||
# $1: Server to start; case sensitive!!!!!
|
# $1: Server to start; case sensitive!!!!!
|
||||||
|
|
12
scripts-and-tools/update.sh
Normal file
12
scripts-and-tools/update.sh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Update script for production
|
||||||
|
#
|
||||||
|
# No arguments
|
||||||
|
# Called manually
|
||||||
|
|
||||||
|
sudo systemctl stop project-lighthouse*
|
||||||
|
|
||||||
|
cd /srv/lighthouse || return
|
||||||
|
sudo -u lighthouse -i /srv/lighthouse/build.sh
|
||||||
|
|
||||||
|
sudo systemctl start project-lighthouse*
|
Loading…
Add table
Add a link
Reference in a new issue