Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Update updater to use the stable channel as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldieeins committed Jun 5, 2024
1 parent e890852 commit 4de9d6f
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private boolean validate() {
}

public boolean update(String updateChannelId, boolean overwrite) {
boolean updated = false;
Launcher.getLogger().log("[UPDATER] Connecting to update channel "+updateChannelId+"...");
try {
JsonArray versions = new Gson().fromJson(GsonUtil.getFromURL("https://raw.githubusercontent.com/zyneonstudios/nexus-nex/main/application/index.json"), JsonObject.class).getAsJsonArray("versions");
Expand All @@ -114,7 +115,8 @@ public boolean update(String updateChannelId, boolean overwrite) {
app.delete();
} else {
Launcher.getLogger().log("[UPDATER] Version "+this.version+" is already installed! Skipping update process...");
return true;
updated = true;
break;
}
}
Launcher.getLogger().log("[UPDATER] Downloading...");
Expand All @@ -124,7 +126,8 @@ public boolean update(String updateChannelId, boolean overwrite) {
this.version = newVersion;
config.set("updater.installed.info.version", this.version);
config.set("updater.installed.info.channel", this.updateChannel);
return true;
updated = true;
break;
} else {
Launcher.getLogger().error("[UPDATER] Couldn't download new version!");
}
Expand All @@ -135,7 +138,10 @@ public boolean update(String updateChannelId, boolean overwrite) {
} catch (Exception e) {
throw new RuntimeException(e);
}
return false;
if(!updated) {
return update("stable",overwrite);
}
return updated;
}

public int launch(String updateChannelId) {
Expand Down

0 comments on commit 4de9d6f

Please sign in to comment.