mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Update fetch remote blocklists
This commit is contained in:
parent
1f5d4b0830
commit
3e491c17f4
@ -4,21 +4,50 @@ require '../../includes/csrf.php';
|
|||||||
require_once '../../includes/config.php';
|
require_once '../../includes/config.php';
|
||||||
|
|
||||||
if (isset($_POST['blocklist_id'])) {
|
if (isset($_POST['blocklist_id'])) {
|
||||||
$blocklist_id = $_POST['blocklist_id'];
|
$blocklist_id = escapeshellcmd($_POST['blocklist_id']);
|
||||||
$notracking_url = "https://raw.githubusercontent.com/notracking/hosts-blocklists/master/";
|
|
||||||
|
|
||||||
switch ($blocklist_id) {
|
switch ($blocklist_id) {
|
||||||
case "notracking-hostnames":
|
case "StevenBlack/hosts \(default\)":
|
||||||
$file = "hostnames.txt";
|
$list_url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts";
|
||||||
|
$dest_file = "hostnames.txt";
|
||||||
break;
|
break;
|
||||||
case "notracking-domains":
|
case "badmojr/1Hosts \(Mini\)":
|
||||||
$file = "domains.txt";
|
$list_url = "https://badmojr.github.io/1Hosts/mini/hosts.txt";
|
||||||
|
$dest_file = "hostnames.txt";
|
||||||
|
break;
|
||||||
|
case "badmojr/1Hosts \(Lite\)":
|
||||||
|
$list_url = "https://badmojr.github.io/1Hosts/Lite/hosts.txt";
|
||||||
|
$dest_file = "hostnames.txt";
|
||||||
|
break;
|
||||||
|
case "badmojr/1Hosts \(Pro\)":
|
||||||
|
$list_url = "https://badmojr.github.io/1Hosts/Pro/hosts.txt";
|
||||||
|
$dest_file = "hostnames.txt";
|
||||||
|
break;
|
||||||
|
case "badmojr/1Hosts \(Xtra\)":
|
||||||
|
$list_url = "https://badmojr.github.io/1Hosts/Xtra/hosts.txt";
|
||||||
|
$dest_file = "hostnames.txt";
|
||||||
|
break;
|
||||||
|
case "oisd/big \(default\)":
|
||||||
|
$list_url = "https://big.oisd.nl/dnsmasq";
|
||||||
|
$dest_file = "domains.txt";
|
||||||
|
break;
|
||||||
|
case "oisd/small":
|
||||||
|
$list_url = "https://small.oisd.nl/dnsmasq";
|
||||||
|
$dest_file = "domains.txt";
|
||||||
|
break;
|
||||||
|
case "oisd/nsfw":
|
||||||
|
$list_url = "https://nsfw.oisd.nl/dnsmasq";
|
||||||
|
$dest_file = "domains.txt";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$blocklist = $notracking_url . $file;
|
$blocklist = $list_url . $dest_file;
|
||||||
|
$dest = substr($dest_file, 0, strrpos($dest_file, "."));
|
||||||
|
|
||||||
exec("sudo /etc/raspap/adblock/update_blocklist.sh $blocklist $file " .RASPI_ADBLOCK_LISTPATH, $return);
|
exec("sudo /etc/raspap/adblock/update_blocklist.sh $list_url $dest_file " .RASPI_ADBLOCK_LISTPATH, $return);
|
||||||
$jsonData = ['return'=>$return];
|
$jsonData = ['return'=>$return,'list'=>$dest];
|
||||||
|
echo json_encode($jsonData);
|
||||||
|
} else {
|
||||||
|
$jsonData = ['return'=>2,'output'=>['Error getting data']];
|
||||||
echo json_encode($jsonData);
|
echo json_encode($jsonData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user