2021-09-29 20:44:00 +02:00
|
|
|
import asyncio
|
|
|
|
|
2021-09-28 21:18:15 +02:00
|
|
|
from fastapi import APIRouter
|
2021-09-27 20:33:18 +01:00
|
|
|
|
2021-08-20 12:44:03 +01:00
|
|
|
from lnbits.db import Database
|
2021-09-27 20:33:18 +01:00
|
|
|
from lnbits.helpers import template_renderer
|
2021-09-29 20:44:00 +02:00
|
|
|
from lnbits.tasks import catch_everything_and_restart
|
2021-08-20 12:44:03 +01:00
|
|
|
|
|
|
|
db = Database("ext_lnticket")
|
|
|
|
|
2021-09-27 20:33:18 +01:00
|
|
|
lnticket_ext: APIRouter = APIRouter(
|
|
|
|
prefix="/lnticket",
|
|
|
|
tags=["LNTicket"]
|
|
|
|
# "lnticket", __name__, static_folder="static", template_folder="templates"
|
2021-08-20 12:44:03 +01:00
|
|
|
)
|
|
|
|
|
2021-10-17 18:33:29 +01:00
|
|
|
|
2021-09-27 20:33:18 +01:00
|
|
|
def lnticket_renderer():
|
2021-10-17 18:33:29 +01:00
|
|
|
return template_renderer(["lnbits/extensions/lnticket/templates"])
|
2021-09-27 20:33:18 +01:00
|
|
|
|
2021-08-20 12:44:03 +01:00
|
|
|
|
|
|
|
from .views_api import * # noqa
|
|
|
|
from .views import * # noqa
|
2021-09-29 20:44:00 +02:00
|
|
|
from .tasks import wait_for_paid_invoices
|
|
|
|
|
|
|
|
|
|
|
|
def lnticket_start():
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|