2022-09-16 13:20:42 +01:00
|
|
|
import asyncio
|
|
|
|
|
|
|
|
from fastapi import APIRouter
|
2022-10-10 12:42:34 +03:00
|
|
|
from fastapi.staticfiles import StaticFiles
|
2022-09-16 13:20:42 +01:00
|
|
|
|
|
|
|
from lnbits.db import Database
|
|
|
|
from lnbits.helpers import template_renderer
|
|
|
|
from lnbits.tasks import catch_everything_and_restart
|
|
|
|
|
2022-09-30 12:25:48 +01:00
|
|
|
db = Database("ext_cashu")
|
2022-09-16 13:20:42 +01:00
|
|
|
|
2022-09-30 12:25:48 +01:00
|
|
|
cashu_ext: APIRouter = APIRouter(prefix="/cashu", tags=["cashu"])
|
2022-09-16 13:20:42 +01:00
|
|
|
|
2022-10-10 12:42:34 +03:00
|
|
|
cashu_static_files = [
|
|
|
|
{
|
|
|
|
"path": "/cashu/static",
|
|
|
|
"app": StaticFiles(directory="lnbits/extensions/cashu/static"),
|
|
|
|
"name": "cashu_static",
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2022-10-07 11:17:02 +03:00
|
|
|
|
2022-09-16 13:20:42 +01:00
|
|
|
def cashu_renderer():
|
|
|
|
return template_renderer(["lnbits/extensions/cashu/templates"])
|
|
|
|
|
2022-10-07 11:17:02 +03:00
|
|
|
|
2022-09-16 13:20:42 +01:00
|
|
|
from .tasks import wait_for_paid_invoices
|
|
|
|
from .views import * # noqa
|
|
|
|
from .views_api import * # noqa
|
|
|
|
|
2022-10-07 11:17:02 +03:00
|
|
|
|
2022-09-16 13:20:42 +01:00
|
|
|
def cashu_start():
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|