/configui: Add option to embed Susimail and I2PSnark in console

This commit is contained in:
str4d
2017-10-25 09:33:20 +00:00
parent b54a5c592e
commit 47d354711e
9 changed files with 42 additions and 14 deletions

View File

@ -26,6 +26,7 @@ public class CSSHelper extends HelperBase {
public static final String PROP_DISABLE_REFRESH = "routerconsole.summaryDisableRefresh";
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
public static final String PROP_FORCE_MOBILE_CONSOLE = "routerconsole.forceMobileConsole";
public static final String PROP_EMBED_APPS = "routerconsole.embedApps";
private static final String _consoleNonce = Long.toString(RandomSource.getInstance().nextLong());
@ -51,6 +52,14 @@ public class CSSHelper extends HelperBase {
return url;
}
/**
* Returns whether app embedding is enabled or disabled
* @since 0.9.32
*/
public boolean embedApps() {
return _context.getBooleanProperty(PROP_EMBED_APPS);
}
/**
* change default language for the router AND save it
* @param lang xx OR xx_XX OR xxx OR xxx_XX

View File

@ -12,8 +12,9 @@ public class ConfigUIHandler extends FormHandler {
private boolean _shouldSave;
private boolean _universalTheming;
private boolean _forceMobileConsole;
private boolean _embedApps;
private String _config;
@Override
protected void processForm() {
if (_shouldSave) {
@ -24,17 +25,19 @@ public class ConfigUIHandler extends FormHandler {
addUser();
}
}
public void setShouldsave(String moo) { _shouldSave = true; }
public void setUniversalTheming(String baa) { _universalTheming = true; }
public void setForceMobileConsole(String baa) { _forceMobileConsole = true; }
public void setEmbedApps(String baa) { _embedApps = true; }
public void setTheme(String val) {
_config = val;
}
/** note - lang change is handled in CSSHelper but we still need to save it here */
private void saveChanges() {
if (_config == null || _config.length() <= 0)
@ -59,6 +62,10 @@ public class ConfigUIHandler extends FormHandler {
changes.put(CSSHelper.PROP_FORCE_MOBILE_CONSOLE, "true");
else
removes.add(CSSHelper.PROP_FORCE_MOBILE_CONSOLE);
if (_embedApps)
changes.put(CSSHelper.PROP_EMBED_APPS, "true");
else
removes.add(CSSHelper.PROP_EMBED_APPS);
boolean ok = _context.router().saveConfig(changes, removes);
if (ok) {
if (!oldTheme.equals(_config))

View File

@ -43,6 +43,15 @@ public class ConfigUIHelper extends HelperBase {
buf.append(CHECKED);
buf.append("value=\"1\">")
.append(_t("Force the mobile console to be used"))
.append("</label></br>\n");
boolean embedApps = _context.getBooleanProperty(CSSHelper.PROP_EMBED_APPS);
buf.append("<label title=\"")
.append(_t("Enabling the Universal Themeing option is recommended when embedding these applications"))
.append("\"><input type=\"checkbox\" name=\"embedApps\" ");
if (embedApps)
buf.append(CHECKED);
buf.append("value=\"1\">")
.append(_t("Embed I2PSnark and I2PMail in the console"))
.append("</label></div>\n");
return buf.toString();
}

View File

@ -17,7 +17,7 @@ import net.i2p.util.PortMapper;
* @since 0.9
*/
public class HomeHelper extends HelperBase {
private static final char S = ',';
private static final String I = "/themes/console/images/";
static final String PROP_SERVICES = "routerconsole.services";
@ -33,11 +33,11 @@ public class HomeHelper extends HelperBase {
_x("Configure UI") + S + _x("Select console theme & language & set optional console password").replace("&", "&amp;") + S + "/configui" + S + I + "info/ui.png" + S +
_x("Customize Home Page") + S + _x("I2P Home Page Configuration") + S + "/confighome" + S + I + "home_page.png" + S +
_x("Customize Sidebar") + S + _x("Customize the sidebar by adding or removing or repositioning elements") + S + "/configsidebar" + S + I + "info/sidebar.png" + S +
_x("Email") + S + _x("Anonymous webmail client") + S + "/susimail/susimail" + S + I + "email.png" + S +
_x("Email") + S + _x("Anonymous webmail client") + S + "/webmail" + S + I + "email.png" + S +
_x("Help") + S + _x("I2P Router Help") + S + "/help" + S + I + "support.png" + S +
_x("Manage Plugins") + S + _x("Install and configure I2P plugins") + S + "/configplugins" + S + I + "plugin.png" + S +
_x("Router Console") + S + _x("I2P Router Console") + S + "/console" + S + I + "info/console.png" + S +
_x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/i2psnark/" + S + I + "i2psnark.png" + S +
_x("Torrents") + S + _x("Built-in anonymous BitTorrent Client") + S + "/torrents" + S + I + "i2psnark.png" + S +
_x("Web Server") + S + _x("Local web server for hosting your own content on I2P") + S + "http://127.0.0.1:7658/" + S + I + "server_32x32.png" + S +
"";

View File

@ -208,13 +208,13 @@ class SummaryBarRenderer {
"<hr class=\"b\"><table id=\"sb_services\"><tr><td>" +
"<a href=\"/susimail/susimail\" target=\"_blank\" title=\"")
"<a href=\"/webmail\" target=\"_top\" title=\"")
.append(_t("Anonymous webmail client"))
.append("\">")
.append(nbsp(_t("Email")))
.append("</a>\n" +
"<a href=\"/i2psnark/\" target=\"_blank\" title=\"")
"<a href=\"/torrents\" target=\"_top\" title=\"")
.append(_t("Built-in anonymous BitTorrent Client"))
.append("\">")
.append(nbsp(_t("Torrents")))

View File

@ -6,7 +6,8 @@
<%
// CSSHelper is also pulled in by css.jsi below...
boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent"));
if (!testIFrame) {
boolean embedApp = tester.embedApps();
if (!testIFrame || !embedApp) {
response.setStatus(302);
response.setHeader("Location", "/i2psnark/");
} else {

View File

@ -6,7 +6,8 @@
<%
// CSSHelper is also pulled in by css.jsi below...
boolean testIFrame = tester.allowIFrame(request.getHeader("User-Agent"));
if (!testIFrame) {
boolean embedApp = tester.embedApps();
if (!testIFrame || !embedApp) {
response.setStatus(302);
response.setHeader("Location", "/susimail/susimail");
} else {

View File

@ -22,6 +22,7 @@
- Add additional reachability states for clockskew and vmcomm (with icons)
- Homepage: Add 'Customize Sidebar' link to signpost the feature now that
there are more optional sections available (ticket #1996)
- /configui: Add option to embed Susimail and I2PSnark in console
* I2PTunnel: Add hostname / destination (b32) information to server section on
index page (for parity with client tunnels section)
* SusiDNS:

View File

@ -688,21 +688,21 @@ p:empty + .sb_notice {
background-color: #ffe;
}
#sb_services a[href="/susimail/susimail"] {
#sb_services a[href="/susimail/susimail"], #sb_services a[href="/webmail"] {
background: #f8f8ff url(images/inbox.png) 3px center no-repeat;
background: rgba(248, 248, 255, 0.8) url(images/inbox.png) 3px center no-repeat;
}
#sb_services a[href="/susimail/susimail"]:hover {
#sb_services a[href="/susimail/susimail"]:hover, #sb_services a[href="/webmail"]:hover {
background: #ffe url(images/inbox.png) 3px center no-repeat;
}
#sb_services a[href="/i2psnark/"] {
#sb_services a[href="/i2psnark/"], #sb_services a[href="/torrents"] {
background: #f8f8ff url(/themes/console/images/i2psnark.png) 3px center no-repeat;
background: rgba(248, 248, 255, 0.8) url(/themes/console/images/i2psnark.png) 3px center no-repeat;
}
#sb_services a[href="/i2psnark/"]:hover {
#sb_services a[href="/i2psnark/"]:hover, #sb_services a[href="/torrents"]:hover {
background: #ffe url(/themes/console/images/i2psnark.png) 3px center no-repeat;
}