mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 06:46:24 +02:00
Prevent being cut off from updates for the future.
The release channels are now provided via an API endpoint from ryujinx.app.
This commit is contained in:
parent
fa5840927a
commit
24c90a8fde
2 changed files with 70 additions and 9 deletions
|
@ -31,9 +31,9 @@ namespace Ryujinx.Ava.Systems
|
|||
{
|
||||
internal static class Updater
|
||||
{
|
||||
private static ReleaseChannels.Channel? _currentReleaseChannel;
|
||||
|
||||
private const string GitHubApiUrl = "https://api.github.com";
|
||||
private const string LatestReleaseUrl =
|
||||
$"{GitHubApiUrl}/repos/{ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}/releases/latest";
|
||||
|
||||
private static readonly GithubReleasesJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
||||
|
@ -70,13 +70,22 @@ namespace Ryujinx.Ava.Systems
|
|||
}
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, "Checking for updates.");
|
||||
|
||||
|
||||
// Get latest version number from GitHub API
|
||||
try
|
||||
{
|
||||
using HttpClient jsonClient = ConstructHttpClient();
|
||||
|
||||
string fetchedJson = await jsonClient.GetStringAsync(LatestReleaseUrl);
|
||||
if (_currentReleaseChannel == null)
|
||||
{
|
||||
ReleaseChannels releaseChannels = await ReleaseInformation.GetReleaseChannelsAsync(jsonClient);
|
||||
|
||||
_currentReleaseChannel = ReleaseInformation.IsCanaryBuild
|
||||
? releaseChannels.Canary
|
||||
: releaseChannels.Stable;
|
||||
}
|
||||
|
||||
string fetchedJson = await jsonClient.GetStringAsync(_currentReleaseChannel.Value.GetLatestReleaseApiUrl());
|
||||
GithubReleasesJsonResponse fetched = JsonHelper.Deserialize(fetchedJson, _serializerContext.GithubReleasesJsonResponse);
|
||||
_buildVer = fetched.TagName;
|
||||
|
||||
|
@ -122,7 +131,7 @@ namespace Ryujinx.Ava.Systems
|
|||
|
||||
if (userResult is UserResult.Ok)
|
||||
{
|
||||
OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion));
|
||||
OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion, _currentReleaseChannel.Value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue