🩹 add page titles
This commit is contained in:
parent
040fd333e2
commit
f9ce89fb4f
1 changed files with 8 additions and 7 deletions
15
src/index.py
15
src/index.py
|
@ -15,7 +15,7 @@ def download_file(url, file):
|
||||||
r = requests.get(url, allow_redirects=True)
|
r = requests.get(url, allow_redirects=True)
|
||||||
open(file, "wb").write(r.content)
|
open(file, "wb").write(r.content)
|
||||||
|
|
||||||
|
# Downloads all bootstrap files to flasks static directory
|
||||||
def cache_bootstrap():
|
def cache_bootstrap():
|
||||||
download_file(
|
download_file(
|
||||||
"https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css",
|
"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 = open(f"/data/messages/{name}-{dt}.asc", "w")
|
||||||
f.write(msg)
|
f.write(msg)
|
||||||
|
|
||||||
|
# Send Notification to all handlers
|
||||||
def notify(msg, title=None):
|
def notify(msg, title=None):
|
||||||
try:
|
try:
|
||||||
gotify_notification(msg, title)
|
gotify_notification(msg, title)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Gotify Notification Handler
|
||||||
def gotify_notification(msg, title=None):
|
def gotify_notification(msg, title=None):
|
||||||
token = CONFIG["notify"]["gotify"]["token"]
|
token = CONFIG["notify"]["gotify"]["token"]
|
||||||
url = CONFIG["notify"]["gotify"]["host"]
|
url = CONFIG["notify"]["gotify"]["host"]
|
||||||
|
@ -131,15 +131,16 @@ def send_message():
|
||||||
css_class="container", style="margin-top: 25px"
|
css_class="container", style="margin-top: 25px"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
]
|
], "Send a message"
|
||||||
).to_code()
|
).to_code()
|
||||||
|
|
||||||
|
|
||||||
# Wrapper for Base HTML
|
# Wrapper for Base HTML
|
||||||
def buildSite(content):
|
def buildSite(content, title=None):
|
||||||
return Document(
|
return Document(
|
||||||
head=Head(
|
head=Head(
|
||||||
[
|
[
|
||||||
|
Title(title),
|
||||||
Meta(
|
Meta(
|
||||||
name="viewport",
|
name="viewport",
|
||||||
content="user-scalable=no, width=device-width, initial-scale=1.0",
|
content="user-scalable=no, width=device-width, initial-scale=1.0",
|
||||||
|
@ -190,7 +191,7 @@ def public_key():
|
||||||
css_class="container card bg-primary"
|
css_class="container card bg-primary"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
], "Public Key"
|
||||||
).to_code()
|
).to_code()
|
||||||
|
|
||||||
# Return raw key
|
# Return raw key
|
||||||
|
@ -273,5 +274,5 @@ def build_information_block():
|
||||||
@main_pages.route("/", methods=["GET"])
|
@main_pages.route("/", methods=["GET"])
|
||||||
def index():
|
def index():
|
||||||
return buildSite(
|
return buildSite(
|
||||||
[build_information_block(), build_contact_block(), build_donation_block()]
|
[build_information_block(), build_contact_block(), build_donation_block()], "About Me"
|
||||||
).to_code()
|
).to_code()
|
||||||
|
|
Loading…
Add table
Reference in a new issue