From 4fa39642b02573d5f2da21bc8275aea44dac3f8e Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sun, 17 May 2026 15:19:00 +0200 Subject: [PATCH] refactor(files): collapse files_overlay binary mode into per-capability gates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Read-only file explorers (server detail page, read-only overlay) used to omit the hover-action panel entirely and make the filename itself the download link. Editable overlays did the opposite: hover-action panel with download + delete, filename-click opens the editor. Unify both surfaces around the editable pattern: always emit the hover-action span when any action applies. Gate the download button on download_supported only (now visible on all surfaces). Keep delete + folder actions (+file, +folder, zip) gated on files_overlay, since read-only surfaces never offer those. In read-only mode, the filename becomes a plain — the hover ⬇ is the single download affordance, matching editable mode's filename-click ≠ hover-download split. Prefactor for the files-overlay.js rewrite (docs/superpowers/plans/ 2026-05-17-files-overlay-rewrite.md). No JS changes; files-overlay.js doesn't run on read-only surfaces (manager-element guard at line 23-24). Verified: pytest stayed at 573/1/3 (URL substrings still appear in the rendered HTML even though they moved out of the filename anchor into the hover-action span). Direct Jinja render confirmed all four branches: read-only downloadable file (new hover ⬇, plain filename), broken read-only symlink (no hover panel — correct, can't download dangling links), read-only download_supported=False (no hover panel, plain ), editable mode (byte-identical to before). Co-Authored-By: Claude Opus 4.7 (1M context) --- l4d2web/l4d2web/templates/_overlay_file_node.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/l4d2web/l4d2web/templates/_overlay_file_node.html b/l4d2web/l4d2web/templates/_overlay_file_node.html index a03d1bd..571c430 100644 --- a/l4d2web/l4d2web/templates/_overlay_file_node.html +++ b/l4d2web/l4d2web/templates/_overlay_file_node.html @@ -18,7 +18,9 @@ {% else %} -
  • {% if entry.broken %} {{ entry.name }} @@ -26,18 +28,20 @@ {% else %} {% if files_overlay %} - {% elif download_supported %} - {{ entry.name }} {% else %} {{ entry.name }} {% endif %} {% if entry.is_symlink %}link{% endif %} {{ entry.size_human }} {% endif %} - {% if files_overlay and not entry.broken %} + {% if has_actions %} + {% if show_download %} + {% endif %} + {% if files_overlay %} + {% endif %} {% endif %}