2018-02-26 09:59:54 +03:00
|
|
|
|
__author__ = 'RemiZOffAlex'
|
|
|
|
|
|
__copyright__ = '(c) RemiZOffAlex'
|
|
|
|
|
|
__email__ = 'remizoffalex@mail.ru'
|
|
|
|
|
|
|
2020-08-17 19:57:37 +03:00
|
|
|
|
from flask import render_template, Response
|
2018-02-26 09:59:54 +03:00
|
|
|
|
|
2023-02-18 07:35:06 +03:00
|
|
|
|
from myapp import app, lib
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/app.js')
|
|
|
|
|
|
def app_js():
|
|
|
|
|
|
"""Фильтр
|
|
|
|
|
|
"""
|
|
|
|
|
|
pagedata = {}
|
|
|
|
|
|
if lib.get_user():
|
|
|
|
|
|
body = render_template('/private/app.js', pagedata=pagedata)
|
|
|
|
|
|
else:
|
|
|
|
|
|
body = render_template('/public/app.js', pagedata=pagedata)
|
|
|
|
|
|
return Response(body, mimetype='application/javascript')
|
|
|
|
|
|
|
2018-02-26 09:59:54 +03:00
|
|
|
|
|
2019-10-27 19:40:03 +03:00
|
|
|
|
@app.route("/robots.txt")
|
|
|
|
|
|
def robots_txt():
|
|
|
|
|
|
body = render_template("robots.txt")
|
|
|
|
|
|
return Response(body, mimetype='text/plain')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# noinspection PyUnusedLocal
|
|
|
|
|
|
@app.errorhandler(404)
|
|
|
|
|
|
def error_missing(exception):
|
|
|
|
|
|
pagedata = {}
|
|
|
|
|
|
error_message = "Не судьба..."
|
2020-08-17 19:57:37 +03:00
|
|
|
|
return render_template(
|
|
|
|
|
|
"error.html",
|
|
|
|
|
|
error_code=404,
|
|
|
|
|
|
error_message=error_message,
|
|
|
|
|
|
pagedata=pagedata
|
|
|
|
|
|
), 404
|
2019-10-27 19:40:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# noinspection PyUnusedLocal
|
|
|
|
|
|
@app.errorhandler(403)
|
|
|
|
|
|
def error_unauthorized(exception):
|
|
|
|
|
|
pagedata = {}
|
|
|
|
|
|
error_message = "У вас нет прав"
|
2020-08-17 19:57:37 +03:00
|
|
|
|
return render_template(
|
|
|
|
|
|
"error.html",
|
|
|
|
|
|
error_code=403,
|
|
|
|
|
|
error_message=error_message,
|
|
|
|
|
|
pagedata=pagedata
|
|
|
|
|
|
), 403
|
2019-10-27 19:40:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# noinspection PyUnusedLocal
|
|
|
|
|
|
@app.errorhandler(500)
|
|
|
|
|
|
def error_crash(exception):
|
|
|
|
|
|
pagedata = {}
|
|
|
|
|
|
error_message = "Вот незадача..."
|
2020-08-17 19:57:37 +03:00
|
|
|
|
return render_template(
|
|
|
|
|
|
"error.html",
|
|
|
|
|
|
error_code=500,
|
|
|
|
|
|
error_message=error_message,
|
|
|
|
|
|
pagedata=pagedata
|
|
|
|
|
|
), 500
|