mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Pi-hole web v5.20 (#2594)
This commit is contained in:
@@ -21,7 +21,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3.4.0
|
||||
uses: actions/checkout@v3.5.2
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Checkout repository
|
||||
uses: actions/checkout@v3.4.0
|
||||
uses: actions/checkout@v3.5.2
|
||||
-
|
||||
name: Spell-Checking
|
||||
uses: codespell-project/actions-codespell@master
|
||||
|
||||
@@ -9,6 +9,6 @@ jobs:
|
||||
name: editorconfig-checker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.4.0
|
||||
- uses: actions/checkout@v3.5.2
|
||||
- uses: editorconfig-checker/action-editorconfig-checker@main
|
||||
- run: editorconfig-checker
|
||||
|
||||
@@ -6,7 +6,7 @@ jobs:
|
||||
name: PHP-CS-Fixer
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.4.0
|
||||
- uses: actions/checkout@v3.5.2
|
||||
- name: PHP-CS-Fixer
|
||||
uses: docker://oskarstark/php-cs-fixer-ga
|
||||
with:
|
||||
|
||||
@@ -8,7 +8,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.4.0
|
||||
- uses: actions/checkout@v3.5.2
|
||||
|
||||
- name: Install composer
|
||||
uses: php-actions/composer@v6
|
||||
|
||||
@@ -4,23 +4,41 @@ on:
|
||||
schedule:
|
||||
- cron: '0 8 * * *'
|
||||
workflow_dispatch:
|
||||
issue_comment:
|
||||
|
||||
env:
|
||||
stale_label: stale
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
|
||||
stale_action:
|
||||
if: github.event_name != 'issue_comment'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v7.0.0
|
||||
- uses: actions/stale@v8.0.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 30
|
||||
days-before-close: 5
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.'
|
||||
stale-issue-label: 'stale'
|
||||
stale-issue-label: $stale_label
|
||||
exempt-issue-labels: 'internal, Fixed In Next Release, Bug, never-stale'
|
||||
exempt-all-issue-assignees: true
|
||||
operations-per-run: 300
|
||||
close-issue-reason: 'not_planned'
|
||||
|
||||
remove_stale: # trigger "stale" removal immediately when stale issues are commented on
|
||||
if: github.event_name == 'issue_comment'
|
||||
permissions:
|
||||
contents: read # for actions/checkout
|
||||
issues: write # to edit issues label
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3.4.0
|
||||
- name: Remove 'stale' label
|
||||
run: gh issue edit ${{ github.event.issue.number }} --remove-label $stale_label
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v7.0.0
|
||||
- uses: actions/stale@v8.0.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Do not automatically mark PR/issue as stale
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
name: Syncing branches
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3.4.0
|
||||
uses: actions/checkout@v3.5.2
|
||||
- name: Opening pull request
|
||||
run: gh pr create -B devel -H master --title 'Sync master back into development' --body 'Created by Github action' --label 'internal'
|
||||
env:
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v3.4.0
|
||||
uses: actions/checkout@v3.5.2
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3.6.0
|
||||
|
||||
@@ -71,6 +71,13 @@ if (isset($_GET['enable']) && $auth) {
|
||||
$branches = array('core_branch' => $core_branch,
|
||||
'web_branch' => $web_branch,
|
||||
'FTL_branch' => $FTL_branch, );
|
||||
if (isset($versions['DOCKER_VERSION'])) {
|
||||
// Docker info is available only inside containers
|
||||
$updates['docker_update'] = $docker_update;
|
||||
$current['docker_current'] = $docker_current;
|
||||
$latest['docker_latest'] = $docker_latest;
|
||||
}
|
||||
|
||||
$data = array_merge($data, $updates);
|
||||
$data = array_merge($data, $current);
|
||||
$data = array_merge($data, $latest);
|
||||
|
||||
+30
-14
@@ -64,30 +64,37 @@ if ((isset($_GET['summary']) || isset($_GET['summaryRaw']) || !count($_GET)) &&
|
||||
}
|
||||
|
||||
if (isset($_GET['getMaxlogage']) && $auth) {
|
||||
$return = callFTLAPI('maxlogage');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$maxlogage = getMaxlogage();
|
||||
|
||||
if ($maxlogage < 0) {
|
||||
// FTL is offline
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
// Convert seconds to hours and rounds to one decimal place.
|
||||
$ret = round(intval($return[0]) / 3600, 1);
|
||||
// Return 24h if value is 0, empty, null or non numeric.
|
||||
$ret = $ret ?: 24;
|
||||
|
||||
$data = array_merge($data, array('maxlogage' => $ret));
|
||||
$data = array_merge($data, array('maxlogage' => $maxlogage));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['overTimeData10mins']) && $auth) {
|
||||
$maxlogage = getMaxlogage();
|
||||
|
||||
$return = callFTLAPI('overTime');
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
if (array_key_exists('FTLnotrunning', $return) || $maxlogage < 0) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$domains_over_time = array();
|
||||
$ads_over_time = array();
|
||||
|
||||
// Use current time and maxlogage to limit the time range
|
||||
$time_end = time();
|
||||
$time_start = $time_end - ($maxlogage * 3600);
|
||||
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(' ', $line);
|
||||
$domains_over_time[intval($tmp[0])] = intval($tmp[1]);
|
||||
$ads_over_time[intval($tmp[0])] = intval($tmp[2]);
|
||||
$timeslot = intval($tmp[0]);
|
||||
if ($timeslot >= $time_start && $timeslot <= $time_end) {
|
||||
$domains_over_time[$timeslot] = intval($tmp[1]);
|
||||
$ads_over_time[$timeslot] = intval($tmp[2]);
|
||||
}
|
||||
}
|
||||
|
||||
$result = array(
|
||||
@@ -401,16 +408,25 @@ if (isset($_GET['getClientNames']) && $auth) {
|
||||
}
|
||||
|
||||
if (isset($_GET['overTimeDataClients']) && $auth) {
|
||||
$return = callFTLAPI('ClientsoverTime');
|
||||
$maxlogage = getMaxlogage();
|
||||
|
||||
if (array_key_exists('FTLnotrunning', $return)) {
|
||||
$return = callFTLAPI('ClientsoverTime');
|
||||
if (array_key_exists('FTLnotrunning', $return) || $maxlogage < 0) {
|
||||
$data = array('FTLnotrunning' => true);
|
||||
} else {
|
||||
$over_time = array();
|
||||
|
||||
// Use current time and maxlogage to limit the time range
|
||||
$time_end = time();
|
||||
$time_start = $time_end - ($maxlogage * 3600);
|
||||
|
||||
foreach ($return as $line) {
|
||||
$tmp = explode(' ', $line);
|
||||
for ($i = 0; $i < count($tmp) - 1; ++$i) {
|
||||
$over_time[intval($tmp[0])][$i] = floatval($tmp[$i + 1]);
|
||||
$timeslot = intval($tmp[0]);
|
||||
if ($timeslot >= $time_start && $timeslot <= $time_end) {
|
||||
$over_time[$timeslot][$i] = floatval($tmp[$i + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = array('over_time' => $over_time);
|
||||
|
||||
Generated
+5
-5
@@ -8,16 +8,16 @@
|
||||
"packages": [
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.7",
|
||||
"version": "1.10.15",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975"
|
||||
"reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b10ceb526d9607903c5b2673f1fc8775dbe48975",
|
||||
"reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd",
|
||||
"reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -66,7 +66,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-03-16T15:24:20+00:00"
|
||||
"time": "2023-05-09T15:28:01+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
||||
Generated
+377
-264
File diff suppressed because it is too large
Load Diff
+6
-5
@@ -25,11 +25,11 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^10.4.14",
|
||||
"eslint-plugin-compat": "^4.1.2",
|
||||
"postcss": "^8.4.21",
|
||||
"eslint-plugin-compat": "^4.1.4",
|
||||
"postcss": "^8.4.23",
|
||||
"postcss-cli": "^10.1.0",
|
||||
"prettier": "2.8.4",
|
||||
"xo": "^0.53.1"
|
||||
"prettier": "2.8.8",
|
||||
"xo": "^0.54.2"
|
||||
},
|
||||
"browserslist": [
|
||||
"defaults",
|
||||
@@ -101,7 +101,8 @@
|
||||
"unicorn/prefer-string-slice": "off",
|
||||
"unicorn/prevent-abbreviations": "off",
|
||||
"unicorn/prefer-logical-operator-over-ternary": "off",
|
||||
"unicorn/switch-case-braces": "off"
|
||||
"unicorn/switch-case-braces": "off",
|
||||
"unicorn/no-negated-condition": "off"
|
||||
}
|
||||
},
|
||||
"dependencies": {}
|
||||
|
||||
@@ -76,11 +76,11 @@ function updateTopClientsChart() {
|
||||
data.top_sources[utils.escapeHtml(client)] = data.top_sources[client];
|
||||
}
|
||||
|
||||
if (client.indexOf("|") !== -1) {
|
||||
if (client.indexOf("|") === -1) {
|
||||
clientname = client;
|
||||
} else {
|
||||
var idx = client.indexOf("|");
|
||||
clientname = client.substr(0, idx);
|
||||
} else {
|
||||
clientname = client;
|
||||
}
|
||||
|
||||
percentage = (data.top_sources[client] / sum) * 100;
|
||||
|
||||
@@ -95,15 +95,15 @@ var tableApi, statistics;
|
||||
function handleAjaxError(xhr, textStatus) {
|
||||
if (textStatus === "timeout") {
|
||||
alert("The server took too long to send the data.");
|
||||
} else if (xhr.responseText.indexOf("Connection refused") !== -1) {
|
||||
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
||||
} else {
|
||||
} else if (xhr.responseText.indexOf("Connection refused") === -1) {
|
||||
alert(
|
||||
"An unknown error occurred while loading the data.\n" +
|
||||
xhr.responseText +
|
||||
"\nCheck the server's log files (/var/log/lighttpd/error-pihole.log) for details.\n\nYou may need to increase PHP memory limit." +
|
||||
"\n\nYou can find more info in pi-hole's FAQ:\nhttps://docs.pi-hole.net/main/faq/#error-while-loading-data-from-the-long-term-database"
|
||||
);
|
||||
} else {
|
||||
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
||||
}
|
||||
|
||||
$("#all-queries_processing").hide();
|
||||
@@ -457,10 +457,10 @@ $(function () {
|
||||
});
|
||||
$("#all-queries tbody").on("click", "button", function () {
|
||||
var data = tableApi.row($(this).parents("tr")).data();
|
||||
if ([1, 4, 5, 9, 10, 11].indexOf(data[4]) !== -1) {
|
||||
utils.addFromQueryLog(data[2], "white");
|
||||
} else {
|
||||
if ([1, 4, 5, 9, 10, 11].indexOf(data[4]) === -1) {
|
||||
utils.addFromQueryLog(data[2], "black");
|
||||
} else {
|
||||
utils.addFromQueryLog(data[2], "white");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ function eventsource() {
|
||||
// Detect ${OVER}
|
||||
var newString = "<------";
|
||||
|
||||
if (e.data.indexOf(newString) !== -1) {
|
||||
if (e.data.indexOf(newString) === -1) {
|
||||
ta.append(e.data);
|
||||
} else {
|
||||
ta.text(ta.text().substring(0, ta.text().lastIndexOf("\n")) + "\n");
|
||||
ta.append(e.data.replace(newString, ""));
|
||||
} else {
|
||||
ta.append(e.data);
|
||||
}
|
||||
},
|
||||
false
|
||||
|
||||
@@ -79,7 +79,7 @@ $(function () {
|
||||
statusEl.on("change", editGroup);
|
||||
|
||||
$("td:eq(3)", row).html('<input id="desc_' + data.id + '" class="form-control">');
|
||||
var desc = data.description !== null ? data.description : "";
|
||||
var desc = data.description === null ? "" : data.description;
|
||||
var descEl = $("#desc_" + data.id, row);
|
||||
descEl.val(utils.unescapeHtml(desc));
|
||||
descEl.on("change", editGroup);
|
||||
|
||||
@@ -491,13 +491,13 @@ function updateTopClientsChart() {
|
||||
}
|
||||
|
||||
client = utils.escapeHtml(client);
|
||||
if (client.indexOf("|") !== -1) {
|
||||
if (client.indexOf("|") === -1) {
|
||||
clientname = client;
|
||||
clientip = client;
|
||||
} else {
|
||||
idx = client.indexOf("|");
|
||||
clientname = client.substr(0, idx);
|
||||
clientip = client.substr(idx + 1, client.length - idx);
|
||||
} else {
|
||||
clientname = client;
|
||||
clientip = client;
|
||||
}
|
||||
|
||||
url =
|
||||
@@ -531,7 +531,7 @@ function updateTopClientsChart() {
|
||||
}
|
||||
|
||||
client = utils.escapeHtml(client);
|
||||
if (client.indexOf("|") !== -1) {
|
||||
if (client.indexOf("|") === -1) {
|
||||
idx = client.indexOf("|");
|
||||
clientname = client.substr(0, idx);
|
||||
clientip = client.substr(idx + 1, client.length - idx);
|
||||
@@ -719,10 +719,10 @@ function updateSummaryData(runOnce) {
|
||||
}, 500);
|
||||
})
|
||||
.done(function () {
|
||||
if (!FTLoffline) {
|
||||
setTimer(1);
|
||||
} else {
|
||||
if (FTLoffline) {
|
||||
setTimer(10);
|
||||
} else {
|
||||
setTimer(1);
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
|
||||
@@ -20,10 +20,10 @@ var DAY_IN_SECONDS = 24 * 60 * 60;
|
||||
function handleAjaxError(xhr, textStatus) {
|
||||
if (textStatus === "timeout") {
|
||||
alert("The server took too long to send the data.");
|
||||
} else if (xhr.responseText.indexOf("Connection refused") !== -1) {
|
||||
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
||||
} else {
|
||||
} else if (xhr.responseText.indexOf("Connection refused") === -1) {
|
||||
alert("An unknown error occurred while loading the data.\n" + xhr.responseText);
|
||||
} else {
|
||||
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
||||
}
|
||||
|
||||
$("#network-entries_processing").hide();
|
||||
|
||||
@@ -31,10 +31,10 @@ var colTypes = ["time", "query type", "domain", "client", "status", "reply type"
|
||||
function handleAjaxError(xhr, textStatus) {
|
||||
if (textStatus === "timeout") {
|
||||
alert("The server took too long to send the data.");
|
||||
} else if (xhr.responseText.indexOf("Connection refused") !== -1) {
|
||||
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
||||
} else {
|
||||
} else if (xhr.responseText.indexOf("Connection refused") === -1) {
|
||||
alert("An unknown error occurred while loading the data.\n" + xhr.responseText);
|
||||
} else {
|
||||
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
||||
}
|
||||
|
||||
$("#all-queries_processing").hide();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Pi-hole: A black hole for Internet advertisements
|
||||
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||
* Network-wide ad blocking via your own hardware.
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
var timeleft = 60;
|
||||
var status = -1;
|
||||
var reloadMsg =
|
||||
"FTL was restarted: <a href='settings.php' class='btn btn-sm btn-primary'>Reload FTL details.</a>";
|
||||
var warningMsg = "FTL was not able to reload after " + timeleft + " seconds.";
|
||||
var counterMsg = "FTL is reloading: ";
|
||||
|
||||
var reloadTimer = setInterval(function () {
|
||||
$.getJSON("api.php?dns-port", function (data) {
|
||||
if ("FTLnotrunning" in data) {
|
||||
return;
|
||||
}
|
||||
|
||||
status = data["dns-port"];
|
||||
});
|
||||
|
||||
if (timeleft <= 0 || status >= 0) {
|
||||
clearInterval(reloadTimer);
|
||||
if (status < 0) {
|
||||
// FTL was not restarted in 60 seconds. Show warning message
|
||||
document.getElementById("restart-countdown").innerHTML = warningMsg;
|
||||
} else {
|
||||
// FTL restartd.
|
||||
document.getElementById("restart-countdown").innerHTML = reloadMsg;
|
||||
}
|
||||
} else {
|
||||
document.getElementById("restart-countdown").innerHTML =
|
||||
counterMsg + timeleft + " seconds remaining...";
|
||||
}
|
||||
|
||||
timeleft -= 1;
|
||||
}, 1000);
|
||||
@@ -366,15 +366,15 @@ $(function () {
|
||||
var bargraphs = $("#bargraphs");
|
||||
var chkboxData = localStorage ? localStorage.getItem("barchart_chkbox") : null;
|
||||
|
||||
if (chkboxData !== null) {
|
||||
// Restore checkbox state
|
||||
bargraphs.prop("checked", chkboxData === "true");
|
||||
} else {
|
||||
if (chkboxData === null) {
|
||||
// Initialize checkbox
|
||||
bargraphs.prop("checked", true);
|
||||
if (localStorage) {
|
||||
localStorage.setItem("barchart_chkbox", true);
|
||||
}
|
||||
} else {
|
||||
// Restore checkbox state
|
||||
bargraphs.prop("checked", chkboxData === "true");
|
||||
}
|
||||
|
||||
bargraphs.on("click", function () {
|
||||
@@ -386,15 +386,15 @@ $(function () {
|
||||
var colorfulQueryLog = $("#colorfulQueryLog");
|
||||
var chkboxData = localStorage ? localStorage.getItem("colorfulQueryLog_chkbox") : null;
|
||||
|
||||
if (chkboxData !== null) {
|
||||
// Restore checkbox state
|
||||
colorfulQueryLog.prop("checked", chkboxData === "true");
|
||||
} else {
|
||||
if (chkboxData === null) {
|
||||
// Initialize checkbox
|
||||
colorfulQueryLog.prop("checked", false);
|
||||
if (localStorage) {
|
||||
localStorage.setItem("colorfulQueryLog_chkbox", false);
|
||||
}
|
||||
} else {
|
||||
// Restore checkbox state
|
||||
colorfulQueryLog.prop("checked", chkboxData === "true");
|
||||
}
|
||||
|
||||
colorfulQueryLog.on("click", function () {
|
||||
@@ -452,15 +452,15 @@ $(function () {
|
||||
var nonfatalwarnigns = $("#hideNonfatalDnsmasqWarnings");
|
||||
var chkboxData = localStorage ? localStorage.getItem("hideNonfatalDnsmasqWarnings_chkbox") : null;
|
||||
|
||||
if (chkboxData !== null) {
|
||||
// Restore checkbox state
|
||||
nonfatalwarnigns.prop("checked", chkboxData === "true");
|
||||
} else {
|
||||
if (chkboxData === null) {
|
||||
// Initialize checkbox
|
||||
nonfatalwarnigns.prop("checked", false);
|
||||
if (localStorage) {
|
||||
localStorage.setItem("hideNonfatalDnsmasqWarnings_chkbox", false);
|
||||
}
|
||||
} else {
|
||||
// Restore checkbox state
|
||||
nonfatalwarnigns.prop("checked", chkboxData === "true");
|
||||
}
|
||||
|
||||
nonfatalwarnigns.on("click", function () {
|
||||
|
||||
+10
-10
@@ -243,7 +243,7 @@ function stateLoadCallback(itemName) {
|
||||
// Receive previous state from client's local storage area
|
||||
if (localStorage === null) {
|
||||
var item = backupStorage[itemName];
|
||||
data = typeof item === "undefined" ? null : item;
|
||||
data = item === "undefined" ? null : item;
|
||||
} else {
|
||||
data = localStorage.getItem(itemName);
|
||||
}
|
||||
@@ -310,15 +310,7 @@ function addFromQueryLog(domain, list) {
|
||||
},
|
||||
success: function (response) {
|
||||
alProcessing.hide();
|
||||
if (!response.success) {
|
||||
// Failure
|
||||
alNetworkErr.hide();
|
||||
alCustomErr.html(response.message);
|
||||
alFailure.fadeIn(1000);
|
||||
setTimeout(function () {
|
||||
alertModal.modal("hide");
|
||||
}, 10000);
|
||||
} else {
|
||||
if (response.success) {
|
||||
// Success
|
||||
alSuccess.children(alDomain).text(domain);
|
||||
alSuccess.children(alList).text(listtype);
|
||||
@@ -326,6 +318,14 @@ function addFromQueryLog(domain, list) {
|
||||
setTimeout(function () {
|
||||
alertModal.modal("hide");
|
||||
}, 2000);
|
||||
} else {
|
||||
// Failure
|
||||
alNetworkErr.hide();
|
||||
alCustomErr.html(response.message);
|
||||
alFailure.fadeIn(1000);
|
||||
setTimeout(function () {
|
||||
alertModal.modal("hide");
|
||||
}, 10000);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
@@ -635,12 +635,30 @@ function getGateway()
|
||||
if (array_key_exists('FTLnotrunning', $gateway)) {
|
||||
$ret = array('ip' => -1);
|
||||
} else {
|
||||
$ret = array_combine(array('ip', 'iface'), explode(' ', $gateway[0]));
|
||||
$ret = array_combine(array('ip', 'iface'), array_pad(explode(' ', $gateway[0]), 2, ''));
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// Returns the maxlogage used by FTL
|
||||
function getMaxlogage()
|
||||
{
|
||||
$api_return = callFTLAPI('maxlogage');
|
||||
|
||||
if (array_key_exists('FTLnotrunning', $api_return)) {
|
||||
// FTL is offline. Return "-1"
|
||||
$maxlogage = -1;
|
||||
} else {
|
||||
// Convert seconds to hours and rounds to one decimal place.
|
||||
$maxlogage = round(intval($api_return[0]) / 3600, 1);
|
||||
// Return 24h if value is 0, empty, null or non numeric.
|
||||
$maxlogage = $maxlogage ?: 24;
|
||||
}
|
||||
|
||||
return $maxlogage;
|
||||
}
|
||||
|
||||
// Try to convert possible IDNA domain to Unicode
|
||||
function convertIDNAToUnicode($IDNA)
|
||||
{
|
||||
|
||||
@@ -21,13 +21,20 @@ header('Cache-Control: no-cache');
|
||||
|
||||
function echoEvent($datatext)
|
||||
{
|
||||
// Detect ${OVER} and replace it with something we can safely transmit
|
||||
$datatext = str_replace("\r[K", '<------', $datatext);
|
||||
// "pihole -g" command uses an escape sequence to allow overwriting lines = ${OVER}
|
||||
// The ${OVER} sequence is a Carriage Return ("\r") followed by "ESC+[+K" ("\e[K")
|
||||
// This allows every line (including progress and error messages) to be shown on the page
|
||||
|
||||
// Replace ${OVER} with something we can safely transmit and use on the javascript code
|
||||
$datatext = str_replace("\r\e[K", '<------', $datatext);
|
||||
|
||||
// Replace "\r" generated by "pihole-FTL gravity parseList" command
|
||||
$datatext = str_replace("\r", '<------', $datatext);
|
||||
|
||||
$pos = strpos($datatext, '<------');
|
||||
// Detect if the ${OVER} line is within this line, e.g.
|
||||
// "Pending: String to replace${OVER}Done: String has been replaced"
|
||||
// If this is the case, we have to remove everything before ${OVER}
|
||||
// and return only the text thereafter
|
||||
// If the "<------" string is in the middle of the line we remove everything before it
|
||||
// Example: "Pending: String to replace<------Done: String has been replaced"
|
||||
// After replacing: "<------Done: String has been replaced"
|
||||
if ($pos !== false && $pos !== 0) {
|
||||
$datatext = substr($datatext, $pos);
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ $DNSserverslist = readDNSserversList();
|
||||
|
||||
$error = '';
|
||||
$success = '';
|
||||
$FTLrestarted = false;
|
||||
|
||||
if (isset($_POST['field'])) {
|
||||
// Handle CSRF
|
||||
@@ -445,6 +446,7 @@ if (isset($_POST['field'])) {
|
||||
|
||||
case 'restartdns':
|
||||
pihole_execute('-a restartdns');
|
||||
$FTLrestarted = true;
|
||||
$success = 'The DNS server has been restarted';
|
||||
|
||||
break;
|
||||
@@ -554,6 +556,7 @@ if (isset($_POST['field'])) {
|
||||
|
||||
if ($privacylevel > $level) {
|
||||
pihole_execute('-a restartdns');
|
||||
$FTLrestarted = true;
|
||||
$success .= 'The privacy level has been decreased and the DNS resolver has been restarted';
|
||||
} elseif ($privacylevel < $level) {
|
||||
$success .= 'The privacy level has been increased';
|
||||
|
||||
+33
-19
@@ -240,10 +240,13 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array('sysadmin', 'dns', 'piho
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<?php
|
||||
$FTLpid = intval(pidofFTL());
|
||||
<?php
|
||||
// Try to get FTL PID
|
||||
$FTLpid = intval(pidofFTL());
|
||||
|
||||
if ($FTLpid !== 0) {
|
||||
$FTLversion = exec('/usr/bin/pihole-FTL version'); ?>
|
||||
$FTLversion = exec('/usr/bin/pihole-FTL version');
|
||||
?>
|
||||
<table class="table table-striped table-bordered nowrap">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -256,20 +259,19 @@ if ($FTLpid !== 0) {
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Time FTL started:</th>
|
||||
<td><?php print_r(get_FTL_data($FTLpid, 'lstart'));
|
||||
echo ' '.$timezone; ?></td>
|
||||
<td><?php echo get_FTL_data($FTLpid, 'lstart').' '.$timezone; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">User / Group:</th>
|
||||
<td><?php print_r(get_FTL_data($FTLpid, 'euser')); ?> / <?php print_r(get_FTL_data($FTLpid, 'egroup')); ?></td>
|
||||
<td><?php echo get_FTL_data($FTLpid, 'euser').' / '.get_FTL_data($FTLpid, 'egroup'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Total CPU utilization:</th>
|
||||
<td><?php print_r(get_FTL_data($FTLpid, '%cpu')); ?>%</td>
|
||||
<td><?php echo get_FTL_data($FTLpid, '%cpu'); ?>%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Memory utilization:</th>
|
||||
<td><?php print_r(get_FTL_data($FTLpid, '%mem')); ?>%</td>
|
||||
<td><?php echo get_FTL_data($FTLpid, '%mem'); ?>%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
@@ -298,10 +300,20 @@ if ($FTLpid !== 0) {
|
||||
</tbody>
|
||||
</table>
|
||||
See also our <a href="https://docs.pi-hole.net/ftldns/dns-cache/" rel="noopener" target="_blank">DNS cache documentation</a>.
|
||||
<?php
|
||||
} else { ?>
|
||||
<?php
|
||||
} elseif ($FTLrestarted) {
|
||||
// Show a countdown and a message if FTL was restarted
|
||||
?>
|
||||
<div id="restart-countdown"></div>
|
||||
<script src="<?php echo fileversion('scripts/pi-hole/js/restartdns.js'); ?>"></script>
|
||||
<?php
|
||||
} else {
|
||||
// Show a message if FTL is offline
|
||||
?>
|
||||
<div>The FTL service is offline!</div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -428,16 +440,18 @@ if ($FTLpid !== 0) {
|
||||
}
|
||||
} else {
|
||||
$DHCP = false;
|
||||
$DHCPstart = '';
|
||||
$DHCPend = '';
|
||||
$DHCProuter = '';
|
||||
|
||||
// Try to guess initial settings
|
||||
if ($IPv4GW !== 'unknown') {
|
||||
$DHCPparts = explode('.', $IPv4GW);
|
||||
$DHCPstart = $DHCPparts[0].'.'.$DHCPparts[1].'.'.$DHCPparts[2].'.201';
|
||||
$DHCPend = $DHCPparts[0].'.'.$DHCPparts[1].'.'.$DHCPparts[2].'.251';
|
||||
$DHCProuter = $IPv4GW;
|
||||
} else {
|
||||
$DHCPstart = '';
|
||||
$DHCPend = '';
|
||||
$DHCProuter = '';
|
||||
if (isset($DHCPparts[0]) && isset($DHCPparts[1]) && isset($DHCPparts[2])) {
|
||||
$DHCPstart = $DHCPparts[0].'.'.$DHCPparts[1].'.'.$DHCPparts[2].'.201';
|
||||
$DHCPend = $DHCPparts[0].'.'.$DHCPparts[1].'.'.$DHCPparts[2].'.251';
|
||||
$DHCProuter = $IPv4GW;
|
||||
}
|
||||
}
|
||||
$DHCPleasetime = 24;
|
||||
$DHCPIPv6 = false;
|
||||
@@ -940,7 +954,7 @@ if (isset($piholeFTLConf['RATE_LIMIT'])) {
|
||||
Use an upstream DNS server which supports DNSSEC when activating DNSSEC. Note that
|
||||
the size of your log might increase significantly
|
||||
when enabling DNSSEC. A DNSSEC resolver test can be found
|
||||
<a href="https://dnssec.vs.uni-due.de/" rel="noopener" target="_blank">here</a>.</p>
|
||||
<a href="https://wander.science/projects/dns/dnssec-resolver-test/" rel="noopener" target="_blank">here</a>.</p>
|
||||
</div>
|
||||
<br>
|
||||
<h4><a id="ratelimit"></a>Rate-limiting</h4>
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
--datatable-bgcolor: rgba(64, 76, 88, 0.8);
|
||||
}
|
||||
|
||||
/* fix #2554: browser not detecting dark mode */
|
||||
html {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #353c42;
|
||||
color: #bec5cb;
|
||||
|
||||
@@ -32,6 +32,8 @@ _______|_______/__/ ____ \__\__|___\__\__|___\__\____
|
||||
/* User-Agent Style */
|
||||
html {
|
||||
background-color: #181a1b !important;
|
||||
/* fix #2554: browser not detecting dark mode */
|
||||
color-scheme: dark;
|
||||
}
|
||||
html,
|
||||
body,
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
/* fix #2554: browser not detecting dark mode */
|
||||
html {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 15px;
|
||||
color: var(--main-text-color);
|
||||
|
||||
+53
-3
@@ -24,6 +24,8 @@
|
||||
/*** General ***/
|
||||
html {
|
||||
font-size: 17px;
|
||||
/* fix #2554: browser not detecting dark mode */
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -502,9 +504,9 @@ p.login-box-msg,
|
||||
margin: 5px 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
color: #000;
|
||||
background: #9ab !important;
|
||||
border: 3px solid #fff !important;
|
||||
color: #9ab;
|
||||
background: #111111 !important;
|
||||
border: 3px solid #4488ff !important;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 0 2000vmax rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
@@ -1143,6 +1145,16 @@ footer a:focus {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.modal-body .overlay {
|
||||
padding: 0px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.modal-header,
|
||||
.modal-footer {
|
||||
border-color: #222;
|
||||
}
|
||||
|
||||
.box-header.with-border,
|
||||
.table-responsive,
|
||||
.table-bordered,
|
||||
@@ -1470,6 +1482,32 @@ table.dataTable {
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
border-radius: 12px;
|
||||
border: 3px solid #4488ff;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
border-radius: 12px;
|
||||
background-color: #111111;
|
||||
}
|
||||
|
||||
.modal-header .close,
|
||||
.close,
|
||||
.alert > .close {
|
||||
color: currentColor;
|
||||
opacity: 1;
|
||||
text-shadow: none;
|
||||
transform: scale(2) translate(0, -3px);
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.close:hover,
|
||||
.close:focus {
|
||||
color: #fff;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.alert {
|
||||
animation: flash 1.2s ease-in-out 0.5s;
|
||||
transition: all ease-in-out 1s;
|
||||
@@ -1643,6 +1681,11 @@ table.dataTable {
|
||||
.main-header .navbar .dropdown-menu li.divider {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.dropdown-menu > li > a:hover,
|
||||
.dropdown-menu > li > a:active,
|
||||
.dropdown-menu > li > a:focus {
|
||||
color: #48f;
|
||||
}
|
||||
.main-header .logo {
|
||||
width: 150px;
|
||||
float: left;
|
||||
@@ -2055,3 +2098,10 @@ td.highlight {
|
||||
#dns .col-md-11 {
|
||||
width: 84%;
|
||||
}
|
||||
|
||||
/*** add style to the information/about dropdown ***/
|
||||
|
||||
.navbar-nav > .user-menu > .dropdown-menu > .user-header,
|
||||
.navbar-nav > .user-menu > .dropdown-menu > .user-footer {
|
||||
background-color: #111111;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user