2021-12-29 12:57:43 +00:00
|
|
|
import asyncio
|
|
|
|
|
2021-10-14 11:45:56 +01:00
|
|
|
from fastapi import APIRouter
|
2022-07-07 11:37:26 +03:00
|
|
|
from fastapi.staticfiles import StaticFiles
|
2021-10-14 11:45:56 +01:00
|
|
|
|
2021-10-14 10:02:02 +01:00
|
|
|
from lnbits.db import Database
|
2021-10-14 11:45:56 +01:00
|
|
|
from lnbits.helpers import template_renderer
|
2021-12-29 12:57:43 +00:00
|
|
|
from lnbits.tasks import catch_everything_and_restart
|
2021-10-14 10:02:02 +01:00
|
|
|
|
|
|
|
db = Database("ext_satspay")
|
|
|
|
|
|
|
|
|
2021-10-17 18:33:29 +01:00
|
|
|
satspay_ext: APIRouter = APIRouter(prefix="/satspay", tags=["satspay"])
|
|
|
|
|
2022-07-07 11:37:26 +03:00
|
|
|
satspay_static_files = [
|
|
|
|
{
|
|
|
|
"path": "/satspay/static",
|
|
|
|
"app": StaticFiles(directory="lnbits/extensions/satspay/static"),
|
|
|
|
"name": "satspay_static",
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2021-10-14 10:02:02 +01:00
|
|
|
|
2021-10-14 11:45:56 +01:00
|
|
|
def satspay_renderer():
|
2021-10-17 18:33:29 +01:00
|
|
|
return template_renderer(["lnbits/extensions/satspay/templates"])
|
2021-10-14 11:45:56 +01:00
|
|
|
|
2022-01-30 19:43:30 +00:00
|
|
|
|
2021-12-29 12:57:43 +00:00
|
|
|
from .tasks import wait_for_paid_invoices
|
2021-10-14 10:02:02 +01:00
|
|
|
from .views import * # noqa
|
2021-11-25 18:52:16 +00:00
|
|
|
from .views_api import * # noqa
|
2021-12-29 12:57:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def satspay_start():
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|