mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 00:55:50 +00:00
Code review changes
This commit is contained in:
parent
dec92ecd31
commit
0d3eed81ba
3 changed files with 9 additions and 18 deletions
|
|
@ -1933,9 +1933,6 @@ def xc_get_user(request):
|
|||
|
||||
|
||||
def xc_get_info(request, full=False):
|
||||
if not network_access_allowed(request, 'XC_API'):
|
||||
return JsonResponse({'error': 'Forbidden'}, status=403)
|
||||
|
||||
user = xc_get_user(request)
|
||||
|
||||
if user is None:
|
||||
|
|
@ -1984,9 +1981,6 @@ def xc_get_info(request, full=False):
|
|||
|
||||
|
||||
def xc_player_api(request, full=False):
|
||||
if not network_access_allowed(request, 'XC_API'):
|
||||
return JsonResponse({'error': 'Forbidden'}, status=403)
|
||||
|
||||
action = request.GET.get("action")
|
||||
user = xc_get_user(request)
|
||||
|
||||
|
|
@ -2021,9 +2015,6 @@ def xc_player_api(request, full=False):
|
|||
|
||||
|
||||
def xc_panel_api(request):
|
||||
if not network_access_allowed(request, 'XC_API'):
|
||||
return JsonResponse({'error': 'Forbidden'}, status=403)
|
||||
|
||||
user = xc_get_user(request)
|
||||
|
||||
if user is None:
|
||||
|
|
|
|||
|
|
@ -564,6 +564,9 @@ def stream_xc(request, username, password, channel_id):
|
|||
extension = pathlib.Path(channel_id).suffix
|
||||
channel_id = pathlib.Path(channel_id).stem
|
||||
|
||||
if not network_access_allowed(request, 'STREAMS', user):
|
||||
return Response({"error": "Forbidden"}, status=403)
|
||||
|
||||
custom_properties = user.custom_properties or {}
|
||||
|
||||
if "xc_password" not in custom_properties:
|
||||
|
|
@ -572,9 +575,6 @@ def stream_xc(request, username, password, channel_id):
|
|||
if custom_properties["xc_password"] != password:
|
||||
return Response({"error": "Invalid credentials"}, status=401)
|
||||
|
||||
if not network_access_allowed(request, 'STREAMS', user):
|
||||
return Response({"error": "Invalid credentials"}, status=401)
|
||||
|
||||
if user.user_level < 10:
|
||||
user_profile_count = user.channel_profiles.count()
|
||||
|
||||
|
|
|
|||
|
|
@ -1023,6 +1023,9 @@ def stream_xc_movie(request, username, password, stream_id, extension):
|
|||
|
||||
user = get_object_or_404(User, username=username)
|
||||
|
||||
if not network_access_allowed(request, 'STREAMS', user):
|
||||
return Response({"error": "Forbidden"}, status=403)
|
||||
|
||||
custom_properties = user.custom_properties or {}
|
||||
|
||||
if "xc_password" not in custom_properties:
|
||||
|
|
@ -1031,9 +1034,6 @@ def stream_xc_movie(request, username, password, stream_id, extension):
|
|||
if custom_properties["xc_password"] != password:
|
||||
return Response({"error": "Invalid credentials"}, status=401)
|
||||
|
||||
if not network_access_allowed(request, 'STREAMS', user):
|
||||
return Response({"error": "Invalid credentials"}, status=401)
|
||||
|
||||
# All authenticated users get access to VOD from all active M3U accounts
|
||||
filters = {"movie_id": stream_id, "m3u_account__is_active": True}
|
||||
|
||||
|
|
@ -1060,6 +1060,9 @@ def stream_xc_episode(request, username, password, stream_id, extension):
|
|||
|
||||
user = get_object_or_404(User, username=username)
|
||||
|
||||
if not network_access_allowed(request, 'STREAMS', user):
|
||||
return Response({"error": "Forbidden"}, status=403)
|
||||
|
||||
custom_properties = user.custom_properties or {}
|
||||
|
||||
if "xc_password" not in custom_properties:
|
||||
|
|
@ -1068,9 +1071,6 @@ def stream_xc_episode(request, username, password, stream_id, extension):
|
|||
if custom_properties["xc_password"] != password:
|
||||
return Response({"error": "Invalid credentials"}, status=401)
|
||||
|
||||
if not network_access_allowed(request, 'STREAMS', user):
|
||||
return Response({"error": "Invalid credentials"}, status=401)
|
||||
|
||||
# All authenticated users get access to series/episodes from all active M3U accounts
|
||||
filters = {"episode_id": stream_id, "m3u_account__is_active": True}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue