Fix update (#10615)

* Fix update

* Clean
This commit is contained in:
DHR60
2026-11-18 02:51:52 +00:00
committed by GitHub
parent f57b1bf479
commit e358934114
3 changed files with 97 additions and 94 deletions
+89 -89
View File
@@ -995,7 +995,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("menuClose", resourceCulture); return ResourceManager.GetString("menuClose", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 Close Connection 的本地化字符串。 /// 查找类似 Close Connection 的本地化字符串。
/// </summary> /// </summary>
@@ -1040,7 +1040,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("menuCurrentlyFrozenColumns", resourceCulture); return ResourceManager.GetString("menuCurrentlyFrozenColumns", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 Latency Test 的本地化字符串。 /// 查找类似 Latency Test 的本地化字符串。
/// </summary> /// </summary>
@@ -1193,7 +1193,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("menuFreezeToThisColumn", resourceCulture); return ResourceManager.GetString("menuFreezeToThisColumn", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 Full Config Template Setting 的本地化字符串。 /// 查找类似 Full Config Template Setting 的本地化字符串。
/// </summary> /// </summary>
@@ -1247,7 +1247,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("menuHideThisColumn", resourceCulture); return ResourceManager.GetString("menuHideThisColumn", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 Import Rules From Clipboard 的本地化字符串。 /// 查找类似 Import Rules From Clipboard 的本地化字符串。
/// </summary> /// </summary>
@@ -1832,7 +1832,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("menuShowColumns", resourceCulture); return ResourceManager.GetString("menuShowColumns", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 Show or hide the main window 的本地化字符串。 /// 查找类似 Show or hide the main window 的本地化字符串。
/// </summary> /// </summary>
@@ -2030,7 +2030,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("menuUnfreezeAllColumns", resourceCulture); return ResourceManager.GetString("menuUnfreezeAllColumns", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 {0} Website 的本地化字符串。 /// 查找类似 {0} Website 的本地化字符串。
/// </summary> /// </summary>
@@ -4949,7 +4949,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("TbSettingsTunAutoRoute", resourceCulture); return ResourceManager.GetString("TbSettingsTunAutoRoute", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 DNS mode 的本地化字符串。 /// 查找类似 DNS mode 的本地化字符串。
/// </summary> /// </summary>
@@ -5418,6 +5418,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 XDRIVE service 的本地化字符串。
/// </summary>
public static string TransportHeaderType6 {
get {
return ResourceManager.GetString("TransportHeaderType6", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 *ws/http upgrade/xhttp path 的本地化字符串。 /// 查找类似 *ws/http upgrade/xhttp path 的本地化字符串。
/// </summary> /// </summary>
@@ -5463,6 +5472,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 XDRIVE remote folder 的本地化字符串。
/// </summary>
public static string TransportPathTip6 {
get {
return ResourceManager.GetString("TransportPathTip6", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 *http host separated by commas (,) 的本地化字符串。 /// 查找类似 *http host separated by commas (,) 的本地化字符串。
/// </summary> /// </summary>
@@ -5516,79 +5534,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("UpgradeAppNotExistTip", resourceCulture); return ResourceManager.GetString("UpgradeAppNotExistTip", resourceCulture);
} }
} }
/// <summary>
/// 查找类似 Preset Provider 的本地化字符串。
/// </summary>
public static string XdriveProvider {
get {
return ResourceManager.GetString("XdriveProvider", resourceCulture);
}
}
/// <summary>
/// 查找类似 XDRIVE service 的本地化字符串。
/// </summary>
public static string XdriveService {
get {
return ResourceManager.GetString("XdriveService", resourceCulture);
}
}
/// <summary>
/// 查找类似 Remote folder 的本地化字符串。
/// </summary>
public static string XdriveRemoteFolder {
get {
return ResourceManager.GetString("XdriveRemoteFolder", resourceCulture);
}
}
/// <summary>
/// 查找类似 Secrets (comma separated) 的本地化字符串。
/// </summary>
public static string XdriveSecrets {
get {
return ResourceManager.GetString("XdriveSecrets", resourceCulture);
}
}
/// <summary>
/// 查找类似 S3 Endpoint 的本地化字符串。
/// </summary>
public static string XdriveS3Endpoint {
get {
return ResourceManager.GetString("XdriveS3Endpoint", resourceCulture);
}
}
/// <summary>
/// 查找类似 S3 Region 的本地化字符串。
/// </summary>
public static string XdriveS3Region {
get {
return ResourceManager.GetString("XdriveS3Region", resourceCulture);
}
}
/// <summary>
/// 查找类似 S3 Bucket 的本地化字符串。
/// </summary>
public static string XdriveS3Bucket {
get {
return ResourceManager.GetString("XdriveS3Bucket", resourceCulture);
}
}
/// <summary>
/// 查找类似 S3 Force Path Style 的本地化字符串。
/// </summary>
public static string XdriveS3PathStyle {
get {
return ResourceManager.GetString("XdriveS3PathStyle", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 XDRIVE Extra 的本地化字符串。 /// 查找类似 XDRIVE Extra 的本地化字符串。
/// </summary> /// </summary>
@@ -5597,7 +5543,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("XdriveExtra", resourceCulture); return ResourceManager.GetString("XdriveExtra", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 Raw JSON, format: { XdriveObject } 的本地化字符串。 /// 查找类似 Raw JSON, format: { XdriveObject } 的本地化字符串。
/// </summary> /// </summary>
@@ -5606,22 +5552,76 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("XdriveExtraTip", resourceCulture); return ResourceManager.GetString("XdriveExtraTip", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 XDRIVE service 的本地化字符串。 /// 查找类似 Preset Provider 的本地化字符串。
/// </summary> /// </summary>
public static string TransportHeaderType6 { public static string XdriveProvider {
get { get {
return ResourceManager.GetString("TransportHeaderType6", resourceCulture); return ResourceManager.GetString("XdriveProvider", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 XDRIVE remote folder 的本地化字符串。 /// 查找类似 Remote folder (remoteFolder) 的本地化字符串。
/// </summary> /// </summary>
public static string TransportPathTip6 { public static string XdriveRemoteFolder {
get { get {
return ResourceManager.GetString("TransportPathTip6", resourceCulture); return ResourceManager.GetString("XdriveRemoteFolder", resourceCulture);
}
}
/// <summary>
/// 查找类似 S3 Bucket 的本地化字符串。
/// </summary>
public static string XdriveS3Bucket {
get {
return ResourceManager.GetString("XdriveS3Bucket", resourceCulture);
}
}
/// <summary>
/// 查找类似 S3 Endpoint 的本地化字符串。
/// </summary>
public static string XdriveS3Endpoint {
get {
return ResourceManager.GetString("XdriveS3Endpoint", resourceCulture);
}
}
/// <summary>
/// 查找类似 S3 Force Path Style 的本地化字符串。
/// </summary>
public static string XdriveS3PathStyle {
get {
return ResourceManager.GetString("XdriveS3PathStyle", resourceCulture);
}
}
/// <summary>
/// 查找类似 S3 Region 的本地化字符串。
/// </summary>
public static string XdriveS3Region {
get {
return ResourceManager.GetString("XdriveS3Region", resourceCulture);
}
}
/// <summary>
/// 查找类似 Secrets (AK,SK / OAuth) 的本地化字符串。
/// </summary>
public static string XdriveSecrets {
get {
return ResourceManager.GetString("XdriveSecrets", resourceCulture);
}
}
/// <summary>
/// 查找类似 Storage service (service) 的本地化字符串。
/// </summary>
public static string XdriveService {
get {
return ResourceManager.GetString("XdriveService", resourceCulture);
} }
} }
} }
@@ -204,15 +204,18 @@ public class DownloadService : IDisposable
/// <summary> /// <summary>
/// Gets redirect target URL without following redirects automatically. /// Gets redirect target URL without following redirects automatically.
/// </summary> /// </summary>
public async Task<string?> UrlRedirectAsync(string url, CancellationToken cancellationToken = default) public async Task<string?> GetFinalUrlAsync(string url, CancellationToken cancellationToken = default)
{ {
using var client = new HttpClient(GetHandler(), false); using var client = new HttpClient(GetHandler(), false);
using var response = await client.GetAsync(url, cancellationToken);
var response = await client.GetAsync(url, cancellationToken); var originalUri = new Uri(url);
if (response.StatusCode == HttpStatusCode.Redirect && response.Headers.Location is not null) var finalUri = response.RequestMessage?.RequestUri;
if (finalUri is not null && !Uri.Equals(originalUri, finalUri))
{ {
return response.Headers.Location.ToString(); return finalUri.ToString();
} }
Error?.Invoke(this, new ErrorEventArgs(new Exception("StatusCode error: " + response.StatusCode))); Error?.Invoke(this, new ErrorEventArgs(new Exception("StatusCode error: " + response.StatusCode)));
Logging.SaveLog("StatusCode error: " + url); Logging.SaveLog("StatusCode error: " + url);
return null; return null;
+1 -1
View File
@@ -206,7 +206,7 @@ public partial class UpdateService(DownloadService downloadService, Config confi
else else
{ {
var url = Path.Combine(coreInfo.Url, "latest"); var url = Path.Combine(coreInfo.Url, "latest");
var lastUrl = await downloadService.UrlRedirectAsync(url, cancellationToken); var lastUrl = await downloadService.GetFinalUrlAsync(url, cancellationToken);
if (lastUrl == null) if (lastUrl == null)
{ {
return new UpdateResult(false, ""); return new UpdateResult(false, "");