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
+78 -78
View File
@@ -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>
@@ -5517,78 +5535,6 @@ namespace ServiceLib.Resx {
} }
} }
/// <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>
@@ -5608,20 +5554,74 @@ namespace ServiceLib.Resx {
} }
/// <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, "");