Skip to content

Commit

Permalink
feat: ability to disable max connection #4
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy authored Nov 16, 2024
1 parent 05fe062 commit a18dceb
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions comet/api/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,17 +601,17 @@ async def playback(request: Request, b64config: str, hash: str, index: str):
and settings.PROXY_DEBRID_STREAM_PASSWORD
== config["debridStreamProxyPassword"]
):
active_ip_connections = await database.fetch_all(
"SELECT ip, COUNT(*) as connections FROM active_connections GROUP BY ip"
)
if any(
connection["ip"] == ip
and connection["connections"]
>= settings.PROXY_DEBRID_STREAM_MAX_CONNECTIONS
and settings.PROXY_DEBRID_STREAM_MAX_CONNECTIONS != -1
for connection in active_ip_connections
):
return FileResponse("comet/assets/proxylimit.mp4")
if settings.PROXY_DEBRID_STREAM_MAX_CONNECTIONS != -1:
active_ip_connections = await database.fetch_all(
"SELECT ip, COUNT(*) as connections FROM active_connections GROUP BY ip"
)
if any(
connection["ip"] == ip
and connection["connections"]
>= settings.PROXY_DEBRID_STREAM_MAX_CONNECTIONS
for connection in active_ip_connections
):
return FileResponse("comet/assets/proxylimit.mp4")

proxy = None

Expand Down

0 comments on commit a18dceb

Please sign in to comment.