deny of global search in case DHT is switched off

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@445 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 6f2f54a312
commit 0174df12af

@ -9,9 +9,9 @@
<br><br> <br><br>
<h2>Index Administration</h2> <h2>Index Administration</h2>
<form action="IndexControl_p.html" method="post" enctype="multipart/form-data">
<p> <p>
The local index currently consists of (at least) #[wcount]# reverse word indexes and #[ucount]# URL references<br> The local index currently consists of (at least) #[wcount]# reverse word indexes and #[ucount]# URL references<br>
<form action="IndexControl_p.html" method="post" enctype="multipart/form-data">
<table border="0" cellpadding="5" cellspacing="0"> <table border="0" cellpadding="5" cellspacing="0">
<tr valign="top" class="TableCellDark"> <tr valign="top" class="TableCellDark">
<td width="70">Word</td> <td width="70">Word</td>
@ -50,34 +50,43 @@ The local index currently consists of (at least) #[wcount]# reverse word indexes
<td><input type="submit" name="urlhashsearch" value="Show Details for URL-Hash"> <td><input type="submit" name="urlhashsearch" value="Show Details for URL-Hash">
</td> </td>
</tr> </tr>
</table><p> </table></p>
<table border="0" cellpadding="5" cellspacing="0">
<p>
DHT Transmission control:<br>
The transmission is necessary for the functionality of global search on other peers.
If you switch off distribution or receipt of RWIs you will be banned from global search.
<table border="0" cellpadding="5" cellspacing="0">
<tr valign="top" class="TableCellDark"> <tr valign="top" class="TableCellDark">
<td width="100">Index Distribution:</td> <td width="100">Index Distribution:</td>
<td><input type="checkbox" name="indexDistribute" align="top" #[indexDistributeChecked]#> <td><input type="checkbox" name="indexDistribute" align="top" #[indexDistributeChecked]#></td>
This enables automated, DHT-ruled Index Transmission to other peers. This is currently only activated for junior peers.</td> <td></td>
<td><input type="submit" name="setIndexDistribute" value="set"></td> <td>This enables automated, DHT-ruled Index Transmission to other peers.
</td>
</tr> </tr>
</table> <tr valign="top" class="TableCellDark">
<table border="0" cellpadding="5" cellspacing="0">
<tr valign="top" class="TableCellLight">
<td width="100">Index Receive:</td> <td width="100">Index Receive:</td>
<td><input type="checkbox" name="indexReceive" align="top" #[indexReceiveChecked]#> <td><input type="checkbox" name="indexReceive" align="top" #[indexReceiveChecked]#></td>
Accept remote Index Transmissions. This works only if you are a senior peer. The DHT-rules do not work without this function.</td> <td></td>
<td>Accept remote Index Transmissions. This works only if you are a senior peer.
The DHT-rules do not work without this function.</td>
</tr> </tr>
<tr valign="top" class="TableCellLight"> <tr valign="top" class="TableCellDark">
<td></td><td>&nbsp;&nbsp;<input type="checkbox" name="indexReceiveBlockBlacklist" align="top" #[indexReceiveBlockBlacklistChecked]#> <td width="100"></td>
If checked, your peer silently ignores transmitted URLs that match your blacklist</td> <td>&nbsp;&nbsp;</td>
<td><input type="checkbox" name="indexReceiveBlockBlacklist" align="top" #[indexReceiveBlockBlacklistChecked]#></td>
<td>If checked, your peer silently ignores transmitted URLs that match your blacklist</td>
</tr> </tr>
<tr valign="top" class="TableCellLight"> <tr valign="top" class="TableCellLight">
<td></td><td><input type="submit" name="setIndexReceive" value="set"></td> <td></td>
<td><input type="submit" name="setIndexTransmission" value="set"></td>
<td></td>
<td>Changes will take effect immediately</td>
</tr> </tr>
</table> </table>
</form>
</p> </p>
</form>
#[result]# #[result]#

@ -105,13 +105,10 @@ public class IndexControl_p {
boolean delurlref = post.containsKey("delurlref"); boolean delurlref = post.containsKey("delurlref");
//System.out.println("DEBUG CHECK: " + ((delurl) ? "delurl" : "") + " " + ((delurlref) ? "delurlref" : "")); //System.out.println("DEBUG CHECK: " + ((delurl) ? "delurl" : "") + " " + ((delurlref) ? "delurlref" : ""));
if (post.containsKey("setIndexDistribute")) { if (post.containsKey("setIndexTransmission")) {
boolean allowDistributeIndex = ((String) post.get("indexDistribute", "")).equals("on"); boolean allowDistributeIndex = ((String) post.get("indexDistribute", "")).equals("on");
switchboard.setConfig("allowDistributeIndex", (allowDistributeIndex) ? "true" : "false"); switchboard.setConfig("allowDistributeIndex", (allowDistributeIndex) ? "true" : "false");
if (allowDistributeIndex) switchboard.indexDistribution.enable(); else switchboard.indexDistribution.disable(); if (allowDistributeIndex) switchboard.indexDistribution.enable(); else switchboard.indexDistribution.disable();
}
if (post.containsKey("setIndexReceive")) {
boolean allowReceiveIndex = ((String) post.get("indexReceive", "")).equals("on"); boolean allowReceiveIndex = ((String) post.get("indexReceive", "")).equals("on");
switchboard.setConfig("allowReceiveIndex", (allowReceiveIndex) ? "true" : "false"); switchboard.setConfig("allowReceiveIndex", (allowReceiveIndex) ? "true" : "false");
yacyCore.seedDB.mySeed.setFlagAcceptRemoteIndex(allowReceiveIndex); yacyCore.seedDB.mySeed.setFlagAcceptRemoteIndex(allowReceiveIndex);

@ -66,7 +66,12 @@ public class index {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
plasmaSwitchboard sb = (plasmaSwitchboard) env; plasmaSwitchboard sb = (plasmaSwitchboard) env;
// case if no values are requested boolean global = (post == null) ? true : ((String) post.get("resource", "global")).equals("global");
boolean indexDistributeGranted = sb.getConfig("allowDistributeIndex", "true").equals("true");
boolean indexReceiveGranted = sb.getConfig("allowReceiveIndex", "true").equals("true");
if ((!indexDistributeGranted) || (!indexReceiveGranted)) global = false;
// case if no values are requested
if ((post == null) || (env == null)) { if ((post == null) || (env == null)) {
// save referrer // save referrer
@ -99,8 +104,8 @@ public class index {
prop.put("count-1000", 0); prop.put("count-1000", 0);
prop.put("order-quality", 0); prop.put("order-quality", 0);
prop.put("order-date", 0); prop.put("order-date", 0);
prop.put("resource-global", 0); prop.put("resource-global", ((global) ? 1 : 0));
prop.put("resource-local", 0); prop.put("resource-local", ((global) ? 0 : 1));
prop.put("time-1", 0); prop.put("time-1", 0);
prop.put("time-3", 0); prop.put("time-3", 0);
prop.put("time-10", 1); prop.put("time-10", 1);
@ -123,7 +128,8 @@ public class index {
// prepare search order // prepare search order
String order = (String) post.get("order", ""); String order = (String) post.get("order", "");
int count = Integer.parseInt((String) post.get("count", "10")); int count = Integer.parseInt((String) post.get("count", "10"));
boolean global = ((String) post.get("resource", "global")).equals("global");
long searchtime = 1000 * Long.parseLong((String) post.get("time", "1")); long searchtime = 1000 * Long.parseLong((String) post.get("time", "1"));
boolean yacyonline = ((yacyCore.seedDB != null) && boolean yacyonline = ((yacyCore.seedDB != null) &&
(yacyCore.seedDB.mySeed != null) && (yacyCore.seedDB.mySeed != null) &&
@ -227,7 +233,7 @@ public class index {
prop.put("order-quality", ((order.equals("Quality-Date")) ? 1 : 0)); prop.put("order-quality", ((order.equals("Quality-Date")) ? 1 : 0));
prop.put("order-date", ((order.equals("Date-Quality")) ? 1 : 0)); prop.put("order-date", ((order.equals("Date-Quality")) ? 1 : 0));
prop.put("resource-global", ((global) ? 1 : 0)); prop.put("resource-global", ((global) ? 1 : 0));
prop.put("resource-local", ((!global) ? 1 : 0)); prop.put("resource-local", ((global) ? 0 : 1));
prop.put("time-1", ((searchtime == 1000) ? 1 : 0)); prop.put("time-1", ((searchtime == 1000) ? 1 : 0));
prop.put("time-3", ((searchtime == 3000) ? 1 : 0)); prop.put("time-3", ((searchtime == 3000) ? 1 : 0));
prop.put("time-10", ((searchtime == 10000) ? 1 : 0)); prop.put("time-10", ((searchtime == 10000) ? 1 : 0));

Loading…
Cancel
Save