Merge pull request #1825 from RaspAP/fix/custom-blocklists

Fix: Check for presence of custom blocklist
This commit is contained in:
Bill Zimmerman
2025-04-17 10:07:12 +02:00
committed by GitHub

View File

@@ -40,7 +40,6 @@ function DisplayAdBlockConfig()
file_put_contents("/tmp/dnsmasq_custom", $_POST['adblock-custom-hosts'].PHP_EOL);
system("sudo cp /tmp/dnsmasq_custom " .RASPI_ADBLOCK_LISTPATH .'custom.txt', $return);
$config.= 'addn-hosts=' .RASPI_ADBLOCK_LISTPATH .'custom.txt'.PHP_EOL;
$custom_enabled = true;
}
if (empty($errors)) {
@@ -64,6 +63,13 @@ function DisplayAdBlockConfig()
}
}
$custom_list = RASPI_ADBLOCK_LISTPATH . 'custom.txt';
$custom_enabled = false;
if (file_exists($custom_list) && filesize($custom_list) > 0) {
$custom_enabled = true;
}
exec('cat '. RASPI_ADBLOCK_CONFIG, $return);
$arrConf = ParseConfig($return);
if (sizeof($arrConf) > 0) {