Skip to content

Commit

Permalink
Calling FTL API directly from PHP
Browse files Browse the repository at this point in the history
- Using constants for default values
- Remove unnecessary variable
- Reuse `summaryRaw` data in index.js
- Replace `piholeStatusAPI()` with a call to FTL API
- Transfer `api.php?status` code from `api.php` to `api_FTL.php`
- Change `piholeStatus()` to use FTL info (no need to use `pihole`).

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
  • Loading branch information
rdwebdesign committed Feb 19, 2022
1 parent e93212f commit c644882
Show file tree
Hide file tree
Showing 5 changed files with 472 additions and 532 deletions.
6 changes: 1 addition & 5 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@
require_once("scripts/pi-hole/php/auth.php");
check_cors();

$FTL_IP = "127.0.0.1";

$data = array();

// Common API functions
if (isset($_GET['status'])) {
$data = array_merge($data, array("status" => piholeStatusAPI()));
} elseif (isset($_GET['enable']) && $auth) {
if (isset($_GET['enable']) && $auth) {
if(isset($_GET["auth"]))
{
if($_GET["auth"] !== $pwhash)
Expand Down
Loading

0 comments on commit c644882

Please sign in to comment.