Checking new versions on Github

This commit is contained in:
Jindra Petřík
2018-01-08 21:50:38 +01:00
parent 5b4a0103b3
commit 527c64af26
6 changed files with 36 additions and 48 deletions

View File

@@ -53,17 +53,24 @@ public class ApplicationInfo {
public static String shortApplicationVerName;
public static final String PROJECT_PAGE = "https://www.free-decompiler.com/flash";
public static final String GIT_HUB_PROJECT = "jindrapetrik/jpexs-decompiler";
public static final String PROJECT_PAGE = "https://github.com/" + GIT_HUB_PROJECT;
/**
* URL for checking new updates
*/
public static String updateCheckUrl = "https://www.free-decompiler.com/flash/update/check/?currentVersion=<version>&currentRevision=<revision>&currentVersionMajor=<version.major>&currentVersionMinor=<version.minor>&currentVersionRelease=<version.release>&currentVersionBuild=<version.build>&currentNightly=<nightly>";
public static final String GITHUB_RELEASES_LATEST_URL = "https://api.github.com/repos/" + GIT_HUB_PROJECT + "/releases/latest";
/**
* URL for checking new updates
*/
public static final String GITHUB_RELEASES_URL = "https://api.github.com/repos/" + GIT_HUB_PROJECT + "/releases";
/**
* URL for doing update
*/
public static String updateUrl = "https://www.free-decompiler.com/flash/update/update/?currentVersion=<version>&currentRevision=<revision>&currentVersionMajor=<version.major>&currentVersionMinor=<version.minor>&currentVersionRelease=<version.release>&currentVersionBuild=<version.build>&currentNightly=<nightly>";
public static String UPDATE_URL = PROJECT_PAGE;
static {
loadProperties();
@@ -105,26 +112,6 @@ public class ApplicationInfo {
} catch (IOException | NullPointerException | NumberFormatException ex) {
// ignore
version = "unknown";
}
try {
updateCheckUrl = updateCheckUrl
.replace("<revision>", URLEncoder.encode(revision, "UTF-8"))
.replace("<version>", URLEncoder.encode(version, "UTF-8"))
.replace("<version.major>", "" + version_major)
.replace("<version.minor>", "" + version_minor)
.replace("<version.release>", "" + version_release)
.replace("<version.build>", "" + version_build)
.replace("<nightly>", nightly ? "1" : "0");
updateUrl = updateUrl
.replace("<revision>", URLEncoder.encode(revision, "UTF-8"))
.replace("<version>", URLEncoder.encode(version, "UTF-8"))
.replace("<version.major>", "" + version_major)
.replace("<version.minor>", "" + version_minor)
.replace("<version.release>", "" + version_release)
.replace("<version.build>", "" + version_build)
.replace("<nightly>", nightly ? "1" : "0");
} catch (UnsupportedEncodingException e) {
}
applicationVerName = APPLICATION_NAME + " v." + version;
shortApplicationVerName = SHORT_APPLICATION_NAME + " v." + version;