summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542>2006-03-01 22:27:20 +0000
committerorbiter <orbiter@6c8d7289-2bf4-0310-a012-ef5d649a1542>2006-03-01 22:27:20 +0000
commit1b9b8922d9c377a4690486b175bbafebf7f7cd9a (patch)
tree216c8a5572b111de295ba05aec24e4f6a2be56fc
parentc2f8318b4fecedd153350362d467bba6dcf65e98 (diff)
* fixed problems with new basic 1-2-3 configuration (now authentication required)
* fixed graphics problem * fixed some other problems with default values * 1-2-3 config now appears automatically on start-up if no password is set * added new config menu * moved profile to new config menu git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1792 6c8d7289-2bf4-0310-a012-ef5d649a1542
-rw-r--r--htroot/ConfigBasic.html4
-rw-r--r--htroot/ConfigBasic.java18
-rw-r--r--htroot/ConfigProfile_p.html (renamed from htroot/EditProfile_p.html)3
-rw-r--r--htroot/ConfigProfile_p.java (renamed from htroot/EditProfile_p.java)2
-rw-r--r--htroot/env/templates/header.template4
-rw-r--r--htroot/env/templates/submenuConfig.template11
-rw-r--r--source/de/anomic/plasma/plasmaSwitchboard.java5
-rw-r--r--source/yacy.java4
8 files changed, 33 insertions, 18 deletions
diff --git a/htroot/ConfigBasic.html b/htroot/ConfigBasic.html
index 493ffa909..d7fa245e6 100644
--- a/htroot/ConfigBasic.html
+++ b/htroot/ConfigBasic.html
@@ -28,8 +28,8 @@ Your YaCy Peer needs some basic information to operate properly
<li>#(statusPassword)#<img src="/env/grafics/warning.png">Please set a password for your peer to protect your settings::<img src="/env/grafics/ok.png" height="32px" width="32px">Password is set#(/statusPassword)#<br>
Peer User: <input type="text" name="adminuser" value="#[defaultUser]#" size="16" maxlength="32"><br>
Peer Password: <input type="text" name="adminpw1" value="" size="16" maxlength="32"><br>
- Peer Password: <input type="text" name="adminpw2" value="" size="16" maxlength="32"><br></li>
- <li>#(statusPort)#<img src="/env/grafics/warning.png">Your peer cannot be reached from outside; please open your firewall for this port and/or set a virtual server option in your router to allow connections on this port::<img src="/env/grafics/check.png">Your peer can be reached by other peers#(/statusPort)#<br>
+ Peer Password: <input type="text" name="adminpw2" value="" size="16" maxlength="32">(repeat same password)<br></li>
+ <li>#(statusPort)#<img src="/env/grafics/warning.png">Your peer cannot be reached from outside; please open your firewall for this port and/or set a virtual server option in your router to allow connections on this port::<img src="/env/grafics/ok.png" height="32px" width="32px">Your peer can be reached by other peers#(/statusPort)#<br>
Peer Port: <input type="text" name="port" value="#[defaultPort]#" size="5" maxlength="5"><br></li>
</ol>
<br>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="set" value="Set Configuration">
diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java
index 1c504061b..81f524df4 100644
--- a/htroot/ConfigBasic.java
+++ b/htroot/ConfigBasic.java
@@ -49,8 +49,10 @@
import de.anomic.http.httpHeader;
import de.anomic.kelondro.kelondroBase64Order;
+import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCodings;
import de.anomic.server.serverCore;
+import de.anomic.server.serverInstantThread;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore;
@@ -60,9 +62,17 @@ public class ConfigBasic {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
// return variable that accumulates replacements
+ plasmaSwitchboard sb = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects();
- //yacyCore.peerPing();
+ int authentication = sb.adminAuthenticated(header);
+ if (authentication < 2) {
+ // must authenticate
+ prop.put("AUTHENTICATE", "admin log-in");
+ return prop;
+ }
+
+ serverInstantThread.oneTimeJob(sb.yc, "peerPing", null, 0);
// password settings
String user = (post == null) ? "" : (String) post.get("adminuser", "");
@@ -70,13 +80,13 @@ public class ConfigBasic {
String pw2 = (post == null) ? "" : (String) post.get("adminpw2", "");
// peer name settings
- String peerName = (post == null) ? "" : (String) post.get("peername", "");
+ String peerName = (post == null) ? env.getConfig("peerName","") : (String) post.get("peername", "");
// port settings
- String port = (post == null) ? "8080" : (String) post.get("port", "8080");
+ String port = (post == null) ? env.getConfig("port", "8080") : (String) post.get("port", "8080");
// admin password
- if ((user.length() > 0) && (!(pw1.equals(pw2)))) {
+ if ((user.length() > 0) && (pw1.equals(pw2))) {
// check passed. set account:
env.setConfig("adminAccountBase64MD5", serverCodings.encodeMD5Hex(kelondroBase64Order.standardCoder.encodeString(user + ":" + pw1)));
env.setConfig("adminAccount", "");
diff --git a/htroot/EditProfile_p.html b/htroot/ConfigProfile_p.html
index 1c5a6df9c..e3af9ca53 100644
--- a/htroot/EditProfile_p.html
+++ b/htroot/ConfigProfile_p.html
@@ -6,7 +6,8 @@
</head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
#%env/templates/header.template%#
-<br><br>
+#%env/templates/submenuConfig.template%#
+<br>
<h2>Your Personal Profile</h2>
<p>
You can create a personal profile here. Other YaCy users can view these information using a link on the network page.<br>
diff --git a/htroot/EditProfile_p.java b/htroot/ConfigProfile_p.java
index f7a0fb44c..2280f5d3d 100644
--- a/htroot/EditProfile_p.java
+++ b/htroot/ConfigProfile_p.java
@@ -59,7 +59,7 @@ import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyNewsRecord;
import de.anomic.yacy.yacyCore;
-public class EditProfile_p {
+public class ConfigProfile_p {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
//listManager.switchboard = (plasmaSwitchboard) env;
diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.template
index ca756cacf..780ddbb40 100644
--- a/htroot/env/templates/header.template
+++ b/htroot/env/templates/header.template
@@ -51,15 +51,15 @@
<tr><td class="MenuItem">&nbsp;<a href="/share/" class="MenuItemLink">File&nbsp;Share</a></td></tr>
<tr><td class="MenuItem">&nbsp;<a href="/Wiki.html" class="MenuItemLink">Wiki</a></td></tr>
<tr><td class="MenuItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;<a href="/Messages_p.html" class="MenuItemLink">Messages</a>&nbsp;<img border="0" src="notifier.gif" align="center"></td></tr>
- <tr><td class="MenuItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;<a href="/EditProfile_p.html" class="MenuItemLink">Personal Profile</a></td></tr>
<tr><td class="MenuSpacer"></td></tr>
<tr><td class="MenuHeader">&nbsp;Peer&nbsp;Control</td></tr>
+ <tr><td class="MenuItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;<a href="/ConfigBasic.html" class="MenuItemLink">Basic Configuration</a></td></tr>
+ <tr><td class="MenuItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;<a href="/Settings_p.html" class="MenuItemLink">Advanced Settings</a></td></tr>
<tr><td class="MenuItem">&nbsp;<a href="/Status.html" accesskey="t" class="MenuItemLink">Status</a></td></tr>
<tr><td class="MenuItem">&nbsp;<a href="/Network.html" accesskey="w" class="MenuItemLink">Network</a></td></tr>
<tr><td class="MenuItem">&nbsp;<a href="/News.html" accesskey="n" class="MenuItemLink">News</a></td></tr>
<tr><td class="MenuItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;<a href="/ViewLog_p.html" class="MenuItemLink">Log</a></td></tr>
- <tr><td class="MenuItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;<a href="/Settings_p.html" class="MenuItemLink">Settings</a></td></tr>
<tr><td class="MenuItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;<a href="/PerformanceQueues_p.html" class="MenuItemLink">Performance</a></td></tr>
<tr><td class="MenuItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;<a href="/Connections_p.html" class="MenuItemLink">Connections</a></td></tr>
<tr><td class="MenuItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;<a href="/Language_p.html" class="MenuItemLink">Language</a></td></tr>
diff --git a/htroot/env/templates/submenuConfig.template b/htroot/env/templates/submenuConfig.template
index c71057c25..162bae253 100644
--- a/htroot/env/templates/submenuConfig.template
+++ b/htroot/env/templates/submenuConfig.template
@@ -1,11 +1,14 @@
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="SubMenu">
-<tr height="10"><td colspan="3" class="MenuHeader">&nbsp;Peer Configuration Menu</td></tr>
-<tr height="2"><td colspan="3"></td></tr>
+<tr height="10"><td colspan="5" class="MenuHeader">&nbsp;Peer Configuration Menu</td></tr>
+<tr height="2"><td colspan="5"></td></tr>
<tr class="TableHeader">
-<td width="50%" class="MenuSubItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;
+<td width="40%" class="MenuSubItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;
<a href="/ConfigBasic.html" class="MenuItemLink">Basic Configuraion</a>&nbsp;</td>
<td class="MenuSubSpacer"></td>
-<td width="50%" class="MenuSubItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;
+<td width="40%" class="MenuSubItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;
+<a href="/ConfigProfile_p.html" class="MenuItemLink">Profile Configuraion</a>&nbsp;</td>
+<td class="MenuSubSpacer"></td>
+<td width="20%" class="MenuSubItem">&nbsp;<img border="0" src="/env/grafics/lock.gif" align="top">&nbsp;
<a href="/ConfigAdvanced_p.html" class="MenuItemLink">Advanced Configuration</a>&nbsp;</td>
</tr>
</table> \ No newline at end of file
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index 2b3847589..0ff87ce40 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -1966,13 +1966,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public int adminAuthenticated(httpHeader header) {
String adminAccountBase64MD5 = getConfig("adminAccountBase64MD5", "");
- if (adminAccountBase64MD5.length() == 0) return 2; // not necessary
+ if (adminAccountBase64MD5.length() == 0) return 2; // no passwrd stored
String authorization = ((String) header.get(httpHeader.AUTHORIZATION, "xxxxxx")).trim().substring(6);
if (authorization.length() == 0) return 1; // no authentication information given
if ((((String) header.get("CLIENTIP", "")).equals("localhost")) && (adminAccountBase64MD5.equals(authorization))) return 3; // soft-authenticated for localhost
if (adminAccountBase64MD5.equals(serverCodings.encodeMD5Hex(authorization))) return 4; // hard-authenticated, all ok
- if(userDB.hasAdminRight((String)header.get(httpHeader.AUTHORIZATION, "xxxxxx")))
- return 4;
+ if (userDB.hasAdminRight((String)header.get(httpHeader.AUTHORIZATION, "xxxxxx"))) return 4;
return 0; // wrong password
}
diff --git a/source/yacy.java b/source/yacy.java
index af82cf475..7aab0b815 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -380,7 +380,9 @@ public final class yacy {
// open the browser window
final boolean browserPopUpTrigger = sb.getConfig("browserPopUpTrigger", "true").equals("true");
if (browserPopUpTrigger) {
- final String browserPopUpPage = sb.getConfig("browserPopUpPage", "Status.html");
+ String browserPopUpPage = sb.getConfig("browserPopUpPage", "ConfigBasic.html");
+ boolean properPW = (sb.getConfig("adminAccount", "").length() == 0) && (sb.getConfig("adminAccountBase64MD5", "").length() > 0);
+ if (!properPW) browserPopUpPage = "ConfigBasic.html";
final String browserPopUpApplication = sb.getConfig("browserPopUpApplication", "netscape");
serverSystem.openBrowser("http://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage, browserPopUpApplication);
}