Tags
@{
- string[] authorLabels = Model.Slot?.AuthorLabels.Split(",") ?? new string[]
- {};
+ string[] authorLabels = Model.Slot?.AuthorLabels.Split(",") ?? new string[]{};
if (authorLabels.Length == 1) // ..?? ok c#
{
This level has no tags.
diff --git a/ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj b/ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj
index 73d6c090..be32d8ff 100644
--- a/ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj
+++ b/ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj
@@ -32,7 +32,7 @@
-
+
diff --git a/ProjectLighthouse.Servers.Website/Startup/WebsiteStartup.cs b/ProjectLighthouse.Servers.Website/Startup/WebsiteStartup.cs
index dabe84c2..97b813cc 100644
--- a/ProjectLighthouse.Servers.Website/Startup/WebsiteStartup.cs
+++ b/ProjectLighthouse.Servers.Website/Startup/WebsiteStartup.cs
@@ -58,7 +58,10 @@ public class WebsiteStartup
app.UseRouting();
- app.UseStaticFiles();
+ app.UseStaticFiles(new StaticFileOptions
+ {
+ ServeUnknownFileTypes = true,
+ });
app.UseEndpoints(endpoints => endpoints.MapControllers());
app.UseEndpoints(endpoints => endpoints.MapRazorPages());
diff --git a/ProjectLighthouse.Tests.GameApiTests/ProjectLighthouse.Tests.GameApiTests.csproj b/ProjectLighthouse.Tests.GameApiTests/ProjectLighthouse.Tests.GameApiTests.csproj
index 086efd76..e81607d6 100644
--- a/ProjectLighthouse.Tests.GameApiTests/ProjectLighthouse.Tests.GameApiTests.csproj
+++ b/ProjectLighthouse.Tests.GameApiTests/ProjectLighthouse.Tests.GameApiTests.csproj
@@ -9,8 +9,8 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/ProjectLighthouse.Tests.WebsiteTests/ProjectLighthouse.Tests.WebsiteTests.csproj b/ProjectLighthouse.Tests.WebsiteTests/ProjectLighthouse.Tests.WebsiteTests.csproj
index 4483c810..0ac93a3d 100644
--- a/ProjectLighthouse.Tests.WebsiteTests/ProjectLighthouse.Tests.WebsiteTests.csproj
+++ b/ProjectLighthouse.Tests.WebsiteTests/ProjectLighthouse.Tests.WebsiteTests.csproj
@@ -9,8 +9,8 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/ProjectLighthouse.Tests/ProjectLighthouse.Tests.csproj b/ProjectLighthouse.Tests/ProjectLighthouse.Tests.csproj
index 0f9fffbf..fd62a0a9 100644
--- a/ProjectLighthouse.Tests/ProjectLighthouse.Tests.csproj
+++ b/ProjectLighthouse.Tests/ProjectLighthouse.Tests.csproj
@@ -14,8 +14,8 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/ProjectLighthouse/Database.cs b/ProjectLighthouse/Database.cs
index 21440f4f..5cd437be 100644
--- a/ProjectLighthouse/Database.cs
+++ b/ProjectLighthouse/Database.cs
@@ -41,7 +41,6 @@ public class Database : DbContext
public DbSet AuthenticationAttempts { get; set; }
public DbSet Reviews { get; set; }
public DbSet RatedReviews { get; set; }
- public DbSet UserApprovedIpAddresses { get; set; }
public DbSet CustomCategories { get; set; }
public DbSet Reactions { get; set; }
public DbSet Reports { get; set; }
diff --git a/ProjectLighthouse/Migrations/20220611221819_OnlyAllowSingleApprovedIP.cs b/ProjectLighthouse/Migrations/20220611221819_OnlyAllowSingleApprovedIP.cs
new file mode 100644
index 00000000..8e03d50d
--- /dev/null
+++ b/ProjectLighthouse/Migrations/20220611221819_OnlyAllowSingleApprovedIP.cs
@@ -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(
+ 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(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ UserId = table.Column(type: "int", nullable: false),
+ IpAddress = table.Column(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");
+ }
+ }
+}
diff --git a/ProjectLighthouse/PlayerData/Profiles/User.cs b/ProjectLighthouse/PlayerData/Profiles/User.cs
index 2ccfd77d..99664812 100644
--- a/ProjectLighthouse/PlayerData/Profiles/User.cs
+++ b/ProjectLighthouse/PlayerData/Profiles/User.cs
@@ -150,6 +150,11 @@ public class User
[JsonIgnore]
public string? BannedReason { get; set; }
+ #nullable enable
+ [JsonIgnore]
+ public string? ApprovedIPAddress { get; set; }
+ #nullable disable
+
public string Serialize(GameVersion gameVersion = GameVersion.LittleBigPlanet1)
{
string user = LbpSerializer.TaggedStringElement("npHandle", this.Username, "icon", this.IconHash) +
diff --git a/ProjectLighthouse/PlayerData/Profiles/UserApprovedIpAddress.cs b/ProjectLighthouse/PlayerData/Profiles/UserApprovedIpAddress.cs
deleted file mode 100644
index cbb4179c..00000000
--- a/ProjectLighthouse/PlayerData/Profiles/UserApprovedIpAddress.cs
+++ /dev/null
@@ -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; }
-}
\ No newline at end of file
diff --git a/ProjectLighthouse/ProjectLighthouse.csproj b/ProjectLighthouse/ProjectLighthouse.csproj
index f38c51ff..78fcd468 100644
--- a/ProjectLighthouse/ProjectLighthouse.csproj
+++ b/ProjectLighthouse/ProjectLighthouse.csproj
@@ -14,9 +14,9 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/ProjectLighthouse/ProjectLighthouse/Migrations/DatabaseModelSnapshot.cs b/ProjectLighthouse/ProjectLighthouse/Migrations/DatabaseModelSnapshot.cs
index 28b23b45..83004d75 100644
--- a/ProjectLighthouse/ProjectLighthouse/Migrations/DatabaseModelSnapshot.cs
+++ b/ProjectLighthouse/ProjectLighthouse/Migrations/DatabaseModelSnapshot.cs
@@ -627,6 +627,12 @@ namespace ProjectLighthouse.Migrations
b.Property("AdminGrantedSlots")
.HasColumnType("int");
+ b.Property("ApprovedIPAddress")
+ .HasColumnType("longtext");
+
+ b.Property("Banned")
+ .HasColumnType("tinyint(1)");
+
b.Property("BannedReason")
.HasColumnType("longtext");
@@ -689,25 +695,6 @@ namespace ProjectLighthouse.Migrations
b.ToTable("Users");
});
- modelBuilder.Entity("LBPUnion.ProjectLighthouse.PlayerData.Profiles.UserApprovedIpAddress", b =>
- {
- b.Property("UserApprovedIpAddressId")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- b.Property("IpAddress")
- .HasColumnType("longtext");
-
- b.Property("UserId")
- .HasColumnType("int");
-
- b.HasKey("UserApprovedIpAddressId");
-
- b.HasIndex("UserId");
-
- b.ToTable("UserApprovedIpAddresses");
- });
-
modelBuilder.Entity("LBPUnion.ProjectLighthouse.PlayerData.Reaction", b =>
{
b.Property("RatingId")
@@ -1076,17 +1063,6 @@ namespace ProjectLighthouse.Migrations
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 =>
{
b.HasOne("LBPUnion.ProjectLighthouse.PlayerData.Reviews.Review", "Review")
diff --git a/ProjectLighthouse/StaticFiles/css/styles.css b/ProjectLighthouse/StaticFiles/css/styles.css
index a944fcfe..ff7ee80d 100644
--- a/ProjectLighthouse/StaticFiles/css/styles.css
+++ b/ProjectLighthouse/StaticFiles/css/styles.css
@@ -27,6 +27,7 @@ canvas.hide-subjects {
.card {
display: flex;
+ overflow-wrap: anywhere;
width: 100%;
}
diff --git a/scripts-and-tools/build.sh b/scripts-and-tools/build.sh
index 8be9cefb..022c2aa6 100644
--- a/scripts-and-tools/build.sh
+++ b/scripts-and-tools/build.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
# Build script for production
#
# No arguments
diff --git a/scripts-and-tools/start.sh b/scripts-and-tools/start.sh
index 10d2803a..b238211a 100644
--- a/scripts-and-tools/start.sh
+++ b/scripts-and-tools/start.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
# Startup script for production
#
# $1: Server to start; case sensitive!!!!!
diff --git a/scripts-and-tools/update.sh b/scripts-and-tools/update.sh
new file mode 100644
index 00000000..f0185362
--- /dev/null
+++ b/scripts-and-tools/update.sh
@@ -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*
\ No newline at end of file