UI: move logout to top-right, hide header Admin link; add global 'Made by Ruslan' watermark with handwriting font; inject <title> from page name; move page overlay Admin button to top-right

This commit is contained in:
2025-09-03 15:25:52 +03:00
parent aa5cb82295
commit c87f4fb0d6
2 changed files with 32 additions and 3 deletions

18
app.py
View File

@@ -168,10 +168,26 @@ def create_app():
abort(404)
# Show a floating admin button for authenticated users, otherwise serve raw HTML
html: str = row["html"]
# Inject <title> tag for better page naming
try:
page_title = row["title"]
except Exception:
page_title = ""
if page_title:
lower = html.lower()
if "</head>" in lower:
i = lower.rfind("</head>")
html = html[:i] + f"<title>{page_title}</title>" + html[i:]
elif "<html" in lower:
if "<body" in lower:
j = lower.find("<body")
html = html[:j] + f"<head><meta charset=\"utf-8\"><title>{page_title}</title></head>" + html[j:]
else:
html = f"<head><meta charset=\"utf-8\"><title>{page_title}</title></head>" + html
if is_logged_in():
admin_url = url_for("admin")
toolbar = (
'<div style="position:fixed;top:16px;left:16px;z-index:2147483647;">'
'<div style="position:fixed;top:16px;right:16px;z-index:2147483647;">'
f'<a href="{admin_url}" '
'style="background:linear-gradient(135deg,#111,#333);color:#fff;padding:10px 14px;'
'border-radius:10px;box-shadow:0 8px 20px rgba(0,0,0,0.25);'