1
0
Dieser Commit ist enthalten in:
Chaoscaot 2022-01-02 15:22:58 +01:00
Ursprung 8a80011a0d
Commit d7ddcb7ec4

Datei anzeigen

@ -1,6 +1,7 @@
package de.chaos.swlnmngr; package de.chaos.swlnmngr;
import de.chaos.swlnmngr.config.Config; import de.chaos.swlnmngr.config.Config;
import lombok.experimental.UtilityClass;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
@ -12,6 +13,7 @@ import org.json.JSONTokener;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@UtilityClass
public class UpdateChecker { public class UpdateChecker {
private static final URI repoUrl = URI.create("https://steamwar.de/devlabs/api/v1/repos/Chaoscaot/SteamwarLinkManager/releases?draft=false&pre-release=" + Config.PRE_RELEASES + "&page=1&limit=1"); private static final URI repoUrl = URI.create("https://steamwar.de/devlabs/api/v1/repos/Chaoscaot/SteamwarLinkManager/releases?draft=false&pre-release=" + Config.PRE_RELEASES + "&page=1&limit=1");
@ -34,7 +36,7 @@ public class UpdateChecker {
try (CloseableHttpResponse response = client.execute(get)) { try (CloseableHttpResponse response = client.execute(get)) {
JSONArray array = new JSONArray(new JSONTokener(response.getEntity().getContent())); JSONArray array = new JSONArray(new JSONTokener(response.getEntity().getContent()));
JSONObject latestObject = array.getJSONObject(0); JSONObject latestObject = array.getJSONObject(0);
String latestVersion = latestObject.getString("name"); String latestVersion = latestObject.getString("tag_name");
if(!latestVersion.equals(CURRENT_VERSION)) { if(!latestVersion.equals(CURRENT_VERSION)) {
Main.getLogger().info("The Running Jar is not the Latest release Version\n\tYour Version: {}\n\tLatest Release Version: {}", CURRENT_VERSION, latestVersion); Main.getLogger().info("The Running Jar is not the Latest release Version\n\tYour Version: {}\n\tLatest Release Version: {}", CURRENT_VERSION, latestVersion);
Main.getLogger().info("Download the Latest Jar here: https://steamwar.de/devlabs/Chaoscaot/SteamwarLinkManager/releases"); Main.getLogger().info("Download the Latest Jar here: https://steamwar.de/devlabs/Chaoscaot/SteamwarLinkManager/releases");
@ -44,8 +46,4 @@ public class UpdateChecker {
Main.getLogger().error("Could not fetch Updates", e); Main.getLogger().error("Could not fetch Updates", e);
} }
} }
public static void update() {
}
} }