Remove DalamudBetaKey, DalamudBetaKind from config

Fix all code that depends on it to use Util.GetActiveTrack() instead
This commit is contained in:
goaaats 2025-11-29 19:15:37 +01:00
parent 6367a66aad
commit d12a9ec7da
6 changed files with 24 additions and 32 deletions

View file

@ -108,11 +108,6 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
/// </summary> /// </summary>
public bool DoPluginTest { get; set; } = false; public bool DoPluginTest { get; set; } = false;
/// <summary>
/// Gets or sets a key to opt into Dalamud staging builds.
/// </summary>
public string? DalamudBetaKey { get; set; } = null;
/// <summary> /// <summary>
/// Gets or sets a list of custom repos. /// Gets or sets a list of custom repos.
/// </summary> /// </summary>
@ -278,11 +273,6 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
/// </summary> /// </summary>
public bool IsResumeGameAfterPluginLoad { get; set; } = false; public bool IsResumeGameAfterPluginLoad { get; set; } = false;
/// <summary>
/// Gets or sets the kind of beta to download when <see cref="DalamudBetaKey"/> matches the server value.
/// </summary>
public string? DalamudBetaKind { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether any plugin should be loaded when the game is started. /// Gets or sets a value indicating whether any plugin should be loaded when the game is started.
/// It is reset immediately when read. /// It is reset immediately when read.

View file

@ -182,7 +182,7 @@ internal class DalamudInterface : IInternalDisposableService
() => Service<DalamudInterface>.GetNullable()?.ToggleDevMenu(), () => Service<DalamudInterface>.GetNullable()?.ToggleDevMenu(),
VirtualKey.SHIFT); VirtualKey.SHIFT);
if (!configuration.DalamudBetaKind.IsNullOrEmpty()) if (Util.GetActiveTrack() != "release")
{ {
titleScreenMenu.AddEntryCore( titleScreenMenu.AddEntryCore(
Loc.Localize("TSMDalamudDevMenu", "Developer Menu"), Loc.Localize("TSMDalamudDevMenu", "Developer Menu"),

View file

@ -6,7 +6,6 @@ using System.Net.Http.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Configuration.Internal;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
@ -15,6 +14,8 @@ using Dalamud.Utility;
using Newtonsoft.Json; using Newtonsoft.Json;
using Serilog;
namespace Dalamud.Interface.Internal.Windows; namespace Dalamud.Interface.Internal.Windows;
/// <summary> /// <summary>
@ -47,7 +48,7 @@ public class BranchSwitcherWindow : Window
Debug.Assert(this.branches != null, "this.branches != null"); Debug.Assert(this.branches != null, "this.branches != null");
var trackName = Util.GetActiveTrack(); 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) if (this.selectedBranchIndex == -1)
{ {
this.selectedBranchIndex = 0; this.selectedBranchIndex = 0;
@ -86,12 +87,9 @@ public class BranchSwitcherWindow : Window
if (ImGui.Button("Pick & Restart"u8)) if (ImGui.Button("Pick & Restart"u8))
{ {
var config = Service<DalamudConfiguration>.Get(); var newTrackName = pickedBranch.Key;
config.DalamudBetaKind = pickedBranch.Key; var newTrackKey = pickedBranch.Value.Key;
config.DalamudBetaKey = pickedBranch.Value.Key; Log.Verbose("Switching to branch {Branch} with key {Key}", newTrackName, newTrackKey);
// If we exit immediately, we need to write out the new config now
config.ForceSave();
var appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var xlPath = Path.Combine(appData, "XIVLauncher", "current", "XIVLauncher.exe"); var xlPath = Path.Combine(appData, "XIVLauncher", "current", "XIVLauncher.exe");
@ -104,8 +102,8 @@ public class BranchSwitcherWindow : Window
UseShellExecute = false, UseShellExecute = false,
}; };
ps.ArgumentList.Add($"--dalamud-beta-kind={config.DalamudBetaKind}"); ps.ArgumentList.Add($"--dalamud-beta-kind={newTrackName}");
ps.ArgumentList.Add($"--dalamud-beta-key={(config.DalamudBetaKey.IsNullOrEmpty() ? "invalid" : config.DalamudBetaKey)}"); ps.ArgumentList.Add($"--dalamud-beta-key={(newTrackKey.IsNullOrEmpty() ? "invalid" : newTrackKey)}");
Process.Start(ps); Process.Start(ps);
Environment.Exit(0); Environment.Exit(0);

View file

@ -302,8 +302,7 @@ internal class PluginInstallerWindow : Window, IDisposable
this.profileManagerWidget.Reset(); this.profileManagerWidget.Reset();
var config = Service<DalamudConfiguration>.Get(); if (this.staleDalamudNewVersion == null && !Util.GetActiveTrack().IsNullOrEmpty())
if (this.staleDalamudNewVersion == null && !config.DalamudBetaKind.IsNullOrEmpty())
{ {
Service<DalamudReleases>.Get().GetVersionForCurrentTrack().ContinueWith(t => Service<DalamudReleases>.Get().GetVersionForCurrentTrack().ContinueWith(t =>
{ {
@ -311,10 +310,10 @@ internal class PluginInstallerWindow : Window, IDisposable
return; return;
var versionInfo = t.Result; var versionInfo = t.Result;
if (versionInfo.AssemblyVersion != Util.GetScmVersion() && if (versionInfo.AssemblyVersion != Util.GetScmVersion())
versionInfo.Track != "release" && {
string.Equals(versionInfo.Key, config.DalamudBetaKey, StringComparison.OrdinalIgnoreCase))
this.staleDalamudNewVersion = versionInfo.AssemblyVersion; this.staleDalamudNewVersion = versionInfo.AssemblyVersion;
}
}); });
} }
} }

View file

@ -3,6 +3,7 @@ using System.Threading.Tasks;
using Dalamud.Configuration.Internal; using Dalamud.Configuration.Internal;
using Dalamud.Networking.Http; using Dalamud.Networking.Http;
using Dalamud.Utility;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -15,7 +16,7 @@ namespace Dalamud.Support;
internal class DalamudReleases : IServiceType internal class DalamudReleases : IServiceType
{ {
private const string VersionInfoUrl = "https://kamori.goats.dev/Dalamud/Release/VersionInfo?track={0}"; private const string VersionInfoUrl = "https://kamori.goats.dev/Dalamud/Release/VersionInfo?track={0}";
private readonly HappyHttpClient httpClient; private readonly HappyHttpClient httpClient;
private readonly DalamudConfiguration config; private readonly DalamudConfiguration config;
@ -30,20 +31,24 @@ internal class DalamudReleases : IServiceType
this.httpClient = httpClient; this.httpClient = httpClient;
this.config = config; this.config = config;
} }
/// <summary> /// <summary>
/// Get the latest version info for the current track. /// Get the latest version info for the current track.
/// </summary> /// </summary>
/// <returns>The version info for the current track.</returns> /// <returns>The version info for the current track.</returns>
public async Task<DalamudVersionInfo> GetVersionForCurrentTrack() public async Task<DalamudVersionInfo?> 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); var response = await this.httpClient.SharedHttpClient.GetAsync(url);
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<DalamudVersionInfo>(content); return JsonConvert.DeserializeObject<DalamudVersionInfo>(content);
} }
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "laziness")] [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "laziness")]
public class DalamudVersionInfo public class DalamudVersionInfo
{ {

View file

@ -73,7 +73,7 @@ public static class Troubleshooting
DalamudGitHash = Util.GetGitHash() ?? "Unknown", DalamudGitHash = Util.GetGitHash() ?? "Unknown",
GameVersion = startInfo.GameVersion?.ToString() ?? "Unknown", GameVersion = startInfo.GameVersion?.ToString() ?? "Unknown",
Language = startInfo.Language.ToString(), Language = startInfo.Language.ToString(),
BetaKey = configuration.DalamudBetaKey, BetaKey = Util.GetActiveTrack(),
DoPluginTest = configuration.DoPluginTest, DoPluginTest = configuration.DoPluginTest,
LoadAllApiLevels = pluginManager?.LoadAllApiLevels == true, LoadAllApiLevels = pluginManager?.LoadAllApiLevels == true,
InterfaceLoaded = interfaceManager?.IsReady ?? false, InterfaceLoaded = interfaceManager?.IsReady ?? false,