chore: code format

This commit is contained in:
Vlad Stan 2023-03-17 15:06:09 +02:00
parent 30ffcf7f55
commit 3aa4875558
3 changed files with 10 additions and 10 deletions

View file

@ -21,17 +21,16 @@ nostrrelay_static_files = [
]
nostrrelay_redirect_paths = [
{
"from_path": "/",
"redirect_to_path": "/api/v1/relay-info",
"header_filters": {
"accept": "application/nostr+json"
{
"from_path": "/",
"redirect_to_path": "/api/v1/relay-info",
"header_filters": {"accept": "application/nostr+json"},
}
}
]
scheduled_tasks: List[asyncio.Task] = []
def nostrrelay_renderer():
return template_renderer(["lnbits/extensions/nostrrelay/templates"])

View file

@ -34,4 +34,4 @@ def relay_info_response(relay_public_data: dict) -> JSONResponse:
"Access-Control-Allow-Headers": "*",
"Access-Control-Allow-Methods": "GET",
},
)
)

View file

@ -121,7 +121,7 @@ async def api_toggle_relay(
) -> NostrRelay:
try:
relay = await get_relay(wallet.wallet.user,relay_id)
relay = await get_relay(wallet.wallet.user, relay_id)
if not relay:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND,
@ -159,12 +159,13 @@ async def api_get_relays(
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
detail="Cannot fetch relays",
)
@nostrrelay_ext.get("/api/v1/relay-info")
async def api_get_relay_info() -> JSONResponse:
return relay_info_response(NostrRelay.info())
@nostrrelay_ext.get("/api/v1/relay/{relay_id}")
async def api_get_relay(
relay_id: str, wallet: WalletTypeInfo = Depends(require_invoice_key)
@ -288,7 +289,7 @@ async def api_pay_to_join(data: BuyOrder):
if data.action == "join":
if relay.is_free_to_join:
raise ValueError("Relay is free to join")
amount = int(relay.config.cost_to_join)
amount = int(relay.config.cost_to_join)
elif data.action == "storage":
if relay.config.storage_cost_value == 0:
raise ValueError("Relay storage cost is zero. Cannot buy!")