feat: Add curl handler for pgp route
All checks were successful
Build Docker / BuildImage (push) Successful in 1m20s
Check Code Quality / RuffCheck (push) Successful in 2m18s

This commit is contained in:
2026-03-05 12:42:00 +11:00
parent 90264c0024
commit 962910f36b

View File

@@ -1,4 +1,4 @@
from flask import render_template from flask import render_template, send_file
from tools import getAddress, get_tools_data, getClientIP from tools import getAddress, get_tools_data, getClientIP
import os import os
from functools import lru_cache from functools import lru_cache
@@ -125,13 +125,15 @@ def curl_response(request):
{"Content-Type": "text/plain; charset=utf-8"}, {"Content-Type": "text/plain; charset=utf-8"},
) )
if path == "pgp" or path == "gpg":
if os.path.exists("data/nathanwoodburn.asc"):
return send_file("data/nathanwoodburn.asc")
if os.path.exists(f"templates/{path}.ascii"): if os.path.exists(f"templates/{path}.ascii"):
return ( return (
render_template(f"{path}.ascii", header=get_header()), render_template(f"{path}.ascii", header=get_header()),
200, 200,
{"Content-Type": "text/plain; charset=utf-8"}, {"Content-Type": "text/plain; charset=utf-8"},
) )
# Fallback to html if it exists # Fallback to html if it exists
if os.path.exists(f"templates/{path}.html"): if os.path.exists(f"templates/{path}.html"):
return render_template(f"{path}.html") return render_template(f"{path}.html")