From a21b0a8f99485d4658e2c3cada8e4658e1bbf091 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 16 Apr 2025 23:33:13 -0700 Subject: [PATCH] Check for presence of custom blocklist in RASPI_ADBLOCK_LISTPATH --- includes/adblock.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/adblock.php b/includes/adblock.php index ec6fb38d..6cf590b8 100755 --- a/includes/adblock.php +++ b/includes/adblock.php @@ -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) {