finished basic about page, and including 15 recent commits by default

This commit is contained in:
2022-12-31 14:28:05 +11:00
parent 70c449d859
commit 1afaa338a8
4 changed files with 34 additions and 4 deletions

33
main.py
View File

@@ -134,6 +134,38 @@ def login():
return render_template("login.html", form=form)
################################################################################
# simple about route/page that shows build date and because Prod version is
# Docker built, it picks up a git log for displaying recent commits
################################################################################
@app.route('/about')
@login_required
def about():
commits=[]
try:
with open( 'internal/git-log.txt', 'r' ) as fp:
can_add=False
for l in fp:
if l.startswith( 'commit' ) or l.startswith( 'Author:' ):
pass
elif l.startswith( 'Date:' ):
if can_add:
commits.append(o)
o={}
o['date']=l.replace("Date: ", "")
o['str']=''
can_add=True
else:
o['str']=o['str']+l
except FileNotFoundError:
o={}
o['date']="No known date"
o['str']='No commits to display (if this is DEV then last build is now)'
# add last commit (or fake commit if no file)
commits.append(o)
return render_template("about.html", commits=commits)
@app.route('/logout')
@login_required
def logout():
@@ -163,4 +195,3 @@ def _jinja2_filter_parentpath(dn):
s+=1
f=username.index(',')
return username[s:f]