blob: 88247b26fa2e78a26f69cc3b07619c7a440cb2a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
"""Basic routes required for all pages"""
import os
from flask import (
Blueprint,
render_template,
current_app as app,
send_from_directory)
from uploader.oauth2.client import user_logged_in
base = Blueprint("base", __name__)
@base.route("/favicon.ico", methods=["GET"])
def favicon():
"""Return the favicon."""
return send_from_directory(os.path.join(app.root_path, "static"),
"images/CITGLogo.png",
mimetype="image/png")
@base.route("/", methods=["GET"])
def index():
"""Load the landing page"""
return render_template("index.html" if user_logged_in() else "login.html")
def appenv():
"""Get app's guix environment path."""
return os.environ.get("GN_UPLOADER_ENVIRONMENT")
@base.route("/bootstrap/<path:filename>")
def bootstrap(filename):
"""Fetch bootstrap files."""
return send_from_directory(
appenv(), f"share/genenetwork2/javascript/bootstrap/{filename}")
@base.route("/jquery/<path:filename>")
def jquery(filename):
"""Fetch jquery files."""
return send_from_directory(
appenv(), f"share/genenetwork2/javascript/jquery/{filename}")
@base.route("/node-modules/<path:filename>")
def node_modules(filename):
"""Fetch node-js modules."""
return send_from_directory(
appenv(), f"lib/node_modules/{filename}")
|