From 318682b63aaef7906254390d8490a5131786a5a4 Mon Sep 17 00:00:00 2001 From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com> Date: Sun, 29 Jun 2025 12:20:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=89=88=E6=9C=AC=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/AssemblyInfo.cs | 4 +-- Ink Canvas/Helpers/AutoUpdateHelper.cs | 45 ++++++++++++++++++++++---- Ink Canvas/Properties/AssemblyInfo.cs | 4 +-- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/Ink Canvas/AssemblyInfo.cs b/Ink Canvas/AssemblyInfo.cs index cfc6a3d3..c52e2153 100644 --- a/Ink Canvas/AssemblyInfo.cs +++ b/Ink Canvas/AssemblyInfo.cs @@ -49,5 +49,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.0.0")] -[assembly: AssemblyFileVersion("1.7.0.0")] +[assembly: AssemblyVersion("1.7.0.1")] +[assembly: AssemblyFileVersion("1.7.0.1")] diff --git a/Ink Canvas/Helpers/AutoUpdateHelper.cs b/Ink Canvas/Helpers/AutoUpdateHelper.cs index 201cab11..3058aa97 100644 --- a/Ink Canvas/Helpers/AutoUpdateHelper.cs +++ b/Ink Canvas/Helpers/AutoUpdateHelper.cs @@ -807,17 +807,48 @@ namespace Ink_Canvas.Helpers { LogHelper.WriteLogToFile($"AutoUpdate | Starting version fix for {channel} channel"); - // 获取当前通道的最新版本 - string latestVersion = await CheckForUpdates(null, channel); + // 获取远程版本号,而不是检查更新 + string remoteVersion = null; + string proxy = null; - if (string.IsNullOrEmpty(latestVersion)) + // 根据通道选择URL + string primaryUrl, fallbackUrl; + + if (channel == UpdateChannel.Release) { - LogHelper.WriteLogToFile("AutoUpdate | No newer version found for fixing", LogHelper.LogType.Warning); + // Release通道版本信息地址 + primaryUrl = "https://github.com/InkCanvasForClass/community/raw/refs/heads/beta/AutomaticUpdateVersionControl.txt"; + fallbackUrl = "https://bgithub.xyz/InkCanvasForClass/community/raw/refs/heads/main/AutomaticUpdateVersionControl.txt"; + } + else + { + // Beta通道版本信息地址 + primaryUrl = "https://github.com/InkCanvasForClass/community-beta/raw/refs/heads/main/AutomaticUpdateVersionControl.txt"; + fallbackUrl = "https://bgithub.xyz/InkCanvasForClass/community-beta/raw/refs/heads/main/AutomaticUpdateVersionControl.txt"; + } + + LogHelper.WriteLogToFile($"AutoUpdate | Retrieving remote version from {channel} channel"); + + // 先尝试主地址 + remoteVersion = await GetRemoteVersion(primaryUrl); + + // 如果主地址失败,尝试备用地址 + if (remoteVersion == null) + { + LogHelper.WriteLogToFile($"AutoUpdate | Primary URL failed, trying fallback URL"); + remoteVersion = await GetRemoteVersion(fallbackUrl); + } + + if (string.IsNullOrEmpty(remoteVersion)) + { + LogHelper.WriteLogToFile("AutoUpdate | Failed to retrieve remote version for fixing", LogHelper.LogType.Error); return false; } - // 下载最新版本 - bool downloadResult = await DownloadSetupFileAndSaveStatus(latestVersion, "", channel); + LogHelper.WriteLogToFile($"AutoUpdate | Remote version for fixing: {remoteVersion}"); + + // 无论版本是否为最新,都下载远程版本 + bool downloadResult = await DownloadSetupFileAndSaveStatus(remoteVersion, "", channel); if (!downloadResult) { @@ -826,7 +857,7 @@ namespace Ink_Canvas.Helpers } // 执行安装,非静默模式 - InstallNewVersionApp(latestVersion, false); + InstallNewVersionApp(remoteVersion, false); // 设置为用户主动退出,避免被看门狗判定为崩溃 App.IsAppExitByUser = true; diff --git a/Ink Canvas/Properties/AssemblyInfo.cs b/Ink Canvas/Properties/AssemblyInfo.cs index ed7a4d2a..2f1690a3 100644 --- a/Ink Canvas/Properties/AssemblyInfo.cs +++ b/Ink Canvas/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.0.0")] -[assembly: AssemblyFileVersion("1.7.0.0")] +[assembly: AssemblyVersion("1.7.0.1")] +[assembly: AssemblyFileVersion("1.7.0.1")]