Add custom icons to visualize
This commit is contained in:
parent
a27a157e22
commit
b20a2a67a5
1 changed files with 8 additions and 5 deletions
13
visualize.py
13
visualize.py
|
@ -9,20 +9,16 @@ import hcl2
|
|||
icon_overrides = {
|
||||
"acme_dns": "lets-encrypt",
|
||||
"backup": "restic",
|
||||
"dokku": None,
|
||||
"extra_services": None,
|
||||
"factorio": None,
|
||||
"forgejo_runner": "forgejo",
|
||||
"healthcheck": "healthchecks",
|
||||
"lego": "lets-encrypt",
|
||||
"mailcowdockerized": "mailcow",
|
||||
"reitanlage_oranienburg": "grav",
|
||||
"tandoor": "tandoor-recipes",
|
||||
"teamspeak_fallback": None,
|
||||
"tinytinyrss": "tiny-tiny-rss",
|
||||
"webdis": "redis",
|
||||
"wiki_js": "wiki-js",
|
||||
"woodpecker": None,
|
||||
}
|
||||
|
||||
icon_format = {
|
||||
|
@ -33,10 +29,17 @@ icon_format = {
|
|||
"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):
|
||||
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}'
|
||||
return icon_url.get(svc, f'https://cdn.jsdelivr.net/gh/selfhst/icons/{fmt}/{svc}.{fmt}')
|
||||
|
||||
def host_key(host, hosts):
|
||||
return f"'serguzim.net'.{hosts[host]["provider"]}.{host}"
|
||||
|
|
Loading…
Reference in a new issue