refactor: extract client_manager
This commit is contained in:
parent
14df3a6ffb
commit
b2b5058784
2 changed files with 5 additions and 3 deletions
|
|
@ -22,10 +22,13 @@ def nostrrelay_renderer():
|
||||||
return template_renderer(["lnbits/extensions/nostrrelay/templates"])
|
return template_renderer(["lnbits/extensions/nostrrelay/templates"])
|
||||||
|
|
||||||
|
|
||||||
|
from .client_manager import NostrClientManager
|
||||||
from .models import NostrRelay
|
from .models import NostrRelay
|
||||||
from .views import * # noqa
|
from .views import * # noqa
|
||||||
from .views_api import * # noqa
|
from .views_api import * # noqa
|
||||||
|
|
||||||
|
client_manager = NostrClientManager()
|
||||||
|
|
||||||
settings.lnbits_relay_information = {
|
settings.lnbits_relay_information = {
|
||||||
"name": "LNbits Nostr Relay",
|
"name": "LNbits Nostr Relay",
|
||||||
"description": "Multiple relays are supported",
|
"description": "Multiple relays are supported",
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ from lnbits.decorators import (
|
||||||
)
|
)
|
||||||
from lnbits.helpers import urlsafe_short_hash
|
from lnbits.helpers import urlsafe_short_hash
|
||||||
|
|
||||||
from . import nostrrelay_ext
|
from . import client_manager, nostrrelay_ext
|
||||||
from .client_manager import NostrClientConnection, NostrClientManager
|
from .client_manager import NostrClientConnection
|
||||||
from .crud import (
|
from .crud import (
|
||||||
create_relay,
|
create_relay,
|
||||||
delete_relay,
|
delete_relay,
|
||||||
|
|
@ -27,7 +27,6 @@ from .crud import (
|
||||||
)
|
)
|
||||||
from .models import NostrRelay
|
from .models import NostrRelay
|
||||||
|
|
||||||
client_manager = NostrClientManager()
|
|
||||||
|
|
||||||
@nostrrelay_ext.websocket("/{relay_id}")
|
@nostrrelay_ext.websocket("/{relay_id}")
|
||||||
async def websocket_endpoint(relay_id: str, websocket: WebSocket):
|
async def websocket_endpoint(relay_id: str, websocket: WebSocket):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue