Adds route to display current users

This commit is contained in:
pluja 2020-09-26 15:09:26 +02:00
parent e9710af05b
commit 75bf4d3bb5

View File

@ -598,13 +598,18 @@ def register():
return render_template('register.html', title='Register', registrations=REGISTRATIONS, form=form, config=config) return render_template('register.html', title='Register', registrations=REGISTRATIONS, form=form, config=config)
@app.route('/registrations_status') @app.route('/registrations_status/icon')
def registrations_status(): def registrations_status_icon():
count = db.session.query(User).count() count = db.session.query(User).count()
if count >= config['maxInstanceUsers'] or config['maxInstanceUsers'] == 0: if count >= config['maxInstanceUsers'] or config['maxInstanceUsers'] == 0:
return url_for('static',filename='img/close.png') return redirect(url_for('static',filename='img/close.png'))
else: else:
return url_for('static',filename='img/open.png') return redirect(url_for('static',filename='img/open.png'))
@app.route('/registrations_status/text')
def registrations_status_text():
count = db.session.query(User).count()
return "{c}/{t}".format(c=count, t=config['maxInstanceUsers'])
@app.route('/error/<errno>') @app.route('/error/<errno>')
def error(errno): def error(errno):