fix: Remove loading page
This commit is contained in:
60
server.py
60
server.py
@@ -24,7 +24,6 @@ from zoneinfo import ZoneInfo
|
|||||||
from blueprints import now, blog, wellknown, api, podcast, acme, spotify
|
from blueprints import now, blog, wellknown, api, podcast, acme, spotify
|
||||||
from tools import (
|
from tools import (
|
||||||
isCLI,
|
isCLI,
|
||||||
isCrawler,
|
|
||||||
getAddress,
|
getAddress,
|
||||||
getFilePath,
|
getFilePath,
|
||||||
error_response,
|
error_response,
|
||||||
@@ -233,32 +232,9 @@ def index():
|
|||||||
if "podcast.woodburn.au" in request.host:
|
if "podcast.woodburn.au" in request.host:
|
||||||
return render_template("podcast.html")
|
return render_template("podcast.html")
|
||||||
|
|
||||||
loaded = False
|
|
||||||
if request.referrer:
|
|
||||||
# Check if referrer includes nathan.woodburn.au
|
|
||||||
if "nathan.woodburn.au" in request.referrer:
|
|
||||||
loaded = True
|
|
||||||
if request.cookies.get("loaded"):
|
|
||||||
loaded = True
|
|
||||||
|
|
||||||
# Always load if load is in the query string
|
|
||||||
if request.args.get("load"):
|
|
||||||
loaded = False
|
|
||||||
if isCLI(request):
|
if isCLI(request):
|
||||||
return curl_response(request)
|
return curl_response(request)
|
||||||
|
|
||||||
if not loaded and not isCrawler(request):
|
|
||||||
# Set cookie
|
|
||||||
resp = make_response(
|
|
||||||
render_template("loading.html").replace(
|
|
||||||
"https://nathan.woodburn.au/loading", "https://nathan.woodburn.au/"
|
|
||||||
),
|
|
||||||
200,
|
|
||||||
{"Content-Type": "text/html"},
|
|
||||||
)
|
|
||||||
resp.set_cookie("loaded", "true", max_age=604800)
|
|
||||||
return resp
|
|
||||||
|
|
||||||
# Use cached git data
|
# Use cached git data
|
||||||
git = get_git_latest_activity()
|
git = get_git_latest_activity()
|
||||||
repo_name = git["repo"]["name"].lower()
|
repo_name = git["repo"]["name"].lower()
|
||||||
@@ -309,29 +285,21 @@ def index():
|
|||||||
SOLaddress = getAddress("SOL")
|
SOLaddress = getAddress("SOL")
|
||||||
BTCaddress = getAddress("BTC")
|
BTCaddress = getAddress("BTC")
|
||||||
ETHaddress = getAddress("ETH")
|
ETHaddress = getAddress("ETH")
|
||||||
# Set cookie
|
return render_template(
|
||||||
resp = make_response(
|
"index.html",
|
||||||
render_template(
|
handshake_scripts=getHandshakeScript(request.host),
|
||||||
"index.html",
|
HNS=HNSaddress,
|
||||||
handshake_scripts=getHandshakeScript(request.host),
|
SOL=SOLaddress,
|
||||||
HNS=HNSaddress,
|
BTC=BTCaddress,
|
||||||
SOL=SOLaddress,
|
ETH=ETHaddress,
|
||||||
BTC=BTCaddress,
|
repo=repo,
|
||||||
ETH=ETHaddress,
|
repo_description=repo_description,
|
||||||
repo=repo,
|
custom=custom,
|
||||||
repo_description=repo_description,
|
sites=SITES,
|
||||||
custom=custom,
|
projects=projects,
|
||||||
sites=SITES,
|
time=time,
|
||||||
projects=projects,
|
message="",
|
||||||
time=time,
|
|
||||||
message="",
|
|
||||||
),
|
|
||||||
200,
|
|
||||||
{"Content-Type": "text/html"},
|
|
||||||
)
|
)
|
||||||
resp.set_cookie("loaded", "true", max_age=604800)
|
|
||||||
|
|
||||||
return resp
|
|
||||||
|
|
||||||
|
|
||||||
# region Donate
|
# region Donate
|
||||||
|
|||||||
Reference in New Issue
Block a user