2022-11-11 23:46:22 +00:00
|
|
|
import asyncio
|
|
|
|
|
2021-10-19 16:12:03 +01:00
|
|
|
from fastapi import APIRouter
|
|
|
|
|
|
|
|
from lnbits.db import Database
|
|
|
|
from lnbits.helpers import template_renderer
|
2022-11-11 23:46:22 +00:00
|
|
|
from lnbits.tasks import catch_everything_and_restart
|
|
|
|
|
2021-10-19 16:12:03 +01:00
|
|
|
db = Database("ext_events")
|
|
|
|
|
|
|
|
|
2021-11-12 04:14:55 +00:00
|
|
|
events_ext: APIRouter = APIRouter(prefix="/events", tags=["Events"])
|
|
|
|
|
2021-10-19 16:12:03 +01:00
|
|
|
|
|
|
|
def events_renderer():
|
|
|
|
return template_renderer(["lnbits/extensions/events/templates"])
|
2021-11-12 04:14:55 +00:00
|
|
|
|
|
|
|
|
2022-11-11 23:46:22 +00:00
|
|
|
from .tasks import wait_for_paid_invoices
|
2021-10-19 16:12:03 +01:00
|
|
|
from .views import * # noqa
|
|
|
|
from .views_api import * # noqa
|
2022-11-11 23:46:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
def events_start():
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|