Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- added recording of all accessed and submitted servlets - this recording is then used to redirect from the Status.html page to BasicConfig in case that servlet was never submitted - this acts as an addition to the new default pop-up page 'index.html' which offers an administration link to Status.html. For a first-time user this then redirects directly to the former start page BasicConfig.html

orbiter786166041a83
diff --git a/defaults/yacy.init b/defaults/yacy.init
index 28125b03e..c7e736137 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -65,6 +65,14 @@ keyStorePassword =
pkcs12ImportFile =
pkcs12ImportPwd =
+# property that collects the names of all servlets that had been used so far
+# that is used to track if the user has already done some configuration steps
+# if the used missed configuration steps that should be done, then a help system
+# is possible which leads the used based on the list of servlets that had been used
+# the list distinguishes called and submitted servlets
+server.servlets.called =
+server.servlets.submitted =
+
# server tracking: maximum time a track entry is hold in the internal cache
# value is in milliseconds, default is one hour
server.maxTrackingTime = 3600000
diff --git a/htroot/Status.html b/htroot/Status.html
index 57ce52e24..b226a4d6e 100644
--- a/htroot/Status.html
+++ b/htroot/Status.html
@@ -1,6 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
+ #(forwardToConfigBasic)#::<meta http-equiv="REFRESH" content="0; url=/ConfigBasic.html" />#(/forwardToConfigBasic)#
<title>YaCy '#[clientname]#': Console Status</title>
#%env/templates/metas.template%#
<script type="text/javascript">
diff --git a/htroot/Status.java b/htroot/Status.java
index 4f87c6e61..c5a1ba93f 100644
--- a/htroot/Status.java
+++ b/htroot/Status.java
@@ -58,7 +58,15 @@ public class Status {
final serverObjects prop = new serverObjects();
final Switchboard sb = (Switchboard) env;
- if (post != null) {
+ // check if the basic configuration was accessed before and forward
+ prop.put("forwardToConfigBasic", 0);
+ if ((post == null || !post.containsKey("noforward")) && sb.getConfig("server.servlets.submitted", "").indexOf("ConfigBasic.html") < 0) {
+ // forward to ConfigBasic
+ prop.put("forwardToConfigBasic", 1);
+ }
+ if (post != null) post.remove("noforward");
+
+ if (post != null && post.size() > 0) {
if (sb.adminAuthenticated(header) < 2) {
prop.put("AUTHENTICATE","admin log-in");
return prop;
diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.template
index 9f922e1ff..afa1092ad 100644
--- a/htroot/env/templates/header.template
+++ b/htroot/env/templates/header.template
@@ -86,7 +86,7 @@
<li class="menugroup" id="menugroupPeerControl">
<h3>Peer Control</h3>
<ul class="menu">
- <li><a href="/Status.html" class="MenuItemLink">Admin Console</a></li>
+ <li><a href="/Status.html?noforward=" class="MenuItemLink">Admin Console</a></li>
<li><a href="/Table_API_p.html" class="MenuItemLink lock">API Action Steering</a></li>
<li><a href="/Steering.html?restart=" class="MenuItemLink lock" onclick="return confirm('Confirm Restart')">Re-Start</a></li>
<li><a href="/Steering.html?shutdown=" class="MenuItemLink lock" onclick="return confirm('Confirm Shutdown')">Shutdown</a></li>
diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java
index b59e967de..c1b83c9bc 100644
--- a/source/de/anomic/http/server/HTTPDFileHandler.java
+++ b/source/de/anomic/http/server/HTTPDFileHandler.java
@@ -514,6 +514,12 @@ public final class HTTPDFileHandler {
}
}
+ // track all files that had been accessed so far
+ if (targetFile != null && targetFile.exists()) {
+ sb.setConfig("server.servlets.called", appendPath(sb.getConfig("server.servlets.called", ""), path));
+ if (args != null && args.size() > 0) sb.setConfig("server.servlets.submitted", appendPath(sb.getConfig("server.servlets.submitted", ""), path));
+ }
+
//File targetClass = rewriteClassFile(targetFile);
//We need tp here
servletProperties templatePatterns = null;
@@ -1111,6 +1117,12 @@ public final class HTTPDFileHandler {
}
}
+ private static final String appendPath(String proplist, String path) {
+ if (proplist.length() == 0) return path;
+ if (proplist.indexOf(path) >= 0) return proplist;
+ return proplist + "," + path;
+ }
+
public static final File getOverlayedClass(final String path) {
File targetClass;
targetClass = rewriteClassFile(new File(htDefaultPath, path)); //works for default and localized files