UPDATE: Attempting to add authentication to .ts route (WIP, not working)
This commit is contained in:
@@ -88,8 +88,8 @@ http {
|
|||||||
## Cacheable HLS files, ts
|
## Cacheable HLS files, ts
|
||||||
location ~ ^/stream/(.+)/(.+\.ts)$ {
|
location ~ ^/stream/(.+)/(.+\.ts)$ {
|
||||||
# Call backend to check permission
|
# Call backend to check permission
|
||||||
auth_request /auth_stream/$1;
|
auth_request http://web_server:5000/stream/$1/direct_live_status;
|
||||||
alias /user_data/$1/stream/$2;
|
root /user_data/$1/stream/$2;
|
||||||
|
|
||||||
# Let the MPEG-TS video chunks be cacheable
|
# Let the MPEG-TS video chunks be cacheable
|
||||||
expires max;
|
expires max;
|
||||||
@@ -114,15 +114,6 @@ http {
|
|||||||
expires -1d;
|
expires -1d;
|
||||||
}
|
}
|
||||||
|
|
||||||
## Auth request for HLS
|
|
||||||
location = /auth_stream/$1 {
|
|
||||||
internal;
|
|
||||||
proxy_pass http://web_server:5000/stream/$1/direct_live_status;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
location ~ ^/\?token=.*$ {
|
location ~ ^/\?token=.*$ {
|
||||||
proxy_pass http://frontend:5173;
|
proxy_pass http://frontend:5173;
|
||||||
|
|||||||
@@ -159,6 +159,25 @@ def user_live_status(username):
|
|||||||
"user_id": user_id
|
"user_id": user_id
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@stream_bp.route('/user/<string:username>/direct_live_status')
|
||||||
|
def user_live_status_direct(username):
|
||||||
|
"""
|
||||||
|
Returns a streamer's status, if they are live or not
|
||||||
|
Returns:
|
||||||
|
{
|
||||||
|
"is_live": bool,
|
||||||
|
"user_id": int
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
user_id = get_user_id(username)
|
||||||
|
is_live = True if get_streamer_live_status(user_id)['is_live'] else False
|
||||||
|
|
||||||
|
if is_live:
|
||||||
|
return 'ok', 200
|
||||||
|
else:
|
||||||
|
return 'not live', 404
|
||||||
|
|
||||||
|
|
||||||
# VOD Routes
|
# VOD Routes
|
||||||
@stream_bp.route('/vods/<int:vod_id>')
|
@stream_bp.route('/vods/<int:vod_id>')
|
||||||
|
|||||||
Reference in New Issue
Block a user