diff --git a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java index aee8212fa385cd28a1b973a4b0765444024dda48..25a0f9a03140057c425a3aebe5552a39bc26a4f7 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java +++ b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java @@ -289,7 +289,14 @@ public class SnarkManager implements Snark.CompleteListener { if (!_config.containsKey(PROP_STARTUP_DELAY)) _config.setProperty(PROP_STARTUP_DELAY, Integer.toString(DEFAULT_STARTUP_DELAY)); // Fetch theme - _theme = _context.readConfigFile(THEME_CONFIG_FILE).getProperty(PROP_THEME, DEFAULT_THEME); + Properties themeProps = _context.readConfigFile(THEME_CONFIG_FILE); + _theme = themeProps.getProperty(PROP_THEME); + // Ensure that theme config line exists in config file + if (_theme == null) { + _theme = DEFAULT_THEME; + themeProps.put(PROP_THEME, _theme); + _context.writeConfigFile(THEME_CONFIG_FILE, themeProps); + } updateConfig(); } /** diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUIHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUIHandler.java index a9d1c4a04c28cff47ce4923eee8f00da2dd00707..6599ffbeaf3c8cda980fb4f34bd21fb75ea32b50 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigUIHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigUIHandler.java @@ -29,16 +29,17 @@ public class ConfigUIHandler extends FormHandler { return; Properties props = _context.readConfigFile(CSSHelper.THEME_CONFIG_FILE); String oldTheme = props.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME); + // Save routerconsole theme first to ensure it is in config file + if (_config.equals("default")) // obsolete + props.put(CSSHelper.PROP_THEME_NAME, null); + else + props.put(CSSHelper.PROP_THEME_NAME, _config); if (_universalTheming) { + // The routerconsole theme gets set again, but oh well for (Iterator it = props.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); props.put(key, _config); } - } else { - if (_config.equals("default")) // obsolete - props.put(CSSHelper.PROP_THEME_NAME, null); - else - props.put(CSSHelper.PROP_THEME_NAME, _config); } boolean ok = _context.writeConfigFile(CSSHelper.THEME_CONFIG_FILE, props); if (ok) { diff --git a/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java b/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java index 7d229cd84133694716e83ccfc2f0327705da6c4b..e157c745a3168e84b01fb52823104c6271287c8e 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/BaseBean.java @@ -47,7 +47,14 @@ public class BaseBean if( properties.getProperty(PRIVATE_BOOK) == null) properties.setProperty(PRIVATE_BOOK, DEFAULT_PRIVATE_BOOK); // Fetch theme - _theme = _context.readConfigFile(THEME_CONFIG_FILE).getProperty(PROP_THEME_NAME, DEFAULT_THEME); + Properties themeProps = _context.readConfigFile(THEME_CONFIG_FILE); + _theme = themeProps.getProperty(PROP_THEME_NAME); + // Ensure that theme config line exists in config file + if (_theme == null) { + _theme = DEFAULT_THEME; + themeProps.put(PROP_THEME_NAME, _theme); + _context.writeConfigFile(THEME_CONFIG_FILE, themeProps); + } configLastLoaded = currentTime; } catch (Exception e) { diff --git a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java index 1b47352a28027a23c5ff52d19da6d56411cbc1a3..113f97bb07900b8667099318f4e314220921080b 100644 --- a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java +++ b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java @@ -49,6 +49,7 @@ import java.util.Enumeration; import java.util.Iterator; import java.util.ListIterator; import java.util.Locale; +import java.util.Properties; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -1190,6 +1191,15 @@ public class WebMail extends HttpServlet private void processRequest( HttpServletRequest httpRequest, HttpServletResponse response ) throws IOException, ServletException { + Properties themeProps = I2PAppContext.getGlobalContext().readConfigFile(THEME_CONFIG_FILE); + String theme = themeProps.getProperty(PROP_THEME); + // Ensure that theme config line exists in config file + if (theme == null) { + theme = DEFAULT_THEME; + themeProps.put(PROP_THEME, theme); + I2PAppContext.getGlobalContext().writeConfigFile(THEME_CONFIG_FILE, themeProps); + } + httpRequest.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setHeader("X-Frame-Options", "SAMEORIGIN"); @@ -1209,7 +1219,7 @@ public class WebMail extends HttpServlet sessionObject.info = ""; sessionObject.pageChanged = false; sessionObject.showAttachment = null; - sessionObject.themePath = "/themes/susimail/" + I2PAppContext.getGlobalContext().readConfigFile(THEME_CONFIG_FILE).getProperty(PROP_THEME, DEFAULT_THEME) + '/'; + sessionObject.themePath = "/themes/susimail/" + theme + '/'; sessionObject.imgPath = sessionObject.themePath + "images/"; processStateChangeButtons( sessionObject, request );