#! .venv/bin/python3
-from flask import Flask, Response, request, render_template, redirect, send_from_directory, url_for
+from flask import Flask, Response, request, render_template_string, redirect, send_from_directory, url_for
from flask_httpauth import HTTPBasicAuth
from werkzeug.security import generate_password_hash, check_password_hash
from werkzeug.middleware.proxy_fix import ProxyFix
cover_path = "/home/stream/critters/cover/"
icon_path = "/home/stream/critters/icon/"
upload_path = "/home/stream/critters/upload/"
+template_path = "/home/stream/critters/critters-api/templates/"
def check_files(track_id):
return {
# Homepage
@app.route("/")
def homepage():
- page = render_template("home.html")
+ with open(template_path + "home.html","r") as f:
+ page = render_template_string(f.read())
return Response(page, mimetype="text/html")
# Admin pannel
else:
playing = "false"
- print(playing)
-
# Get the new track id if neccicary
if commit_id == 0:
tracks = cur.execute(f"SELECT id FROM critters").fetchall()
os.system(f"convert {file_path} -scale 32x32! {icon_path}{commit_id}.png &")
os.system(f"convert {file_path} -scale 600x600! {cover_path}{commit_id}.png &")
- page = render_template("admin.html", user = auth.current_user())
+ with open(template_path + "admin.html", "r") as f:
+ page = render_template_string(f.read(), user = auth.current_user())
return Response(page, mimetype="text/html")
# Get the next track