fix publish
This commit is contained in:
parent
24718abb92
commit
1531cebc35
|
@ -27,19 +27,16 @@ def publish_check():
|
||||||
|
|
||||||
# TODO: check if user created stream
|
# TODO: check if user created stream
|
||||||
|
|
||||||
# check if already redirected
|
|
||||||
token = request.form.get('token')
|
|
||||||
if jwt.verify(token):
|
|
||||||
return Response('OK', 200)
|
|
||||||
|
|
||||||
# get user
|
# get user
|
||||||
try:
|
try:
|
||||||
stream_key = request.form.get('name')
|
stream_key = request.form.get('stream_key')
|
||||||
stream_user = user.search_stream_key(stream_key)[0]['username']
|
username = request.form.get('name')
|
||||||
username = stream_user['username']
|
stream_user = user.search_stream_key(stream_key)[0]
|
||||||
|
if username != stream_user['username']:
|
||||||
|
raise ValueError
|
||||||
|
|
||||||
except IndexError:
|
except (IndexError, ValueError):
|
||||||
|
print('vish')
|
||||||
return Response('Invalid Stream Key', 401)
|
return Response('Invalid Stream Key', 401)
|
||||||
|
|
||||||
token = jwt.create_token(username, stream_key, 10)
|
return Response('OK', 200)
|
||||||
return redirect(f'rtmp://127.0.0.1:33000/live/{username}?{token}', code=302)
|
|
||||||
|
|
Loading…
Reference in New Issue