From f8ef22572a430fbfaae33443c73da529fd75018b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 8 Mar 2025 21:37:21 +0100 Subject: [PATCH] Store value of pihole.webhome() in a globally available variable instead of calling pihole.webhome() multiple times Signed-off-by: DL6ER --- login.lp | 3 ++- scripts/lua/header.lp | 16 ++++++++-------- scripts/lua/header_authenticated.lp | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/login.lp b/login.lp index 13497d0a..8a6f53a8 100644 --- a/login.lp +++ b/login.lp @@ -14,7 +14,7 @@ mg.include('scripts/lua/header.lp','r')
@@ -117,6 +117,7 @@ mg.include('scripts/lua/header.lp','r') Donate if you found this useful. + diff --git a/scripts/lua/header.lp b/scripts/lua/header.lp index 3b5379c8..a9eeee7e 100644 --- a/scripts/lua/header.lp +++ b/scripts/lua/header.lp @@ -11,6 +11,7 @@ starttime = mg.time(true) hostname = pihole.hostname() webhome = pihole.webhome() +theme = pihole.webtheme() -- Get name of script by matching whatever is after the last "/" in the URI scriptname = mg.request_info.request_uri:match(webhome.."(.*)$") @@ -59,15 +60,14 @@ is_authenticated = mg.request_info.is_authenticated - - - - - - - + + + + + + - + diff --git a/scripts/lua/header_authenticated.lp b/scripts/lua/header_authenticated.lp index e14377b0..a0fc5085 100644 --- a/scripts/lua/header_authenticated.lp +++ b/scripts/lua/header_authenticated.lp @@ -39,7 +39,7 @@ mg.include('header.lp','r')