From ba34c94a27bd4395ace8502cc60ee6e19c67007e Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 20 Nov 2024 12:19:39 +0100 Subject: [PATCH] Update CreateDocker.php Make sure to replace `[IP]` and `[PORT:]` in query string from URL --- .../plugins/dynamix.docker.manager/include/CreateDocker.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php b/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php index e24f389cb..b2fa890d1 100644 --- a/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php +++ b/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php @@ -450,6 +450,8 @@ if (!empty($TS_no_peers) && !empty($TS_container)) { // Check if serve or funnel are enabled by checking for [hostname] and replace string with TS_DNSName if (!empty($xml['TailscaleWebUI']) && strpos($xml['TailscaleWebUI'], '[hostname]') !== false && isset($TS_DNSName)) { $TS_webui_url = str_replace("[hostname][magicdns]", rtrim($TS_DNSName, '.'), $xml['TailscaleWebUI']); + $TS_webui_url = preg_replace('/\[IP\]/', rtrim($TS_DNSName, '.'), $TS_webui_url); + $TS_webui_url = preg_replace('/\[PORT:(\d{1,5})\]/', '443', $TS_webui_url); // Check if serve is disabled, construct url with port, path and query if present and replace [noserve] with url } elseif (strpos($xml['TailscaleWebUI'], '[noserve]') !== false && isset($TS_container['TailscaleIPs'])) { $ipv4 = ''; @@ -464,6 +466,8 @@ if (!empty($TS_no_peers) && !empty($TS_container)) { $webui_port = (preg_match('/\[PORT:(\d+)\]/', $xml['WebUI'], $matches)) ? ':' . $matches[1] : ''; $webui_path = $webui_url['path'] ?? ''; $webui_query = isset($webui_url['query']) ? '?' . $webui_url['query'] : ''; + $webui_query = preg_replace('/\[IP\]/', $ipv4, $webui_query); + $webui_query = preg_replace('/\[PORT:(\d{1,5})\]/', ltrim($webui_port, ':'), $webui_query); $TS_webui_url = 'http://' . $ipv4 . $webui_port . $webui_path . $webui_query; } // Check if TailscaleWebUI in the xml is custom and display instead