diff --git a/apps/BOB/nbproject/private/private.xml b/apps/BOB/nbproject/private/private.xml index c1f155a78..685ecc5a1 100644 --- a/apps/BOB/nbproject/private/private.xml +++ b/apps/BOB/nbproject/private/private.xml @@ -1,4 +1,7 @@ + + file:/usblv/NetBeansProjects/wi2p.i2p/apps/BOB/src/net/i2p/BOB/BOB.java + diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigConsoleHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigConsoleHandler.java new file mode 100644 index 000000000..758ddae05 --- /dev/null +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigConsoleHandler.java @@ -0,0 +1,61 @@ +package net.i2p.router.web; + +/** + * Handler to deal with console config. + * + */ +public class ConfigConsoleHandler extends FormHandler { + + private boolean _forceRestart; + private boolean _shouldSave; + private String _configPass; + // This is possibly the wrong place for this... + // private String _configPort; + + @Override + protected void processForm() { + if(_shouldSave) { + saveChanges(); + } else { + // noop + } + } + + public void setShouldsave(String moo) { + _shouldSave = true; + } + + public void setRestart(String moo) { + _forceRestart = true; + } + + public void setConfigPass(String val) { + _configPass = val.trim(); + } + + /** + * The user made changes to the config and wants to save them, so + * lets go ahead and do so. + * + */ + private void saveChanges() { + if(_configPass != null) { + _context.router().setConfigSetting("consolePassword", _configPass); + } else { + _context.router().setConfigSetting("consolePassword", ""); + } + + boolean saved = _context.router().saveConfig(); + if(saved) { + addFormNotice("Configuration saved successfully"); + } else { + addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs"); + } + + if(_forceRestart) { + addFormNotice("Performing a soft restart"); + _context.router().restart(); + addFormNotice("Soft restart complete"); + } + } +} diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigConsoleHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigConsoleHelper.java new file mode 100644 index 000000000..78aac3b99 --- /dev/null +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigConsoleHelper.java @@ -0,0 +1,14 @@ +package net.i2p.router.web; + + +public class ConfigConsoleHelper extends HelperBase { + private String consolePassword="consolePassword"; + + public ConfigConsoleHelper() {} + + public String getSettings() { + StringBuilder buf = new StringBuilder(4*1024); + buf.append(consolePassword); + return buf.toString(); + } +} diff --git a/history.txt b/history.txt index 9c499ed63..6c3cf37e0 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2009-08-19 sponge + * Java code to set Router Console password for dr|z3d + 2009-08-18 dr|z3d * Fixes for sidepanel * Overhauled classic theme for i2ptunnels