mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-15 06:02:28 +00:00
Add basic checks to grief reporting
This commit is contained in:
parent
cf1adbe640
commit
a796cb9185
2 changed files with 12 additions and 3 deletions
|
@ -3,6 +3,7 @@ using System.Text.Json;
|
|||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Files;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
|
@ -37,6 +38,14 @@ public class ReportController : ControllerBase
|
|||
|
||||
SanitizationHelper.SanitizeStringsInClass(report);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(report.JpegHash)) return this.BadRequest();
|
||||
|
||||
if (!FileHelper.ResourceExists(report.JpegHash)) return this.BadRequest();
|
||||
|
||||
if (report.XmlPlayers.Length > 4) return this.BadRequest();
|
||||
|
||||
if (report.XmlPlayers.Any(p => !this.database.IsUsernameValid(p.Name))) return this.BadRequest();
|
||||
|
||||
report.Bounds = JsonSerializer.Serialize(report.XmlBounds.Rect, typeof(Rectangle));
|
||||
report.Players = JsonSerializer.Serialize(report.XmlPlayers, typeof(ReportPlayer[]));
|
||||
report.Timestamp = TimeHelper.TimestampMillis;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue