diff --git a/Dalamud/Configuration/Internal/DalamudConfiguration.cs b/Dalamud/Configuration/Internal/DalamudConfiguration.cs index da0d7c2c6..9404b5b10 100644 --- a/Dalamud/Configuration/Internal/DalamudConfiguration.cs +++ b/Dalamud/Configuration/Internal/DalamudConfiguration.cs @@ -108,11 +108,6 @@ internal sealed class DalamudConfiguration : IInternalDisposableService /// public bool DoPluginTest { get; set; } = false; - /// - /// Gets or sets a key to opt into Dalamud staging builds. - /// - public string? DalamudBetaKey { get; set; } = null; - /// /// Gets or sets a list of custom repos. /// @@ -278,11 +273,6 @@ internal sealed class DalamudConfiguration : IInternalDisposableService /// public bool IsResumeGameAfterPluginLoad { get; set; } = false; - /// - /// Gets or sets the kind of beta to download when matches the server value. - /// - public string? DalamudBetaKind { get; set; } - /// /// Gets or sets a value indicating whether any plugin should be loaded when the game is started. /// It is reset immediately when read. diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index 202334580..64e1acaa4 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -182,7 +182,7 @@ internal class DalamudInterface : IInternalDisposableService () => Service.GetNullable()?.ToggleDevMenu(), VirtualKey.SHIFT); - if (!configuration.DalamudBetaKind.IsNullOrEmpty()) + if (Util.GetActiveTrack() != "release") { titleScreenMenu.AddEntryCore( Loc.Localize("TSMDalamudDevMenu", "Developer Menu"), diff --git a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs index 4e95b718e..9cc14ea14 100644 --- a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs +++ b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs @@ -6,7 +6,6 @@ using System.Net.Http.Json; using System.Threading.Tasks; using Dalamud.Bindings.ImGui; -using Dalamud.Configuration.Internal; using Dalamud.Interface.Colors; using Dalamud.Interface.Utility; using Dalamud.Interface.Windowing; @@ -15,6 +14,8 @@ using Dalamud.Utility; using Newtonsoft.Json; +using Serilog; + namespace Dalamud.Interface.Internal.Windows; /// @@ -47,7 +48,7 @@ public class BranchSwitcherWindow : Window Debug.Assert(this.branches != null, "this.branches != null"); var trackName = Util.GetActiveTrack(); - this.selectedBranchIndex = this.branches.IndexOf(x => x.Value.Track != trackName); + this.selectedBranchIndex = this.branches.IndexOf(x => x.Value.Track == trackName); if (this.selectedBranchIndex == -1) { this.selectedBranchIndex = 0; @@ -86,12 +87,9 @@ public class BranchSwitcherWindow : Window if (ImGui.Button("Pick & Restart"u8)) { - var config = Service.Get(); - config.DalamudBetaKind = pickedBranch.Key; - config.DalamudBetaKey = pickedBranch.Value.Key; - - // If we exit immediately, we need to write out the new config now - config.ForceSave(); + var newTrackName = pickedBranch.Key; + var newTrackKey = pickedBranch.Value.Key; + Log.Verbose("Switching to branch {Branch} with key {Key}", newTrackName, newTrackKey); var appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var xlPath = Path.Combine(appData, "XIVLauncher", "current", "XIVLauncher.exe"); @@ -104,8 +102,8 @@ public class BranchSwitcherWindow : Window UseShellExecute = false, }; - ps.ArgumentList.Add($"--dalamud-beta-kind={config.DalamudBetaKind}"); - ps.ArgumentList.Add($"--dalamud-beta-key={(config.DalamudBetaKey.IsNullOrEmpty() ? "invalid" : config.DalamudBetaKey)}"); + ps.ArgumentList.Add($"--dalamud-beta-kind={newTrackName}"); + ps.ArgumentList.Add($"--dalamud-beta-key={(newTrackKey.IsNullOrEmpty() ? "invalid" : newTrackKey)}"); Process.Start(ps); Environment.Exit(0); diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index b203b3894..ac092bd25 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -302,8 +302,7 @@ internal class PluginInstallerWindow : Window, IDisposable this.profileManagerWidget.Reset(); - var config = Service.Get(); - if (this.staleDalamudNewVersion == null && !config.DalamudBetaKind.IsNullOrEmpty()) + if (this.staleDalamudNewVersion == null && !Util.GetActiveTrack().IsNullOrEmpty()) { Service.Get().GetVersionForCurrentTrack().ContinueWith(t => { @@ -311,10 +310,10 @@ internal class PluginInstallerWindow : Window, IDisposable return; var versionInfo = t.Result; - if (versionInfo.AssemblyVersion != Util.GetScmVersion() && - versionInfo.Track != "release" && - string.Equals(versionInfo.Key, config.DalamudBetaKey, StringComparison.OrdinalIgnoreCase)) + if (versionInfo.AssemblyVersion != Util.GetScmVersion()) + { this.staleDalamudNewVersion = versionInfo.AssemblyVersion; + } }); } } diff --git a/Dalamud/Support/DalamudReleases.cs b/Dalamud/Support/DalamudReleases.cs index 15e851da2..603c77487 100644 --- a/Dalamud/Support/DalamudReleases.cs +++ b/Dalamud/Support/DalamudReleases.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Dalamud.Configuration.Internal; using Dalamud.Networking.Http; +using Dalamud.Utility; using Newtonsoft.Json; @@ -15,7 +16,7 @@ namespace Dalamud.Support; internal class DalamudReleases : IServiceType { private const string VersionInfoUrl = "https://kamori.goats.dev/Dalamud/Release/VersionInfo?track={0}"; - + private readonly HappyHttpClient httpClient; private readonly DalamudConfiguration config; @@ -30,20 +31,24 @@ internal class DalamudReleases : IServiceType this.httpClient = httpClient; this.config = config; } - + /// /// Get the latest version info for the current track. /// /// The version info for the current track. - public async Task GetVersionForCurrentTrack() + public async Task GetVersionForCurrentTrack() { - var url = string.Format(VersionInfoUrl, [this.config.DalamudBetaKind]); + var currentTrack = Util.GetActiveTrack(); + if (currentTrack.IsNullOrEmpty()) + return null; + + var url = string.Format(VersionInfoUrl, [currentTrack]); var response = await this.httpClient.SharedHttpClient.GetAsync(url); response.EnsureSuccessStatusCode(); var content = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject(content); } - + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "laziness")] public class DalamudVersionInfo { diff --git a/Dalamud/Support/Troubleshooting.cs b/Dalamud/Support/Troubleshooting.cs index 4af8d5ffc..88048c462 100644 --- a/Dalamud/Support/Troubleshooting.cs +++ b/Dalamud/Support/Troubleshooting.cs @@ -73,7 +73,7 @@ public static class Troubleshooting DalamudGitHash = Util.GetGitHash() ?? "Unknown", GameVersion = startInfo.GameVersion?.ToString() ?? "Unknown", Language = startInfo.Language.ToString(), - BetaKey = configuration.DalamudBetaKey, + BetaKey = Util.GetActiveTrack(), DoPluginTest = configuration.DoPluginTest, LoadAllApiLevels = pluginManager?.LoadAllApiLevels == true, InterfaceLoaded = interfaceManager?.IsReady ?? false,