mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Proxy Test
This commit is contained in:
parent
93a1108c15
commit
78bbfb39ea
3 changed files with 23 additions and 9 deletions
|
|
@ -482,9 +482,7 @@ class MediaItemViewSet(viewsets.ModelViewSet):
|
|||
payload["start_ms"] = applied_start_ms
|
||||
|
||||
token = self._stream_signer.sign_object(payload)
|
||||
stream_url = request.build_absolute_uri(
|
||||
reverse("api:media:stream-file", args=[token])
|
||||
)
|
||||
stream_url = request.build_absolute_uri(reverse("proxy:library-stream", args=[token]))
|
||||
ttl = getattr(settings, "MEDIA_LIBRARY_STREAM_TOKEN_TTL", 3600)
|
||||
return Response(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
from django.urls import path, include
|
||||
from django.urls import include, path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = 'proxy'
|
||||
|
||||
|
|
@ -6,4 +8,5 @@ urlpatterns = [
|
|||
path('ts/', include('apps.proxy.ts_proxy.urls')),
|
||||
path('hls/', include('apps.proxy.hls_proxy.urls')),
|
||||
path('vod/', include('apps.proxy.vod_proxy.urls')),
|
||||
]
|
||||
path('library/<str:token>/', views.library_stream, name='library-stream'),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
from rest_framework import viewsets, status
|
||||
import logging
|
||||
|
||||
from django.apps import apps
|
||||
from django.http import HttpResponse
|
||||
from rest_framework import status, viewsets
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.response import Response
|
||||
from django.apps import apps
|
||||
import logging
|
||||
|
||||
from apps.media_library.views import stream_media_file
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -40,6 +44,7 @@ class ProxyViewSet(viewsets.ViewSet):
|
|||
status=status.HTTP_500_INTERNAL_SERVER_ERROR
|
||||
)
|
||||
|
||||
|
||||
@action(detail=False, methods=['post'])
|
||||
def stop(self, request):
|
||||
"""Stop a proxy server for a channel"""
|
||||
|
|
@ -61,4 +66,12 @@ class ProxyViewSet(viewsets.ViewSet):
|
|||
return Response(
|
||||
{'error': str(e)},
|
||||
status=status.HTTP_500_INTERNAL_SERVER_ERROR
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def library_stream(request, token: str) -> HttpResponse:
|
||||
"""
|
||||
Shallow proxy around the media library stream endpoint so playback traffic
|
||||
is routed through the proxy layer (for stats, connection tracking, etc.).
|
||||
"""
|
||||
return stream_media_file(request, token)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue