feat: Show Wireless Access URLs on Management Access page

This commit is contained in:
ljm42
2025-03-04 12:29:49 -07:00
parent 3dba0de2ca
commit dc6402dc4b

View File

@@ -143,7 +143,7 @@ $https_fqdn6_url = 'https://'._var($nginx,'NGINX_LANFQDN6').$https_port.'/';
$urls = [];
// push an array of five values into the $urls array:
// 0 - type of url ['LAN','WAN','WG','TAILSCALE']
// 0 - type of url ['LAN','WLAN','WAN','WG','TAILSCALE']
// 1 - the url
// 3 - the url it redirects to, or null
// 4 - the certificate file used, or null
@@ -192,19 +192,19 @@ foreach ($nginx as $key => $host) {
}
}
// determine whether there are urls for a given interface
function has_urls($interface) {
// determine whether there are urls for a given list of interfaces
function has_urls(array $interfaces) {
global $urls;
foreach($urls as $url) {
if ($url[0] == $interface) return true;
if (in_array($url[0], $interfaces)) return true;
}
return false;
}
// show all urls for a given interface
function show_urls($interface) {
// show all urls for a given list of interface
function show_urls(array $interfaces) {
global $urls;
// 0 - type of url ['LAN','WAN','WG','TAILSCALE']
// 0 - type of url ['LAN','WLAN','WAN','WG','TAILSCALE']
// 1 - the url
// 3 - the url it redirects to, or null
// 4 - the certificate file used, or null
@@ -214,7 +214,7 @@ function show_urls($interface) {
$lineend = "</dd>\n";
$first = true;
foreach($urls as $url) {
if ($url[0] == $interface) {
if (in_array($url[0], $interfaces)) {
$msg = "<a class='localURL' href='$url[1]'>$url[1]</a>";
if ($url[2]) $msg .= " "._("redirects to")." <a class='localURL' href='$url[2]'>$url[2]</a>";
if ($url[3]) $msg .= " "._("uses")." ".$url[3];
@@ -408,23 +408,23 @@ _(Local TLD)_:
<hr>
_(Local access URLs)_:
: <? show_urls('LAN'); ?>
: <? show_urls(['LAN','WLAN']); ?>
:mgmt_local_access_urls_help:
<?if (has_urls('WG')): ?>
<?if (has_urls(['WG'])): ?>
_(WireGuard URLs)_:
: <? show_urls('WG'); ?>
: <? show_urls(['WG']); ?>
:mgmt_wg_access_urls_help:
<?endif;?>
<?if (has_urls('TAILSCALE')): ?>
<?if (has_urls(['TAILSCALE'])): ?>
_(Tailscale URLs)_:
: <? show_urls('TAILSCALE'); ?>
: <? show_urls(['TAILSCALE']); ?>
:mgmt_tailscale_access_urls_help:
@@ -522,7 +522,7 @@ _(Certificate expiration)_:
</form>
<?if (has_urls('WG')): ?>
<?if (has_urls(['WG'])): ?>
<small>"WireGuard" and the "WireGuard" logo are registered trademarks of Jason A. Donenfeld</small>