22 lines
762 B
Python
22 lines
762 B
Python
from flask import Blueprint, abort, render_template, url_for
|
|
|
|
from ..models import Company, Display
|
|
from ..uploads import is_valid_upload_relpath
|
|
|
|
bp = Blueprint("display", __name__, url_prefix="/display")
|
|
|
|
|
|
@bp.get("/<token>")
|
|
def display_player(token: str):
|
|
display = Display.query.filter_by(token=token).first()
|
|
if not display:
|
|
abort(404)
|
|
|
|
overlay_url = None
|
|
if display.show_overlay:
|
|
company = Company.query.filter_by(id=display.company_id).first()
|
|
if company and company.overlay_file_path and is_valid_upload_relpath(company.overlay_file_path):
|
|
overlay_url = url_for("static", filename=company.overlay_file_path)
|
|
|
|
return render_template("display/player.html", display=display, overlay_url=overlay_url)
|