diff --git a/MareSynchronos/Configuration.cs b/MareSynchronos/Configuration.cs index cb3ae11..7e9f0b5 100644 --- a/MareSynchronos/Configuration.cs +++ b/MareSynchronos/Configuration.cs @@ -114,6 +114,35 @@ namespace MareSynchronos UidComments.Clear(); Save(); } + + if (Version == 1) + { + Logger.Debug("Migrating Configuration from V1 to V2"); + ApiUri = ApiUri.Replace("5001", "5000"); + foreach (var kvp in ClientSecret.ToList()) + { + var newKey = kvp.Key.Replace("5001", "5000"); + ClientSecret.Remove(kvp.Key); + if (ClientSecret.ContainsKey(newKey)) + { + ClientSecret[newKey] = kvp.Value; + } + else + { + ClientSecret.Add(newKey, kvp.Value); + } + } + + foreach (var kvp in UidServerComments.ToList()) + { + var newKey = kvp.Key.Replace("5001", "5000"); + UidServerComments.Remove(kvp.Key); + UidServerComments.Add(newKey, kvp.Value); + } + + Version = 2; + Save(); + } } } } diff --git a/MareSynchronos/UI/MainUi.cs b/MareSynchronos/UI/MainUi.cs index 7558bba..f837afc 100644 --- a/MareSynchronos/UI/MainUi.cs +++ b/MareSynchronos/UI/MainUi.cs @@ -82,7 +82,7 @@ namespace MareSynchronos.UI } else { - string error = _configuration.FullPause ? "Fully Paused" : _apiController.ServerAlive ? "Unauthorized" : "Service unavailable"; + string error = _configuration.FullPause ? "Disconnected" : _apiController.ServerAlive ? "Unauthorized" : "Service unavailable"; ImGui.TextColored(ImGuiColors.DalamudRed, $"No UID ({error})"); ImGui.SetWindowFontScale(1.0f); if (_apiController.ServerAlive && !_configuration.FullPause) @@ -454,7 +454,7 @@ namespace MareSynchronos.UI if (!_configuration.FullPause) { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow); - UiShared.TextWrapped("Note: to change servers you need to pause Mare Synchronos."); + UiShared.TextWrapped("Note: to change servers you need to disconnect from your current Mare Synchronos server."); ImGui.PopStyleColor(); } @@ -462,19 +462,19 @@ namespace MareSynchronos.UI if (_configuration.HasValidSetup()) { - if (ImGui.Checkbox("Pause Mare Synchronos", ref marePaused)) + if (ImGui.Checkbox("Disconnect Mare Synchronos", ref marePaused)) { _configuration.FullPause = marePaused; _configuration.Save(); Task.Run(_apiController.CreateConnections); } - UiShared.DrawHelpText("Completely pauses the sync and clear your current data (not uploaded files) on the service."); + UiShared.DrawHelpText("Completely pauses the sync and clears your current data (not uploaded files) on the service."); } else { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow); - ImGui.TextUnformatted("You cannot resume pause without a valid account on the service."); + ImGui.TextUnformatted("You cannot reconnect without a valid account on the service."); ImGui.PopStyleColor(); } diff --git a/MareSynchronos/WebAPI/ApIController.Functions.Files.cs b/MareSynchronos/WebAPI/ApIController.Functions.Files.cs index 1e4db58..dc29e3b 100644 --- a/MareSynchronos/WebAPI/ApIController.Functions.Files.cs +++ b/MareSynchronos/WebAPI/ApIController.Functions.Files.cs @@ -24,7 +24,8 @@ namespace MareSynchronos.WebAPI { Logger.Warn("Cancelling upload"); _uploadCancellationTokenSource?.Cancel(); - _fileHub!.InvokeAsync("AbortUpload"); + _fileHub!.SendAsync("AbortUpload"); + CurrentUploads.Clear(); } } @@ -167,7 +168,7 @@ namespace MareSynchronos.WebAPI Logger.Verbose("Compressing and uploading " + file); var data = await GetCompressedFileData(file.Hash, uploadToken); CurrentUploads.Single(e => e.Hash == data.Item1).Total = data.Item2.Length; - _ = UploadFile(data.Item2, file.Hash, uploadToken); + await UploadFile(data.Item2, file.Hash, uploadToken); if (!uploadToken.IsCancellationRequested) continue; Logger.Warn("Cancel in filesToUpload loop detected"); CurrentUploads.Clear(); diff --git a/MareSynchronos/WebAPI/ApiController.Connectivity.cs b/MareSynchronos/WebAPI/ApiController.Connectivity.cs index da5f59a..a09b4fa 100644 --- a/MareSynchronos/WebAPI/ApiController.Connectivity.cs +++ b/MareSynchronos/WebAPI/ApiController.Connectivity.cs @@ -17,7 +17,7 @@ namespace MareSynchronos.WebAPI { #if DEBUG public const string MainServer = "darkarchons Debug Server (Dev Server (CH))"; - public const string MainServiceUri = "wss://darkarchon.internet-box.ch:5001"; + public const string MainServiceUri = "wss://darkarchon.internet-box.ch:5000"; #else public const string MainServer = "Lunae Crescere Incipientis (Central Server EU)"; public const string MainServiceUri = "to be defined";