mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Remove DalamudBetaKey, DalamudBetaKind from config
Fix all code that depends on it to use Util.GetActiveTrack() instead
This commit is contained in:
parent
6367a66aad
commit
d12a9ec7da
6 changed files with 24 additions and 32 deletions
|
|
@ -108,11 +108,6 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
|
|||
/// </summary>
|
||||
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>
|
||||
/// Gets or sets a list of custom repos.
|
||||
/// </summary>
|
||||
|
|
@ -278,11 +273,6 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
|
|||
/// </summary>
|
||||
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>
|
||||
/// Gets or sets a value indicating whether any plugin should be loaded when the game is started.
|
||||
/// It is reset immediately when read.
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ internal class DalamudInterface : IInternalDisposableService
|
|||
() => Service<DalamudInterface>.GetNullable()?.ToggleDevMenu(),
|
||||
VirtualKey.SHIFT);
|
||||
|
||||
if (!configuration.DalamudBetaKind.IsNullOrEmpty())
|
||||
if (Util.GetActiveTrack() != "release")
|
||||
{
|
||||
titleScreenMenu.AddEntryCore(
|
||||
Loc.Localize("TSMDalamudDevMenu", "Developer Menu"),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -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<DalamudConfiguration>.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);
|
||||
|
|
|
|||
|
|
@ -302,8 +302,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
this.profileManagerWidget.Reset();
|
||||
|
||||
var config = Service<DalamudConfiguration>.Get();
|
||||
if (this.staleDalamudNewVersion == null && !config.DalamudBetaKind.IsNullOrEmpty())
|
||||
if (this.staleDalamudNewVersion == null && !Util.GetActiveTrack().IsNullOrEmpty())
|
||||
{
|
||||
Service<DalamudReleases>.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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the latest version info for the current track.
|
||||
/// </summary>
|
||||
/// <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);
|
||||
response.EnsureSuccessStatusCode();
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
return JsonConvert.DeserializeObject<DalamudVersionInfo>(content);
|
||||
}
|
||||
|
||||
|
||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "laziness")]
|
||||
public class DalamudVersionInfo
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue