mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Add frontend changes for supporting a local recursive DNS server
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -198,11 +198,34 @@ function readAdlists()
|
||||
}
|
||||
}
|
||||
}
|
||||
$DNSservercount = count($DNSservers);
|
||||
|
||||
// Check if at least one DNS server has been added
|
||||
if(count($DNSservers) < 1)
|
||||
if(isset($_POST["localrecursive"]))
|
||||
{
|
||||
$error .= "No DNS server has been selected.<br>";
|
||||
if(isset($_POST["localrecursiveport"]) &&
|
||||
is_numeric($_POST["localrecursiveport"]))
|
||||
{
|
||||
// Save port and modify dnsmasq.d config file
|
||||
exec("sudo pihole -a localrecursivedns ".intval($_POST["localrecursiveport"]));
|
||||
$DNSservercount++;
|
||||
}
|
||||
else if(isset($localrecursive))
|
||||
{
|
||||
// Remove entry without valid port
|
||||
exec("sudo pihole -a localrecursivedns 0");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove possible entry if unticked
|
||||
|
||||
exec("sudo pihole -a localrecursivedns 0");
|
||||
// Check if at least one DNS server has been added
|
||||
if($DNSservercount < 1)
|
||||
{
|
||||
$error .= "No DNS server has been selected.<br>";
|
||||
}
|
||||
}
|
||||
|
||||
// Check if domain-needed is requested
|
||||
@@ -286,7 +309,7 @@ function readAdlists()
|
||||
$IPs = implode (",", $DNSservers);
|
||||
$return = exec("sudo pihole -a setdns ".$IPs." ".$extra);
|
||||
$success .= htmlspecialchars($return)."<br>";
|
||||
$success .= "The DNS settings have been updated (using ".count($DNSservers)." DNS servers)";
|
||||
$success .= "The DNS settings have been updated (using ".$DNSservercount." DNS servers)";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -205,6 +205,16 @@ if (isset($setupVars["QUERY_LOGGING"])) {
|
||||
} else {
|
||||
$piHoleLogging = true;
|
||||
}
|
||||
|
||||
if (isset($setupVars["LOCAL_RECURSIVE"])) {
|
||||
if($setupVars["LOCAL_RECURSIVE"]) {
|
||||
$localrecursive = $setupVars["LOCAL_RECURSIVE"];
|
||||
} else {
|
||||
$localrecursive = false;
|
||||
}
|
||||
} else {
|
||||
$localrecursive = false;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
@@ -744,6 +754,16 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "blocklists"
|
||||
data-inputmask="'alias': 'ipv6'" data-mask
|
||||
<?php if (isset($custom4)){ ?>value="<?php echo $custom4; ?>"<?php } ?>>
|
||||
</div>
|
||||
<label>Local recursive server (see <a href="https://github.com/pi-hole/pi-hole/wiki/Pi-hole-as-recursive-DNS-server">here</a>)</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">
|
||||
<input type="checkbox" name="localrecursive" value="yes"
|
||||
<?php if ($localrecursive){ ?>checked<?php } ?>>
|
||||
</div>
|
||||
<input type="text" placeholder="127.0.0.1" class="form-control" disabled style="background: white; width: 25%;">
|
||||
<input type="text" name="localrecursiveport" class="form-control" placeholder="port" style="width: 75%"
|
||||
<?php if ($localrecursive){ ?>value="<?php echo $localrecursive; ?>"<?php } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user