Merge branch 'refs/heads/main' into digest-refactor

# Conflicts:
#	ProjectLighthouse.Servers.GameServer/Controllers/Slots/ReviewController.cs
This commit is contained in:
Slendy 2024-07-03 22:16:32 -05:00
commit 0e0a900f67
No known key found for this signature in database
GPG key ID: 7288D68361B91428
86 changed files with 1477 additions and 170 deletions

View file

@ -1,4 +1,5 @@
using System.Text.Json;
using LBPUnion.ProjectLighthouse.Configuration;
using LBPUnion.ProjectLighthouse.Database;
using LBPUnion.ProjectLighthouse.Extensions;
using LBPUnion.ProjectLighthouse.Files;
@ -69,6 +70,9 @@ public class UserController : GameController
if (update.Biography != null)
{
// Deny request if in read-only mode
if (ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode) return this.BadRequest();
if (update.Biography.Length > 512) return this.BadRequest();
user.Biography = update.Biography;
@ -81,6 +85,9 @@ public class UserController : GameController
{
if (string.IsNullOrWhiteSpace(resource)) continue;
// Deny request if in read-only mode
if (ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode) return this.BadRequest();
if (!FileHelper.ResourceExists(resource) && !resource.StartsWith('g')) return this.BadRequest();
if (!GameResourceHelper.IsValidTexture(resource)) return this.BadRequest();
@ -169,7 +176,7 @@ public class UserController : GameController
// Sometimes the update gets called periodically as pin progress updates via playing,
// may not affect equipped profile pins however, so check before setting it.
string currentPins = user.Pins;
string newPins = string.Join(",", pinJson.ProfilePins);
string newPins = string.Join(",", pinJson.ProfilePins.Distinct());
if (string.Equals(currentPins, newPins)) return this.Ok("[{\"StatusCode\":200}]");