diff --git a/htroot/ConfigBasic.html b/htroot/ConfigBasic.html index d3efb3df9..d6756bea2 100644 --- a/htroot/ConfigBasic.html +++ b/htroot/ConfigBasic.html @@ -32,6 +32,28 @@ + #(setUseCase)#:: +
  • + ok Use Case: what do you want to do with YaCy:
    +
    +
    +
    Community-based web search
    +
    + +
    +
    Search portal for your own web pages
    +
    + +
    +
    Intranet Indexing
    +
    + +
    +
    +
    +
  • + #(/setUseCase)# +
  • #(statusName)#warning Your peer name has not been customized; please set your own peer name::ok You may change your peer name#(/statusName)#
    @@ -43,6 +65,7 @@
  • +
  • #(statusPort)#warning 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.::ok Your peer can be reached by other peers#(/statusPort)#
    @@ -74,7 +97,7 @@
  • just monitor at the network page what the other peers are doing
  • :: -

    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.

    :: +

    You did not set a user name and/or a password. Some pages are protected by passwords. You should set a password at the Accounts Menu to secure your YaCy peer.

    ::

    Your Peer name is a default name; please set an individual peer name.

    :: diff --git a/htroot/ConfigBasic.java b/htroot/ConfigBasic.java index 0b59db406..3fdda7da3 100644 --- a/htroot/ConfigBasic.java +++ b/htroot/ConfigBasic.java @@ -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; @@ -146,8 +147,73 @@ public class ConfigBasic { } else { 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 { diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.java index f3049be7e..2319be547 100644 --- a/htroot/ConfigNetwork_p.java +++ b/htroot/ConfigNetwork_p.java @@ -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"); diff --git a/htroot/Status.html b/htroot/Status.html index 4e3563edc..d8da33c67 100644 --- a/htroot/Status.html +++ b/htroot/Status.html @@ -50,7 +50,7 @@ #(urgentSetPassword)#::
    bad
    Your settings are _not_ protected! - Please open the settings page immediately + Please open the accounts configuration page immediately and set an administration password.
    #(/urgentSetPassword)# diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java index b6fc58448..5b070c880 100644 --- a/source/de/anomic/http/httpdFileHandler.java +++ b/source/de/anomic/http/httpdFileHandler.java @@ -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"); diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 313f9f899..513712292 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -1271,6 +1271,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch