mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Specify one common place for defining the IP of a non-local FTL instance. Fixes #589
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -13,6 +13,7 @@ require("scripts/pi-hole/php/password.php");
|
||||
require("scripts/pi-hole/php/auth.php");
|
||||
check_cors();
|
||||
|
||||
$FTL_IP = "127.0.0.1";
|
||||
|
||||
$data = array();
|
||||
|
||||
@@ -74,7 +75,7 @@ elseif (isset($_GET['disable']) && $auth)
|
||||
}
|
||||
|
||||
// Other API functions
|
||||
if(!testFTL() && !isset($_GET["PHP"]))
|
||||
if(!testFTL($FTL_IP) && !isset($_GET["PHP"]))
|
||||
{
|
||||
$data = array_merge($data, array("FTLnotrunning" => true));
|
||||
}
|
||||
|
||||
+2
-1
@@ -12,7 +12,8 @@ if(!isset($api))
|
||||
die("Direct call to api_FTL.php is not allowed!");
|
||||
}
|
||||
|
||||
$socket = connectFTL("127.0.0.1");
|
||||
// $FTL_IP is defined in api.php
|
||||
$socket = connectFTL($FTL_IP);
|
||||
|
||||
if (isset($_GET['type'])) {
|
||||
$data["type"] = "FTL";
|
||||
|
||||
@@ -6,10 +6,19 @@
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
function testFTL()
|
||||
function testFTL($address)
|
||||
{
|
||||
$ret = shell_exec("pidof pihole-FTL");
|
||||
return intval($ret);
|
||||
if($address === "127.0.0.1")
|
||||
{
|
||||
$ret = shell_exec("pidof pihole-FTL");
|
||||
return intval($ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We cannot relly test for a distant FTL instance
|
||||
// in the same way, so we return true here
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function connectFTL($address, $port=4711, $quiet=true)
|
||||
|
||||
Reference in New Issue
Block a user