From dcfb836b396c23b18169626bc1f64bfba8515aa5 Mon Sep 17 00:00:00 2001 From: Marcel Baumgartner Date: Wed, 17 Apr 2024 15:42:23 +0200 Subject: [PATCH] Added some documentation it triggered me that this was missing, okay? --- Moonlight/Core/Http/Controllers/AvatarController.cs | 6 +++--- Moonlight/Core/Services/DiagnoseService.cs | 3 +++ Moonlight/Core/Services/UnloadService.cs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Moonlight/Core/Http/Controllers/AvatarController.cs b/Moonlight/Core/Http/Controllers/AvatarController.cs index 617363d..1b235ff 100644 --- a/Moonlight/Core/Http/Controllers/AvatarController.cs +++ b/Moonlight/Core/Http/Controllers/AvatarController.cs @@ -55,9 +55,9 @@ public class AvatarController : Controller if (!IdentityService.IsLoggedIn) return StatusCode(403); - if (ConfigService.Get().Security.EnforceAvatarPrivacy && - id != IdentityService.CurrentUser.Id && - IdentityService.CurrentUser.Permissions < 1000) + if (ConfigService.Get().Security.EnforceAvatarPrivacy && // Do we need to enforce privacy? + id != IdentityService.CurrentUser.Id && // is the user not viewing his own image? + IdentityService.CurrentUser.Permissions < 1000) // and not an admin? { return StatusCode(403); } diff --git a/Moonlight/Core/Services/DiagnoseService.cs b/Moonlight/Core/Services/DiagnoseService.cs index a38bbe3..b76bbc2 100644 --- a/Moonlight/Core/Services/DiagnoseService.cs +++ b/Moonlight/Core/Services/DiagnoseService.cs @@ -22,13 +22,16 @@ public class DiagnoseService { using var scope = ServiceProvider.CreateScope(); + // Create in memory zip archive using var dataStream = new MemoryStream(); var zipArchive = new ZipArchive(dataStream, ZipArchiveMode.Create, true); + // Call every plugin to perform their modifications to the file await PluginService.ExecuteFuncAsync( async x => await x.GenerateReport(zipArchive, scope.ServiceProvider) ); + // Add a timestamp await zipArchive.AddText("exported_at.txt", Formatter.FormatDate(DateTime.UtcNow)); zipArchive.Dispose(); diff --git a/Moonlight/Core/Services/UnloadService.cs b/Moonlight/Core/Services/UnloadService.cs index 6da5863..d62ced4 100644 --- a/Moonlight/Core/Services/UnloadService.cs +++ b/Moonlight/Core/Services/UnloadService.cs @@ -5,7 +5,7 @@ using MoonCore.Helpers; namespace Moonlight.Core.Services; /// -/// This class provides a event to execute code when a user leaves the page +/// This class provides an event to execute code when a user leaves the page /// [Scoped]