mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-25 09:00:25 +00:00
Added contant adblock_listpath
This commit is contained in:
parent
ab68168951
commit
46213b90b0
3 changed files with 12 additions and 4 deletions
|
@ -11,6 +11,8 @@ define('RASPI_CACHE_PATH', sys_get_temp_dir() . '/raspap');
|
|||
// These are typical for default RPi installs. Modify if needed.
|
||||
define('RASPI_DNSMASQ_CONFIG', '/etc/dnsmasq.conf');
|
||||
define('RASPI_DNSMASQ_LEASES', '/var/lib/misc/dnsmasq.leases');
|
||||
define('RASPI_ADBLOCK_LISTPATH', '/etc/raspap/adblock/');
|
||||
define('RASPI_ADBLOCK_CONFIG', '/etc/dnsmasq.d/090_adblock.conf');
|
||||
define('RASPI_HOSTAPD_CONFIG', '/etc/hostapd/hostapd.conf');
|
||||
define('RASPI_DHCPCD_CONFIG', '/etc/dhcpcd.conf');
|
||||
define('RASPI_WPA_SUPPLICANT_CONFIG', '/etc/wpa_supplicant/wpa_supplicant.conf');
|
||||
|
|
|
@ -16,18 +16,21 @@ function DisplayAdBlockConfig()
|
|||
if (!RASPI_MONITOR_ENABLED) {
|
||||
if (isset($_POST['saveadblocksettings'])) {
|
||||
if ($_POST['adblock-enable'] == "1") {
|
||||
$arrConf['conf-file'] = '/etc/dnsmasq.d/domains.txt';
|
||||
$arrConf['addn-hosts'] = '/etc/dnsmasq.d/hostnames.txt';
|
||||
$arrConf['conf-file'] = RASPI_ADBLOCK_LISTPATH .'domains.txt';
|
||||
$arrConf['addn-hosts'] = RASPI_ADBLOCK_LISTPATH .'hostnames.txt';
|
||||
} else {
|
||||
unset($arrConf['conf-file']);
|
||||
unset($arrConf['addn-hosts']);
|
||||
}
|
||||
$config = array_map(function($value, $key) {
|
||||
if (is_bool($value)) {
|
||||
return $key;
|
||||
} else {
|
||||
return $key.'='.$value;
|
||||
}
|
||||
}, array_values($arrConf), array_keys($arrConf));
|
||||
$config = implode(PHP_EOL, $config);
|
||||
$config = $config . PHP_EOL;
|
||||
|
||||
file_put_contents("/tmp/dnsmasqdata", $config);
|
||||
system('sudo cp /tmp/dnsmasqdata '.RASPI_DNSMASQ_CONFIG, $return);
|
||||
|
||||
|
@ -47,6 +50,7 @@ function DisplayAdBlockConfig()
|
|||
"adblock", compact(
|
||||
"status",
|
||||
"serviceStatus",
|
||||
"dnsmasq_state",
|
||||
"arrConf"
|
||||
)
|
||||
);
|
||||
|
|
|
@ -15,6 +15,8 @@ $defaults = [
|
|||
// These are typical for default RPi installs. Modify if needed.
|
||||
'RASPI_DNSMASQ_CONFIG' => '/etc/dnsmasq.conf',
|
||||
'RASPI_DNSMASQ_LEASES' => '/var/lib/misc/dnsmasq.leases',
|
||||
'RASPI_ADBLOCK_LISTPATH' => '/etc/raspap/adblock/',
|
||||
'RASPI_ADBLOCK_CONFIG' => '/etc/dnsmasq.d/090_adblock.conf',
|
||||
'RASPI_HOSTAPD_CONFIG' => '/etc/hostapd/hostapd.conf',
|
||||
'RASPI_DHCPCD_CONFIG' => '/etc/dhcpcd.conf',
|
||||
'RASPI_WPA_SUPPLICANT_CONFIG' => '/etc/wpa_supplicant/wpa_supplicant.conf',
|
||||
|
|
Loading…
Reference in a new issue