Files @ 4f24db93bdd2
Branch filter:

Location: C3L-NOC/spaceapi/spaceapi/views.py

Dennis Fink
fix multiple users
from flask import Blueprint, jsonify, render_template, abort

from .auth import httpauth
from .active import active_json, reload_json
from .utils import request_wants_json

root_views = Blueprint('root', __name__)


@root_views.route('/')
def index():
    if request_wants_json():
        return jsonify(active_json)
    return render_template('index.html', status=active_json)


@root_views.route('/status.json')
def status_json():
    return jsonify(active_json)


@root_views.route('/reload')
@httpauth.login_required
def reload():
    reload_json()
    return abort(200)