Allow path prefix multiplexing the dashboard and API. See https://github.com/pi-hole/FTL/pull/2319 for further details

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2025-03-02 20:20:10 +01:00
parent 22bfbd9d75
commit a7f1ca7800
27 changed files with 108 additions and 103 deletions

View File

@@ -5,7 +5,7 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
/* global utils:false, setConfigValues: false, apiFailure: false, QRious: false */
/* global utils:false, apiUrl:false, setConfigValues: false, apiFailure: false, QRious: false */
var apiSessionsTable = null;
var ownSessionID = null;
@@ -31,7 +31,7 @@ function renderBool(data, type) {
$(function () {
apiSessionsTable = $("#APISessionsTable").DataTable({
ajax: {
url: "/api/auth/sessions",
url: apiUrl + "/auth/sessions",
type: "GET",
dataSrc: "sessions",
},
@@ -247,7 +247,7 @@ function deleteOneSession(id, len, ownSessionDelete) {
// our own session is then triggered by the last successful deletion of
// another session (ownSessionDelete == true, len == global deleted)
$.ajax({
url: "/api/auth/session/" + id,
url: apiUrl + "/auth/session/" + id,
method: "DELETE",
})
.done(function () {
@@ -272,7 +272,7 @@ function deleteOneSession(id, len, ownSessionDelete) {
function processWebServerConfig() {
$.ajax({
url: "/api/config/webserver?detailed=true",
url: apiUrl + "/config/webserver?detailed=true",
})
.done(function (data) {
setConfigValues("webserver", "webserver", data.config.webserver);
@@ -291,7 +291,7 @@ function processWebServerConfig() {
$("#modal-totp").on("shown.bs.modal", function () {
$.ajax({
url: "/api/auth/totp",
url: apiUrl + "/auth/totp",
})
.done(function (data) {
TOTPdata = data.totp;
@@ -329,7 +329,7 @@ $("#modal-totp").on("shown.bs.modal", function () {
var apppwhash = null;
$("#modal-apppw").on("shown.bs.modal", function () {
$.ajax({
url: "/api/auth/app",
url: apiUrl + "/auth/app",
})
.done(function (data) {
apppwhash = data.app.hash;
@@ -373,7 +373,7 @@ $("#apppw_clear").on("click", function () {
function setAppPassword() {
$.ajax({
url: "/api/config",
url: apiUrl + "/config",
type: "PATCH",
dataType: "json",
processData: false,
@@ -426,7 +426,7 @@ $("#totp_code").on("keyup", function () {
function setTOTPSecret(secret) {
$.ajax({
url: "/api/config",
url: apiUrl + "/config",
type: "PATCH",
dataType: "json",
processData: false,
@@ -478,7 +478,7 @@ $(document).ready(function () {
processWebServerConfig();
// Check if TOTP is enabled
$.ajax({
url: "/api/auth",
url: apiUrl + "/auth",
}).done(function (data) {
if (data.session.totp === false) $("#button-enable-totp").removeClass("hidden");
else $("#button-disable-totp").removeClass("hidden");