Add automatic empty icon on missing in visualize script
This commit is contained in:
parent
b5256dd831
commit
44efb8aa71
1 changed files with 6 additions and 6 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import json
|
||||
import sys
|
||||
import requests
|
||||
|
||||
import jinja2
|
||||
import hcl2
|
||||
|
|
@ -12,9 +13,6 @@ icon_overrides = {
|
|||
"backup": "restic",
|
||||
"calibre_web": "calibre-web",
|
||||
"deploy": "adnanh-webhook",
|
||||
"dmarc_report": None,
|
||||
"emgauwa": None,
|
||||
"extra_services": None,
|
||||
"forgejo_runner": "forgejo",
|
||||
"foundryvtt": "foundry-virtual-tabletop",
|
||||
"healthcheck": "healthchecks",
|
||||
|
|
@ -25,8 +23,6 @@ icon_overrides = {
|
|||
"minecraft_3": "minecraft",
|
||||
"node_exporter": "prometheus",
|
||||
"paperless": "paperless-ngx",
|
||||
"phpvms": None,
|
||||
"phpvms_test": None,
|
||||
"reitanlage_oranienburg": "grav",
|
||||
"tandoor": "tandoor-recipes",
|
||||
"tinytinyrss": "tiny-tiny-rss",
|
||||
|
|
@ -49,7 +45,7 @@ icon_url = {
|
|||
}
|
||||
|
||||
def get_icon(svc):
|
||||
svc = icon_overrides.get(svc, svc) or 'docker'
|
||||
svc = icon_overrides.get(svc, svc)
|
||||
fmt = icon_format.get(svc, 'svg')
|
||||
return icon_url.get(svc, f'https://cdn.jsdelivr.net/gh/selfhst/icons/{fmt}/{svc}.{fmt}')
|
||||
|
||||
|
|
@ -84,7 +80,11 @@ def parse_service(svc, data, hosts):
|
|||
data['key'] = svc_key
|
||||
data['host_key'] = host_key(data["host"], hosts)
|
||||
data['label'] = "\\n".join([svc] + domains)
|
||||
|
||||
data['icon'] = get_icon(svc)
|
||||
r = requests.get(data['icon'])
|
||||
if r.status_code != 200:
|
||||
data['icon'] = get_icon('docker')
|
||||
|
||||
return dict(data)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue