From 937433c0e55fd53554a9c8aa64ff20a80929cd0d Mon Sep 17 00:00:00 2001 From: Alpinux Date: Wed, 6 May 2026 10:53:07 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20pr=C3=A9visualisation=20depuis=20la=20c?= =?UTF-8?q?orbeille=20+=20suppression=20doublon=20nav?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Route /trash/preview/ : réutilise preview_image/text/other.html avec from_trash=True (← Corbeille, pas de rename ni de resize) - Nom de fichier cliquable dans la liste corbeille → aperçu - Suppression du lien "Tableau de bord" du header (doublon avec le logo) - Ferme #25 Co-Authored-By: Claude Sonnet 4.6 --- app/app.py | 35 ++++++++++++++++++++++++++++++++ app/templates/_file_table.html | 2 +- app/templates/base.html | 2 -- app/templates/preview_image.html | 14 +++++++++++-- app/templates/preview_other.html | 10 ++++++--- app/templates/preview_text.html | 10 ++++++--- 6 files changed, 62 insertions(+), 11 deletions(-) diff --git a/app/app.py b/app/app.py index aa6ee12..0fe2b81 100644 --- a/app/app.py +++ b/app/app.py @@ -741,6 +741,41 @@ def trash_restore(): return redirect(url_for("browse", subpath=parent) if parent != "." else url_for("browse")) +@app.route("/trash/preview/") +def trash_preview(subpath): + redir = _require_admin() + if redir: + return redir + target = (TRASH_ROOT / subpath).resolve() + if not str(target).startswith(str(TRASH_ROOT)): + abort(400) + if not target.is_file(): + abort(404) + stat = target.stat() + ext = target.suffix.lower() + ctx = dict( + subpath = subpath, + filename = target.name, + filesize = _humansize(stat.st_size), + mtime = datetime.fromtimestamp(stat.st_mtime), + raw_url = url_for("trash_raw", subpath=subpath), + parent_path= None, + prev_path = None, + next_path = None, + sibling_pos= "", + ext = ext, + from_trash = True, + ) + if ext in IMAGE_EXT: + ctx["meta"] = _image_meta(target) + return render_template("preview_image.html", **ctx) + if ext in TEXT_EXT: + return render_template("preview_text.html", + content=target.read_text(errors="replace"), + lang=ext.lstrip("."), **ctx) + return render_template("preview_other.html", **ctx) + + @app.route("/trash/empty", methods=["POST"]) def trash_empty(): redir = _require_admin() diff --git a/app/templates/_file_table.html b/app/templates/_file_table.html index 0484641..4768481 100644 --- a/app/templates/_file_table.html +++ b/app/templates/_file_table.html @@ -61,7 +61,7 @@ alt="{{ e.name }}" loading="lazy"> {% endif %} {% if mode == 'trash' %} - {{ e.name }} + {{ e.name }} {% else %} {{ e.name }}{% if e.is_dir %}/{% endif %} diff --git a/app/templates/base.html b/app/templates/base.html index 3a672c2..41769b2 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -16,8 +16,6 @@ Alpinux Static