mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
Blacklist import from file, exclude comment lines
starting with # // or ; inspired by issue https://github.com/yacy/yacy_search_server/issues/446
This commit is contained in:
parent
0e4c93f02a
commit
11c4a1b45c
|
@ -58,7 +58,7 @@ public class BlacklistImpExp_p {
|
|||
|
||||
// if we have not chosen a blacklist until yet we use the first file
|
||||
if (blacklistToUse == null && dirlist != null && !dirlist.isEmpty()) {
|
||||
blacklistToUse = dirlist.get(0);
|
||||
blacklistToUse = Blacklist.defaultBlacklist(sb.listsPath);
|
||||
}
|
||||
|
||||
// List known hosts for BlackList retrieval
|
||||
|
|
|
@ -9,14 +9,21 @@
|
|||
var selectForm = document.forms.namedItem(name);
|
||||
var count = selectForm.elements["num"].value;
|
||||
for(i = 0; i<= count; i++){
|
||||
selectForm.elements["item" + i].checked = true;
|
||||
//If it isn't "undefined" and it isn't "null", then it exists.
|
||||
if(typeof(selectForm.elements["item" + i]) != 'undefined' && selectForm.elements["item" + i] != null) {
|
||||
//thecheckbox.checked = true;
|
||||
selectForm.elements["item" + i].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function deselectall(name){
|
||||
var selectForm = document.forms.namedItem(name);
|
||||
var count = selectForm.elements["num"].value;
|
||||
for(i = 0; i<= count; i++){
|
||||
selectForm.elements["item" + i].checked = false;
|
||||
if(typeof(selectForm.elements["item" + i]) != 'undefined' && selectForm.elements["item" + i] != null){
|
||||
selectForm.elements["item" + i].checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
-->
|
||||
|
@ -65,7 +72,7 @@
|
|||
|
||||
<select name="currentBlacklist" size="1">
|
||||
#{blackLists}#
|
||||
<option value="#[name]#">#[name]#</option>
|
||||
<option value="#[name]#" #[options]#>#[name]#</option>
|
||||
#{/blackLists}#
|
||||
</select>
|
||||
|
||||
|
@ -79,7 +86,13 @@
|
|||
</tr>#{urllist}#
|
||||
<tr class="TableCell#(dark)#Light::Dark#(/dark)#" class="small">
|
||||
<td>#[url]#</td>
|
||||
<td><input type="checkbox" name="item#[count]#" value="#[url]#" /></td>
|
||||
<td>
|
||||
#(toimport)#
|
||||
|
||||
::
|
||||
<input type="checkbox" name="item#[count]#" value="#[url]#" />
|
||||
#(/toimport)#
|
||||
</td>
|
||||
</tr>#{/urllist}#
|
||||
<tr class="small" style="background-color: #eeeeee">
|
||||
<td colspan="2">
|
||||
|
|
|
@ -119,6 +119,11 @@ public class sharedBlacklist_p {
|
|||
if (dirlist != null) {
|
||||
for (final String element : dirlist) {
|
||||
prop.putXML("page_blackLists_" + blacklistCount + "_name", element);
|
||||
if (selectedBlacklistName.equalsIgnoreCase(element)) {
|
||||
prop.putXML("page_blackLists_" + blacklistCount + "_options","selected");
|
||||
} else {
|
||||
prop.putXML("page_blackLists_" + blacklistCount + "_options","");
|
||||
}
|
||||
blacklistCount++;
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +293,14 @@ public class sharedBlacklist_p {
|
|||
prop.put("page_urllist_" + count + "_dark", count % 2 == 0 ? "0" : "1");
|
||||
/* We do not use here putHTML as we don't want '+' characters to be decoded as spaces by application/x-www-form-urlencoded encoding */
|
||||
prop.put("page_urllist_" + count + "_url", CharacterCoding.unicode2html(tmp, true));
|
||||
prop.put("page_urllist_" + count + "_count", count);
|
||||
// exclude comment lines
|
||||
if (tmp.startsWith("#") || tmp.startsWith("//") || tmp.startsWith(";")) {
|
||||
prop.put("page_urllist_" + count + "_toimport", "0");
|
||||
} else {
|
||||
prop.put("page_urllist_" + count + "_toimport", "1");
|
||||
prop.put("page_urllist_" + count + "_toimport_count", count);
|
||||
prop.put("page_urllist_" + count + "_toimport_url", CharacterCoding.unicode2html(tmp, true));
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user