diff --git a/MareSynchronosServer/MareSynchronosServices/CleanupService.cs b/MareSynchronosServer/MareSynchronosServices/CleanupService.cs index 4e1db29..78d3a77 100644 --- a/MareSynchronosServer/MareSynchronosServices/CleanupService.cs +++ b/MareSynchronosServer/MareSynchronosServices/CleanupService.cs @@ -138,6 +138,7 @@ namespace MareSynchronosServices var otherPairData = dbContext.ClientPairs.Include(u => u.User) .Where(u => u.OtherUser.UID == user.UID).ToList(); + _logger.LogInformation("User purged: {uid}", user.UID); metrics.DecGauge(MetricsAPI.GaugePairs, ownPairData.Count + otherPairData.Count); metrics.DecGauge(MetricsAPI.GaugePairsPaused, ownPairData.Count + ownPairData.Count(c => c.IsPaused)); diff --git a/MareSynchronosServer/MareSynchronosServices/Discord/DiscordBot.cs b/MareSynchronosServer/MareSynchronosServices/Discord/DiscordBot.cs index 25b6b6c..51f3dfe 100644 --- a/MareSynchronosServer/MareSynchronosServices/Discord/DiscordBot.cs +++ b/MareSynchronosServer/MareSynchronosServices/Discord/DiscordBot.cs @@ -71,8 +71,11 @@ public class DiscordBot : IHostedService { if (arg.Data.Name == "register") { + logger.LogInformation("{user} called register", arg.User.Id); + if (arg.Data.Options.FirstOrDefault(f => f.Name == "overwrite_old_account") != null) { + logger.LogInformation("{user} called register with overwrite_old_account", arg.User.Id); await DeletePreviousUserAccount(arg.User.Id).ConfigureAwait(false); } @@ -84,6 +87,7 @@ public class DiscordBot : IHostedService } else if (arg.Data.Name == "verify") { + logger.LogInformation("{user} called verify", arg.User.Id); EmbedBuilder eb = new(); if (verificationQueue.Any(u => u.User.Id == arg.User.Id)) { @@ -105,6 +109,8 @@ public class DiscordBot : IHostedService } else if (arg.Data.Name == "setvanityuid") { + logger.LogInformation("{user} called setvanityuid", arg.User.Id); + EmbedBuilder eb = new(); var newUid = (string)arg.Data.Options.First(f => f.Name == "vanity_uid").Value; eb = await HandleVanityUid(eb, arg.User.Id, newUid); @@ -247,7 +253,7 @@ public class DiscordBot : IHostedService user.LastLoggedIn = DateTime.UtcNow - TimeSpan.FromDays(purgedDays) + TimeSpan.FromDays(1); } - var computedHash = BitConverter.ToString(sha256.ComputeHash(Encoding.UTF8.GetBytes(GenerateRandomString(64)))).Replace("-", ""); + var computedHash = BitConverter.ToString(sha256.ComputeHash(Encoding.UTF8.GetBytes(GenerateRandomString(64) + DateTime.UtcNow.ToString()))).Replace("-", ""); var auth = new Auth() { HashedKey = BitConverter.ToString(sha256.ComputeHash(Encoding.UTF8.GetBytes(computedHash))) diff --git a/MareSynchronosServer/MareSynchronosServices/MareSynchronosServices.csproj b/MareSynchronosServer/MareSynchronosServices/MareSynchronosServices.csproj index ec881e7..6199576 100644 --- a/MareSynchronosServer/MareSynchronosServices/MareSynchronosServices.csproj +++ b/MareSynchronosServer/MareSynchronosServices/MareSynchronosServices.csproj @@ -23,6 +23,7 @@ + diff --git a/MareSynchronosServer/MareSynchronosServices/Program.cs b/MareSynchronosServer/MareSynchronosServices/Program.cs index 6e61499..834c8ee 100644 --- a/MareSynchronosServer/MareSynchronosServices/Program.cs +++ b/MareSynchronosServer/MareSynchronosServices/Program.cs @@ -4,6 +4,7 @@ using MareSynchronosShared.Metrics; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; using System; using System.Linq; @@ -33,6 +34,11 @@ public class Program .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseContentRoot(AppContext.BaseDirectory); + webBuilder.ConfigureLogging((ctx, builder) => + { + builder.AddConfiguration(ctx.Configuration.GetSection("Logging")); + builder.AddFile(o => o.RootPath = AppContext.BaseDirectory); + }); webBuilder.UseStartup(); }); } \ No newline at end of file