2021-10-05 09:19:21 +01:00
|
|
|
import asyncio
|
|
|
|
|
2021-10-20 12:03:11 +01:00
|
|
|
from fastapi import APIRouter
|
2021-09-28 18:10:22 +01:00
|
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
|
2021-08-20 12:44:03 +01:00
|
|
|
from lnbits.db import Database
|
2021-10-05 09:19:21 +01:00
|
|
|
from lnbits.helpers import template_renderer
|
|
|
|
from lnbits.tasks import catch_everything_and_restart
|
2021-08-20 12:44:03 +01:00
|
|
|
|
|
|
|
db = Database("ext_lnurlp")
|
|
|
|
|
2021-10-05 09:19:21 +01:00
|
|
|
lnurlp_static_files = [
|
|
|
|
{
|
|
|
|
"path": "/lnurlp/static",
|
2022-07-08 09:49:38 +01:00
|
|
|
"app": StaticFiles(packages=[("lnbits", "extensions/lnurlp/static")]),
|
2021-10-05 09:19:21 +01:00
|
|
|
"name": "lnurlp_static",
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2021-11-26 05:58:20 +00:00
|
|
|
lnurlp_ext: APIRouter = APIRouter(prefix="/lnurlp", tags=["lnurlp"])
|
2021-08-20 12:44:03 +01:00
|
|
|
|
2021-10-10 23:57:15 +01:00
|
|
|
|
2021-09-28 18:10:22 +01:00
|
|
|
def lnurlp_renderer():
|
2022-07-23 20:08:59 +01:00
|
|
|
return template_renderer(["lnbits/extensions/lnurlp/templates"])
|
2021-09-28 18:10:22 +01:00
|
|
|
|
2021-08-20 12:44:03 +01:00
|
|
|
|
2023-01-21 19:31:42 +00:00
|
|
|
from .lnurl import * # noqa: F401,F403
|
2021-10-20 12:03:11 +01:00
|
|
|
from .tasks import wait_for_paid_invoices
|
2023-01-21 19:31:42 +00:00
|
|
|
from .views import * # noqa: F401,F403
|
|
|
|
from .views_api import * # noqa: F401,F403
|
2021-10-05 09:19:21 +01:00
|
|
|
|
2021-10-10 23:57:15 +01:00
|
|
|
|
2021-10-05 09:19:21 +01:00
|
|
|
def lnurlp_start():
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|