Add node status page

This commit is contained in:
Timotej Lazar 2023-07-07 09:16:51 +02:00
parent 4ef3efbc68
commit 6b72316076
3 changed files with 30 additions and 1 deletions

View file

@ -86,4 +86,18 @@ def create_app(test_config=None):
def home():
return flask.render_template('index.html')
@app.route('/nodes')
@flask_login.login_required
def nodes():
try:
if not flask_login.current_user.is_admin:
return flask.Response('forbidden', status=403, mimetype='text/plain')
with db.locked('nodes'):
version = db.load('settings').get('version')
nodes = db.read('nodes')
return flask.render_template('nodes.html', version=version, nodes=nodes)
except Exception as e:
return flask.Response(f'something went catastrophically wrong: {e}',
status=400, mimetype='text/plain')
return app