Added some documentation

it triggered me that this was missing, okay?
This commit is contained in:
Marcel Baumgartner 2024-04-17 15:42:23 +02:00
parent 610501ef19
commit dcfb836b39
3 changed files with 7 additions and 4 deletions

View file

@ -55,9 +55,9 @@ public class AvatarController : Controller
if (!IdentityService.IsLoggedIn) if (!IdentityService.IsLoggedIn)
return StatusCode(403); return StatusCode(403);
if (ConfigService.Get().Security.EnforceAvatarPrivacy && if (ConfigService.Get().Security.EnforceAvatarPrivacy && // Do we need to enforce privacy?
id != IdentityService.CurrentUser.Id && id != IdentityService.CurrentUser.Id && // is the user not viewing his own image?
IdentityService.CurrentUser.Permissions < 1000) IdentityService.CurrentUser.Permissions < 1000) // and not an admin?
{ {
return StatusCode(403); return StatusCode(403);
} }

View file

@ -22,13 +22,16 @@ public class DiagnoseService
{ {
using var scope = ServiceProvider.CreateScope(); using var scope = ServiceProvider.CreateScope();
// Create in memory zip archive
using var dataStream = new MemoryStream(); using var dataStream = new MemoryStream();
var zipArchive = new ZipArchive(dataStream, ZipArchiveMode.Create, true); var zipArchive = new ZipArchive(dataStream, ZipArchiveMode.Create, true);
// Call every plugin to perform their modifications to the file
await PluginService.ExecuteFuncAsync<IDiagnoseAction>( await PluginService.ExecuteFuncAsync<IDiagnoseAction>(
async x => await x.GenerateReport(zipArchive, scope.ServiceProvider) async x => await x.GenerateReport(zipArchive, scope.ServiceProvider)
); );
// Add a timestamp
await zipArchive.AddText("exported_at.txt", Formatter.FormatDate(DateTime.UtcNow)); await zipArchive.AddText("exported_at.txt", Formatter.FormatDate(DateTime.UtcNow));
zipArchive.Dispose(); zipArchive.Dispose();

View file

@ -5,7 +5,7 @@ using MoonCore.Helpers;
namespace Moonlight.Core.Services; namespace Moonlight.Core.Services;
/// <summary> /// <summary>
/// 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
/// </summary> /// </summary>
[Scoped] [Scoped]