diff --git a/htroot/SettingsAck_p.html b/htroot/SettingsAck_p.html index f8b1fd166..daedbbc1f 100644 --- a/htroot/SettingsAck_p.html +++ b/htroot/SettingsAck_p.html @@ -138,7 +138,11 @@ Seed Upload method was changed successfully.

Port Forwarding Settings changed, but something is wrong.

#[errormsg]#

Port Forwarding was deactivated automatically.
-Please return to the settings page and modify the data.
+Please return to the settings page and modify the data.
+:: +You are now event-based online. After a short while you should see the effect on the status page.
+:: +You are now in Cache Mode. Only Proxy-cache ist available in this mode. After a short while you should see the effect on the status page.
#(/info)#

You can now go back to the Settings page if you want to make more changes.

diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.java index 39782c651..a0a34314c 100644 --- a/htroot/SettingsAck_p.java +++ b/htroot/SettingsAck_p.java @@ -297,10 +297,25 @@ public class SettingsAck_p { if (post.containsKey("pmode")) { env.setConfig("onlineMode", "2"); prop.put("info", 11);//permanent online mode + yacyCore.setOnlineMode(2); yacyCore.triggerOnlineAction(); return prop; } + if (post.containsKey("emode")) { + env.setConfig("onlineMode", "1"); + prop.put("info", 24);//event-based online mode + yacyCore.setOnlineMode(1); + return prop; + } + + if (post.containsKey("cmode")) { + env.setConfig("onlineMode", "0"); + prop.put("info", 25);//cache mode + yacyCore.setOnlineMode(0); + return prop; + } + if (post.containsKey("generalsettings")) { /* // set peer language diff --git a/htroot/Status.html b/htroot/Status.html index 474fa400f..07c6fc404 100644 --- a/htroot/Status.html +++ b/htroot/Status.html @@ -78,18 +78,30 @@ Last upload: #[lastUpload]# ago. Online-mode #(omode)# - +You are in Cache-browsing mode.
+Only Website from the Proxycache are accessable. +To switch online-mode, press one of the following buttons: +
+ + +
:: You are in event-based online mode.
The YaCy p2p network will boot when you start using the proxy or you switch to permanent mode. Attention: Using the proxy in permanent mode will keep your internet connection online as long as YaCy runs. Use this only if you have a flatrate or you have an always-on connection. -To start permanent mode, press this button: +To switch online-mode, press one of the following buttons:
+
:: You are in permanent mode. Attention: If you don't have a flatrate or are always-on, you must switch off the proxy to go off-line. +To switch online-mode, press one of the following buttons: +
+ + +
#(/omode)# @@ -100,4 +112,4 @@ You are in permanent mode. Attention: If you don't have a flatrate or are #[footer]# - \ No newline at end of file + diff --git a/htroot/Status.java b/htroot/Status.java index 75cda8736..45666e64b 100644 --- a/htroot/Status.java +++ b/htroot/Status.java @@ -225,9 +225,11 @@ public class Status { prop.put("popup", 1); } - if (env.getConfig("onlineMode", "1").equals("1")) { - prop.put("omode", 1); - } else { + if (env.getConfig("onlineMode", "1").equals("0")) { + prop.put("omode", 0); + } else if (env.getConfig("onlineMode", "1").equals("1")) { + prop.put("omode", 1); + } else { prop.put("omode", 2); } diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java index 59b8eef75..9ed502dd5 100644 --- a/source/de/anomic/http/httpdProxyHandler.java +++ b/source/de/anomic/http/httpdProxyHandler.java @@ -409,8 +409,15 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt null, // initiator switchboard.defaultProxyProfile // profile ); - - if (cacheExists && cacheEntry.shallUseCacheForProxy()) { + if (yacyCore.getOnlineMode() == 0) { + if (cacheExists) { + fulfillRequestFromCache(conProp,url,ext,requestHeader,cachedResponseHeader,cacheFile,respond); + } + else { + httpd.sendRespondError(conProp,respond,4,404,null,"URL not availabe in Cache",null); + } + } + else if (cacheExists && cacheEntry.shallUseCacheForProxy()) { fulfillRequestFromCache(conProp,url,ext,requestHeader,cachedResponseHeader,cacheFile,respond); } else { fulfillRequestFromWeb(conProp,url,ext,requestHeader,cachedResponseHeader,cacheFile,respond); diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.java index 068abd5bb..e14730307 100644 --- a/source/de/anomic/yacy/yacyCore.java +++ b/source/de/anomic/yacy/yacyCore.java @@ -105,7 +105,7 @@ public class yacyCore { private String lastSeedUpload_myPeerType = ""; private String lastSeedUpload_myIP = ""; - private int onlineMode = 1; + private static int onlineMode = 1; private plasmaSwitchboard switchboard; private static TimeZone GMTTimeZone = TimeZone.getTimeZone("America/Los_Angeles"); @@ -221,6 +221,15 @@ public class yacyCore { return ((onlineMode == 2) || ((System.currentTimeMillis() - lastOnlineTime) < 10000)); } + public static int getOnlineMode() { + return onlineMode; + } + + public static void setOnlineMode(int newOnlineMode) { + onlineMode = newOnlineMode; + return; + } + public void loadSeeds() { //new Thread(new vprobe()).start(); peerActions.loadSeedLists(); // start to bootstrap the network here @@ -716,4 +725,4 @@ public class yacyCore { } } -} \ No newline at end of file +} diff --git a/yacy.init b/yacy.init index fe73da889..97f395d0a 100644 --- a/yacy.init +++ b/yacy.init @@ -287,6 +287,7 @@ peerName=anomic peerCycle=2 # The p2p maintenance can run in either of two online modes: +# - don't process jobs and only access available in cache -> mode 0 # - process any job only if we are online, which is technically only the case # if the proxy is used -> mode 1 # - process jobs periodically, with periodes according to peerCycle -> mode 2