diff --git a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs index 1f492474f..e0d232068 100644 --- a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs +++ b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs @@ -1,6 +1,5 @@ using Gommon; using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.Common.Models.Github; using Ryujinx.Ava.Common.Models.GitLab; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Common; @@ -8,6 +7,7 @@ using Ryujinx.Common.Helper; using Ryujinx.Common.Logging; using Ryujinx.Common.Utilities; using System; +using System.Linq; using System.Net.Http; using System.Net.Http.Json; using System.Text.Json.Serialization; @@ -41,6 +41,8 @@ namespace Ryujinx.Ava.Systems { using HttpClient jsonClient = ConstructHttpClient(); + jsonClient.Timeout = TimeSpan.FromSeconds(10); // GitLab instance is located in Ukraine. Connection times will vary across the world. + if (_currentGitLabReleaseChannel == null) { GitLabReleaseChannels releaseChannels = await GitLabReleaseChannels.GetAsync(jsonClient); @@ -55,16 +57,12 @@ namespace Ryujinx.Ava.Systems string fetchedJson = await jsonClient.GetStringAsync(_currentGitLabReleaseChannel.GetLatestReleaseApiUrl()); GitLabReleasesJsonResponse fetched = JsonHelper.Deserialize(fetchedJson, _glSerializerContext.GitLabReleasesJsonResponse); + _buildVer = fetched.TagName; - - foreach (GitLabReleaseAssetJsonResponse.GitLabReleaseAssetLinkJsonResponse asset in fetched.Assets.Links) - { - if (asset.AssetName.StartsWith("ryujinx") && asset.AssetName.EndsWith(_platformExt)) - { - _buildUrl = asset.Url; - break; - } - } + _buildUrl = fetched.Assets.Links + .FirstOrDefault(link => + link.AssetName.StartsWith("ryujinx") && link.AssetName.EndsWith(_platformExt) + )?.Url; // If build not done, assume no new update are available. if (_buildUrl is null) diff --git a/src/Ryujinx/Systems/Updater/Updater.cs b/src/Ryujinx/Systems/Updater/Updater.cs index 302c2ad15..c457176c7 100644 --- a/src/Ryujinx/Systems/Updater/Updater.cs +++ b/src/Ryujinx/Systems/Updater/Updater.cs @@ -117,6 +117,7 @@ namespace Ryujinx.Ava.Systems try { buildSizeClient.DefaultRequestHeaders.Add("Range", "bytes=0-0"); + buildSizeClient.Timeout = TimeSpan.FromSeconds(10); // GitLab instance is located in Ukraine. Connection times will vary across the world. HttpResponseMessage message = await buildSizeClient.GetAsync(new Uri(_buildUrl), HttpCompletionOption.ResponseHeadersRead);