Files
anki-creator-flask/src/anki_creator_flask/mainapp.py
Wolfang Torres 3bb0caa64d update hotfix
2026-06-07 00:36:21 +08:00

32 lines
843 B
Python

# Pip
from flask import Blueprint, render_template, request
mainapp = Blueprint(
"mainapp",
__name__,
template_folder="templates",
url_prefix="/app",
static_folder="static",
)
@mainapp.route("/", methods=["GET", "POST"])
def show():
if request.method == "GET":
args = request.args.to_dict()
deck_type = args.get("deck_type", "")
language = args.get("language", "")
output_type = args.get("output_type", "")
if not deck_type or not language or not output_type:
state = "new"
else:
print()
print(deck_type, language, output_type)
print()
state = "complete"
elif request.method == "POST":
state = "ready"
form = request.form.to_dict()
return render_template(f"app.html", data=locals())