Rename IsAutoUpdateDisabled to IsAutoUpdateAllowed and env var to DISCORDCHATEXPORTER_ALLOW_AUTO_UPDATE

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/aa3944a4-e542-4770-8d17-2acb2c958ce9
This commit is contained in:
copilot-swe-agent[bot] 2026-03-21 18:11:49 +00:00
parent c61c9bef55
commit 2a291b0dff
3 changed files with 7 additions and 6 deletions

View file

@ -10,7 +10,7 @@ namespace DiscordChatExporter.Gui.Services;
public class UpdateService(SettingsService settingsService) : IDisposable public class UpdateService(SettingsService settingsService) : IDisposable
{ {
private readonly IUpdateManager? _updateManager = private readonly IUpdateManager? _updateManager =
OperatingSystem.IsWindows() && !StartOptions.Current.IsAutoUpdateDisabled OperatingSystem.IsWindows() && StartOptions.Current.IsAutoUpdateAllowed
? new UpdateManager( ? new UpdateManager(
new GithubPackageResolver( new GithubPackageResolver(
"Tyrrrz", "Tyrrrz",

View file

@ -7,7 +7,7 @@ public partial class StartOptions
{ {
public required string SettingsPath { get; init; } public required string SettingsPath { get; init; }
public required bool IsAutoUpdateDisabled { get; init; } public required bool IsAutoUpdateAllowed { get; init; }
} }
public partial class StartOptions public partial class StartOptions
@ -22,8 +22,9 @@ public partial class StartOptions
? Path.Combine(path, "Settings.dat") ? Path.Combine(path, "Settings.dat")
: path : path
: Path.Combine(AppContext.BaseDirectory, "Settings.dat"), : Path.Combine(AppContext.BaseDirectory, "Settings.dat"),
IsAutoUpdateDisabled = IsAutoUpdateAllowed =
Environment.GetEnvironmentVariable("DISCORDCHATEXPORTER_DISABLE_UPDATE") is { } v Environment.GetEnvironmentVariable("DISCORDCHATEXPORTER_ALLOW_AUTO_UPDATE") is not
&& (v == "1" || v.Equals("true", StringComparison.OrdinalIgnoreCase)), { } v
|| !(v == "0" || v.Equals("false", StringComparison.OrdinalIgnoreCase)),
}; };
} }

View file

@ -47,7 +47,7 @@ public class SettingsViewModel : DialogViewModelBase
} }
public bool IsAutoUpdateAvailable { get; } = public bool IsAutoUpdateAvailable { get; } =
OperatingSystem.IsWindows() && !StartOptions.Current.IsAutoUpdateDisabled; OperatingSystem.IsWindows() && StartOptions.Current.IsAutoUpdateAllowed;
public bool IsAutoUpdateEnabled public bool IsAutoUpdateEnabled
{ {