fix: Async hns script to fix site loading
All checks were successful
Build Docker / Build Image (push) Successful in 25s

This commit is contained in:
Nathan Woodburn 2024-02-22 16:40:52 +11:00
parent 2d56c89765
commit 6d47ddf89f
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -8,6 +8,7 @@ app = Flask(__name__)
dotenv.load_dotenv() dotenv.load_dotenv()
address = '' address = ''
handshake_scripts = '<script src="https://nathan.woodburn/handshake.js" domain="nathan.woodburn" async></script><script src="https://nathan.woodburn/https.js" async></script>'
# Custom header # Custom header
def add_custom_header(response): def add_custom_header(response):
@ -113,7 +114,6 @@ def index():
html_url=git['repo']['html_url'] html_url=git['repo']['html_url']
repo = "<a href=\"" + html_url + "\" target=\"_blank\">" + repo_name + "</a>" repo = "<a href=\"" + html_url + "\" target=\"_blank\">" + repo_name + "</a>"
handshake_scripts = "<script src=\"https://nathan.woodburn/handshake.js\" domain=\"nathan.woodburn\"></script><script src=\"https://nathan.woodburn/https.js\"></script>"
# If localhost, don't load handshake # If localhost, don't load handshake
if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au": if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au":
handshake_scripts = "" handshake_scripts = ""
@ -133,7 +133,7 @@ def index():
@app.route('/now') @app.route('/now')
def now(): def now():
handshake_scripts = "<script src=\"https://nathan.woodburn/handshake.js\" domain=\"nathan.woodburn\"></script><script src=\"https://nathan.woodburn/https.js\"></script>"
# If localhost, don't load handshake # If localhost, don't load handshake
if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au": if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au":
handshake_scripts = "" handshake_scripts = ""
@ -148,7 +148,6 @@ def now():
@app.route('/<path:path>') @app.route('/<path:path>')
def catch_all(path): def catch_all(path):
handshake_scripts = "<script src=\"https://nathan.woodburn/handshake.js\" domain=\"nathan.woodburn\"></script><script src=\"https://nathan.woodburn/https.js\"></script>"
# If localhost, don't load handshake # If localhost, don't load handshake
if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au": if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au":
handshake_scripts = "" handshake_scripts = ""