Skip to content

Commit

Permalink
add maintenance mode warning
Browse files Browse the repository at this point in the history
  • Loading branch information
oscie57 committed Jun 21, 2024
1 parent e17aeab commit 7a32ced
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion templates/generic/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
{% endwith %}

<section class="section">
<div class="container">
<div class="container">{% if maintenance %}
<div class="notification is-warning">
Wii Room is currently in <b>maintenance mode</b>.
</div>
{% endif %}
<div class="columns">
<div class="column is-one-quarter">
{% include 'includes/sidebar.html' %}
Expand Down
11 changes: 10 additions & 1 deletion theunderground/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
from flask import url_for, flash, render_template, send_from_directory
from flask_login import current_user, login_user, login_required, logout_user
from werkzeug.utils import redirect
from first import conf_first_bin_xml

from models import User, db
from room import app
from theunderground.forms import LoginForm, NewUserForm, ChangePasswordForm


def is_maintenance():
returned_xml = conf_first_bin_xml()
if b"<maint>1</maint>" in returned_xml:
return True
else:
return False


@app.login_manager.unauthorized_handler
def unauthorized():
return redirect(url_for("root"))
Expand Down Expand Up @@ -84,4 +93,4 @@ def logout():
@app.route("/theunderground/admin")
@login_required
def admin():
return render_template("underground.html")
return render_template("underground.html", maintenance=is_maintenance())

0 comments on commit 7a32ced

Please sign in to comment.