added peer-Name settings to Settings page

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@172 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 5f90daa265
commit 6f09251bbc

@ -28,14 +28,20 @@ Your request cannot be processed.<br>Nothing changed.
<b>Your administration account setting has been made.</b><br>
Your new administration account name is #[user]#. The password has been accepted.<br>If you go back to the Settings page, you must log-in again.
::
<b>Your proxy account setting has been changed.<br>
<b>Your proxy access setting has been changed.<br>
Your proxy account check has been disabled, since you did not supply a password.</b><br>
The new proxy IP filter is set to #[filter]#
The new proxy IP filter is set to #[filter]#<br>
Transparent Proxy Support is: <font color="#556699">#[isTransparentProxy]#</font><p>
The proxy port is: <font color="#556699">#[port]#</font><br>
<u>if you changed the Port, you need to restart YaCy.</u>
::
<b>Your proxy account setting has been changed.</b><br>
<b>Your proxy access setting has been changed.</b><br>
Your new proxy account name is #[user]#. The password has been accepted.<br>
If you open any public web page through the proxy, you must log-in then.<br>
The new proxy IP filter is set to #[filter]#.
The new proxy IP filter is set to #[filter]#.<br>
Transparent Proxy Support is: <font color="#556699">#[isTransparentProxy]#</font><p>
The proxy port is: <font color="#556699">#[port]#</font><br>
<u>if you changed the Port, you need to restart YaCy.</u>
::
<b>Your server access filter is now set to #[filter]#</b><br>
<!--Your new server account name is #[user]#. The password has been accepted.<br>
@ -47,12 +53,10 @@ Auto pop-up of the Status page is now <b>enabled</b><br>
::
You are now permanently <b>online</b>. After a short while you should see the effect on the <a href="Status.html">status</a> page.<br>
::
<b>Port is: <font color="#556699">#[port]#</font></b><br>
<b>PeerName is: <font color="#556699">#[peerName]#</font></b><br>
<b>Transparent Proxy Support is: <font color="#556699">#[isTransparentProxy]#</font></b><p>
<u>if you changed the Port, you need to restart the Proxy.</u>
<b>The Peer Name is: <font color="#556699">#[peerName]#</font><br>
Your Peer Language is: <font color="#556699">#[peerLang]#</font><br>
::
<b>Seed Settings changed.#(success)#::You are now a principal peer.#(/success)#</b><br>
<b>Seed Settings changed.#(success)#::You are now a principal peer.#(/success)#<br>
::
<p><b>Seed Settings changed, but something is wrong.</b></p>
<p><font color="red">#[errormsg]#</font></p>
@ -62,12 +66,12 @@ Please return to the settings page and modify the data.<br>
<b>The remote-proxy setting has been changed</b><br>
The new setting is effective immediately, you don't need to re-start.
::
<b>The submitted peer name is already used by another peer. Please choose a different name.</b><br>
The settings have not been changed.
<b>The submitted peer name is already used by another peer. Please choose a different name.</b> The Peer name has not been changed.<br>
Your Peer Language is: <font color="#556699">#[peerLang]#</font><br>
::
<b>The submitted peer name is not well-formed. Please choose a different name.</b><br>
<b>The submitted peer name is not well-formed. Please choose a different name.</b> The Peer name has not been changed.<br>
Peer names must not contain characters other than (a-z, A-Z, 0-9, '-', '_') and must not be longer than 80 characters.
The settings have not been changed.
Your Peer Language is: <font color="#556699">#[peerLang]#</font><br>
::
The new parser settings where changed successfully.<br>
Parsing of the following mime-types was enabled:<br>

@ -49,6 +49,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@ -66,6 +67,17 @@ public class SettingsAck_p {
private static boolean nothingChanged;
public static HashMap langMap(serverSwitch env) {
String[] ms = env.getConfig("htLocaleLang", "").split(",");
HashMap map = new HashMap();
int p;
for (int i = 0; i < ms.length; i++) {
p = ms[i].indexOf("/");
if (p > 0) map.put(ms[i].substring(0, p), ms[i].substring(p + 1));
}
return map;
}
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
// return variable that accumulates replacements
serverObjects prop = new serverObjects();
@ -111,6 +123,16 @@ public class SettingsAck_p {
// proxy password
if (post.containsKey("proxyaccount")) {
// set new port
String port = (String) post.get("port");
env.setConfig("port", port);
prop.put("info_port", port);
// set transparent proxy flag
httpdProxyHandler.isTransparentProxy = post.containsKey("isTransparentProxy");
env.setConfig("isTransparentProxy", httpdProxyHandler.isTransparentProxy ? "true" : "false");
prop.put("info_isTransparentProxy", httpdProxyHandler.isTransparentProxy ? "on" : "off");
// read and process data
String filter = (String) post.get("proxyfilter");
String user = (String) post.get("proxyuser");
@ -202,12 +224,16 @@ public class SettingsAck_p {
}
if (post.containsKey("generalsettings")) {
String port = (String) post.get("port");
String peerName = (String) post.get("peername");
httpdProxyHandler.isTransparentProxy = post.containsKey("isTransparentProxy");
// set peer language
String peerLang = (String) post.get("peerlang");
if ((peerLang == null) || (peerLang.equals("en"))) peerLang = "default";
HashMap lm = langMap(env);
if (!(lm.containsKey(peerLang))) peerLang = "default";
env.setConfig("htLocaleSelection", peerLang);
prop.put("info_peerLang", (String) lm.get(peerLang));
// check if peer name already exists
String peerName = (String) post.get("peername");
yacySeed oldSeed = yacyCore.seedDB.lookupByName(peerName);
if ((oldSeed == null) || (env.getConfig("peerName","").equals(peerName))) {
@ -222,14 +248,9 @@ public class SettingsAck_p {
} else {
// set values
env.setConfig("port", port);
env.setConfig("peerName", peerName);
env.setConfig("isTransparentProxy", httpdProxyHandler.isTransparentProxy ? "true" : "false");
prop.put("info", 12);//port or peername changed
prop.put("info_port", port);
prop.put("info_peerName", peerName);
prop.put("info_isTransparentProxy", httpdProxyHandler.isTransparentProxy ? "on" : "off");
}
} else {
// deny change
@ -352,8 +373,6 @@ public class SettingsAck_p {
}
}
if (post.containsKey("parserSettings")) {
plasmaSwitchboard sb = (plasmaSwitchboard)env;
post.remove("parserSettings");

@ -19,11 +19,17 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold
<fieldset><legend>Administration Account Settings</legend>
<p>This is the account that restricts access to this 'Settings' page. If you have not customized it yet, you should do so now:
<p><table border="0" cellspacing="5">
<tr valign="top">
<td>Account Name:</td><td><input name="adminuser" type="text" size="16" maxlength="16" value="#[adminuser]#"></td>
<td valign="bottom" align="right" rowspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="adminaccount" value="submit"></td></tr>
<tr valign="top"><td>Password:</td><td><input name="adminpw1" type="password" size="16" maxlength="16" value=""></td></tr>
<tr valign="top"><td>Password (repeat same as above):</td><td><input name="adminpw2" type="password" size="16" maxlength="16" value=""></td></tr>
<tr valign="top">
<td>Account Name:</td><td><input name="adminuser" type="text" size="16" maxlength="16" value="#[adminuser]#"></td>
<td valign="bottom" align="right" rowspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="adminaccount" value="submit"></td>
</tr>
<tr valign="top">
<td>Password:</td>
<td><input name="adminpw1" type="password" size="16" maxlength="16" value=""></td></tr>
<tr valign="top">
<td>Password (repeat same as above):</td>
<td><input name="adminpw2" type="password" size="16" maxlength="16" value=""></td>
</tr>
</table>
</fieldset>
</form><br>
@ -32,11 +38,6 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold
<fieldset><legend>General Settings</legend>
<p>
<table border="0" cellspacing="5">
<tr valign="top">
<td>Proxy and Administration Port:</td>
<td><input name="port" type="text" size="5" maxlength="5" value="#[port]#"></td>
<td><i>Changes will take effect after restart only.</i></td>
</tr>
<tr valign="top">
<td>Peer Name:</td>
<td><input name="peername" type="text" size="32" maxlength="80" value="#[peerName]#"></td>
@ -45,12 +46,9 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold
<i>(hint: choose a name that appears on a web page that tells something about you, vistit the page, get the 'senior' status, and you can be found..)</i></td>
</tr>
<tr valign="top">
<td>Transparent Proxy:</td>
<td><input type="checkbox" name="isTransparentProxy" align="top" #(isTransparentProxy)#::checked#(/isTransparentProxy)#></td>
<td>With this you can specify if YaCy can be used as transparent proxy.<br>
<i>Hint: On linux you can configure your firewall to transparently redirect all http traffic through yacy using this iptables rule:</i><br>
<small><code>iptables -t nat -A PREROUTING -p tcp -s 192.168.0.0/16 --dport 80 -j DNAT --to 192.168.0.1:#[port]#</code></small>
</td>
<td>Peer Language:</td>
<td><input name="peerlang" type="text" size="2" maxlength="2" value="#[peerLang]#"></td>
<td>Enter 'de' for Deutsch, 'en' for English</td> <!-- make a selection box here -->
</tr>
<tr>
<td><input type="submit" name="generalsettings" value="submit"></td>
@ -61,6 +59,40 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold
</fieldset>
</form><br>
<p><form action="SettingsAck_p.html" method="post" enctype="multipart/form-data">
<fieldset><legend>Proxy Access Settings</legend>
<table border="0" cellspacing="5">
<tr valign="top">
<td>Proxy and Administration Port:</td>
<td><input name="port" type="text" size="5" maxlength="5" value="#[port]#"></td>
<td><i>Changes will take effect after restart only.</i></td>
</tr>
<tr valign="top">
<td>Transparent Proxy:</td>
<td><input type="checkbox" name="isTransparentProxy" align="top" #(isTransparentProxy)#::checked#(/isTransparentProxy)#></td>
<td>With this you can specify if YaCy can be used as transparent proxy.<br>
<i>Hint: On linux you can configure your firewall to transparently redirect all http traffic through yacy using this iptables rule:</i><br>
<small><code>iptables -t nat -A PREROUTING -p tcp -s 192.168.0.0/16 --dport 80 -j DNAT --to 192.168.0.1:#[port]#</code></small>
</td>
</tr>
</table>
<p>You can restrict the access to this proxy using a two-stage security barrier:
<ul>
<li>define an <i>access domain</i> with a list of granted client IP-numbers or with wildcards</li>
<li>define an <i>user account</i> with an user:password - pair</li>
</ul><br>
<p>This is the account that restricts access to the proxy function. You probably don't want to share the proxy to the internet, so you should set the IP-Number Access Domain to a pattern that corresponds to you local intranet. The default setting should be right in most cases. If you want, you can also set a proxy account so that every proxy user must authenticate first, but this is rather unusual.</p>
<p><table border="0" cellspacing="5">
<tr valign="top"><td>IP-Number filter:</td><td colspan ="2"><input name="proxyfilter" type="text" size="50" maxlength="1000" value="#[proxyfilter]#"></td></tr>
<tr valign="top"><td>Account Name:</td><td><input name="proxyuser" type="text" size="16" maxlength="16" value="#[proxyuser]#"></td>
<td valign="bottom" align="right" rowspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="proxyaccount" value="Submit"></td></tr>
<tr valign="top"><td>Password:</td><td><input name="proxypw1" type="password" size="16" maxlength="16" value=""></td></tr>
<tr valign="top"><td>Password (repeat same as above):</td><td><input name="proxypw2" type="password" size="16" maxlength="16" value=""></td></tr>
</table>
</fieldset>
</form><br>
<p><form action="SettingsAck_p.html" method="post" enctype="multipart/form-data">
<fieldset><legend>Remote Proxy (optional)</legend>
@ -90,25 +122,6 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold
</fieldset>
</form><br>
<p>You can restrict the access to this proxy using a two-stage security barrier:
<ul>
<li>define an <i>access domain</i> with a list of granted client IP-numbers or with wildcards</li>
<li>define an <i>user account</i> with an user:password - pair</li>
</ul><br>
<p><form action="SettingsAck_p.html" method="post" enctype="multipart/form-data">
<fieldset><legend>Proxy Access Settings</legend>
<p>This is the account that restricts access to the proxy function. You probably don't want to share the proxy to the internet, so you should set the IP-Number Access Domain to a pattern that corresponds to you local intranet. The default setting should be right in most cases. If you want, you can also set a proxy account so that every proxy user must authenticate first, but this is rather unusual.</p>
<p><table border="0" cellspacing="5">
<tr valign="top"><td>IP-Number filter:</td><td colspan ="2"><input name="proxyfilter" type="text" size="50" maxlength="1000" value="#[proxyfilter]#"></td></tr>
<tr valign="top"><td>Account Name:</td><td><input name="proxyuser" type="text" size="16" maxlength="16" value="#[proxyuser]#"></td>
<td valign="bottom" align="right" rowspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="proxyaccount" value="Submit"></td></tr>
<tr valign="top"><td>Password:</td><td><input name="proxypw1" type="password" size="16" maxlength="16" value=""></td></tr>
<tr valign="top"><td>Password (repeat same as above):</td><td><input name="proxypw2" type="password" size="16" maxlength="16" value=""></td></tr>
</table>
</fieldset>
</form><br>
<p><form action="SettingsAck_p.html" method="post" enctype="multipart/form-data">
<fieldset><legend>Server Access Settings</legend>
<p>Here you can restrict access to the server. By default, the access is not limited, because this function is needed to spawn the p2p index-sharing function. If you block access to your server (setting anything else than '*'), then you will also be blocked from using other peers' indexes for search service. However, blocking access may be correct in enterprise environments where you only want to index your company's own web pages.</p>

@ -66,8 +66,11 @@ public final class Settings_p {
//if (post == null) System.out.println("POST: NULL"); else System.out.println("POST: " + post.toString());
prop.put("port", env.getConfig("port", "8080"));
prop.put("peerName", env.getConfig("peerName", "nameless"));
prop.put("isTransparentProxy", env.getConfig("isTransparentProxy", "false").equals("true") ? 1 : 0);
prop.put("peerName", env.getConfig("peerName", "nameless"));
String peerLang = env.getConfig("htLocaleSelection", "default");
if (peerLang.equals("default")) peerLang = "en";
prop.put("peerLang", peerLang);
// set values
String s;

Loading…
Cancel
Save