Skip to content

Commit

Permalink
Complete the CompletableFuture in AbstractPluginUpdater (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalshyDev authored Jan 17, 2024
1 parent fcdbd45 commit 1108163
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ public UpdateInfo parse(String result) throws MalformedURLException, URISyntaxEx
int latestVersion = data.get("buildId").getAsInt();
URL downloadURL = new URI(data.get("fileDownloadUrl").getAsString()).toURL();
String checksum = data.get("checksum").getAsString();
PrefixedVersion latest = new PrefixedVersion(releaseChannel + " - ", latestVersion);
getLatestVersion().complete(latest);

return new UpdateInfo(downloadURL, new PrefixedVersion(releaseChannel + " - ", latestVersion), checksum);
return new UpdateInfo(downloadURL, latest, checksum);
}
});
} catch (MalformedURLException | URISyntaxException e ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ public UpdateInfo parse(String result) throws MalformedURLException {
URL download = new URL(latest.get("downloadUrl").getAsString());
String remoteVersion = latest.getAsJsonObject().get("name").getAsString();
remoteVersion = remoteVersion.toLowerCase(Locale.ROOT);
SemanticVersion latestVersion = SemanticVersion.parse(remoteVersion);
getLatestVersion().complete(latestVersion);

return new UpdateInfo(download, SemanticVersion.parse(remoteVersion));
return new UpdateInfo(download, latestVersion);
}

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ public UpdateInfo parse(String result) throws MalformedURLException {

int latestVersion = json.get("last_successful").getAsInt();
URL downloadURL = new URL(API_URL + repository + '/' + CommonPatterns.SLASH.split(repository)[1] + '-' + latestVersion + ".jar");
PrefixedVersion latest = new PrefixedVersion(prefix, latestVersion);
getLatestVersion().complete(latest);

return new UpdateInfo(downloadURL, new PrefixedVersion(prefix, latestVersion));
return new UpdateInfo(downloadURL, latest);
}

});
Expand Down

0 comments on commit 1108163

Please sign in to comment.