From d351bcbee56b8eb29f538d20930d3e8b25420fea Mon Sep 17 00:00:00 2001 From: mwiegand Date: Fri, 8 May 2026 15:50:36 +0200 Subject: [PATCH] feat(l4d2-web): script overlay UI Adds the script type to the create-overlay modal (with an admin-only system-wide checkbox) and a script-section to the detail page: textarea for the bash body, Save / Rebuild / Wipe buttons, last_build_status badge, latest-build-job link, and a Wipe confirm modal. Removes the GlobalOverlaySource block. Co-Authored-By: Claude Opus 4.7 (1M context) --- l4d2web/templates/overlay_detail.html | 78 +++++++++++++++++++++++---- l4d2web/templates/overlays.html | 4 ++ l4d2web/tests/test_pages.py | 58 ++++++++++++++++++++ 3 files changed, 129 insertions(+), 11 deletions(-) diff --git a/l4d2web/templates/overlay_detail.html b/l4d2web/templates/overlay_detail.html index 7381cc9..40148d5 100644 --- a/l4d2web/templates/overlay_detail.html +++ b/l4d2web/templates/overlay_detail.html @@ -6,7 +6,7 @@

Overlay: {{ overlay.name }}

- {% set can_edit = overlay.type not in ['l4d2center_maps', 'cedapug_maps'] and (g.user.admin or (overlay.type == 'workshop' and overlay.user_id == g.user.id)) %} + {% set can_edit = g.user.admin or (overlay.type in ['workshop', 'script'] and overlay.user_id == g.user.id) %} {% if can_edit %} {% endif %} @@ -27,21 +27,58 @@ Type{{ overlay.type }} Scope{% if overlay.user_id %}private{% else %}system{% endif %} Path{{ overlay.path }} + + Last build + + {% if overlay.last_build_status == 'ok' %} + ok + {% elif overlay.last_build_status == 'failed' %} + failed + {% else %} + never + {% endif %} + +
-{% if global_source %} +{% if overlay.type == 'script' %}
-

Global source

- - - - - - - -
Source key{{ global_source.source_key }}
Source URL{{ global_source.source_url }}
Last refreshed{{ global_source.last_refreshed_at or "Never" }}
Last error{{ global_source.last_error or "None" }}
+
+

Script

+ {% if can_edit %} +
+
+ + +
+ +
+ {% endif %} +
+ + {% if can_edit %} +
+ + +

Runs sandboxed against the overlay directory mounted at /overlay. Saving auto-enqueues a build.

+
+ +
+
+ {% else %} +
{{ overlay.script or "" }}
+ {% endif %} + + {% if latest_build_job %} +

+ Latest build: job #{{ latest_build_job.id }} + — state: {{ latest_build_job.state }} +

+ {% endif %}
{% endif %} @@ -118,5 +155,24 @@ + +{% if overlay.type == 'script' %} + + + + + +{% endif %} {% endif %} {% endblock %} diff --git a/l4d2web/templates/overlays.html b/l4d2web/templates/overlays.html index fd6f012..2185e50 100644 --- a/l4d2web/templates/overlays.html +++ b/l4d2web/templates/overlays.html @@ -37,8 +37,12 @@
Type +
+ {% if g.user and g.user.admin %} + + {% endif %}

The path is generated automatically.