Compare commits
2 Commits
9568cfe177
...
5685830cba
Author | SHA1 | Date | |
---|---|---|---|
5685830cba | |||
1f9b38306c |
29
cleanSite.py
Normal file
29
cleanSite.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
# Read all files in the templates directory
|
||||||
|
for file in os.listdir('templates'):
|
||||||
|
# Check if the file is sitemap.xml
|
||||||
|
if file == 'sitemap.xml':
|
||||||
|
# Open the file
|
||||||
|
with open('templates/sitemap.xml', 'r') as f:
|
||||||
|
# Read the content
|
||||||
|
content = f.read()
|
||||||
|
# Replace all .html with empty string
|
||||||
|
content = content.replace('.html', '')
|
||||||
|
# Write the content back to the file
|
||||||
|
with open('templates/sitemap.xml', 'w') as f:
|
||||||
|
f.write(content)
|
||||||
|
# Skip the file
|
||||||
|
continue
|
||||||
|
|
||||||
|
# If the file is not an html file, skip it
|
||||||
|
if not file.endswith('.html'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Open the file
|
||||||
|
with open('templates/' + file, 'r') as f:
|
||||||
|
# Read and remove all .html
|
||||||
|
content = f.read().replace('.html"', '"')
|
||||||
|
# Write the cleaned content back to the file
|
||||||
|
with open('templates/' + file, 'w') as f:
|
||||||
|
f.write(content)
|
21
server.py
21
server.py
@ -189,8 +189,7 @@ def index():
|
|||||||
repo_description = "Personal website"
|
repo_description = "Personal website"
|
||||||
git = {'repo': {'html_url': 'https://nathan.woodburn.au', 'name': 'nathanwoodburn.github.io', 'description': 'Personal website'}}
|
git = {'repo': {'html_url': 'https://nathan.woodburn.au', 'name': 'nathanwoodburn.github.io', 'description': 'Personal website'}}
|
||||||
print("Error getting git data")
|
print("Error getting git data")
|
||||||
custom = ""
|
|
||||||
|
|
||||||
# Get only repo names for the newest updates
|
# Get only repo names for the newest updates
|
||||||
if projects == [] or projectsUpdated < datetime.datetime.now() - datetime.timedelta(hours=2):
|
if projects == [] or projectsUpdated < datetime.datetime.now() - datetime.timedelta(hours=2):
|
||||||
projectsreq = requests.get('https://git.woodburn.au/api/v1/users/nathanwoodburn/repos')
|
projectsreq = requests.get('https://git.woodburn.au/api/v1/users/nathanwoodburn/repos')
|
||||||
@ -221,6 +220,7 @@ def index():
|
|||||||
projectNum += 1
|
projectNum += 1
|
||||||
projectsUpdated = datetime.datetime.now()
|
projectsUpdated = datetime.datetime.now()
|
||||||
|
|
||||||
|
custom = ""
|
||||||
# Check for downtime
|
# Check for downtime
|
||||||
uptime = requests.get('https://uptime.woodburn.au/api/status-page/main/badge')
|
uptime = requests.get('https://uptime.woodburn.au/api/status-page/main/badge')
|
||||||
uptime = uptime.content.count(b'Up') > 1
|
uptime = uptime.content.count(b'Up') > 1
|
||||||
@ -239,26 +239,13 @@ 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":
|
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 = ""
|
||||||
|
|
||||||
if request.cookies.get('HNS'):
|
address = getAddress()
|
||||||
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
|
# Set cookie
|
||||||
resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts,
|
resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts,
|
||||||
HNS=address, repo=repo,
|
HNS=address, repo=repo,
|
||||||
repo_description=repo_description,
|
repo_description=repo_description,
|
||||||
custom=custom,sites=sites,projects=projects), 200, {'Content-Type': 'text/html'})
|
custom=custom,sites=sites,projects=projects), 200, {'Content-Type': 'text/html'})
|
||||||
# Cookie should last 1 week
|
resp.set_cookie('loaded', 'true', max_age=604800)
|
||||||
resp.set_cookie('HNS', address, max_age=604800)
|
|
||||||
|
|
||||||
if loaded:
|
|
||||||
resp.set_cookie('loaded', 'true', max_age=604800)
|
|
||||||
|
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
@ -101,15 +101,12 @@ Check them out here!</blockquote><img class="img-fluid" src="/assets/img/pfront.
|
|||||||
<h1>Some recent projects</h1>
|
<h1>Some recent projects</h1>
|
||||||
<div class="swiper">
|
<div class="swiper">
|
||||||
<div class="swiper-wrapper">{% for project in projects %}
|
<div class="swiper-wrapper">{% for project in projects %}
|
||||||
<div class="swiper-slide site" data-url="{{ project_url }}">
|
<div class="swiper-slide site" data-url="{{ project.html_url }}">
|
||||||
<img class="site-img" src="{{ project.avatar_url }}" />
|
<img class="site-img" src="{{ project.avatar_url }}" />
|
||||||
<div class="site-body">
|
<div class="site-body">
|
||||||
<div class="site-detail" style="width: 100%;">
|
<div class="site-detail" style="width: 100%;">
|
||||||
<h2 class="site-name" style="text-align: left;">{{ project.name }}</h2>
|
<h2 class="site-name" style="text-align: left;">{{ project.name }}</h2>
|
||||||
<p class="text-start site-author">{{ project.description }}</p>
|
<p class="text-start site-author">{{ project.description }}</p>
|
||||||
{% if project.actions %}
|
|
||||||
<img src="{{project.actions}}" alt="Build Status">
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,10 +36,7 @@
|
|||||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="6a55028e-aad3-481c-9a37-3e096ff75589"></script>
|
<script async src="https://umami.woodburn.au/script.js" data-website-id="6a55028e-aad3-481c-9a37-3e096ff75589"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77"><!-- Google Tag Manager (noscript) -->
|
<body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77">
|
||||||
<noscript><iframe src="https://www.googletagmanager.com/ns?id=GTM-NNXTCKW"
|
|
||||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|
||||||
<!-- End Google Tag Manager (noscript) -->
|
|
||||||
<nav class="navbar navbar-expand-md fixed-top navbar-light" id="mainNav" style="background: var(--bs-navbar-hover-color);">
|
<nav class="navbar navbar-expand-md fixed-top navbar-light" id="mainNav" style="background: var(--bs-navbar-hover-color);">
|
||||||
<div class="container-fluid"><a class="navbar-brand nathanwoodburn" href="/#">Nathan.Woodburn/</a><button data-bs-toggle="collapse" class="navbar-toggler navbar-toggler-right" data-bs-target="#navbarResponsive" type="button" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation" value="Menu"><i class="fa fa-bars"></i></button>
|
<div class="container-fluid"><a class="navbar-brand nathanwoodburn" href="/#">Nathan.Woodburn/</a><button data-bs-toggle="collapse" class="navbar-toggler navbar-toggler-right" data-bs-target="#navbarResponsive" type="button" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation" value="Menu"><i class="fa fa-bars"></i></button>
|
||||||
<div class="collapse navbar-collapse" id="navbarResponsive">
|
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||||||
|
@ -35,10 +35,7 @@
|
|||||||
<script async src="https://umami.woodburn.au/script.js" data-website-id="6a55028e-aad3-481c-9a37-3e096ff75589"></script>
|
<script async src="https://umami.woodburn.au/script.js" data-website-id="6a55028e-aad3-481c-9a37-3e096ff75589"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77"><!-- Google Tag Manager (noscript) -->
|
<body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77">
|
||||||
<noscript><iframe src="https://www.googletagmanager.com/ns?id=GTM-NNXTCKW"
|
|
||||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|
||||||
<!-- End Google Tag Manager (noscript) -->
|
|
||||||
<header class="masthead" style="background-image:url('/assets/img/bg/projects.webp');">
|
<header class="masthead" style="background-image:url('/assets/img/bg/projects.webp');">
|
||||||
<div class="intro-body">
|
<div class="intro-body">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
Loading…
Reference in New Issue
Block a user