forked from I2P_Developers/i2p.i2p
SSL wizard: Add missing file, fix form params
This commit is contained in:
60
apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/SSLHelper.java
Normal file
60
apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/SSLHelper.java
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
package net.i2p.i2ptunnel.web;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class for ssl.jsp
|
||||||
|
*
|
||||||
|
* @since 0.9.35
|
||||||
|
*/
|
||||||
|
public class SSLHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapted from LoadClientAppsJob
|
||||||
|
* @return param args non-null
|
||||||
|
* @return non-null
|
||||||
|
*/
|
||||||
|
public static List<String> parseArgs(String args) {
|
||||||
|
List<String> argList = new ArrayList<String>(4);
|
||||||
|
StringBuilder buf = new StringBuilder(32);
|
||||||
|
boolean isQuoted = false;
|
||||||
|
for (int j = 0; j < args.length(); j++) {
|
||||||
|
char c = args.charAt(j);
|
||||||
|
switch (c) {
|
||||||
|
case '\'':
|
||||||
|
case '"':
|
||||||
|
if (isQuoted) {
|
||||||
|
String str = buf.toString().trim();
|
||||||
|
if (str.length() > 0)
|
||||||
|
argList.add(str);
|
||||||
|
buf.setLength(0);
|
||||||
|
}
|
||||||
|
isQuoted = !isQuoted;
|
||||||
|
break;
|
||||||
|
case ' ':
|
||||||
|
case '\t':
|
||||||
|
// whitespace - if we're in a quoted section, keep this as part of the quote,
|
||||||
|
// otherwise use it as a delim
|
||||||
|
if (isQuoted) {
|
||||||
|
buf.append(c);
|
||||||
|
} else {
|
||||||
|
String str = buf.toString().trim();
|
||||||
|
if (str.length() > 0)
|
||||||
|
argList.add(str);
|
||||||
|
buf.setLength(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
buf.append(c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (buf.length() > 0) {
|
||||||
|
String str = buf.toString().trim();
|
||||||
|
if (str.length() > 0)
|
||||||
|
argList.add(str);
|
||||||
|
}
|
||||||
|
return argList;
|
||||||
|
}
|
||||||
|
}
|
@@ -99,16 +99,14 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
|||||||
|
|
||||||
if (name == null || name.equals(""))
|
if (name == null || name.equals(""))
|
||||||
name = editBean.getTunnelName(curTunnel);
|
name = editBean.getTunnelName(curTunnel);
|
||||||
%>
|
|
||||||
<input type="hidden" name="tunnel" value="<%=curTunnel%>" />
|
|
||||||
<input type="hidden" name="nonce" value="<%=net.i2p.i2ptunnel.web.IndexBean.getNextNonce()%>" />
|
|
||||||
<input type="hidden" name="type" value="<%=tunnelType%>" />
|
|
||||||
<input type="submit" class="default" name="action" value="Save changes" />
|
|
||||||
<%
|
|
||||||
if (!"new".equals(tunnelType)) {
|
if (!"new".equals(tunnelType)) {
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<form method="post" action="ssl?tunnel=<%=curTunnel%>" accept-charset="UTF-8">
|
<form method="post" action="ssl" accept-charset="UTF-8">
|
||||||
|
<input type="hidden" name="tunnel" value="<%=curTunnel%>" />
|
||||||
|
<input type="hidden" name="nonce" value="<%=net.i2p.i2ptunnel.web.IndexBean.getNextNonce()%>" />
|
||||||
|
<input type="hidden" name="type" value="<%=tunnelType%>" />
|
||||||
|
<input type="submit" class="default" name="action" value="Save changes" />
|
||||||
<table>
|
<table>
|
||||||
<tr><td colspan="4" class="infohelp"><%=intl._t("Experts only!")%> Beta!</td></tr>
|
<tr><td colspan="4" class="infohelp"><%=intl._t("Experts only!")%> Beta!</td></tr>
|
||||||
<tr><td colspan="4"><b><%=intl._t("Tunnel name")%>:</b> <%=editBean.getTunnelName(curTunnel)%></td></tr>
|
<tr><td colspan="4"><b><%=intl._t("Tunnel name")%>:</b> <%=editBean.getTunnelName(curTunnel)%></td></tr>
|
||||||
@@ -374,6 +372,14 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
|||||||
<tr><td colspan="7">Jetty SSL cert passwords are not the default</td></tr>
|
<tr><td colspan="7">Jetty SSL cert passwords are not the default</td></tr>
|
||||||
<%
|
<%
|
||||||
} // isPWDefault
|
} // isPWDefault
|
||||||
|
%>
|
||||||
|
<tr><td colspan="7"><b><%=intl._t("Password")%>:</b>
|
||||||
|
<input type="password" name="nofilter_keyPassword" title="<%=intl._t("Set password required to access this service")%>" value="" class="freetext password" />
|
||||||
|
</td></tr>
|
||||||
|
<tr><td class="buttons" colspan="7">
|
||||||
|
<button id="controlSave" class="control" type="submit" name="action" value="Generate"><%=intl._t("Generate certificate")%></button>
|
||||||
|
</td></tr>
|
||||||
|
<%
|
||||||
} // canConfigure
|
} // canConfigure
|
||||||
} // for client
|
} // for client
|
||||||
} catch (java.io.IOException ioe) { ioe.printStackTrace(); }
|
} catch (java.io.IOException ioe) { ioe.printStackTrace(); }
|
||||||
|
Reference in New Issue
Block a user