fix: 修复更新镜像爆炸时不尝试其他镜像的问题,删掉几个爆炸的镜像

This commit is contained in:
MistEO
2023-04-07 23:23:06 +08:00
parent 2132d097d3
commit bce5175641

View File

@@ -72,7 +72,7 @@ namespace MaaWpfGui.ViewModels.UI
return Regex.Replace(text, @"([^\[`]|^)@([^\s]+)", "$1[@$2](https://github.com/$2)");
}
private readonly string _curVersion = Marshal.PtrToStringAnsi(AsstGetVersion());
private readonly string _curVersion = "v4.13.0-rc.1"; //Marshal.PtrToStringAnsi(AsstGetVersion());
private string _latestVersion;
private string _updateTag = ConfigurationHelper.GetValue(ConfigurationKeys.VersionName, string.Empty);
@@ -362,7 +362,8 @@ namespace MaaWpfGui.ViewModels.UI
{
_settingsViewModel.IsCheckingForUpdates = true;
async Task<CheckUpdateRetT> CheckUpdateInner() {
async Task<CheckUpdateRetT> CheckUpdateInner()
{
// 检查更新
var checkRet = await CheckUpdate(force);
if (checkRet != CheckUpdateRetT.OK)
@@ -464,10 +465,7 @@ namespace MaaWpfGui.ViewModels.UI
var mirroredReplaceMap = new List<Tuple<string, string>>
{
new Tuple<string, string>("github.com", "agent.imgg.dev"),
new Tuple<string, string>("https://", "https://git.114514.pro/https://"),
new Tuple<string, string>("https://", "https://ghproxy.com/https://"),
new Tuple<string, string>("github.com", "ota.maa.plus"),
new Tuple<string, string>("github.com", "download.fastgit.org"),
null,
};
@@ -475,9 +473,9 @@ namespace MaaWpfGui.ViewModels.UI
const int DownloadRetryMaxTimes = 1;
for (int i = 0; i <= DownloadRetryMaxTimes && !downloaded; i++)
{
var url = rawUrl;
foreach (var repTuple in mirroredReplaceMap)
{
var url = string.Copy(rawUrl);
if (repTuple != null)
{
url = url.Replace(repTuple.Item1, repTuple.Item2);
@@ -703,11 +701,18 @@ namespace MaaWpfGui.ViewModels.UI
private async Task<bool> DownloadGithubAssets(string url, JObject assetsObject)
{
_logItemViewModels = _taskQueueViewModel.LogItemViewModels;
return await _httpService.DownloadFileAsync(
new Uri(url),
assetsObject["name"].ToString(),
assetsObject["content_type"].ToString())
.ConfigureAwait(false);
try
{
return await _httpService.DownloadFileAsync(
new Uri(url),
assetsObject["name"].ToString(),
assetsObject["content_type"].ToString())
.ConfigureAwait(false);
}
catch (Exception)
{
return false;
}
}
private static ObservableCollection<LogItemViewModel> _logItemViewModels = null;