name check on new peer names

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 955d26b117
commit 7eb3c81aad

@ -37,6 +37,18 @@ globalheader();
-->
<br><p>v0.37
<ul>
<li>Check on new peer names: must not occur already and may only contain letters, numbers and '_' or '-'.</li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<br><p>v0.36_build20050326
<ul>
<li>Enhanced thread control and added performance menu: this can be used to steer scheduling tasks and for profiling.</li>

@ -58,7 +58,13 @@ You are now permanently <b>online</b>. After a short while you should see the ef
::
<b>The remote-proxy setting has been changed</b><br>
The new setting is effective immediately, you don't need to re-start.
#(/info)#
::
<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 not well-formed. Please choose a different name.</b><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.#(/info)#
</p>
<p>You can now go back to the <a href="Settings_p.html">Settings</a> page if you want to make more changes.</p>

@ -191,15 +191,35 @@ public class SettingsAck_p {
String port = (String) post.get("port");
String peerName = (String) post.get("peername");
String shutdownWaiting = (String) post.get("shutdownWaiting");
String info = "";
env.setConfig("port", port);
env.setConfig("peerName", peerName);
env.setConfig("shutdownWaiting", shutdownWaiting);
prop.put("info", 12);//port or peername changed
prop.put("info_port", port);
prop.put("info_peerName", peerName);
prop.put("info_shutdownWaiting", shutdownWaiting);
// check if peer name already exists
yacySeed oldSeed = yacyCore.seedDB.lookupByName(peerName);
if (oldSeed == null) {
// the name is new
boolean nameOK = (peerName.length() <= 80);
for (int i = 0; i < peerName.length(); i++) {
if ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_".indexOf(peerName.charAt(i)) < 0) nameOK = false;
}
if (!(nameOK)) {
// deny change
prop.put("info", 17);//peer name is wrong
} else {
// set values
env.setConfig("port", port);
env.setConfig("peerName", peerName);
env.setConfig("shutdownWaiting", shutdownWaiting);
prop.put("info", 12);//port or peername changed
prop.put("info_port", port);
prop.put("info_peerName", peerName);
prop.put("info_shutdownWaiting", shutdownWaiting);
}
} else {
// deny change
prop.put("info", 16);//peer name is already used by another peer
}
return prop;
}

@ -47,7 +47,7 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold
</tr>
<tr valign="top">
<td>Peer Name:</td>
<td><input name="peername" type="text" size="32" maxlength="32" value="#[peerName]#"></td>
<td><input name="peername" type="text" size="32" maxlength="80" value="#[peerName]#"></td>
<td><b>Your peer name defines also a new '.yacy' - domain, which can be accessed from every peer running this proxy.
Using your 'Home Page' and 'File Share' - zones you also have a platform to provide content to your new domain.</b><br>
<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>

@ -45,10 +45,10 @@
# Contributions and changes to the program code must be marked as such.
# define variables
version='0.36'
version='0.361'
datestr=`date +%Y%m%d`
release='yacy_v'$version'_'$datestr
#release='yacy_dev_v'$version'_'$datestr
#release='yacy_v'$version'_'$datestr
release='yacy_dev_v'$version'_'$datestr
target='RELEASE'
classes='classes'
source='source'

Loading…
Cancel
Save