🐛 Fix port in Service URL for Docker Module

This commit is contained in:
Noan
2022-08-22 22:51:42 +02:00
parent 7d08646a29
commit 67bd4cffc8

View File

@@ -24,12 +24,12 @@ export function tryMatchService(container: Dockerode.ContainerInfo | undefined)
if (container === undefined) return {}; if (container === undefined) return {};
const name = container.Names[0].substring(1); const name = container.Names[0].substring(1);
const type = tryMatchType(container.Image); const type = tryMatchType(container.Image);
const port = tryMatchPort(type.toLowerCase()); const port = tryMatchPort(type.toLowerCase())?.value ?? container.Ports[0]?.PublicPort;
return { return {
name, name,
id: container.Id, id: container.Id,
type: tryMatchType(container.Image), type: tryMatchType(container.Image),
url: `localhost${port ? `:${port.value}` : ''}`, url: `localhost${port ? `:${port}` : ''}`,
icon: `https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/${name icon: `https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/${name
.replace(/\s+/g, '-') .replace(/\s+/g, '-')
.toLowerCase()}.png`, .toLowerCase()}.png`,