Store value of pihole.webhome() in a globally available variable instead of calling pihole.webhome() multiple times

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2025-03-08 21:37:21 +01:00
parent a7f1ca7800
commit f8ef22572a
3 changed files with 13 additions and 12 deletions

View File

@@ -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
<meta name="csrf-token" content="<?=mg.request_info.csrf_token?>">
<link rel="apple-touch-icon" href="<?=pihole.webhome()?>img/favicons/apple-touch-icon.png" sizes="180x180">
<link rel="icon" href="<?=pihole.webhome()?>img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="<?=pihole.webhome()?>img/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="manifest" href="<?=pihole.webhome()?>img/favicons/manifest.json">
<? theme = pihole.webtheme() ?>
<link rel="mask-icon" href="<?=pihole.webhome()?>img/favicons/safari-pinned-tab.svg" color="<?=theme.color?>">
<link rel="shortcut icon" href="<?=pihole.webhome()?>img/favicons/favicon.ico">
<link rel="apple-touch-icon" href="<?=webhome?>img/favicons/apple-touch-icon.png" sizes="180x180">
<link rel="icon" href="<?=webhome?>img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="<?=webhome?>img/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="manifest" href="<?=webhome?>img/favicons/manifest.json">
<link rel="mask-icon" href="<?=webhome?>img/favicons/safari-pinned-tab.svg" color="<?=theme.color?>">
<link rel="shortcut icon" href="<?=webhome?>img/favicons/favicon.ico">
<meta name="msapplication-TileColor" content="<?=theme.color?>">
<meta name="msapplication-TileImage" content="<?=pihole.webhome()?>img/favicons/mstile-150x150.png">
<meta name="msapplication-TileImage" content="<?=webhome?>img/favicons/mstile-150x150.png">
<!-- Theme styles -->
<meta name="theme-color" content="<?=theme.color?>">

View File

@@ -39,7 +39,7 @@ mg.include('header.lp','r')
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="<?=pihole.webhome()?>" class="logo">
<a href="<?=webhome?>" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini">P<strong>h</strong></span>
<!-- logo for regular state and mobile devices -->
@@ -68,7 +68,7 @@ mg.include('header.lp','r')
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img class="logo-img" src="<?=pihole.webhome()?>img/logo.svg" alt="Pi-hole Logo" style="border: 0" width="90" height="90">
<img class="logo-img" src="<?=webhome?>img/logo.svg" alt="Pi-hole Logo" style="border: 0" width="90" height="90">
<p>
Open Source Ad Blocker
</p>
@@ -78,7 +78,7 @@ mg.include('header.lp','r')
<!-- Menu Footer -->
<li class="user-footer">
<a class="btn-link" href="https://pi-hole.net/" rel="noopener" target="_blank">
<svg class="svg-inline--fa fa-fw menu-icon" style="height: 1.25em"><use xlink:href="<?=pihole.webhome()?>img/pihole_icon.svg#pihole-svg-logo"/></svg>
<svg class="svg-inline--fa fa-fw menu-icon" style="height: 1.25em"><use xlink:href="<?=webhome?>img/pihole_icon.svg#pihole-svg-logo"/></svg>
Pi-hole Website
</a>
<hr>