add push notification support
This commit is contained in:
parent
6a69c5a34d
commit
1b1dcc3755
12 changed files with 175 additions and 10 deletions
|
|
@ -23,7 +23,7 @@ def pathParts(path):
|
|||
async def mediamtxChannelStreams(request: Request, channel: str):
|
||||
inChannel = request.state.jwt.get("channel", "").lower() == "#" + channel.lower()
|
||||
results = []
|
||||
for result in redis.scan_iter(f"stream #{channel} *"):
|
||||
async for result in redis.scan_iter(f"stream #{channel} *"):
|
||||
_, channel, user, token = result.decode("utf8").split()
|
||||
if inChannel or token == "public":
|
||||
results.append({
|
||||
|
|
@ -74,7 +74,7 @@ async def mediamtxAdd(request: Request):
|
|||
body = await request.json()
|
||||
path = body["env"]["MTX_PATH"].split("/")
|
||||
parts = [x for x in pathParts(path) if x]
|
||||
redis.set("stream " + " ".join(parts), parts[2])
|
||||
await redis.set("stream " + " ".join(parts), parts[2])
|
||||
if len(parts) == 3:
|
||||
await ergo.broadcastTo(parts[0], "STREAMSTART", parts[0], parts[1], parts[2])
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ async def mediamtxDelete(request: Request):
|
|||
body = await request.json()
|
||||
path = body["env"]["MTX_PATH"].split("/")
|
||||
parts = [x for x in pathParts(path) if x]
|
||||
redis.delete("stream " + " ".join(parts))
|
||||
await redis.delete("stream " + " ".join(parts))
|
||||
if len(parts) == 3:
|
||||
await ergo.broadcastTo(parts[0], "STREAMEND", parts[0], parts[1], parts[2])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue