mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-12 08:11:27 +00:00
Censor filter logging improvements (#804)
* Move censor/msg logging to MessageController & separate LogAreas/config * Correct LBP character limit to 95 * Log filtered comments as well * Remove two unnecessary variables from CensorHelper * Add censor logging to SlotPage/UserPage controllers and improve logging slightly * Remove accidental dollar sign in log * Grammatical nitpick in CommentController.cs * Contextual nitpick in MessageController.cs * Add escaped quotes in CommentController log to match the rest * Increase limit to account for descriptions, magic mouth, etc. * Consolidate LogChatMessages logging into Filter log area to prevent confusion * Apply code review suggestions
This commit is contained in:
parent
8b1121a4f8
commit
e5cfeb1e39
6 changed files with 39 additions and 22 deletions
|
@ -1,11 +1,14 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
using LBPUnion.ProjectLighthouse.Types.Filter;
|
||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||
using LBPUnion.ProjectLighthouse.Types.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Types.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
@ -119,6 +122,10 @@ public class CommentController : ControllerBase
|
|||
|
||||
string filteredText = CensorHelper.FilterMessage(comment.Message);
|
||||
|
||||
if (ServerConfiguration.Instance.LogChatFiltering && filteredText != comment.Message)
|
||||
Logger.Info($"Censored profane word(s) from in-game comment sent by {username}: \"{comment.Message}\" => \"{filteredText}\"",
|
||||
LogArea.Filter);
|
||||
|
||||
bool success = await this.database.PostComment(token.UserId, targetId, type, filteredText);
|
||||
if (success) return this.Ok();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue