From d57affd193d4feef700421ce4e527ee3a1a33e18 Mon Sep 17 00:00:00 2001 From: shayne <79330+shayne@users.noreply.github.com> Date: Thu, 3 Feb 2022 10:24:04 -0500 Subject: [PATCH] Always show "WebUI" for user specified URLs I often specify custom WebUI URLs based on my network/local-domain setup. I rarely if ever use "http://[IP]:[PORT:8888]/" templated URLs. This change maintains support for the existing templated bridged/host-network URL schema while enabling the "WebUI" affordance for containers where the user explicitly entered a WebUI url, e.g. "https://grafana.mylan.io" --- .../dynamix.docker.manager/include/DockerClient.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/dynamix.docker.manager/include/DockerClient.php b/plugins/dynamix.docker.manager/include/DockerClient.php index 30b9e299f..36d2aee6a 100644 --- a/plugins/dynamix.docker.manager/include/DockerClient.php +++ b/plugins/dynamix.docker.manager/include/DockerClient.php @@ -305,8 +305,14 @@ public function getAllInfo($reload=false,$com=true,$communityApplications=false) } if ($ct['Running']) { $port = &$ct['Ports'][0]; - $ip = ($ct['NetworkMode']=='host'||$port['NAT'] ? $host : $port['IP']); - $tmp['url'] = $ip ? (strpos($tmp['url'],$ip)!==false ? $tmp['url'] : $this->getControlURL($ct, $ip)) : $tmp['url']; + $webui = $this->getTemplateValue($ct['Image'], 'WebUI'); + if (strlen($webui) > 0 && !preg_match("%\[(IP|PORT:(\d+))\]%", $webui)) { + // non-templated webui, user specified + $tmp['url'] = $webui; + } else { + $ip = ($ct['NetworkMode']=='host'||$port['NAT'] ? $host : $port['IP']); + $tmp['url'] = $ip ? (strpos($tmp['url'],$ip)!==false ? $tmp['url'] : $this->getControlURL($ct, $ip)) : $tmp['url']; + } $tmp['shell'] = $tmp['shell'] ?? $this->getTemplateValue($image, 'Shell'); } $tmp['registry'] = $tmp['registry'] ?? $this->getTemplateValue($image, 'Registry');