forked from I2P_Developers/i2p.i2p
Update: Require Java 7 to download dev builds
This commit is contained in:
@ -10,8 +10,10 @@ import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterVersion;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.update.*;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.PartialEepGet;
|
||||
import net.i2p.util.PortMapper;
|
||||
import net.i2p.util.SystemVersion;
|
||||
import net.i2p.util.VersionComparator;
|
||||
|
||||
/**
|
||||
@ -73,8 +75,15 @@ class DevSU3UpdateChecker extends UpdateRunner {
|
||||
String newVersion = TrustedUpdate.getVersionString(new ByteArrayInputStream(_baos.toByteArray()));
|
||||
boolean newer = VersionComparator.comp(newVersion, RouterVersion.FULL_VERSION) > 0;
|
||||
if (newer) {
|
||||
_mgr.notifyVersionAvailable(this, _currentURI, UpdateType.ROUTER_DEV_SU3, "", UpdateMethod.HTTP,
|
||||
if (SystemVersion.isJava7()) {
|
||||
_mgr.notifyVersionAvailable(this, _currentURI, UpdateType.ROUTER_DEV_SU3, "", UpdateMethod.HTTP,
|
||||
_urls, newVersion, RouterVersion.FULL_VERSION);
|
||||
} else {
|
||||
String ourJava = System.getProperty("java.version");
|
||||
String msg = _mgr._t("Requires Java version {0} but installed Java version is {1}", "1.7", ourJava);
|
||||
_log.logAlways(Log.WARN, "Cannot update to version " + newVersion + ": " + msg);
|
||||
_mgr.notifyVersionConstraint(this, _currentURI, UpdateType.ROUTER_DEV_SU3, "", newVersion, msg);
|
||||
}
|
||||
} else {
|
||||
//updateStatus("<b>" + _t("No new version found at {0}", linkify(url)) + "</b>");
|
||||
if (_log.shouldWarn())
|
||||
|
@ -8,7 +8,9 @@ import net.i2p.router.util.RFC822Date;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.update.*;
|
||||
import net.i2p.util.EepHead;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.PortMapper;
|
||||
import net.i2p.util.SystemVersion;
|
||||
|
||||
/**
|
||||
* Does a simple EepHead to get the last-modified header.
|
||||
@ -76,9 +78,17 @@ class UnsignedUpdateChecker extends UpdateRunner {
|
||||
if (modtime <= 0) return false;
|
||||
if (_ms <= 0) return false;
|
||||
if (modtime > _ms) {
|
||||
_unsignedUpdateAvailable = true;
|
||||
_mgr.notifyVersionAvailable(this, _urls.get(0), getType(), "", getMethod(), _urls,
|
||||
Long.toString(modtime), "");
|
||||
String newVersion = Long.toString(modtime);
|
||||
if (SystemVersion.isJava7()) {
|
||||
_unsignedUpdateAvailable = true;
|
||||
_mgr.notifyVersionAvailable(this, _urls.get(0), getType(), "", getMethod(), _urls,
|
||||
newVersion, "");
|
||||
} else {
|
||||
String ourJava = System.getProperty("java.version");
|
||||
String msg = _mgr._t("Requires Java version {0} but installed Java version is {1}", "1.7", ourJava);
|
||||
_log.logAlways(Log.WARN, "Cannot update to version " + newVersion + ": " + msg);
|
||||
_mgr.notifyVersionConstraint(this, _urls.get(0), getType(), "", newVersion, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -99,6 +99,28 @@ public class NewsHelper extends ContentHelper {
|
||||
return mgr.getUpdateConstraint(ROUTER_SIGNED, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Translated message about new version available but constrained
|
||||
* @return null if none
|
||||
* @since 0.9.23
|
||||
*/
|
||||
public static String unsignedUpdateConstraint() {
|
||||
ConsoleUpdateManager mgr = ConsoleUpdateManager.getInstance();
|
||||
if (mgr == null) return null;
|
||||
return mgr.getUpdateConstraint(ROUTER_UNSIGNED, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Translated message about new version available but constrained
|
||||
* @return null if none
|
||||
* @since 0.9.23
|
||||
*/
|
||||
public static String devSU3UpdateConstraint() {
|
||||
ConsoleUpdateManager mgr = ConsoleUpdateManager.getInstance();
|
||||
if (mgr == null) return null;
|
||||
return mgr.getUpdateConstraint(ROUTER_DEV_SU3, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Release update only.
|
||||
* Already downloaded but not installed version.
|
||||
|
@ -724,6 +724,8 @@ public class SummaryHelper extends HelperBase {
|
||||
boolean unsignedAvail = unsignedUpdateAvailable();
|
||||
boolean devSU3Avail = devSU3UpdateAvailable();
|
||||
String constraint = avail ? NewsHelper.updateConstraint() : null;
|
||||
String unsignedConstraint = unsignedAvail ? NewsHelper.unsignedUpdateConstraint() : null;
|
||||
String devSU3Constraint = devSU3Avail ? NewsHelper.devSU3UpdateConstraint() : null;
|
||||
if (avail && constraint != null &&
|
||||
!NewsHelper.isUpdateInProgress() &&
|
||||
!_context.router().gracefulShutdownInProgress()) {
|
||||
@ -736,6 +738,30 @@ public class SummaryHelper extends HelperBase {
|
||||
buf.append(constraint).append("</b></h4>");
|
||||
avail = false;
|
||||
}
|
||||
if (unsignedAvail && unsignedConstraint != null &&
|
||||
!NewsHelper.isUpdateInProgress() &&
|
||||
!_context.router().gracefulShutdownInProgress()) {
|
||||
if (needSpace)
|
||||
buf.append("<hr>");
|
||||
else
|
||||
needSpace = true;
|
||||
buf.append("<h4><b>").append(_t("Update available")).append(":<br>");
|
||||
buf.append(_t("Version {0}", getUnsignedUpdateVersion())).append("<br>");
|
||||
buf.append(unsignedConstraint).append("</b></h4>");
|
||||
unsignedAvail = false;
|
||||
}
|
||||
if (devSU3Avail && devSU3Constraint != null &&
|
||||
!NewsHelper.isUpdateInProgress() &&
|
||||
!_context.router().gracefulShutdownInProgress()) {
|
||||
if (needSpace)
|
||||
buf.append("<hr>");
|
||||
else
|
||||
needSpace = true;
|
||||
buf.append("<h4><b>").append(_t("Update available")).append(":<br>");
|
||||
buf.append(_t("Version {0}", getDevSU3UpdateVersion())).append("<br>");
|
||||
buf.append(devSU3Constraint).append("</b></h4>");
|
||||
devSU3Avail = false;
|
||||
}
|
||||
if ((avail || unsignedAvail || devSU3Avail) &&
|
||||
!NewsHelper.isUpdateInProgress() &&
|
||||
!_context.router().gracefulShutdownInProgress() &&
|
||||
|
Reference in New Issue
Block a user