diff --git a/htdocs/luci-static/resources/view/dockerman/containers.js b/htdocs/luci-static/resources/view/dockerman/containers.js index bf380a4..424671d 100644 --- a/htdocs/luci-static/resources/view/dockerman/containers.js +++ b/htdocs/luci-static/resources/view/dockerman/containers.js @@ -344,12 +344,20 @@ return dm2.dv.extend({ Created: this.buildTimeString(cont?.Created) || '', Ports: (Array.isArray(cont.Ports) && cont.Ports.length > 0) ? cont.Ports.map(p => { - // const ip = p.IP || ''; const pub = p.PublicPort || ''; const priv = p.PrivatePort || ''; const type = p.Type || ''; - return `${pub ? pub + ':' : ''}${priv}/${type}`; - // return `${ip ? ip + ':' : ''}${pub} -> ${priv} (${type})`; + const displayText = `${pub ? pub + ':' : ''}${priv}/${type}`; + if (!pub) { + return displayText; + } + const host = p.IP; + if (!host || host === '0.0.0.0' || host === '::') { + const onclick = `window.open((window.location.origin.match(/^(.+):\\d+$/) && window.location.origin.match(/^(.+):\\d+$/)[1] || window.location.origin) + ':${pub}', '_blank')`; + return `${displayText}`; + } + const urlHost = host.includes(':') ? `[${host}]` : host; + return `${displayText}`; }).join('
') : '', });