Skip to content

Commit

Permalink
🔥 Remove code that has been obsoleted by removal of HTTP(S) downloads…
Browse files Browse the repository at this point in the history
… for official plugins
  • Loading branch information
Bombe authored and ArneBab committed Sep 9, 2023
1 parent e5dc83d commit a93c3fd
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 273 deletions.
19 changes: 1 addition & 18 deletions src/freenet/clients/fcp/LoadPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public class LoadPlugin extends FCPMessage {
private final String pluginURL;
private final String urlType;
private final boolean store;
private final boolean force;
private final boolean forceHTTPS;

public LoadPlugin(SimpleFieldSet fs) throws MessageInvalidException {
identifier = fs.get("Identifier");
Expand All @@ -51,21 +49,6 @@ public LoadPlugin(SimpleFieldSet fs) throws MessageInvalidException {
TYPENAME_URL.equalsIgnoreCase(urlType)))
throw new MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "Unknown URL type: '"+urlType+"'", identifier, false);
}
String officialSource = fs.get("OfficialSource");
if(officialSource != null) {
if(officialSource.equalsIgnoreCase("https")) {
force = true;
forceHTTPS = true;
} else if(officialSource.equalsIgnoreCase("freenet")) {
force = true;
forceHTTPS = false;
} else {
throw new MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "Unknown OfficialSource '"+officialSource+"'", identifier, false);
}
} else {
force = false;
forceHTTPS = false;
}
store = fs.getBoolean("Store", false);
}

Expand Down Expand Up @@ -124,7 +107,7 @@ public void run() {
}
PluginInfoWrapper pi;
if (TYPENAME_OFFICIAL.equals(type)) {
pi = node.pluginManager.startPluginOfficial(pluginURL, store, force, forceHTTPS);
pi = node.pluginManager.startPluginOfficial(pluginURL, store);
} else if (TYPENAME_FILE.equals(type)) {
pi = node.pluginManager.startPluginFile(pluginURL, store);
} else if (TYPENAME_FREENET.equals(type)) {
Expand Down
5 changes: 2 additions & 3 deletions src/freenet/clients/http/PproxyToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,11 @@ public void handleMethodPOST(URI uri, final HTTPRequest request, ToadletContext

if (request.isPartSet("submit-official")) {
final String pluginName = request.getPartAsStringFailsafe("plugin-name", 40);
final String pluginSource = request.getPartAsStringFailsafe("pluginSource", 10);


node.executor.execute(new Runnable() {
@Override
public void run() {
pm.startPluginOfficial(pluginName, true, true, "https".equals(pluginSource));
pm.startPluginOfficial(pluginName, true);
}
});

Expand Down
21 changes: 0 additions & 21 deletions src/freenet/clients/http/staticfiles/globalsign.pem

This file was deleted.

2 changes: 1 addition & 1 deletion src/freenet/clients/http/wizardsteps/MISC.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void setUPnP(final boolean enableUPnP) {
@Override
public void run() {
if(enable) {
core.node.pluginManager.startPluginOfficial("UPnP", true, false, false);
core.node.pluginManager.startPluginOfficial("UPnP", true);
} else {
core.node.pluginManager.killPluginByClass("plugins.UPnP.UPnP", 5000);
}
Expand Down
38 changes: 0 additions & 38 deletions src/freenet/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
import freenet.node.stats.StoreCallbackStats;
import freenet.node.updater.NodeUpdateManager;
import freenet.pluginmanager.ForwardPort;
import freenet.pluginmanager.PluginDownLoaderOfficialHTTPS;
import freenet.pluginmanager.PluginManager;
import freenet.store.BlockMetadata;
import freenet.store.CHKStore;
Expand Down Expand Up @@ -956,7 +955,6 @@ public NodeStarter getNodeStarter(){
this.shutdownHook = SemiOrderedShutdownHook.get();
// Easy stuff
String tmp = "Initializing Node using Freenet Build #"+Version.buildNumber()+" r"+Version.cvsRevision()+" and freenet-ext Build #"+NodeStarter.extBuildNumber+" r"+NodeStarter.extRevisionNumber+" with "+System.getProperty("java.vendor")+" JVM version "+System.getProperty("java.version")+" running on "+System.getProperty("os.arch")+' '+System.getProperty("os.name")+' '+System.getProperty("os.version");
fixCertsFiles();
Logger.normal(this, tmp);
System.out.println(tmp);
collector = new IOStatisticCollector();
Expand Down Expand Up @@ -2709,42 +2707,6 @@ private void deleteOldBDBIndexStoreFiles() {
}
}

private void fixCertsFiles() {
// Hack to update certificates file to fix update.cmd
// startssl.pem: Might be useful for old versions of update.sh too?
File certs = new File(PluginDownLoaderOfficialHTTPS.certfileOld);
fixCertsFile(certs);
if(FileUtil.detectedOS.isWindows) {
// updater\startssl.pem: Needed for Windows update.cmd.
certs = new File("updater", PluginDownLoaderOfficialHTTPS.certfileOld);
fixCertsFile(certs);
}
}

private void fixCertsFile(File certs) {
long oldLength = certs.exists() ? certs.length() : -1;
try {
File tmpFile = File.createTempFile(PluginDownLoaderOfficialHTTPS.certfileOld, ".tmp", new File("."));
PluginDownLoaderOfficialHTTPS.writeCertsTo(tmpFile);
if(FileUtil.renameTo(tmpFile, certs)) {
long newLength = certs.length();
if(newLength != oldLength)
System.err.println("Updated "+certs+" so that update scripts will work");
} else {
if(certs.length() != tmpFile.length()) {
System.err.println("Cannot update "+certs+" : last-resort update scripts (in particular update.cmd on Windows) may not work");
File manual = new File(PluginDownLoaderOfficialHTTPS.certfileOld+".new");
manual.delete();
if(tmpFile.renameTo(manual))
System.err.println("Please delete "+certs+" and rename "+manual+" over it");
else
tmpFile.delete();
}
}
} catch (IOException e) {
}
}

/**
** Sets up a program directory using the config value defined by the given
** parameters.
Expand Down
2 changes: 1 addition & 1 deletion src/freenet/node/TextModeClientInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ else if(uline.startsWith("PUTSSKDIR:")) {
} else if(uline.startsWith("PLUGLOAD")) {
if(uline.startsWith("PLUGLOAD:O:")) {
String name = line.substring("PLUGLOAD:O:".length()).trim();
n.pluginManager.startPluginOfficial(name, true, false, false);
n.pluginManager.startPluginOfficial(name, true);
} else if(uline.startsWith("PLUGLOAD:F:")) {
String name = line.substring("PLUGLOAD:F:".length()).trim();
n.pluginManager.startPluginFile(name, true);
Expand Down
180 changes: 0 additions & 180 deletions src/freenet/pluginmanager/PluginDownLoaderOfficialHTTPS.java

This file was deleted.

17 changes: 6 additions & 11 deletions src/freenet/pluginmanager/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public PluginInfoWrapper startPluginAuto(final String pluginname, boolean store)

OfficialPluginDescription desc;
if((desc = isOfficialPlugin(pluginname)) != null) {
return startPluginOfficial(pluginname, store, desc, false, false);
return startPluginOfficial(pluginname, store, desc);
}

try {
Expand All @@ -318,18 +318,13 @@ public PluginInfoWrapper startPluginAuto(final String pluginname, boolean store)
return startPluginURL(pluginname, store);
}

public PluginInfoWrapper startPluginOfficial(final String pluginname, boolean store, boolean force, boolean forceHTTPS) {
return startPluginOfficial(pluginname, store, officialPlugins.get(pluginname), force, forceHTTPS);
public PluginInfoWrapper startPluginOfficial(final String pluginname, boolean store) {
return startPluginOfficial(pluginname, store, officialPlugins.get(pluginname));
}

public PluginInfoWrapper startPluginOfficial(final String pluginname, boolean store, OfficialPluginDescription desc, boolean force, boolean forceHTTPS) {
if((alwaysLoadOfficialPluginsFromCentralServer && !force)|| force && forceHTTPS) {
return realStartPlugin(new PluginDownLoaderOfficialHTTPS(), pluginname, store,
desc.alwaysFetchLatestVersion);
} else {
return realStartPlugin(new PluginDownLoaderOfficialFreenet(client, node, false),
pluginname, store, desc.alwaysFetchLatestVersion);
}
public PluginInfoWrapper startPluginOfficial(final String pluginname, boolean store, OfficialPluginDescription desc) {
return realStartPlugin(new PluginDownLoaderOfficialFreenet(client, node, false),
pluginname, store, desc.alwaysFetchLatestVersion);
}

public PluginInfoWrapper startPluginFile(final String filename, boolean store) {
Expand Down

0 comments on commit a93c3fd

Please sign in to comment.