From cd69d86246432c372cc876f5ed1d7a565a973f32 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Thu, 19 Dec 2024 12:33:56 +1100 Subject: [PATCH] feat: Add new now page --- Dockerfile | 2 +- server.py | 17 ++-- templates/404.html | 4 +- templates/about.html | 4 +- templates/donate.html | 4 +- templates/gitpgp.html | 4 +- templates/index.html | 4 +- templates/link.html | 4 +- templates/loading.html | 4 +- templates/now.html | 4 +- templates/now/24_02_18.html | 2 +- templates/now/24_02_25.html | 2 +- templates/now/24_04_19.html | 2 +- templates/now/24_05_20.html | 2 +- templates/now/24_05_28.html | 2 +- templates/now/24_06_06.html | 2 +- templates/now/24_06_17.html | 2 +- templates/now/24_06_24.html | 2 +- templates/now/24_07_15.html | 2 +- templates/now/24_08_05.html | 2 +- templates/now/24_09_07.html | 2 +- templates/now/24_09_27.html | 2 +- templates/now/24_10_07.html | 2 +- templates/now/24_10_15.html | 2 +- templates/now/24_10_22.html | 2 +- templates/now/24_12_19.html | 156 ++++++++++++++++++++++++++++++++++++ templates/now/old.html | 2 +- templates/now/template.html | 2 +- templates/pgp.html | 4 +- templates/projects.html | 2 +- templates/resume.html | 4 +- templates/servers.html | 2 +- templates/signalQR.html | 4 +- templates/sitemap.xml | 3 + 34 files changed, 209 insertions(+), 51 deletions(-) create mode 100644 templates/now/24_12_19.html diff --git a/Dockerfile b/Dockerfile index 2269b7c..815c5b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,4 +14,4 @@ COPY . /app ENTRYPOINT ["python3"] CMD ["main.py"] -FROM builder as dev-envs \ No newline at end of file +FROM builder AS dev-envs \ No newline at end of file diff --git a/server.py b/server.py index 01e7741..467090a 100644 --- a/server.py +++ b/server.py @@ -413,7 +413,7 @@ def email(): "status": 400, "error": "Bad request JSON Data missing" }) - + # Check if api key sent data = request.json if "key" not in data: @@ -421,7 +421,7 @@ def email(): "status": 401, "error": "Unauthorized 'key' missing" }) - + if data["key"] != os.getenv("EMAIL_KEY"): return jsonify({ "status": 401, @@ -429,7 +429,6 @@ def email(): }) return sendEmail(data) - #endregion # endregion @@ -437,7 +436,7 @@ def email(): # region Main routes @app.route("/") -def index(): +def index(): global handshake_scripts global projects global projectsUpdated @@ -453,7 +452,7 @@ def index(): loaded = True # Check if crawler - if request.headers: + if request.headers and request.headers.get("User-Agent"): # Check if curl if "curl" in request.headers.get("User-Agent"): return jsonify( @@ -479,7 +478,7 @@ def index(): ) resp.set_cookie("loaded", "true", max_age=604800) return resp - + try: git = requests.get( "https://git.woodburn.au/api/v1/users/nathanwoodburn/activities/feeds?only-performed-by=true&limit=1", @@ -650,7 +649,7 @@ def now_path(path): or request.host == "test.nathan.woodburn.au" ): handshake_scripts = "" - + return now.render_now_page(path,handshake_scripts) @@ -669,11 +668,11 @@ def now_old(): or request.host == "test.nathan.woodburn.au" ): handshake_scripts = "" - + now_dates = now.list_now_dates()[1:] html = '