forked from I2P_Developers/i2p.i2p
lots of bitchin' oOo patches (woot, thanks oOo!), plus some cleanup
* apply oOo's patch for beautifying the new console w/ links to a shitlisted peer's netDb entry * apply oOo's patch to clean up the peer shitlist count more aggressively * apply oOo's patch to allow removing lines via /configadvanced.jsp * apply oOo's patch to clean up the memory usage display * apply oOo's patch to include log messages on /logs.jsp most recent first, rather than last * get rid of the netDb key shitlist (its a bad idea, better solution coming soon)
This commit is contained in:
@ -4,6 +4,8 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Handler to deal with form submissions from the advanced config form and act
|
||||
@ -41,6 +43,7 @@ public class ConfigAdvancedHandler extends FormHandler {
|
||||
*
|
||||
*/
|
||||
private void saveChanges() {
|
||||
HashSet unsetKeys = new HashSet(_context.router().getConfigMap().keySet());
|
||||
if (_config != null) {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(_config.getBytes())));
|
||||
String line = null;
|
||||
@ -52,12 +55,19 @@ public class ConfigAdvancedHandler extends FormHandler {
|
||||
String key = line.substring(0, eq).trim();
|
||||
String val = line.substring(eq + 1).trim();
|
||||
_context.router().setConfigSetting(key, val);
|
||||
unsetKeys.remove(key);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
addFormError("Error updating the configuration (IOERROR) - please see the error logs");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Iterator cleaner = unsetKeys.iterator();
|
||||
while (cleaner.hasNext()) {
|
||||
String unsetKey = (String)cleaner.next();
|
||||
_context.router().removeConfigSetting(unsetKey);
|
||||
}
|
||||
|
||||
boolean saved = _context.router().saveConfig();
|
||||
if (saved)
|
||||
addFormNotice("Configuration saved successfully");
|
||||
|
Reference in New Issue
Block a user