migrate from flask to quart.
also remove all flaskiness from static file serving. and reference all vendored scripts on the base tempĺate for simplicity.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import re
|
||||
from flask import g, jsonify, request
|
||||
from quart import g, jsonify, request
|
||||
from http import HTTPStatus
|
||||
|
||||
from lnbits.core.crud import get_user, get_wallet
|
||||
@@ -26,7 +26,7 @@ from .crud import (
|
||||
|
||||
@lnticket_ext.route("/api/v1/forms", methods=["GET"])
|
||||
@api_check_wallet_key("invoice")
|
||||
def api_forms():
|
||||
async def api_forms():
|
||||
wallet_ids = [g.wallet.id]
|
||||
|
||||
if "all_wallets" in request.args:
|
||||
@@ -46,7 +46,7 @@ def api_forms():
|
||||
"costpword": {"type": "integer", "min": 0, "required": True},
|
||||
}
|
||||
)
|
||||
def api_form_create(form_id=None):
|
||||
async def api_form_create(form_id=None):
|
||||
if form_id:
|
||||
form = get_form(form_id)
|
||||
|
||||
@@ -64,7 +64,7 @@ def api_form_create(form_id=None):
|
||||
|
||||
@lnticket_ext.route("/api/v1/forms/<form_id>", methods=["DELETE"])
|
||||
@api_check_wallet_key("invoice")
|
||||
def api_form_delete(form_id):
|
||||
async def api_form_delete(form_id):
|
||||
form = get_form(form_id)
|
||||
|
||||
if not form:
|
||||
@@ -83,7 +83,7 @@ def api_form_delete(form_id):
|
||||
|
||||
@lnticket_ext.route("/api/v1/tickets", methods=["GET"])
|
||||
@api_check_wallet_key("invoice")
|
||||
def api_tickets():
|
||||
async def api_tickets():
|
||||
wallet_ids = [g.wallet.id]
|
||||
|
||||
if "all_wallets" in request.args:
|
||||
@@ -101,7 +101,7 @@ def api_tickets():
|
||||
"ltext": {"type": "string", "empty": False, "required": True},
|
||||
}
|
||||
)
|
||||
def api_ticket_make_ticket(form_id):
|
||||
async def api_ticket_make_ticket(form_id):
|
||||
form = get_form(form_id)
|
||||
if not form:
|
||||
return jsonify({"message": "LNTicket does not exist."}), HTTPStatus.NOT_FOUND
|
||||
@@ -126,7 +126,7 @@ def api_ticket_make_ticket(form_id):
|
||||
|
||||
|
||||
@lnticket_ext.route("/api/v1/tickets/<payment_hash>", methods=["GET"])
|
||||
def api_ticket_send_ticket(payment_hash):
|
||||
async def api_ticket_send_ticket(payment_hash):
|
||||
ticket = get_ticket(payment_hash)
|
||||
try:
|
||||
is_paid = not check_invoice_status(ticket.wallet, payment_hash).pending
|
||||
@@ -145,7 +145,7 @@ def api_ticket_send_ticket(payment_hash):
|
||||
|
||||
@lnticket_ext.route("/api/v1/tickets/<ticket_id>", methods=["DELETE"])
|
||||
@api_check_wallet_key("invoice")
|
||||
def api_ticket_delete(ticket_id):
|
||||
async def api_ticket_delete(ticket_id):
|
||||
ticket = get_ticket(ticket_id)
|
||||
|
||||
if not ticket:
|
||||
|
||||
Reference in New Issue
Block a user