diff --git a/scripts/pi-hole/js/settings-advanced.js b/scripts/pi-hole/js/settings-advanced.js index ccc7cc01..6c770cfb 100644 --- a/scripts/pi-hole/js/settings-advanced.js +++ b/scripts/pi-hole/js/settings-advanced.js @@ -197,6 +197,7 @@ function generateRow(topic, key, value) { break; } + case "enum (unsigned integer)": // fallthrough case "enum (string)": { box += '' + diff --git a/scripts/pi-hole/js/settings-privacy.js b/scripts/pi-hole/js/settings-privacy.js new file mode 100644 index 00000000..5c57e979 --- /dev/null +++ b/scripts/pi-hole/js/settings-privacy.js @@ -0,0 +1,24 @@ +/* Pi-hole: A black hole for Internet advertisements + * (c) 2023 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. */ + +/* global setConfigValues: false, apiFailure: false */ + +function getConfig() { + $.ajax({ + url: "/api/config/?detailed=true", + }) + .done(function (data) { + setConfigValues("", "", data.config); + }) + .fail(function (data) { + apiFailure(data); + }); +} + +$(document).ready(function () { + getConfig(); +}); diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 2a048d08..1966d747 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -28,7 +28,9 @@ function setConfigValues(topic, key, value) { if (!("description" in value)) { Object.keys(value).forEach(function (subkey) { var subvalue = value[subkey]; - setConfigValues(topic, key + "." + subkey, subvalue); + // If the key is empty, we are at the top level + var newKey = key === "" ? subkey : key + "." + subkey; + setConfigValues(topic, newKey, subvalue); }); return; } @@ -36,6 +38,7 @@ function setConfigValues(topic, key, value) { // else: we have a setting we can set var escapedKey = key.replace(/\./g, "\\."); switch (value.type) { + case "enum (unsigned integer)": // fallthrough case "enum (string)": { // Remove all options from select $("#" + escapedKey + " option").remove(); @@ -68,7 +71,13 @@ function setConfigValues(topic, key, value) { default: { // Set input field values (if available) - $("#" + escapedKey).val(value.value); + // Set text if this is a or element + if ($("#" + escapedKey).is("span") || $("#" + escapedKey).is("code")) { + $("#" + escapedKey).text(value.value); + } else { + // Set value if this is an element + $("#" + escapedKey).val(value.value); + } } } } diff --git a/scripts/pi-hole/lua/sidebar.lp b/scripts/pi-hole/lua/sidebar.lp index b6db1eaa..de4c5009 100644 --- a/scripts/pi-hole/lua/sidebar.lp +++ b/scripts/pi-hole/lua/sidebar.lp @@ -155,7 +155,7 @@
  • "> - Privacy + Privacy
  • settings-level-2"> diff --git a/settings-privacy.lp b/settings-privacy.lp new file mode 100644 index 00000000..772d8c5e --- /dev/null +++ b/settings-privacy.lp @@ -0,0 +1,109 @@ + +
    +
    +
    +
    +
    +
    +

    Query Logging

    +
    +
    +
    +
    +

    The currently configued logging file is

    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Privacy-related database settings

    +
    +
    +
    +
    +

    Pi-hole's long-term database is stored at

    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +

    IP addresses (and associated host names) older than the specified number of days are removed to avoid dead entries in the network overview table.

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Query Anonymization ("Privacy Level")

    +
    +
    +
    +
    +

    Specify if DNS queries should be anonymized, available options are:

    +
    + + +

    Gives maximum amount of statistics

    +
    +
    + + +

    This disables the Top Permitted Domains and Top Blocked Domains tables on the dashboard

    +
    +
    + + +

    This disables all tables on the dashboard

    +
    +
    + + +

    No history is saved at all to the database, and nothing is shown in the query log. Also, there are no top item lists. Note that this also largely disabled regex capabilities.

    +
    +

    The privacy level may be increased at any time without having to restart the DNS resolver. However, note that the DNS resolver needs to be restarted when lowering the privacy level. This restarting is automatically done when saving.

    +
    +
    +
    +
    +
    +
    + +
    +
    + + + + +