From 0fac11c5d76f6c80da2a392b20eba0348d848bb9 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Tue, 15 Sep 2026 00:40:33 -0500 Subject: [PATCH] fix(homepage): resolve local icons robustly and include houston.svg --- config/homepage/icons/houston.png | 2 +- config/homepage/icons/houston.svg | 1 + scripts/appctl_engine.py | 46 +++++++++++++++++++------------ 3 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 config/homepage/icons/houston.svg diff --git a/config/homepage/icons/houston.png b/config/homepage/icons/houston.png index 731237a..3f399da 100644 --- a/config/homepage/icons/houston.png +++ b/config/homepage/icons/houston.png @@ -1 +1 @@ - + diff --git a/config/homepage/icons/houston.svg b/config/homepage/icons/houston.svg new file mode 100644 index 0000000..3f399da --- /dev/null +++ b/config/homepage/icons/houston.svg @@ -0,0 +1 @@ + diff --git a/scripts/appctl_engine.py b/scripts/appctl_engine.py index 9d0df10..f242212 100755 --- a/scripts/appctl_engine.py +++ b/scripts/appctl_engine.py @@ -13,8 +13,20 @@ import subprocess import sys from concurrent.futures import ThreadPoolExecutor -SITES_DIR = os.environ.get("SITES_DIR", os.path.expanduser("~/Sites")) -CORE_DIR = os.environ.get("CORE_DIR", os.path.expanduser("~/Core")) +CORE_DIR = os.environ.get( + "CORE_DIR", + os.path.dirname(os.path.dirname(os.path.abspath(__file__))), +) +SITES_DIR = os.environ.get( + "SITES_DIR", + os.path.join(os.path.dirname(CORE_DIR), "Sites") + if os.path.isdir(os.path.join(os.path.dirname(CORE_DIR), "Sites")) + else ( + os.path.expanduser("~/Sites") + if os.path.isdir(os.path.expanduser("~/Sites")) + else os.path.expanduser("~/Homelab/Sites") + ), +) ENV_FILE = os.environ.get("ENV_FILE", "/run/secrets/rendered/traefik-deployments.env") if not os.path.isfile(ENV_FILE) and os.path.isfile("/run/secrets/traefik-deployments.env"): ENV_FILE = "/run/secrets/traefik-deployments.env" @@ -773,22 +785,22 @@ def cmd_sync_homepage(args): desc = app.get("description", "") # Resolve custom local icons mounted in config/homepage/icons - if ( - os.path.isdir(icons_dir) - and not icon.startswith(("/", "http")) - and ( - os.path.isfile(os.path.join(icons_dir, icon)) - or os.path.isfile(os.path.join(icons_dir, f"{icon}.svg")) - or os.path.isfile(os.path.join(icons_dir, f"{icon}.png")) - ) - ): - if not icon.endswith((".svg", ".png", ".webp")): + base_icon, ext = os.path.splitext(icon) + matched_icon = None + if os.path.isdir(icons_dir) and not icon.startswith(("/", "http")): + if os.path.isfile(os.path.join(icons_dir, icon)): + matched_icon = icon + elif ext and os.path.isfile(os.path.join(icons_dir, f"{base_icon}.svg")): + matched_icon = f"{base_icon}.svg" + elif ext and os.path.isfile(os.path.join(icons_dir, f"{base_icon}.png")): + matched_icon = f"{base_icon}.png" + elif not ext: if os.path.isfile(os.path.join(icons_dir, f"{icon}.svg")): - icon = f"/icons/{icon}.svg" - else: - icon = f"/icons/{icon}.png" - else: - icon = f"/icons/{icon}" + matched_icon = f"{icon}.svg" + elif os.path.isfile(os.path.join(icons_dir, f"{icon}.png")): + matched_icon = f"{icon}.png" + if matched_icon: + icon = f"/icons/{matched_icon}" card_data = { "title": card_title,