feat: Add download option for PGP public key
All checks were successful
Build Docker / BuildImage (push) Successful in 43s
All checks were successful
Build Docker / BuildImage (push) Successful in 43s
This commit is contained in:
12
server.py
12
server.py
@@ -42,6 +42,10 @@ restricted = ["ascii"]
|
||||
redirects = {
|
||||
"contact":"/#contact"
|
||||
}
|
||||
downloads = {
|
||||
"pgp": "data/nathanwoodburn.asc"
|
||||
}
|
||||
|
||||
|
||||
sites = []
|
||||
if os.path.isfile("data/sites.json"):
|
||||
@@ -789,6 +793,14 @@ def supersecretpath():
|
||||
ascii_art_html = converter.convert(ascii_art)
|
||||
return render_template("ascii.html", ascii_art=ascii_art_html)
|
||||
|
||||
@app.route("/download/<path:path>")
|
||||
def download(path):
|
||||
# Check if file exists
|
||||
if path in downloads:
|
||||
path = downloads[path]
|
||||
if os.path.isfile(path):
|
||||
return send_file(path)
|
||||
return render_template("404.html"), 404
|
||||
|
||||
@app.route("/<path:path>")
|
||||
def catch_all(path: str):
|
||||
|
||||
Reference in New Issue
Block a user