added use cases to basic configuration

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4831 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent 4229cd275c
commit faed00d75d

@ -32,6 +32,28 @@
</fieldset>
</li>
#(setUseCase)#::
<li>
<img src="/env/grafics/ok.png" height="16" width="16" alt="ok" />&nbsp;Use Case: what do you want to do with YaCy:<br />
<fieldset>
<dl>
<dt>Community-based web search</dt>
<dd>
<input type="radio" name="usecase" value="freeworld" id="usecaseFreeworld" #(freeworldChecked)#::checked="checked"#(/freeworldChecked)# /> <label for="usecaseFreeworld">join and support the global network 'freeworld', search the web with a uncensored user-owned search network</label>
</dd>
<dt>Search portal for your own web pages</dt>
<dd>
<input type="radio" name="usecase" value="portal" id="usecasePortal" #(portalChecked)#::checked="checked"#(/portalChecked)# /> <label for="usecasePortal">your YaCy installation behaves independently from other peers and you define your own web index by starting your own web crawl. This can be used to search your own web pages or to define a topic-oriented search portal.</label>
</dd>
<dt>Intranet Indexing</dt>
<dd>
<input type="radio" name="usecase" value="intranet" id="usecaseIntranet" #(intranetChecked)#::checked="checked"#(/intranetChecked)# /> <label for="usecaseIntranet">create a search portal for your intranet web pages, or pages that are placed at DATA/HTDOCS/repository and can be accessed at <a href="http://localhost:#[port]#/repository/">http://localhost:#[port]#/repository</a></label>
</dd>
</dl>
</fieldset>
</li>
#(/setUseCase)#
<li>
#(statusName)#<img src="/env/grafics/bad.png" height="16" width="16" alt="warning" />&nbsp;Your peer name has not been customized; please set your own peer name::<img src="/env/grafics/ok.png" height="16" width="16" alt="ok" />&nbsp;You may change your peer name#(/statusName)#<br />
<fieldset>
@ -43,6 +65,7 @@
</dl>
</fieldset>
</li>
<li>
#(statusPort)#<img src="/env/grafics/bad.png" height="16" width="16" alt="warning" />&nbsp;Your peer cannot be reached from outside (which is not fatal, but would be good for the YaCy network); 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="16" width="16" alt="ok" />&nbsp;Your peer can be reached by other peers#(/statusPort)#<br />
<fieldset>
@ -74,7 +97,7 @@
<li>just <a href="Network.html">monitor at the network page</a> what the other peers are doing</li>
</ul>::
<!-- [1]: password not proper -->
<p>You did not set a user name and/or a password. Some pages are protected by passwords. You should set a password here to secure your YaCy peer.</p>::
<p>You did not set a user name and/or a password. Some pages are protected by passwords. You should set a password at the <a href="Accounts_p.html">Accounts Menu</a> to secure your YaCy peer.</p>::
<!-- [2]: peername not proper -->
<p>Your Peer name is a default name; please set an individual peer name.</p>::
<!-- [3]: port not proper -->

@ -52,6 +52,7 @@ import java.util.regex.Pattern;
import de.anomic.data.translator;
import de.anomic.http.httpHeader;
import de.anomic.http.httpd;
import de.anomic.http.httpdFileHandler;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCore;
@ -64,7 +65,7 @@ import de.anomic.yacy.yacySeed;
public class ConfigBasic {
private static final int NEXTSTEP_FINISHED = 0;
//private static final int NEXTSTEP_PWD = 1;
private static final int NEXTSTEP_PWD = 1;
private static final int NEXTSTEP_PEERNAME = 2;
private static final int NEXTSTEP_PEERPORT = 3;
private static final int NEXTSTEP_RECONNECT = 4;
@ -147,7 +148,72 @@ public class ConfigBasic {
prop.put("reconnect", "0");
}
// set a use case
String networkName = sb.getConfig("network.unit.name", "");
if (post != null && post.containsKey("usecase")) {
boolean indexDistribute = sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true").equals("true");
boolean indexReceive = sb.getConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, "true").equals("true");
if (post.get("usecase", "").equals("freeworld")) {
if (networkName.equals("freeworld")) {
if (!indexDistribute && !indexReceive) {
// switch from robinson mode to p2p mode
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, true);
sb.setConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, true);
}
} else {
// switch from intranet to p2p mode
sb.switchNetwork("defaults/yacy.network.freeworld.unit");
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, true);
sb.setConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, true);
}
}
if (post.get("usecase", "").equals("portal")) {
if (networkName.equals("freeworld")) {
if (indexDistribute || indexReceive) {
// switch from p2p mode to robinson mode
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, false);
sb.setConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, false);
}
} else {
// switch from intranet to robinson mode
sb.switchNetwork("defaults/yacy.network.freeworld.unit");
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, false);
sb.setConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, false);
}
}
if (post.get("usecase", "").equals("intranet")) {
if (!networkName.equals("intranet")) {
// switch from p2p or robinson mode to intranet mode
sb.switchNetwork("defaults/yacy.network.intranet.unit");
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, true);
sb.setConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, true);
}
}
}
networkName = sb.getConfig("network.unit.name", "");
if (networkName.equals("freeworld")) {
prop.put("setUseCase", 1);
boolean indexDistribute = sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true").equals("true");
boolean indexReceive = sb.getConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, "true").equals("true");
if (indexDistribute || indexReceive) {
// p2p mode
prop.put("setUseCase_freeworldChecked", 1);
} else {
// robinson mode
prop.put("setUseCase_portalChecked", 1);
}
} else if (networkName.equals("intranet")) {
prop.put("setUseCase", 1);
prop.put("setUseCase_intranetChecked", 1);
} else {
prop.put("setUseCase", 0);
}
prop.put("setUseCase_port", port);
// check if values are proper
boolean properPassword = (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0) || sb.getConfigBool("adminAccountForLocalhost", false);
boolean properName = (env.getConfig("peerName","").length() >= 3) && (!(yacySeed.isDefaultPeerName(env.getConfig("peerName",""))));
boolean properPort = (sb.webIndex.seedDB.mySeed().isSenior()) || (sb.webIndex.seedDB.mySeed().isPrincipal());
@ -162,6 +228,8 @@ public class ConfigBasic {
prop.put("nextStep", NEXTSTEP_RECONNECT);
} else if (!properName) {
prop.put("nextStep", NEXTSTEP_PEERNAME);
} else if (!properPassword) {
prop.put("nextStep", NEXTSTEP_PWD);
} else if (!properPort) {
prop.put("nextStep", NEXTSTEP_PEERPORT);
} else {

@ -104,35 +104,35 @@ public class ConfigNetwork_p {
}
if (indexDistribute) {
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true");
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, true);
} else {
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "false");
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, false);
}
if (post.get("indexDistributeWhileCrawling","").equals("on")) {
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true");
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, true);
} else {
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "false");
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, false);
}
if (post.get("indexDistributeWhileIndexing","").equals("on")) {
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_INDEXING, "true");
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_INDEXING, true);
} else {
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_INDEXING, "false");
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_INDEXING, false);
}
if (indexReceive) {
sb.setConfig("allowReceiveIndex", "true");
sb.setConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, true);
sb.webIndex.seedDB.mySeed().setFlagAcceptRemoteIndex(true);
} else {
sb.setConfig("allowReceiveIndex", "false");
sb.setConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, false);
sb.webIndex.seedDB.mySeed().setFlagAcceptRemoteIndex(false);
}
if (post.get("indexReceiveBlockBlacklist", "").equals("on")) {
sb.setConfig("indexReceiveBlockBlacklist", "true");
sb.setConfig("indexReceiveBlockBlacklist", true);
} else {
sb.setConfig("indexReceiveBlockBlacklist", "false");
sb.setConfig("indexReceiveBlockBlacklist", false);
}
if (post.containsKey("peertags")) {
@ -173,7 +173,7 @@ public class ConfigNetwork_p {
prop.put("acceptCrawlLimit", RTCppm);
boolean indexDistribute = sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true").equals("true");
boolean indexReceive = sb.getConfig("allowReceiveIndex", "true").equals("true");
boolean indexReceive = sb.getConfig(plasmaSwitchboard.INDEX_RECEIVE_ALLOW, "true").equals("true");
prop.put("indexDistributeChecked", (indexDistribute) ? "1" : "0");
prop.put("indexDistributeWhileCrawling.on", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? "1" : "0");
prop.put("indexDistributeWhileCrawling.off", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? "0" : "1");

@ -50,7 +50,7 @@
#(urgentSetPassword)#::
<dt class="hintIcon"><img src="env/grafics/bad.png" width="32" height="32" alt="bad" /></dt>
<dd class="hint"><strong>Your settings are _not_ protected!</strong>
Please open the <a href="ConfigBasic.html">settings</a> page <strong>immediately</strong>
Please open the <a href="ConfigAccounts_p.html">accounts configuration</a> page <strong>immediately</strong>
and set an administration password.
</dd>
#(/urgentSetPassword)#

@ -174,9 +174,13 @@ public final class httpdFileHandler {
// create a htDocsPath: user defined pages
if (htDocsPath == null) {
htDocsPath = switchboard.getConfigPath(plasmaSwitchboard.HTDOCS_PATH, plasmaSwitchboard.HTDOCS_PATH_DEFAULT);
if (!(htDocsPath.exists())) htDocsPath.mkdir();
if (!(htDocsPath.exists())) htDocsPath.mkdirs();
}
// create a repository path
File repository = new File(htDocsPath, "repository");
if (!repository.exists()) repository.mkdirs();
// create a htTemplatePath
if (htTemplatePath == null) {
htTemplatePath = switchboard.getConfigPath("htTemplatePath","htroot/env/templates");

@ -1271,6 +1271,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
// start up crawl jobs again
if (lcp) continueCrawlJob(CRAWLJOB_LOCAL_CRAWL);
if (rcp) continueCrawlJob(CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
this.log.logInfo("switched network to " + networkDefinition);
// check status of account configuration: when local url crawling is allowed, it is not allowed
// that an automatic authorization of localhost is done, because in this case crawls from local
// addresses are blocked to prevent attack szenarios where remote pages contain links to localhost

Loading…
Cancel
Save