Add custom icons to visualize

This commit is contained in:
Tobias Reisinger 2025-02-01 02:51:52 +01:00
parent a27a157e22
commit b20a2a67a5
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE

View file

@ -9,20 +9,16 @@ import hcl2
icon_overrides = { icon_overrides = {
"acme_dns": "lets-encrypt", "acme_dns": "lets-encrypt",
"backup": "restic", "backup": "restic",
"dokku": None,
"extra_services": None, "extra_services": None,
"factorio": None,
"forgejo_runner": "forgejo", "forgejo_runner": "forgejo",
"healthcheck": "healthchecks", "healthcheck": "healthchecks",
"lego": "lets-encrypt", "lego": "lets-encrypt",
"mailcowdockerized": "mailcow", "mailcowdockerized": "mailcow",
"reitanlage_oranienburg": "grav", "reitanlage_oranienburg": "grav",
"tandoor": "tandoor-recipes", "tandoor": "tandoor-recipes",
"teamspeak_fallback": None,
"tinytinyrss": "tiny-tiny-rss", "tinytinyrss": "tiny-tiny-rss",
"webdis": "redis", "webdis": "redis",
"wiki_js": "wiki-js", "wiki_js": "wiki-js",
"woodpecker": None,
} }
icon_format = { icon_format = {
@ -33,10 +29,17 @@ icon_format = {
"watchtower": "webp", # TODO revert when icon is fixed "watchtower": "webp", # TODO revert when icon is fixed
} }
icon_url = {
"dokku": "https://avatars.githubusercontent.com/u/13455795?s=200&v=4",
"factorio": "https://avatars.githubusercontent.com/u/50074624?s=200&v=4",
"teamspeak_fallback": "https://avatars.githubusercontent.com/u/136759148?s=200&v=4",
"woodpecker": "https://avatars.githubusercontent.com/u/84780935?s=200&v=4",
}
def get_icon(svc): def get_icon(svc):
svc = icon_overrides.get(svc, svc) or 'docker' svc = icon_overrides.get(svc, svc) or 'docker'
fmt = icon_format.get(svc, 'svg') fmt = icon_format.get(svc, 'svg')
return f'https://cdn.jsdelivr.net/gh/selfhst/icons/{fmt}/{svc}.{fmt}' return icon_url.get(svc, f'https://cdn.jsdelivr.net/gh/selfhst/icons/{fmt}/{svc}.{fmt}')
def host_key(host, hosts): def host_key(host, hosts):
return f"'serguzim.net'.{hosts[host]["provider"]}.{host}" return f"'serguzim.net'.{hosts[host]["provider"]}.{host}"