majuna/app/portal/eotk.py

27 lines
891 B
Python
Raw Normal View History

2022-05-13 16:20:44 +01:00
from flask import render_template, Blueprint, Response
from sqlalchemy import desc
2022-05-13 16:20:44 +01:00
from app.models.base import Group
from app.models.onions import Eotk
bp = Blueprint("eotk", __name__)
@bp.route("/list")
def eotk_list():
instances = Eotk.query.filter(Eotk.destroyed == None).order_by(desc(Eotk.added)).all()
return render_template("list.html.j2",
section="eotk",
title="EOTK Instances",
item="eotk",
items=instances)
2022-05-13 16:20:44 +01:00
@bp.route("/conf/<group_id>")
def eotk_conf(group_id: int):
from app import app
group = Group.query.filter(Group.id == group_id).first()
return Response(render_template("sites.conf.j2",
bypass_token=app.config["BYPASS_TOKEN"],
group=group), content_type="text/plain")