feat: basic relay public info

This commit is contained in:
Vlad Stan 2023-02-10 13:39:38 +02:00
parent 1eda457067
commit 9ccd94aae3
2 changed files with 25 additions and 28 deletions

View file

@ -45,25 +45,6 @@ async def websocket_endpoint(relay_id: str, websocket: WebSocket):
client_manager.remove_client(client)
@nostrrelay_ext.get("/{relay_id}", status_code=HTTPStatus.OK)
async def api_nostrrelay_info(relay_id: str):
relay = await get_public_relay(relay_id)
if not relay:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND,
detail="Relay not found",
)
return JSONResponse(
content=relay,
headers={
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "*",
"Access-Control-Allow-Methods": "GET",
},
)
@nostrrelay_ext.post("/api/v1/relay")
async def api_create_relay(
data: NostrRelay, wallet: WalletTypeInfo = Depends(require_admin_key)