From 7ad2549a17f74bcaa8a9993198aeac673f1fe637 Mon Sep 17 00:00:00 2001 From: Lapis <47952866+LapisGit@users.noreply.github.com> Date: Sat, 4 Apr 2026 08:03:07 -0400 Subject: [PATCH] notify server changes + logging changes --- CannedNet/Models/JoinMode.cs | 9 +++++++++ CannedNet/Models/ModerationState.cs | 11 +++++++++++ CannedNet/Models/NotificationModels.cs | 6 +++--- CannedNet/Models/RelationshipType.cs | 9 +++++++++ CannedNet/Services/NotificationService.cs | 2 +- CannedNet/Services/RequestLoggingMiddleware.cs | 9 +-------- 6 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 CannedNet/Models/JoinMode.cs create mode 100644 CannedNet/Models/ModerationState.cs create mode 100644 CannedNet/Models/RelationshipType.cs diff --git a/CannedNet/Models/JoinMode.cs b/CannedNet/Models/JoinMode.cs new file mode 100644 index 0000000..89b4124 --- /dev/null +++ b/CannedNet/Models/JoinMode.cs @@ -0,0 +1,9 @@ +namespace CannedNet; + +public enum JoinMode +{ + Default = 0, + CreateIfNotExists = 1, + JoinOrRejoin = 2, + RejoinOnly = 3 +} \ No newline at end of file diff --git a/CannedNet/Models/ModerationState.cs b/CannedNet/Models/ModerationState.cs new file mode 100644 index 0000000..082e79b --- /dev/null +++ b/CannedNet/Models/ModerationState.cs @@ -0,0 +1,11 @@ +namespace CannedNet; + +public enum ModerationState +{ + Active = 0, + Junior_Pending = 1, + Moderation_Pending = 2, + Moderation_Closed = 3, + Moderation_Banned = 4, + MarkedForDelete = 5 +} \ No newline at end of file diff --git a/CannedNet/Models/NotificationModels.cs b/CannedNet/Models/NotificationModels.cs index e6baf20..df4ae43 100644 --- a/CannedNet/Models/NotificationModels.cs +++ b/CannedNet/Models/NotificationModels.cs @@ -8,7 +8,7 @@ public class NotificationMessage public string? NotificationId { get; set; } [JsonPropertyName("notificationType")] - public string? NotificationType { get; set; } + public PushNotificationId? NotificationType { get; set; } [JsonPropertyName("id")] public int? Id { get; set; } @@ -95,7 +95,7 @@ public class RelationshipChangedNotification public int? AccountId { get; set; } [JsonPropertyName("relationshipType")] - public string? RelationshipType { get; set; } + public RelationshipType? RelationshipType { get; set; } [JsonPropertyName("status")] public string? Status { get; set; } @@ -227,5 +227,5 @@ public class InventionModerationNotification public string? InventionId { get; set; } [JsonPropertyName("moderationState")] - public string? ModerationState { get; set; } + public ModerationState? ModerationState { get; set; } } diff --git a/CannedNet/Models/RelationshipType.cs b/CannedNet/Models/RelationshipType.cs new file mode 100644 index 0000000..ab913ab --- /dev/null +++ b/CannedNet/Models/RelationshipType.cs @@ -0,0 +1,9 @@ +namespace CannedNet; + +public enum RelationshipType +{ + None, + FriendRequestSent, + FriendRequestReceived, + Friend +} \ No newline at end of file diff --git a/CannedNet/Services/NotificationService.cs b/CannedNet/Services/NotificationService.cs index 22eb101..85e6de2 100644 --- a/CannedNet/Services/NotificationService.cs +++ b/CannedNet/Services/NotificationService.cs @@ -101,7 +101,7 @@ public class NotificationService await hubContext.Clients.All.SendAsync("Notification", notification); } - public NotificationMessage CreateNotification(string notificationType, int? id = null, int? fromAccountId = null, int? toAccountId = null, Dictionary? data = null) + public NotificationMessage CreateNotification(PushNotificationId notificationType, int? id = null, int? fromAccountId = null, int? toAccountId = null, Dictionary? data = null) { return new NotificationMessage { diff --git a/CannedNet/Services/RequestLoggingMiddleware.cs b/CannedNet/Services/RequestLoggingMiddleware.cs index 444452e..432f1f3 100644 --- a/CannedNet/Services/RequestLoggingMiddleware.cs +++ b/CannedNet/Services/RequestLoggingMiddleware.cs @@ -58,14 +58,7 @@ public class RequestLoggingMiddleware private static bool IsSensitiveHeader(string headerName) { - var sensitiveHeaders = new HashSet(StringComparer.OrdinalIgnoreCase) - { - "Authorization", - "Cookie", - "Set-Cookie", - "X-Auth-Token", - "X-Csrf-Token" - }; + var sensitiveHeaders = new HashSet(StringComparer.OrdinalIgnoreCase) { }; return sensitiveHeaders.Contains(headerName); } }