refactor: extract nostr to __init__

This commit is contained in:
Vlad Stan 2023-06-23 11:15:57 +03:00
parent e35dafe056
commit 99022f2b4a
4 changed files with 12 additions and 10 deletions

View file

@ -8,6 +8,8 @@ from lnbits.db import Database
from lnbits.helpers import template_renderer
from lnbits.tasks import catch_everything_and_restart
from .nostr.client.client import NostrClient as NostrClientLib
db = Database("ext_nostrclient")
nostrclient_static_files = [
@ -22,6 +24,13 @@ nostrclient_ext: APIRouter = APIRouter(prefix="/nostrclient", tags=["nostrclient
scheduled_tasks: List[asyncio.Task] = []
class NostrClient:
def __init__(self):
self.client: NostrClientLib = NostrClientLib(connect=False)
nostr = NostrClient()
def nostr_renderer():
return template_renderer(["lnbits/extensions/nostrclient/templates"])