From f9ce89fb4f299534088ca7583074a59a797388e5 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Tue, 30 Aug 2022 20:33:22 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20add=20page=20titles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/index.py b/src/index.py index d1f8bc7..3b9beb2 100644 --- a/src/index.py +++ b/src/index.py @@ -15,7 +15,7 @@ def download_file(url, file): r = requests.get(url, allow_redirects=True) open(file, "wb").write(r.content) - +# Downloads all bootstrap files to flasks static directory def cache_bootstrap(): download_file( "https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css", @@ -58,14 +58,14 @@ def save_message(msg, name=""): f = open(f"/data/messages/{name}-{dt}.asc", "w") f.write(msg) - +# Send Notification to all handlers def notify(msg, title=None): try: gotify_notification(msg, title) except: pass - +# Gotify Notification Handler def gotify_notification(msg, title=None): token = CONFIG["notify"]["gotify"]["token"] url = CONFIG["notify"]["gotify"]["host"] @@ -131,15 +131,16 @@ def send_message(): css_class="container", style="margin-top: 25px" ), ) - ] + ], "Send a message" ).to_code() # Wrapper for Base HTML -def buildSite(content): +def buildSite(content, title=None): return Document( head=Head( [ + Title(title), Meta( name="viewport", content="user-scalable=no, width=device-width, initial-scale=1.0", @@ -190,7 +191,7 @@ def public_key(): css_class="container card bg-primary" ), ), - ] + ], "Public Key" ).to_code() # Return raw key @@ -273,5 +274,5 @@ def build_information_block(): @main_pages.route("/", methods=["GET"]) def index(): return buildSite( - [build_information_block(), build_contact_block(), build_donation_block()] + [build_information_block(), build_contact_block(), build_donation_block()], "About Me" ).to_code()