diff --git a/visualize.py b/visualize.py index 9287d03..b68757b 100755 --- a/visualize.py +++ b/visualize.py @@ -18,6 +18,12 @@ icon_overrides = { "woodpecker": None, } +icon_format = { + "linkwarden": "webp", + "telegraf": "webp", + "tiny-tiny-rss": "webp", +} + template_host = """ 'serguzim.net'.{host}: {{ label: {host} @@ -28,7 +34,7 @@ template_service = """ {key}: {{ label: {label} label.near: top-left - icon: https://cdn.jsdelivr.net/gh/selfhst/icons/webp/{icon}.webp + icon: {icon} icon.near: top-right }} """ @@ -53,6 +59,11 @@ external: { } """ +def get_icon(svc): + svc = icon_overrides.get(svc, svc) or 'docker' + fmt = icon_format.get(svc, 'svg') + return f'https://cdn.jsdelivr.net/gh/selfhst/icons/{fmt}/{svc}.{fmt}' + def service_key(svc, data): return f"'serguzim.net'.{data['host']}.{svc}" @@ -95,7 +106,7 @@ def parse_services(services): result.append(template_service.format( key=svc_key, label="\\n".join([svc] + domains), - icon=icon_overrides.get(svc, svc) or "docker", + icon=get_icon(svc) )) for backup in data.get("backup") or []: