From 60958b3d242606e877b8acff498e694236180d1a Mon Sep 17 00:00:00 2001 From: Jesse Date: Tue, 12 Aug 2025 19:26:05 +0200 Subject: [PATCH] Merge pull request #544 from sp-tarkov/remove-warnings Remove unused dependencies and improve code quality --- CHANGELOG.md | 5 +++++ .../Extensions/ObjectExtensions.cs | 2 +- .../Callbacks/GameCallbacks.cs | 2 +- .../Controllers/DialogueController.cs | 2 +- .../Controllers/InRaidController.cs | 2 -- .../Controllers/LauncherController.cs | 1 - .../Controllers/LauncherV2Controller.cs | 2 -- .../Controllers/MatchController.cs | 2 -- .../Controllers/PrestigeController.cs | 8 +------- .../Controllers/TradeController.cs | 1 - .../Controllers/WeatherController.cs | 2 -- .../Extensions/ProfileExtensions.cs | 2 +- .../Generators/BotLevelGenerator.cs | 3 +-- .../Generators/PMCLootGenerator.cs | 2 -- .../Generators/PmcWaveGenerator.cs | 3 +-- .../PickupQuestGenerator.cs | 9 +-------- .../Helpers/HideoutHelper.cs | 3 +-- .../Helpers/NotifierHelper.cs | 2 +- .../Helpers/RagfairServerHelper.cs | 2 -- .../Models/Eft/Common/Tables/TemplateItem.cs | 8 +++----- .../Models/Eft/Ragfair/RagfairOffer.cs | 4 ---- .../Routers/EventOutputHolder.cs | 3 +-- .../SPTarkov.Server.Core/Servers/SaveServer.cs | 17 ++++++++++++++++- .../DefaultSptWebSocketMessageHandler.cs | 3 ++- .../Servers/Ws/SptWebSocketConnectionHandler.cs | 4 +++- .../Services/ProfileValidatorService.cs | 6 ++++++ 26 files changed, 46 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26a9bdf3..11c5a134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,3 +9,8 @@ Changes before the CSharp rewrite (less than version 4) are not documented withi ## [Unreleased] [unreleased]: https://github.com/sp-tarkov/server-csharp/compare/47b6c3426e6f7db2e1b6d97281d850c89466aba0..HEAD +### Changed +- Removed unused dependencies and improved documentation grammar. + +### Fixed +- Added error handling for profile loading failures and adjusted nullable return types for better type safety. diff --git a/Libraries/SPTarkov.Common/Extensions/ObjectExtensions.cs b/Libraries/SPTarkov.Common/Extensions/ObjectExtensions.cs index c015f1d0..d7d94de9 100644 --- a/Libraries/SPTarkov.Common/Extensions/ObjectExtensions.cs +++ b/Libraries/SPTarkov.Common/Extensions/ObjectExtensions.cs @@ -116,7 +116,7 @@ public static class ObjectExtensions return resultDict; } - public static T ToObject(this JsonElement element) + public static T? ToObject(this JsonElement element) { var json = element.GetRawText(); return JsonSerializer.Deserialize(json); diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs index 7eb6772d..331a91a3 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs @@ -132,7 +132,7 @@ public class GameCallbacks( } /// - /// Handle /client/report/send & /client/reports/lobby/send + /// Handle /client/report/send and handle /client/reports/lobby/send /// /// public ValueTask ReportNickname(string url, UIDRequestData request, MongoId sessionID) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs b/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs index 265841a7..cf801fe1 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs @@ -425,7 +425,7 @@ public class DialogueController( } /// - /// Handle client/mail/dialog/pin && Handle client/mail/dialog/unpin + /// Handle client/mail/dialog/pin and handle client/mail/dialog/unpin /// /// /// diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InRaidController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InRaidController.cs index a1d2bd91..c921b135 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InRaidController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InRaidController.cs @@ -3,14 +3,12 @@ using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.InRaid; using SPTarkov.Server.Core.Models.Spt.Config; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; namespace SPTarkov.Server.Core.Controllers; [Injectable] public class InRaidController( - ISptLogger logger, ProfileHelper profileHelper, //ApplicationContext _applicationContext, ConfigServer configServer diff --git a/Libraries/SPTarkov.Server.Core/Controllers/LauncherController.cs b/Libraries/SPTarkov.Server.Core/Controllers/LauncherController.cs index 88d68f9c..f0f7ba34 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/LauncherController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/LauncherController.cs @@ -16,7 +16,6 @@ namespace SPTarkov.Server.Core.Controllers; [Injectable] public class LauncherController( - ISptLogger logger, IReadOnlyList loadedMods, HashUtil hashUtil, SaveServer saveServer, diff --git a/Libraries/SPTarkov.Server.Core/Controllers/LauncherV2Controller.cs b/Libraries/SPTarkov.Server.Core/Controllers/LauncherV2Controller.cs index 9c590a87..92635d45 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/LauncherV2Controller.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/LauncherV2Controller.cs @@ -4,7 +4,6 @@ using SPTarkov.Server.Core.Models.Eft.Launcher; using SPTarkov.Server.Core.Models.Eft.Profile; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Spt.Mod; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; @@ -14,7 +13,6 @@ namespace SPTarkov.Server.Core.Controllers; [Injectable] public class LauncherV2Controller( - ISptLogger logger, IReadOnlyList loadedMods, HashUtil hashUtil, SaveServer saveServer, diff --git a/Libraries/SPTarkov.Server.Core/Controllers/MatchController.cs b/Libraries/SPTarkov.Server.Core/Controllers/MatchController.cs index 74ac524d..a9b8bfec 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/MatchController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/MatchController.cs @@ -3,7 +3,6 @@ using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Match; using SPTarkov.Server.Core.Models.Spt.Config; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using static SPTarkov.Server.Core.Services.MatchLocationService; @@ -12,7 +11,6 @@ namespace SPTarkov.Server.Core.Controllers; [Injectable] public class MatchController( - ISptLogger logger, MatchLocationService matchLocationService, ConfigServer configServer, LocationLifecycleService locationLifecycleService, diff --git a/Libraries/SPTarkov.Server.Core/Controllers/PrestigeController.cs b/Libraries/SPTarkov.Server.Core/Controllers/PrestigeController.cs index 8ef78453..e3f7d6a4 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/PrestigeController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/PrestigeController.cs @@ -4,19 +4,13 @@ using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.Prestige; using SPTarkov.Server.Core.Models.Eft.Profile; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; namespace SPTarkov.Server.Core.Controllers; [Injectable] -public class PrestigeController( - ISptLogger logger, - ProfileHelper profileHelper, - DatabaseService databaseService, - SaveServer saveServer -) +public class PrestigeController(ProfileHelper profileHelper, DatabaseService databaseService, SaveServer saveServer) { /// /// Handle /client/prestige/list diff --git a/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs b/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs index 7ed69625..7b3c7064 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs @@ -27,7 +27,6 @@ public class TradeController( TimeUtil timeUtil, RandomUtil randomUtil, ItemHelper itemHelper, - ProfileHelper profileHelper, RagfairOfferHelper ragfairOfferHelper, RagfairServer ragfairServer, HttpResponseUtil httpResponseUtil, diff --git a/Libraries/SPTarkov.Server.Core/Controllers/WeatherController.cs b/Libraries/SPTarkov.Server.Core/Controllers/WeatherController.cs index 852e1549..90eb0add 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/WeatherController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/WeatherController.cs @@ -5,7 +5,6 @@ using SPTarkov.Server.Core.Models.Eft.Weather; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Spt.Weather; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; @@ -13,7 +12,6 @@ namespace SPTarkov.Server.Core.Controllers; [Injectable] public class WeatherController( - ISptLogger logger, WeatherGenerator weatherGenerator, SeasonalEventService seasonalEventService, RaidWeatherService raidWeatherService, diff --git a/Libraries/SPTarkov.Server.Core/Extensions/ProfileExtensions.cs b/Libraries/SPTarkov.Server.Core/Extensions/ProfileExtensions.cs index 83df3712..8905bfba 100644 --- a/Libraries/SPTarkov.Server.Core/Extensions/ProfileExtensions.cs +++ b/Libraries/SPTarkov.Server.Core/Extensions/ProfileExtensions.cs @@ -172,7 +172,7 @@ public static class ProfileExtensions /// Experience table from globals.json /// /// The calculated level of the player as an integer, or null if the level cannot be determined. - /// This value is also assigned to within the provided profile. + /// This value is also assigned to within the provided profile. /// public static int? CalculateLevel(this PmcData pmcData, ExpTable[] expTable) { diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotLevelGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotLevelGenerator.cs index b6dbd54e..1221dd01 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotLevelGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotLevelGenerator.cs @@ -3,14 +3,13 @@ using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Bot; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Spt.Bots; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; namespace SPTarkov.Server.Core.Generators; [Injectable] -public class BotLevelGenerator(ISptLogger logger, RandomUtil randomUtil, DatabaseService databaseService) +public class BotLevelGenerator(RandomUtil randomUtil, DatabaseService databaseService) { /// /// Return a randomised bot level and exp value diff --git a/Libraries/SPTarkov.Server.Core/Generators/PMCLootGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/PMCLootGenerator.cs index 49c10fbf..a2bda4b6 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/PMCLootGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/PMCLootGenerator.cs @@ -4,7 +4,6 @@ using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; @@ -12,7 +11,6 @@ namespace SPTarkov.Server.Core.Generators; [Injectable] public class PMCLootGenerator( - ISptLogger logger, DatabaseService databaseService, ItemHelper itemHelper, ItemFilterService itemFilterService, diff --git a/Libraries/SPTarkov.Server.Core/Generators/PmcWaveGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/PmcWaveGenerator.cs index 26ffd1ec..c80b8b48 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/PmcWaveGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/PmcWaveGenerator.cs @@ -1,14 +1,13 @@ using SPTarkov.DI.Annotations; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Spt.Config; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; namespace SPTarkov.Server.Core.Generators; [Injectable] -public class PmcWaveGenerator(ISptLogger logger, DatabaseService databaseService, ConfigServer configServer) +public class PmcWaveGenerator(DatabaseService databaseService, ConfigServer configServer) { protected readonly PmcConfig _pmcConfig = configServer.GetConfig(); diff --git a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGeneration/PickupQuestGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGeneration/PickupQuestGenerator.cs index 7bbf3cad..307dfe7e 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGeneration/PickupQuestGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGeneration/PickupQuestGenerator.cs @@ -5,8 +5,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Spt.Repeatable; -using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Json; @@ -14,14 +12,9 @@ namespace SPTarkov.Server.Core.Generators.RepeatableQuestGeneration; [Injectable] public class PickupQuestGenerator( - ISptLogger logger, RepeatableQuestHelper repeatableQuestHelper, RepeatableQuestRewardGenerator repeatableQuestRewardGenerator, - DatabaseService databaseService, - ServerLocalisationService localisationService, - RandomUtil randomUtil, - MathUtil mathUtil, - HashUtil hashUtil + RandomUtil randomUtil ) : IRepeatableQuestGenerator { // TODO: This isn't really implemented, not in the current pool. diff --git a/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs index cb400688..87c2cbdc 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/HideoutHelper.cs @@ -28,8 +28,7 @@ public class HideoutHelper( ProfileHelper profileHelper, InventoryHelper inventoryHelper, ItemHelper itemHelper, - ICloner cloner, - MathUtil mathUtil + ICloner cloner ) { public static readonly MongoId BitcoinProductionId = new("5d5c205bd582a50d042a3c0e"); diff --git a/Libraries/SPTarkov.Server.Core/Helpers/NotifierHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/NotifierHelper.cs index 39e87972..75dc8aec 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/NotifierHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/NotifierHelper.cs @@ -29,7 +29,7 @@ public class NotifierHelper(HttpServerHelper httpServerHelper) EventIdentifier = dialogueMessage.Id, OfferId = ragfairData.OfferId, HandbookId = ragfairData.HandbookId, - Count = (int)ragfairData.Count, + Count = Convert.ToInt32(ragfairData.Count), }; } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/RagfairServerHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/RagfairServerHelper.cs index cdd30c6b..ed63d867 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/RagfairServerHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/RagfairServerHelper.cs @@ -4,7 +4,6 @@ using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; using SPTarkov.Server.Core.Services; using SPTarkov.Server.Core.Utils; @@ -14,7 +13,6 @@ namespace SPTarkov.Server.Core.Helpers; [Injectable] public class RagfairServerHelper( - ISptLogger logger, RandomUtil randomUtil, TimeUtil timeUtil, DatabaseService databaseService, diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/TemplateItem.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/TemplateItem.cs index dba88ffd..8041d681 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/TemplateItem.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/TemplateItem.cs @@ -15,9 +15,7 @@ public record TemplateItem private string? _name; - private string? _parent; - - private string _prototype; + private string? _prototype; private string? _type; @@ -78,9 +76,9 @@ public record Props [JsonExtensionData] public Dictionary? ExtensionData { get; set; } - private string _backgroundColor; + private string? _backgroundColor; - private string _itemSound; + private string? _itemSound; private string? _metascoreGroup; private string? _rarityPvE; diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Ragfair/RagfairOffer.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Ragfair/RagfairOffer.cs index bc050395..cdb1d698 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Ragfair/RagfairOffer.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Ragfair/RagfairOffer.cs @@ -10,10 +10,6 @@ public record RagfairOffer [JsonExtensionData] public Dictionary? ExtensionData { get; set; } - private string? _id; - - private string? _root; - [JsonPropertyName("sellResult")] public List? SellResults { get; set; } diff --git a/Libraries/SPTarkov.Server.Core/Routers/EventOutputHolder.cs b/Libraries/SPTarkov.Server.Core/Routers/EventOutputHolder.cs index 0df9bd58..8e827b61 100644 --- a/Libraries/SPTarkov.Server.Core/Routers/EventOutputHolder.cs +++ b/Libraries/SPTarkov.Server.Core/Routers/EventOutputHolder.cs @@ -4,14 +4,13 @@ using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Models.Eft.ItemEvent; -using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; namespace SPTarkov.Server.Core.Routers; [Injectable] -public class EventOutputHolder(ISptLogger logger, ProfileHelper profileHelper, TimeUtil timeUtil, ICloner cloner) +public class EventOutputHolder(ProfileHelper profileHelper, TimeUtil timeUtil, ICloner cloner) { protected readonly Dictionary> _clientActiveSessionStorage = new(); protected readonly Dictionary _outputStore = new(); diff --git a/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs b/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs index 9d193211..7cf6824b 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs @@ -210,7 +210,15 @@ public class SaveServer( if (profile is not null) { - profiles[sessionID] = profileValidatorService.MigrateAndValidateProfile(profile); + try + { + profiles[sessionID] = profileValidatorService.MigrateAndValidateProfile(profile); + } + catch (InvalidOperationException ex) + { + logger.Critical($"Failed to load profile with ID '{sessionID}'"); + logger.Critical(ex.ToString()); + } } } @@ -292,6 +300,13 @@ public class SaveServer( return !fileUtil.FileExists(file); } + /// + /// Determines whether the specified profile is marked as invalid or cannot be loaded. + /// + /// The ID of the profile to check. + /// + /// true if the profile is invalid or unloadable; otherwise, false. + /// public bool IsProfileInvalidOrUnloadable(MongoId sessionID) { if ( diff --git a/Libraries/SPTarkov.Server.Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs index 19be3e30..b8e9d572 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/Ws/Message/DefaultSptWebSocketMessageHandler.cs @@ -8,8 +8,9 @@ namespace SPTarkov.Server.Core.Servers.Ws.Message; [Injectable] public class DefaultSptWebSocketMessageHandler(ISptLogger logger) : ISptWebSocketMessageHandler { - public async Task OnSptMessage(string sessionID, WebSocket client, byte[] rawData) + public Task OnSptMessage(string sessionID, WebSocket client, byte[] rawData) { logger.Debug($"[{sessionID}] SPT message received: {Encoding.UTF8.GetString(rawData)}"); + return Task.CompletedTask; } } diff --git a/Libraries/SPTarkov.Server.Core/Servers/Ws/SptWebSocketConnectionHandler.cs b/Libraries/SPTarkov.Server.Core/Servers/Ws/SptWebSocketConnectionHandler.cs index f64957b9..ca7f74dc 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/Ws/SptWebSocketConnectionHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/Ws/SptWebSocketConnectionHandler.cs @@ -98,7 +98,7 @@ public class SptWebSocketConnectionHandler( } } - public async Task OnClose(WebSocket ws, HttpContext context, string sessionIdContext) + public Task OnClose(WebSocket ws, HttpContext context, string sessionIdContext) { var splitUrl = context.Request.Path.Value.Split("/"); var sessionID = splitUrl.Last(); @@ -144,6 +144,8 @@ public class SptWebSocketConnectionHandler( } } } + + return Task.CompletedTask; } public void SendMessageToAll(WsNotificationEvent output) diff --git a/Libraries/SPTarkov.Server.Core/Services/ProfileValidatorService.cs b/Libraries/SPTarkov.Server.Core/Services/ProfileValidatorService.cs index 5866cf43..70b00e49 100644 --- a/Libraries/SPTarkov.Server.Core/Services/ProfileValidatorService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/ProfileValidatorService.cs @@ -20,6 +20,12 @@ public class ProfileValidatorService( { private readonly IEnumerable _sortedMigrations = profileMigrations.Sort(); + /// + /// Migrates and verifies if profiles are compatible + /// + /// The profile as a to verify and migrate + /// The migrated and validated profile + /// Thrown if a profile file cannot be loaded at all public SptProfile MigrateAndValidateProfile(JsonObject profile) { var profileId = profile["info"]?["id"]?.GetValue();