Keep Superpanel's dashboard current: link, docs and updates
The service file gets URL="https://<name>.$DOMAIN/", as Federated's apps on their own hostnames do. Apps from a repository without docs link to it. Updates remake Superpanel's applist and catalog, as removes do, so a new title or icon shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+15
-7
@@ -576,7 +576,8 @@ def make_service_folder(m, p, source, origin):
|
||||
"""/federated/services/<name>/ in the Core's generic format, from m."""
|
||||
values = {
|
||||
"NAME": m["name"], "TITLE": m["title"], "DESCRIPTION": m["description"],
|
||||
"DOCS": m["docs"], "IMAGE": m["image"], "VERSION": m["version"],
|
||||
# Without docs, Superpanel links a search of Federated's documentation
|
||||
"DOCS": m["docs"] or (origin["source"] if origin else ""), "IMAGE": m["image"], "VERSION": m["version"],
|
||||
"IP": p["address"], "PORT": str(m["port"]), "DBNAME": m["dbname"],
|
||||
"DEPENDS": " ".join(read_text(NEEDS_DIR, n, "depends").strip() for n in m["needs"]),
|
||||
}
|
||||
@@ -782,6 +783,8 @@ def install_app(m, p, folder, origin, addon_ok, recreate):
|
||||
check_needs(m)
|
||||
if p["state"] == "update":
|
||||
remove_old_images(m)
|
||||
# Its title, description, icon or link may have changed
|
||||
refresh_superpanel(log)
|
||||
say(f"{'Installed' if p['state'] == 'new' else 'Updated'}: {p['url']}")
|
||||
return 0
|
||||
|
||||
@@ -961,16 +964,21 @@ def remove(name):
|
||||
if image:
|
||||
remove_images(image)
|
||||
# uninstallapp made superpanel's catalog while the folder was still
|
||||
# there, so it would still offer the app: make it again, as installapp
|
||||
# does
|
||||
if os.path.exists(APPS + "/superpanel/.env"):
|
||||
run_logged([FEDERATED + "/bin/superpanel-generate-catalog"], log,
|
||||
"Updating superpanel's app catalog failed")
|
||||
run(["docker", "exec", "superpanel", "pkill", "-HUP", "superpanel"])
|
||||
# there, so it would still offer the app: make it again
|
||||
refresh_superpanel(log)
|
||||
say(f"Removed {name}.")
|
||||
return 0
|
||||
|
||||
|
||||
def refresh_superpanel(log):
|
||||
"""Superpanel's lists of installed apps (its dashboard) and of apps it
|
||||
offers, as installapp and uninstallapp make them."""
|
||||
if os.path.exists(APPS + "/superpanel/.env"):
|
||||
for script in ("superpanel-generate-applist-dashboard", "superpanel-generate-catalog"):
|
||||
run_logged([f"{FEDERATED}/bin/{script}"], log, f"{script} failed")
|
||||
run(["docker", "exec", "superpanel", "pkill", "-HUP", "superpanel"])
|
||||
|
||||
|
||||
def list_apps():
|
||||
rows = []
|
||||
for name in sorted(os.listdir(SERVICES)):
|
||||
|
||||
@@ -6,3 +6,5 @@ VERSION={{VERSION}}
|
||||
INTERNAL_IP={{IP}}
|
||||
DEPENDS="{{DEPENDS}}"
|
||||
PORTS={{PORT}}
|
||||
# Superpanel's dashboard link, as Federated's apps give it (with $DOMAIN)
|
||||
URL="https://{{NAME}}.$DOMAIN/"
|
||||
|
||||
Reference in New Issue
Block a user