forked from I2P_Developers/i2p.i2p
Plugins: SU3 support in form, type checking,
don't require DSA key in SU3
This commit is contained in:
@ -43,7 +43,9 @@ class PluginUpdateHandler implements Checker, Updater {
|
|||||||
|
|
||||||
Properties props = PluginStarter.pluginProperties(_context, appName);
|
Properties props = PluginStarter.pluginProperties(_context, appName);
|
||||||
String oldVersion = props.getProperty("version");
|
String oldVersion = props.getProperty("version");
|
||||||
String xpi2pURL = props.getProperty("updateURL");
|
String xpi2pURL = props.getProperty("updateURL.su3");
|
||||||
|
if (xpi2pURL == null)
|
||||||
|
xpi2pURL = props.getProperty("updateURL");
|
||||||
List<URI> updateSources = null;
|
List<URI> updateSources = null;
|
||||||
if (xpi2pURL != null) {
|
if (xpi2pURL != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -254,6 +254,10 @@ class PluginUpdateRunner extends UpdateRunner {
|
|||||||
String signingKeyName;
|
String signingKeyName;
|
||||||
try {
|
try {
|
||||||
su3.verifyAndMigrate(to);
|
su3.verifyAndMigrate(to);
|
||||||
|
if (su3.getFileType() != SU3File.TYPE_ZIP)
|
||||||
|
throw new IOException("bad file type");
|
||||||
|
if (su3.getContentType() != SU3File.CONTENT_PLUGIN)
|
||||||
|
throw new IOException("bad content type");
|
||||||
sudVersion = su3.getVersionString();
|
sudVersion = su3.getVersionString();
|
||||||
signingKeyName = su3.getSignerString();
|
signingKeyName = su3.getSignerString();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
@ -265,9 +269,8 @@ class PluginUpdateRunner extends UpdateRunner {
|
|||||||
Properties props = getPluginConfig(f, to, url);
|
Properties props = getPluginConfig(f, to, url);
|
||||||
if (props == null)
|
if (props == null)
|
||||||
return;
|
return;
|
||||||
String pubkey = props.getProperty("key");
|
|
||||||
String signer = props.getProperty("signer");
|
String signer = props.getProperty("signer");
|
||||||
if (pubkey == null || signer == null || pubkey.length() != 172 || signer.length() <= 0) {
|
if (signer == null || signer.length() <= 0) {
|
||||||
f.delete();
|
f.delete();
|
||||||
to.delete();
|
to.delete();
|
||||||
statusDone("<b>" + _("Plugin from {0} contains an invalid key", url) + "</b>");
|
statusDone("<b>" + _("Plugin from {0} contains an invalid key", url) + "</b>");
|
||||||
@ -284,7 +287,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
|||||||
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
|
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
processFinal(to, appDir, url, props, sudVersion, pubkey, signer);
|
processFinal(to, appDir, url, props, sudVersion, null, signer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,6 +320,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param pubkey null OK for su3
|
||||||
* @since 0.9.15
|
* @since 0.9.15
|
||||||
*/
|
*/
|
||||||
private void processFinal(File to, File appDir, String url, Properties props, String sudVersion, String pubkey, String signer) {
|
private void processFinal(File to, File appDir, String url, Properties props, String sudVersion, String pubkey, String signer) {
|
||||||
@ -377,7 +381,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
|||||||
String oldPubkey = oldProps.getProperty("key");
|
String oldPubkey = oldProps.getProperty("key");
|
||||||
String oldKeyName = oldProps.getProperty("signer");
|
String oldKeyName = oldProps.getProperty("signer");
|
||||||
String oldAppName = oldProps.getProperty("name");
|
String oldAppName = oldProps.getProperty("name");
|
||||||
if ((!pubkey.equals(oldPubkey)) || (!signer.equals(oldKeyName)) || (!appName.equals(oldAppName))) {
|
if ((pubkey != null && !pubkey.equals(oldPubkey)) || (!signer.equals(oldKeyName)) || (!appName.equals(oldAppName))) {
|
||||||
to.delete();
|
to.delete();
|
||||||
statusDone("<b>" + _("Signature of downloaded plugin does not match installed plugin") + "</b>");
|
statusDone("<b>" + _("Signature of downloaded plugin does not match installed plugin") + "</b>");
|
||||||
return;
|
return;
|
||||||
|
@ -344,7 +344,9 @@ public class ConfigClientsHandler extends FormHandler {
|
|||||||
|
|
||||||
private void updatePlugin(String app) {
|
private void updatePlugin(String app) {
|
||||||
Properties props = PluginStarter.pluginProperties(_context, app);
|
Properties props = PluginStarter.pluginProperties(_context, app);
|
||||||
String url = props.getProperty("updateURL");
|
String url = props.getProperty("updateURL.su3");
|
||||||
|
if (url == null)
|
||||||
|
url = props.getProperty("updateURL");
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
addFormError(_("No update URL specified for {0}",app));
|
addFormError(_("No update URL specified for {0}",app));
|
||||||
return;
|
return;
|
||||||
|
@ -232,7 +232,9 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
desc.append("<tr><td>")
|
desc.append("<tr><td>")
|
||||||
.append("<a href=\"").append(s).append("\">").append(_("Website")).append("</a><td> ");
|
.append("<a href=\"").append(s).append("\">").append(_("Website")).append("</a><td> ");
|
||||||
}
|
}
|
||||||
String updateURL = stripHTML(appProps, "updateURL");
|
String updateURL = stripHTML(appProps, "updateURL.su3");
|
||||||
|
if (updateURL == null)
|
||||||
|
updateURL = stripHTML(appProps, "updateURL");
|
||||||
if (updateURL != null) {
|
if (updateURL != null) {
|
||||||
desc.append("<tr><td>")
|
desc.append("<tr><td>")
|
||||||
.append("<a href=\"").append(updateURL).append("\">").append(_("Update link")).append("</a><td> ");
|
.append("<a href=\"").append(updateURL).append("\">").append(_("Update link")).append("</a><td> ");
|
||||||
|
Reference in New Issue
Block a user