Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

velopack prepare #2798

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Flow.Launcher.Core/Flow.Launcher.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<PackageReference Include="FSharp.Core" Version="7.0.401" />
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.2.1" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageReference Include="SemanticVersioning" Version="3.0.0-beta2" />
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
<PackageReference Include="StreamJsonRpc" Version="2.17.11" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Flow.Launcher.Core/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true)
// UpdateApp CheckForUpdate will return value only if the app is squirrel installed
var newUpdateInfo = await updateManager.CheckForUpdate().NonNull().ConfigureAwait(false);

var newReleaseVersion = Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString());
var currentVersion = Version.Parse(Constant.Version);
var newReleaseVersion = SemanticVersioning.Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString());
var currentVersion = SemanticVersioning.Version.Parse(Constant.Version);

Log.Info($"|Updater.UpdateApp|Future Release <{newUpdateInfo.FutureReleaseEntry.Formatted()}>");

Expand Down Expand Up @@ -127,7 +127,7 @@ private async Task<UpdateManager> GitHubUpdateManagerAsync(string repository)
await using var jsonStream = await Http.GetStreamAsync(api).ConfigureAwait(false);

var releases = await System.Text.Json.JsonSerializer.DeserializeAsync<List<GithubRelease>>(jsonStream).ConfigureAwait(false);
var latest = releases.Where(r => !r.Prerelease).OrderByDescending(r => r.PublishedAt).First();
var latest = releases.OrderByDescending(r => r.PublishedAt).First();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimization of fetching the latest release

The current implementation fetches all releases and then sorts them to find the latest. This could be optimized by using GitHub API parameters to directly fetch the latest release, reducing the amount of data transferred and processed.

- var latest = releases.OrderByDescending(r => r.PublishedAt).First();
+ // Assuming GitHub API supports fetching only the latest release:
+ var latest = await Http.GetLatestReleaseAsync(api); // This method needs to be implemented

Consider adding error handling for the scenario where no releases are found, which could throw an exception when calling First().

Committable suggestion was skipped due to low confidence.

var latestUrl = latest.HtmlUrl.Replace("/tag/", "/download/");

var client = new WebClient
Expand Down
Loading