diff --git a/app/app.py b/app/app.py index ad90ab2..aa6ee12 100644 --- a/app/app.py +++ b/app/app.py @@ -356,7 +356,12 @@ def _entry(item: Path) -> dict: @app.context_processor def _inject_globals(): - return {"trash_count": _trash_count() if _user() else 0} + u = _user() + return { + "user": u, + "trash_count": _trash_count() if u else 0, + "humansize": _humansize, + } # ── Auth ────────────────────────────────────────────────────────────── @@ -414,12 +419,10 @@ def dashboard(): folders[item.name] = _folder_stats(item) return render_template("dashboard.html", - user=_user(), folders=folders, total_files=sum(v["files"] for v in folders.values()), total_size=sum(v["size"] for v in folders.values()), trash=_trash_stats(), - humansize=_humansize, ) @@ -462,11 +465,9 @@ def browse(subpath=""): ] return render_template("browse.html", - user=_user(), entries=entries, subpath=subpath, breadcrumb=breadcrumb, - humansize=_humansize, has_hits=STATS_JSON.is_file(), ) @@ -486,7 +487,6 @@ def _file_preview(path: Path, subpath: str): next_path = str(siblings[idx + 1].relative_to(ASSETS_ROOT)) if idx is not None and idx < len(siblings) - 1 else None ctx = dict( - user=_user(), subpath=subpath, filename=path.name, filesize=_humansize(stat.st_size), @@ -567,14 +567,12 @@ def search(): results.append(e) return render_template("search.html", - user=_user(), q=q, after=after_s, before=before_s, in_content=in_content, results=results, searched=searched, - humansize=_humansize, ) @@ -586,7 +584,6 @@ def stats(): if redir: return redir return render_template("stats.html", - user=_user(), has_report=STATS_FILE.is_file(), ) @@ -691,7 +688,7 @@ def trash_list(): return redir _trash_purge(30) entries = _trash_list() - return render_template("trash.html", entries=entries, humansize=_humansize) + return render_template("trash.html", entries=entries) @app.route("/trash/raw/")