Merge branch 'development' into feature/release-candidate

This commit is contained in:
Jeroen Ketelaar
2016-10-18 21:02:50 +02:00
committed by GitHub
3 changed files with 22 additions and 14 deletions
+1 -12
View File
@@ -44,18 +44,7 @@ public final class Landing {
}
if (!Core.inDebugMode() && Core.hasValidation() && !Core.isValid()) {
UILog.log(TranslationHelper.translate("UPDATES"),
TranslationHelper.translate("DOWNLOAD_UPDATE_PARABOT_AT")
+ Configuration.DOWNLOAD_BOT,
JOptionPane.INFORMATION_MESSAGE);
URI uri = URI.create(Configuration.API_DOWNLOAD_BOT);
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
JOptionPane.showMessageDialog(null, TranslationHelper.translate("CONNECTION_ERROR"),
TranslationHelper.translate("ERROR"), JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
Core.downloadNewVersion();
return;
}
@@ -16,7 +16,7 @@ public class Configuration extends org.parabot.api.Configuration {
public static final String GET_SERVER_PROVIDER_INFO = "http://bdn.parabot.org/api/get.php?action=server_information&name=";
public static final String GET_SERVER_SETTINGS = "http://bdn.parabot.org/api/get.php?action=get_settings";
public static final String GET_BOT_VERSION = "http://bdn.parabot.org/api/v2/bot/version";
public static final String API_DOWNLOAD_BOT = "http://bdn.parabot.org/api/v2/bot/download/client/";
public static final String API_DOWNLOAD_BOT = "http://v3.bdn.parabot.org/api/bot/download/client";
public static final String DOWNLOAD_BOT = "http://bdn.parabot.org/versions/";
public static final String REGISTRATION_PAGE = "https://www.parabot.org/community/register/";
public static final String GET_RANDOMS = "http://v3.bdn.parabot.org/api/bot/download/randoms";
@@ -25,5 +25,5 @@ public class Configuration extends org.parabot.api.Configuration {
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
public static final String NIGHTLY_APPEND = "nightly=true";
public static final String NIGHTLY_APPEND = "?nightly=true";
}
+19
View File
@@ -3,15 +3,19 @@ package org.parabot.core;
import org.json.simple.JSONObject;
import org.json.simple.parser.ParseException;
import org.parabot.Landing;
import org.parabot.api.translations.TranslationHelper;
import org.parabot.core.ui.utils.UILog;
import org.parabot.environment.api.utils.Version;
import org.parabot.environment.api.utils.WebUtil;
import javax.swing.*;
import java.awt.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.security.MessageDigest;
@@ -229,6 +233,21 @@ public class Core {
}
}
public static void downloadNewVersion(){
UILog.log(TranslationHelper.translate("UPDATES"),
TranslationHelper.translate("DOWNLOAD_UPDATE_PARABOT_AT")
+ Configuration.DOWNLOAD_BOT + (currentVersion.isNightly() ? Configuration.NIGHTLY_APPEND : ""),
JOptionPane.INFORMATION_MESSAGE);
URI uri = URI.create(Configuration.API_DOWNLOAD_BOT + (currentVersion.isNightly() ? Configuration.NIGHTLY_APPEND : ""));
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
JOptionPane.showMessageDialog(null, TranslationHelper.translate("CONNECTION_ERROR"),
TranslationHelper.translate("ERROR"), JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
}
/**
* Checks for updates.
*