From a98d86a3036fd1adb02cb7082c15f8a8bdbba714 Mon Sep 17 00:00:00 2001 From: Tim Dreyer <74516735+eyerrock@users.noreply.github.com> Date: Sat, 26 Apr 2025 16:23:17 +0200 Subject: [PATCH] fix: unexposed containers with existing proxy rule --- src/web/snippet/dockerContainersList.html | 36 ++++++++++++----------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/web/snippet/dockerContainersList.html b/src/web/snippet/dockerContainersList.html index 5f8765c..d5bf493 100644 --- a/src/web/snippet/dockerContainersList.html +++ b/src/web/snippet/dockerContainersList.html @@ -268,26 +268,28 @@ // add the container to the networked list, using it's name as address container.Ports.forEach((portObject) => { - // skip unexposed ports if the checkbox is not checked - if (!portObject.PublicPort && !$showUnexposed.is(":checked")) { - return; - } - const port = portObject.PublicPort || portObject.PrivatePort; const key = `${containerName}:${port}`; - if (existingTargets.has(key) && !existingEntries[key]) { - existingEntries[key] = { - name: containerName, - ip: containerName, - port, - }; - } else if (!networkedEntries[key]) { - networkedEntries[key] = { - name: containerName, - ip: containerName, - port, - }; + // always include existing proxy-rule targets + if (existingTargets.has(key)) { + if (!existingEntries[key]) { + existingEntries[key] = { + name: containerName, + ip: containerName, + port, + }; + } + } + // otherwise, include only if exposed or checkbox is checked + else if (portObject.PublicPort || $showUnexposed.is(":checked")) { + if (!networkedEntries[key]) { + networkedEntries[key] = { + name: containerName, + ip: containerName, + port, + }; + } } }); });