Skip to content

Commit

Permalink
Download FRGUI prerelease versions if on a prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
CoocooFroggy committed Mar 25, 2022
1 parent 0570b44 commit 2e1d9bd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/FRUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,19 @@ public static File downloadFRGUI(MainMenu mainMenuInstance, String frguiDownload
String frguiDownloadName = null;
String frguiDownloadUrl = null;
try {
System.out.println("Finding download...");
URL releasesApiUrl = new URL("https://api.github.com/repos/CoocooFroggy/FutureRestore-GUI/releases/latest");
String releasesApiResponse = IOUtils.toString(releasesApiUrl.openConnection().getInputStream(), StandardCharsets.UTF_8);
Gson gson = new Gson();
Map<String, Object> latestReleaseApi = gson.fromJson(releasesApiResponse, Map.class);
System.out.println("Finding download...");
Map<String, Object> latestReleaseApi;
if (Main.futureRestoreGUIPrerelease) {
URL releasesApiUrl = new URL("https://api.github.com/repos/CoocooFroggy/FutureRestore-GUI/releases");
String releasesApiResponse = IOUtils.toString(releasesApiUrl.openConnection().getInputStream(), StandardCharsets.UTF_8);
ArrayList<Map<String, Object>> releasesApi = gson.fromJson(releasesApiResponse, ArrayList.class);
latestReleaseApi = releasesApi.get(0);
} else {
URL releasesApiUrl = new URL("https://api.github.com/repos/CoocooFroggy/FutureRestore-GUI/releases/latest");
String releasesApiResponse = IOUtils.toString(releasesApiUrl.openConnection().getInputStream(), StandardCharsets.UTF_8);
latestReleaseApi = gson.fromJson(releasesApiResponse, Map.class);
}

ArrayList<Map<String, Object>> assetsApi = (ArrayList<Map<String, Object>>) latestReleaseApi.get("assets");

Expand Down

0 comments on commit 2e1d9bd

Please sign in to comment.