feat: allow admin users to specify custom relay name
This commit is contained in:
parent
bc60551313
commit
eedaa52bcf
1 changed files with 6 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from http import HTTPStatus
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic.types import UUID4
|
||||
from fastapi import Depends, Query, WebSocket
|
||||
from fastapi.exceptions import HTTPException
|
||||
from fastapi.responses import JSONResponse
|
||||
|
|
@ -47,6 +47,10 @@ async def api_nostrrelay_info():
|
|||
|
||||
@nostrrelay_ext.post("/api/v1/relay")
|
||||
async def api_create_relay(data: NostrRelay, wallet: WalletTypeInfo = Depends(require_admin_key)) -> NostrRelay:
|
||||
if len(data.id):
|
||||
await check_admin(UUID4(wallet.wallet.user))
|
||||
else:
|
||||
data.id = urlsafe_short_hash()[:8]
|
||||
|
||||
try:
|
||||
relay = await create_relay(wallet.wallet.user, data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue