fix: Cleanup index variables
All checks were successful
Build Docker / BuildImage (push) Successful in 37s

This commit is contained in:
Nathan Woodburn 2024-06-19 13:16:30 +10:00
parent 1f9b38306c
commit 5685830cba
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -189,7 +189,6 @@ def index():
repo_description = "Personal website"
git = {'repo': {'html_url': 'https://nathan.woodburn.au', 'name': 'nathanwoodburn.github.io', 'description': 'Personal website'}}
print("Error getting git data")
custom = ""
# Get only repo names for the newest updates
if projects == [] or projectsUpdated < datetime.datetime.now() - datetime.timedelta(hours=2):
@ -221,6 +220,7 @@ def index():
projectNum += 1
projectsUpdated = datetime.datetime.now()
custom = ""
# Check for downtime
uptime = requests.get('https://uptime.woodburn.au/api/status-page/main/badge')
uptime = uptime.content.count(b'Up') > 1
@ -239,25 +239,12 @@ def index():
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 = ""
if request.cookies.get('HNS'):
resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts,
HNS=request.cookies.get('HNS'), repo=repo,
repo_description=repo_description,
custom=custom,sites=sites, projects=projects), 200, {'Content-Type': 'text/html'})
resp.set_cookie('loaded', 'true', max_age=604800)
return resp
if address == '':
address = getAddress()
# Set cookie
resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts,
HNS=address, repo=repo,
repo_description=repo_description,
custom=custom,sites=sites,projects=projects), 200, {'Content-Type': 'text/html'})
# Cookie should last 1 week
resp.set_cookie('HNS', address, max_age=604800)
if loaded:
resp.set_cookie('loaded', 'true', max_age=604800)
return resp