|
@@ -3,6 +3,7 @@
|
|
Serve static content
|
|
Serve static content
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
+import os
|
|
from flask import render_template, Blueprint, abort
|
|
from flask import render_template, Blueprint, abort
|
|
from jinja2 import TemplateNotFound
|
|
from jinja2 import TemplateNotFound
|
|
from flask_login import current_user
|
|
from flask_login import current_user
|
|
@@ -18,9 +19,14 @@ BLUEPRINT = Blueprint(
|
|
@BLUEPRINT.route("/<path:page>")
|
|
@BLUEPRINT.route("/<path:page>")
|
|
def show(page):
|
|
def show(page):
|
|
"""Display static page"""
|
|
"""Display static page"""
|
|
- try:
|
|
|
|
- if current_user.is_authenticated:
|
|
|
|
|
|
+ if current_user.is_authenticated:
|
|
|
|
+ try:
|
|
return render_template("private/%s.html" % page)
|
|
return render_template("private/%s.html" % page)
|
|
|
|
+ except TemplateNotFound:
|
|
|
|
+ abort(404)
|
|
|
|
+ try:
|
|
return render_template("public/%s.html" % page)
|
|
return render_template("public/%s.html" % page)
|
|
except TemplateNotFound:
|
|
except TemplateNotFound:
|
|
|
|
+ if os.path.exists("app/modules/static/pages/private/%s.html" % page):
|
|
|
|
+ abort(401)
|
|
abort(404)
|
|
abort(404)
|