parent
eb18fda87b
commit
32bf4ae1d6
19 changed files with 2822 additions and 61 deletions
36
__init__.py
36
__init__.py
|
|
@ -1,13 +1,12 @@
|
|||
import asyncio
|
||||
from loguru import logger
|
||||
|
||||
from fastapi import APIRouter
|
||||
from loguru import logger
|
||||
|
||||
from lnbits.db import Database
|
||||
from lnbits.helpers import template_renderer
|
||||
from lnbits.tasks import create_permanent_unique_task
|
||||
|
||||
db = Database("ext_splitpayments")
|
||||
from .crud import db
|
||||
from .tasks import wait_for_paid_invoices
|
||||
from .views import splitpayments_generic_router
|
||||
from .views_api import splitpayments_api_router
|
||||
|
||||
splitpayments_static_files = [
|
||||
{
|
||||
|
|
@ -18,19 +17,12 @@ splitpayments_static_files = [
|
|||
splitpayments_ext: APIRouter = APIRouter(
|
||||
prefix="/splitpayments", tags=["splitpayments"]
|
||||
)
|
||||
|
||||
|
||||
def splitpayments_renderer():
|
||||
return template_renderer(["splitpayments/templates"])
|
||||
|
||||
|
||||
from .tasks import wait_for_paid_invoices
|
||||
from .views import * # noqa: F401,F403
|
||||
from .views_api import * # noqa: F401,F403
|
||||
|
||||
splitpayments_ext.include_router(splitpayments_generic_router)
|
||||
splitpayments_ext.include_router(splitpayments_api_router)
|
||||
|
||||
scheduled_tasks: list[asyncio.Task] = []
|
||||
|
||||
|
||||
def splitpayments_stop():
|
||||
for task in scheduled_tasks:
|
||||
try:
|
||||
|
|
@ -38,6 +30,18 @@ def splitpayments_stop():
|
|||
except Exception as ex:
|
||||
logger.warning(ex)
|
||||
|
||||
|
||||
def splitpayments_start():
|
||||
from lnbits.tasks import create_permanent_unique_task
|
||||
|
||||
task = create_permanent_unique_task("ext_splitpayments", wait_for_paid_invoices)
|
||||
scheduled_tasks.append(task)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"db",
|
||||
"splitpayments_ext",
|
||||
"splitpayments_static_files",
|
||||
"splitpayments_start",
|
||||
"splitpayments_stop",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue