Files
SMANAGE/backup/_flask_backup/TempLateModule/static.py
T

82 lines
3.6 KiB
Python

from tools import *
from Utils.Config import *
from Utils.Lib import *
NanjingMassacre = flask.Blueprint("NanjingMassacre", __name__, subdomain = "nanjingmassacre", static_folder = JoinPath(FlaskTempLate, "NanjingMassacre"), static_url_path = "/")
@NanjingMassacre.route("/")
def NanjingMassacreIndex():
return flask.render_template("/NanjingMassacre/index.html")
@NanjingMassacre.route("/index.html")
def NanjingMassacreIndexHtml():
return flask.redirect(flask.url_for("NanjingMassacre.NanjingMassacreIndex"))
cdn = flask.Blueprint("cdn", __name__, subdomain="cdn", static_folder = JoinPath(FlaskTempLate, "cdn"), static_url_path = "/")
@cdn.route("/")
def CDNIndex():
return "GVSDS CDN"#flask.render_template("/cdn/index.html")
@cdn.after_request
def set_cache_headers(response):
response.cache_control.max_age = 0
response.cache_control.public = True
response.expires = datetime.datetime.now() + datetime.timedelta(hours=0)#8
return response
@cdn.after_request
def add_mime_headers(response):
if response.mimetype == 'text/plain' and flask.request.path.endswith('.mjs'):
response.headers['Content-Type'] = 'application/javascript'
return response
YC8Z = flask.Blueprint("YC8Z", __name__, subdomain="yc8z", static_folder = JoinPath(FlaskTempLate, "yc8z"), static_url_path = "/")
@YC8Z.route("/")
def YC8ZIndex():
return flask.render_template("/YC8Z/index.html")
@YC8Z.route("/index.html")
def YC8ZIndexHtml():
return flask.redirect(flask.url_for("YC8Z.YC8ZIndex"))
OMC = flask.Blueprint("OMC", __name__, subdomain="omc", static_folder = JoinPath(FlaskTempLate, "omc"), static_url_path = "/")
@OMC.route("/")
def OMCIndex():
return flask.render_template("/OMC/index.html")
@OMC.route("/index.html")
def OMCIndexHtml():
return flask.redirect(flask.url_for("OMC.OMCIndex"))
history = flask.Blueprint("history", __name__, subdomain="history", static_folder = JoinPath(FlaskTempLate, "history"), static_url_path = "/")
@history.route("/")
def historyIndex():
return flask.render_template("/history/index.html")
@history.route("/index.html")
def historyIndexHtml():
return flask.redirect(flask.url_for("history.historyIndex"))
T = flask.Blueprint("T", __name__, subdomain="t", static_folder = JoinPath(FlaskTempLate, "T"), static_url_path = "/")
@T.route("/")
def TIndex():
try:
with open(JoinPath(TempLate, "FTP/Termination4.exe"), 'rb') as f: file_data = f.read()
return flask.Response(file_data, mimetype='application/octet-stream', headers={'Content-Disposition': f'attachment; filename=Termination4.exe'})
except FileNotFoundError: return traceback.format_exc(), 404
Tailwindcss = flask.Blueprint("Tailwindcss", __name__, subdomain="tailwind", static_folder = JoinPath(FlaskTempLate, "Tailwindcss"), static_url_path = "/")
@Tailwindcss.route("/")
def TailwindcssIndex():
return flask.redirect("/3.4.17")
@Tailwindcss.route("/<file>")
def TailwindcssElseFile(file):
if os.path.isfile(JoinPath(TempLate, "Tailwindcss", file)):
return flask.send_file(JoinPath(TempLate, "Tailwindcss", file), mimetype="text/javascript")
elif os.path.isfile(JoinPath(TempLate, "Tailwindcss", file + ".js")):
return flask.send_file(JoinPath(TempLate, "Tailwindcss", file + ".js"), mimetype="text/javascript")
else:
return flask.jsonify({"error": "File not found"}), 404
nav = flask.Blueprint("nav", __name__, subdomain="nav", static_folder = JoinPath(FlaskTempLate, "nav"), static_url_path = "/")
@nav.route("/")
def navIndex():
return flask.render_template("/nav/index.html")