This commit is contained in:
callebtc 2023-02-13 16:14:52 +01:00
parent f03284d4ea
commit 4feb366493
18 changed files with 10 additions and 7 deletions

View file

@ -60,6 +60,8 @@ async def api_get_relays(): # type: ignore
@nostrclient_ext.post("/api/v1/relay")
async def api_add_relay(relay: Relay): # type: ignore
assert relay.url, "no URL"
if relay.url in client.relay_manager.relays:
return
relay.id = urlsafe_short_hash()
await add_relay(relay)
await init_relays()
@ -67,6 +69,8 @@ async def api_add_relay(relay: Relay): # type: ignore
@nostrclient_ext.delete("/api/v1/relay")
async def api_delete_relay(relay: Relay): # type: ignore
assert relay.url
client.relay_manager.remove_relay(relay.url)
await delete_relay(relay)