feat: Add date to now page
This commit is contained in:
parent
12a51bbb54
commit
35e4ae222c
14
server.py
14
server.py
@ -3,6 +3,7 @@ import os
|
||||
import dotenv
|
||||
import requests
|
||||
import CloudFlare
|
||||
import datetime
|
||||
|
||||
app = Flask(__name__)
|
||||
dotenv.load_dotenv()
|
||||
@ -129,6 +130,7 @@ def index():
|
||||
return resp
|
||||
|
||||
@app.route('/now')
|
||||
@app.route('/now/')
|
||||
def now():
|
||||
global handshake_scripts
|
||||
|
||||
@ -141,7 +143,13 @@ def now():
|
||||
# Remove template
|
||||
files = [file for file in files if file != 'template.html']
|
||||
files.sort(reverse=True)
|
||||
return render_template('now/' + files[0], handshake_scripts=handshake_scripts)
|
||||
date = files[0].strip('.html')
|
||||
# Convert to date
|
||||
date = datetime.datetime.strptime(date, '%y_%m_%d')
|
||||
date = date.strftime('%A, %B %d, %Y')
|
||||
|
||||
|
||||
return render_template('now/' + files[0], handshake_scripts=handshake_scripts, DATE=date)
|
||||
|
||||
|
||||
@app.route('/<path:path>')
|
||||
@ -158,13 +166,15 @@ def catch_all(path):
|
||||
if os.path.isfile('templates/' + path + '.html'):
|
||||
return render_template(path + '.html', handshake_scripts=handshake_scripts)
|
||||
|
||||
if os.path.isfile('templates/' + path.strip('/') + '.html'):
|
||||
return render_template(path.strip('/') + '.html', handshake_scripts=handshake_scripts)
|
||||
|
||||
return render_template('404.html'), 404
|
||||
|
||||
def getAddress():
|
||||
global address
|
||||
if address == '':
|
||||
address = 'hs1qv3uu4amv87g7p7h49xez2pmzwjf92am0wzpnh4'
|
||||
# address = requests.get('http://hip02-server:3000').text?
|
||||
return address
|
||||
|
||||
|
||||
|
@ -72,7 +72,8 @@ Find out what I've been up to in the last week">
|
||||
</nav>{{handshake_scripts | safe}}
|
||||
<div class="profile-container" style="margin-bottom: 2em;margin-top: 10em;"><img class="profile background" src="/assets/img/profile.jpg" style="border-radius: 50%;"><img class="profile foreground" src="/assets/img/pfront.webp"></div>
|
||||
<h1 class="nathanwoodburn" style="margin-bottom: 0px;">Nathan.Woodburn/</h1>
|
||||
<h3>WHat's Happening Now</h3>
|
||||
<h3 style="margin-bottom: 0px;">WHat's Happening Now</h3>
|
||||
<h6>{{DATE}}</h6>
|
||||
<section style="margin-bottom: 50px;">
|
||||
<div style="max-width: 700px;margin: auto;">
|
||||
<h1 style="margin-bottom: 0px;">HappeninG</h1>
|
||||
|
@ -72,7 +72,8 @@ Find out what I've been up to in the last week">
|
||||
</nav>{{handshake_scripts | safe}}
|
||||
<div class="profile-container" style="margin-bottom: 2em;margin-top: 10em;"><img class="profile background" src="/assets/img/profile.jpg" style="border-radius: 50%;"><img class="profile foreground" src="/assets/img/pfront.webp"></div>
|
||||
<h1 class="nathanwoodburn" style="margin-bottom: 0px;">Nathan.Woodburn/</h1>
|
||||
<h3>WHat's Happening Now</h3>
|
||||
<h3 style="margin-bottom: 0px;">WHat's Happening Now</h3>
|
||||
<h6>{{DATE}}</h6>
|
||||
<section style="margin-bottom: 50px;">
|
||||
<div style="max-width: 700px;margin: auto;">
|
||||
<h1 style="margin-bottom: 0px;">Title</h1>
|
||||
|
@ -3,6 +3,9 @@
|
||||
<url>
|
||||
<loc>https://nathan.woodburn.au/now/24_02_18</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://nathan.woodburn.au/now/24_02_25</loc>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://nathan.woodburn.au/now/template</loc>
|
||||
</url>
|
||||
|
Loading…
Reference in New Issue
Block a user