From 9cb652bbc6cab4adaaf2d6c57f8fe96747738181 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 26 May 2023 21:51:17 +0200 Subject: [PATCH] Add deep URI rewriting for groups and settings pages Signed-off-by: DL6ER --- login.lp | 2 +- scripts/pi-hole/js/footer.js | 2 +- scripts/pi-hole/lua/header.lp | 2 +- scripts/pi-hole/lua/header_authenticated.lp | 4 +- scripts/pi-hole/lua/sidebar.lp | 92 +++++++++---------- ...s-dns-records.lp => settings-dnsrecords.lp | 0 6 files changed, 51 insertions(+), 51 deletions(-) rename settings-dns-records.lp => settings-dnsrecords.lp (100%) diff --git a/login.lp b/login.lp index 340de316..5e7d72de 100644 --- a/login.lp +++ b/login.lp @@ -15,7 +15,7 @@ mg.include('scripts/pi-hole/lua/header.lp','r')
diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index 2f2d9df0..65cec64f 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -169,7 +169,7 @@ function applyCheckboxRadioStyle() { function initCheckboxRadioStyle() { function getCheckboxURL(style) { var extra = style.startsWith("material-") ? "material" : "bootstrap"; - return "style/vendor/icheck-" + extra + ".min.css"; + return "/admin/style/vendor/icheck-" + extra + ".min.css"; } // Read from local storage, initialize if needed diff --git a/scripts/pi-hole/lua/header.lp b/scripts/pi-hole/lua/header.lp index b5055c2a..e59d2a1d 100644 --- a/scripts/pi-hole/lua/header.lp +++ b/scripts/pi-hole/lua/header.lp @@ -11,7 +11,7 @@ starttime = mg.time(true) hostname = pihole.hostname() -- Get name of script by matching whatever is after the last "/" in the URI -scriptname = mg.request_info.request_uri:match("/([^/]*)$") +scriptname = mg.request_info.request_uri:match(pihole.webhome().."(.*)$") -- Fall back to "index.lp" if no match is found (e.g. when accessing the root) if scriptname == nil or string.len(scriptname) == 0 then scriptname = "index.lp" end diff --git a/scripts/pi-hole/lua/header_authenticated.lp b/scripts/pi-hole/lua/header_authenticated.lp index be6c45d6..594df520 100644 --- a/scripts/pi-hole/lua/header_authenticated.lp +++ b/scripts/pi-hole/lua/header_authenticated.lp @@ -77,7 +77,7 @@ mg.include('header.lp','r')