Split up /configclients, add /configi2cp, /configplugins, /configwebappsx

(ticket #1804)
This commit is contained in:
zzz
2016-06-16 15:24:24 +00:00
parent e146480401
commit e6f111c5fc
6 changed files with 212 additions and 120 deletions

View File

@ -19,12 +19,14 @@ public class ConfigNavHelper extends HelperBase {
private static final String pages[] = private static final String pages[] =
{"", "net", "ui", "sidebar", "home", "service", "update", "tunnels", {"", "net", "ui", "sidebar", "home", "service", "update", "tunnels",
"clients", "peer", "keyring", "logging", "stats", "clients", "peer", "keyring", "logging", "stats",
"i2cp", "plugins", "webapps",
"reseed", "advanced", "family" }; "reseed", "advanced", "family" };
private static final String titles[] = private static final String titles[] =
{_x("Bandwidth"), _x("Network"), _x("UI"), _x("Summary Bar"), _x("Home Page"), {_x("Bandwidth"), _x("Network"), _x("UI"), _x("Summary Bar"), _x("Home Page"),
_x("Service"), _x("Update"), _x("Tunnels"), _x("Service"), _x("Update"), _x("Tunnels"),
_x("Clients"), _x("Peers"), _x("Keyring"), _x("Logging"), _x("Stats"), _x("Clients"), _x("Peers"), _x("Keyring"), _x("Logging"), _x("Stats"),
_x("I2CP"), _x("Plugins"), _x("Web Apps"),
_x("Reseeding"), _x("Advanced"), _x("Router Family") }; _x("Reseeding"), _x("Advanced"), _x("Router Family") };
/** @since 0.9.19 */ /** @since 0.9.19 */
@ -61,7 +63,10 @@ public class ConfigNavHelper extends HelperBase {
if (!span) if (!span)
buf.append("<center>"); buf.append("<center>");
List<Tab> tabs = new ArrayList<Tab>(pages.length); List<Tab> tabs = new ArrayList<Tab>(pages.length);
boolean hidePlugins = !PluginStarter.pluginsEnabled(_context);
for (int i = 0; i < pages.length; i++) { for (int i = 0; i < pages.length; i++) {
if (hidePlugins && pages[i].equals("plugins"))
continue;
tabs.add(new Tab(pages[i], _t(titles[i]))); tabs.add(new Tab(pages[i], _t(titles[i])));
} }
Collections.sort(tabs, new TabComparator()); Collections.sort(tabs, new TabComparator());

View File

@ -44,123 +44,4 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
<% } %> <% } %>
<input type="submit" class="accept" name="action" value="<%=intl._t("Save Client Configuration")%>" /> <input type="submit" class="accept" name="action" value="<%=intl._t("Save Client Configuration")%>" />
</div></form></div> </div></form></div>
<h3><a name="i2cp"></a><%=intl._t("Advanced Client Interface Configuration")%></h3>
<form action="" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<p>
<b><%=intl._t("External I2CP (I2P Client Protocol) Interface Configuration")%></b><br>
<input type="radio" class="optbox" name="mode" value="1" <%=clientshelper.i2cpModeChecked(1) %> >
<%=intl._t("Enabled without SSL")%><br>
<input type="radio" class="optbox" name="mode" value="2" <%=clientshelper.i2cpModeChecked(2) %> >
<%=intl._t("Enabled with SSL required")%><br>
<input type="radio" class="optbox" name="mode" value="0" <%=clientshelper.i2cpModeChecked(0) %> >
<%=intl._t("Disabled - Clients outside this Java process may not connect")%><br>
<%=intl._t("I2CP Interface")%>:
<select name="interface">
<%
String[] ips = clientshelper.intfcAddresses();
for (int i = 0; i < ips.length; i++) {
out.print("<option value=\"");
out.print(ips[i]);
out.print('\"');
if (clientshelper.isIFSelected(ips[i]))
out.print(" selected=\"selected\"");
out.print('>');
out.print(ips[i]);
out.print("</option>\n");
}
%>
</select><br>
<%=intl._t("I2CP Port")%>:
<input name="port" type="text" size="5" maxlength="5" value="<jsp:getProperty name="clientshelper" property="port" />" ><br>
<b><%=intl._t("Authorization")%></b><br>
<input type="checkbox" class="optbox" name="auth" value="true" <jsp:getProperty name="clientshelper" property="auth" /> >
<%=intl._t("Require username and password")%><br>
<%=intl._t("Username")%>:
<input name="user" type="text" value="" /><br>
<%=intl._t("Password")%>:
<input name="nofilter_pw" type="password" value="" /><br>
</p><p><b><%=intl._t("The default settings will work for most people.")%></b>
<%=intl._t("Any changes made here must also be configured in the external client.")%>
<%=intl._t("Many clients do not support SSL or authorization.")%>
<i><%=intl._t("All changes require restart to take effect.")%></i>
</p><hr><div class="formaction">
<input type="submit" class="default" name="action" value="<%=intl._t("Save Interface Configuration")%>" />
<input type="submit" class="cancel" name="foo" value="<%=intl._t("Cancel")%>" />
<input type="submit" class="accept" name="action" value="<%=intl._t("Save Interface Configuration")%>" />
</div></form>
<h3><a name="webapp"></a><%=intl._t("WebApp Configuration")%></h3><p>
<%=intl._t("The Java web applications listed below are started by the webConsole client and run in the same JVM as the router. They are usually web applications accessible through the router console. They may be complete applications (e.g. i2psnark),front-ends to another client or application which must be separately enabled (e.g. susidns, i2ptunnel), or have no web interface at all (e.g. addressbook).")%>
</p><p>
<%=intl._t("A web app may also be disabled by removing the .war file from the webapps directory; however the .war file and web app will reappear when you update your router to a newer version, so disabling the web app here is the preferred method.")%>
</p><div class="wideload">
<form action="configclients" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<jsp:getProperty name="clientshelper" property="form2" />
<p><i><%=intl._t("All changes require restart to take effect.")%></i>
</p><hr><div class="formaction">
<input type="submit" class="cancel" name="foo" value="<%=intl._t("Cancel")%>" />
<input type="submit" name="action" class="accept" value="<%=intl._t("Save WebApp Configuration")%>" />
</div></form></div>
<%
if (clientshelper.showPlugins()) {
if (clientshelper.isPluginUpdateEnabled()) {
%>
<h3><a name="pconfig"></a><%=intl._t("Plugin Configuration")%></h3><p>
<%=intl._t("The plugins listed below are started by the webConsole client.")%>
</p><div class="wideload">
<form action="" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<jsp:getProperty name="clientshelper" property="form3" />
<div class="formaction">
<input type="submit" class="cancel" name="foo" value="<%=intl._t("Cancel")%>" />
<input type="submit" name="action" class="accept" value="<%=intl._t("Save Plugin Configuration")%>" />
</div></form></div>
<%
} // pluginUpdateEnabled
if (clientshelper.isPluginInstallEnabled()) {
%>
<h3><a name="plugin"></a><%=intl._t("Plugin Installation from URL")%></h3><p>
<%=intl._t("Look for available plugins on {0}.", "<a href=\"http://i2pwiki.i2p/index.php?title=Plugins\">i2pwiki.i2p</a>")%>
<%=intl._t("To install a plugin, enter the download URL:")%>
</p>
<div class="wideload">
<form action="configclients" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<p>
<input type="text" size="60" name="pluginURL" >
</p><hr><div class="formaction">
<input type="submit" name="action" class="default" value="<%=intl._t("Install Plugin")%>" />
<input type="submit" class="cancel" name="foo" value="<%=intl._t("Cancel")%>" />
<input type="submit" name="action" class="download" value="<%=intl._t("Install Plugin")%>" />
</div></form></div>
<div class="wideload">
<h3><a name="plugin"></a><%=intl._t("Plugin Installation from File")%></h3>
<form action="configclients" method="POST" enctype="multipart/form-data" accept-charset="UTF-8">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<p><%=intl._t("Install plugin from file.")%>
<br><%=intl._t("Select xpi2p or su3 file")%> :
<input type="file" name="pluginFile" >
</p><hr><div class="formaction">
<input type="submit" name="action" class="download" value="<%=intl._t("Install Plugin from File")%>" />
</div></form></div>
<%
} // pluginInstallEnabled
if (clientshelper.isPluginUpdateEnabled()) {
%>
<h3><a name="plugin"></a><%=intl._t("Update All Plugins")%></h3>
<div class="formaction">
<form action="configclients" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<input type="submit" name="action" class="reload" value="<%=intl._t("Update All Installed Plugins")%>" />
</form></div>
<%
} // pluginUpdateEnabled
} // showPlugins
%>
</div></div></body></html> </div></div></body></html>

View File

@ -0,0 +1,75 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<%@include file="css.jsi" %>
<%=intl.title("config clients")%>
<style type='text/css'>
button span.hide{
display:none;
}
input.default { width: 1px; height: 1px; visibility: hidden; }
</style>
<script src="/js/ajax.js" type="text/javascript"></script>
<%@include file="summaryajax.jsi" %>
</head><body onload="initAjax()">
<%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigClientsHelper" id="clientshelper" scope="request" />
<jsp:setProperty name="clientshelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
<jsp:setProperty name="clientshelper" property="edit" value="<%=request.getParameter(\"edit\")%>" />
<h1><%=intl._t("I2P Client Configuration")%></h1>
<div class="main" id="main">
<%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigClientsHandler" id="formhandler" scope="request" />
<%@include file="formhandler.jsi" %>
<div class="configure">
<h3><a name="i2cp"></a><%=intl._t("Advanced Client Interface Configuration")%></h3>
<form action="configi2cp" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<p>
<b><%=intl._t("External I2CP (I2P Client Protocol) Interface Configuration")%></b><br>
<input type="radio" class="optbox" name="mode" value="1" <%=clientshelper.i2cpModeChecked(1) %> >
<%=intl._t("Enabled without SSL")%><br>
<input type="radio" class="optbox" name="mode" value="2" <%=clientshelper.i2cpModeChecked(2) %> >
<%=intl._t("Enabled with SSL required")%><br>
<input type="radio" class="optbox" name="mode" value="0" <%=clientshelper.i2cpModeChecked(0) %> >
<%=intl._t("Disabled - Clients outside this Java process may not connect")%><br>
<%=intl._t("I2CP Interface")%>:
<select name="interface">
<%
String[] ips = clientshelper.intfcAddresses();
for (int i = 0; i < ips.length; i++) {
out.print("<option value=\"");
out.print(ips[i]);
out.print('\"');
if (clientshelper.isIFSelected(ips[i]))
out.print(" selected=\"selected\"");
out.print('>');
out.print(ips[i]);
out.print("</option>\n");
}
%>
</select><br>
<%=intl._t("I2CP Port")%>:
<input name="port" type="text" size="5" maxlength="5" value="<jsp:getProperty name="clientshelper" property="port" />" ><br>
<b><%=intl._t("Authorization")%></b><br>
<input type="checkbox" class="optbox" name="auth" value="true" <jsp:getProperty name="clientshelper" property="auth" /> >
<%=intl._t("Require username and password")%><br>
<%=intl._t("Username")%>:
<input name="user" type="text" value="" /><br>
<%=intl._t("Password")%>:
<input name="nofilter_pw" type="password" value="" /><br>
</p><p><b><%=intl._t("The default settings will work for most people.")%></b>
<%=intl._t("Any changes made here must also be configured in the external client.")%>
<%=intl._t("Many clients do not support SSL or authorization.")%>
<i><%=intl._t("All changes require restart to take effect.")%></i>
</p><hr><div class="formaction">
<input type="submit" class="default" name="action" value="<%=intl._t("Save Interface Configuration")%>" />
<input type="submit" class="cancel" name="foo" value="<%=intl._t("Cancel")%>" />
<input type="submit" class="accept" name="action" value="<%=intl._t("Save Interface Configuration")%>" />
</div></form>
</div></div></body></html>

View File

@ -0,0 +1,88 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<%@include file="css.jsi" %>
<%=intl.title("config plugins")%>
<style type='text/css'>
button span.hide{
display:none;
}
input.default { width: 1px; height: 1px; visibility: hidden; }
</style>
<script src="/js/ajax.js" type="text/javascript"></script>
<%@include file="summaryajax.jsi" %>
</head><body onload="initAjax()">
<%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigClientsHelper" id="clientshelper" scope="request" />
<jsp:setProperty name="clientshelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
<jsp:setProperty name="clientshelper" property="edit" value="<%=request.getParameter(\"edit\")%>" />
<h1><%=intl._t("Plugin Configuration")%></h1>
<div class="main" id="main">
<%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigClientsHandler" id="formhandler" scope="request" />
<%@include file="formhandler.jsi" %>
<div class="configure">
<%
if (clientshelper.showPlugins()) {
if (clientshelper.isPluginUpdateEnabled()) {
%>
<h3><a name="pconfig"></a><%=intl._t("Plugin Configuration")%></h3><p>
<%=intl._t("The plugins listed below are started by the webConsole client.")%>
</p><div class="wideload">
<form action="" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<jsp:getProperty name="clientshelper" property="form3" />
<div class="formaction">
<input type="submit" class="cancel" name="foo" value="<%=intl._t("Cancel")%>" />
<input type="submit" name="action" class="accept" value="<%=intl._t("Save Plugin Configuration")%>" />
</div></form></div>
<%
} // pluginUpdateEnabled
if (clientshelper.isPluginInstallEnabled()) {
%>
<h3><a name="plugin"></a><%=intl._t("Plugin Installation from URL")%></h3><p>
<%=intl._t("Look for available plugins on {0}.", "<a href=\"http://i2pwiki.i2p/index.php?title=Plugins\">i2pwiki.i2p</a>")%>
<%=intl._t("To install a plugin, enter the download URL:")%>
</p>
<div class="wideload">
<form action="configplugins" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<p>
<input type="text" size="60" name="pluginURL" >
</p><hr><div class="formaction">
<input type="submit" name="action" class="default" value="<%=intl._t("Install Plugin")%>" />
<input type="submit" class="cancel" name="foo" value="<%=intl._t("Cancel")%>" />
<input type="submit" name="action" class="download" value="<%=intl._t("Install Plugin")%>" />
</div></form></div>
<div class="wideload">
<h3><a name="plugin"></a><%=intl._t("Plugin Installation from File")%></h3>
<form action="configplugins" method="POST" enctype="multipart/form-data" accept-charset="UTF-8">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<p><%=intl._t("Install plugin from file.")%>
<br><%=intl._t("Select xpi2p or su3 file")%> :
<input type="file" name="pluginFile" >
</p><hr><div class="formaction">
<input type="submit" name="action" class="download" value="<%=intl._t("Install Plugin from File")%>" />
</div></form></div>
<%
} // pluginInstallEnabled
if (clientshelper.isPluginUpdateEnabled()) {
%>
<h3><a name="plugin"></a><%=intl._t("Update All Plugins")%></h3>
<div class="formaction">
<form action="configplugins" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<input type="submit" name="action" class="reload" value="<%=intl._t("Update All Installed Plugins")%>" />
</form></div>
<%
} // pluginUpdateEnabled
} // showPlugins
%>
</div></div></body></html>

View File

@ -0,0 +1,43 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<%@include file="css.jsi" %>
<%=intl.title("config webapps")%>
<style type='text/css'>
button span.hide{
display:none;
}
input.default { width: 1px; height: 1px; visibility: hidden; }
</style>
<script src="/js/ajax.js" type="text/javascript"></script>
<%@include file="summaryajax.jsi" %>
</head><body onload="initAjax()">
<%@include file="summary.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigClientsHelper" id="clientshelper" scope="request" />
<jsp:setProperty name="clientshelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
<jsp:setProperty name="clientshelper" property="edit" value="<%=request.getParameter(\"edit\")%>" />
<h1><%=intl._t("WebApp Configuration")%></h1>
<div class="main" id="main">
<%@include file="confignav.jsi" %>
<jsp:useBean class="net.i2p.router.web.ConfigClientsHandler" id="formhandler" scope="request" />
<%@include file="formhandler.jsi" %>
<div class="configure">
<h3><a name="webapp"></a><%=intl._t("WebApp Configuration")%></h3><p>
<%=intl._t("The Java web applications listed below are started by the webConsole client and run in the same JVM as the router. They are usually web applications accessible through the router console. They may be complete applications (e.g. i2psnark),front-ends to another client or application which must be separately enabled (e.g. susidns, i2ptunnel), or have no web interface at all (e.g. addressbook).")%>
</p><p>
<%=intl._t("A web app may also be disabled by removing the .war file from the webapps directory; however the .war file and web app will reappear when you update your router to a newer version, so disabling the web app here is the preferred method.")%>
</p><div class="wideload">
<form action="configwebapps" method="POST">
<input type="hidden" name="nonce" value="<%=pageNonce%>" >
<jsp:getProperty name="clientshelper" property="form2" />
<p><i><%=intl._t("All changes require restart to take effect.")%></i>
</p><hr><div class="formaction">
<input type="submit" class="cancel" name="foo" value="<%=intl._t("Cancel")%>" />
<input type="submit" name="action" class="accept" value="<%=intl._t("Save WebApp Configuration")%>" />
</div></form></div>
</div></div></body></html>

View File

@ -14,5 +14,5 @@
<h1><%=intl._t("Web Application Not Running")%></h1> <h1><%=intl._t("Web Application Not Running")%></h1>
<div class="sorry" id="warning"> <div class="sorry" id="warning">
<%=intl._t("The requested web application is not running.")%> <%=intl._t("The requested web application is not running.")%>
<%=intl._t("Please visit the {0}config clients page{1} to start it.", "<a href=\"/configclients.jsp#webapp\" target=\"_top\">", "</a>")%> <%=intl._t("Please visit the {0}config clients page{1} to start it.", "<a href=\"/configwebapps.jsp#webapp\" target=\"_top\">", "</a>")%>
</div></body></html> </div></body></html>