feat: Update home page
All checks were successful
Build Docker / Build Image (push) Successful in 40s

This commit is contained in:
2024-02-11 20:00:42 +11:00
parent 8dee38c981
commit aa21e9f203
10 changed files with 51 additions and 49 deletions

View File

@@ -2,7 +2,7 @@ from flask import Flask, make_response, redirect, request, jsonify, render_templ
import os
import dotenv
import requests
import CloudFlare
import datetime
app = Flask(__name__)
dotenv.load_dotenv()
@@ -40,20 +40,29 @@ def wallet(path):
# Special routes
@app.route('/email')
def email():
return redirect('mailto:hns@hns.au')
# Main routes
@app.route('/')
def index():
return render_template('index.html')
year = datetime.datetime.now().year
return render_template('index.html',year=year)
@app.route('/<path:path>')
def catch_all(path):
year = datetime.datetime.now().year
# If file exists, load it
if os.path.isfile('templates/' + path):
return render_template(path)
return render_template(path, year=year)
# Try with .html
if os.path.isfile('templates/' + path + '.html'):
return render_template(path + '.html')
return render_template(path + '.html', year=year)
return render_template('404.html'), 404