mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 17:16:26 +00:00
Merge branch 'main' of https://github.com/Dispatcharr/Dispatcharr into proxy-refactoring
This commit is contained in:
commit
45185fc658
7 changed files with 18 additions and 7 deletions
|
|
@ -36,12 +36,13 @@ class M3UAccountSerializer(serializers.ModelSerializer):
|
|||
required=True
|
||||
)
|
||||
profiles = M3UAccountProfileSerializer(many=True, read_only=True)
|
||||
read_only_fields = ['locked']
|
||||
|
||||
class Meta:
|
||||
model = M3UAccount
|
||||
fields = [
|
||||
'id', 'name', 'server_url', 'uploaded_file', 'server_group',
|
||||
'max_streams', 'is_active', 'created_at', 'updated_at', 'filters', 'user_agent', 'profiles'
|
||||
'max_streams', 'is_active', 'created_at', 'updated_at', 'filters', 'user_agent', 'profiles', 'locked'
|
||||
]
|
||||
|
||||
class ServerGroupSerializer(serializers.ModelSerializer):
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ urlpatterns = [
|
|||
re_path(r'^epg/?$', generate_epg, name='generate_epg'),
|
||||
|
||||
# Allow both `/stream/<int:stream_id>` and `/stream/<int:stream_id>/`
|
||||
re_path(r'^stream/(?P<stream_id>\d+)/?$', stream_view, name='stream'),
|
||||
re_path(r'^stream/(?P<channel_uuid>[0-9a-fA-F\-]+)/?$', stream_view, name='stream'),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -22,7 +22,11 @@ def generate_m3u(request):
|
|||
f'#EXTINF:-1 tvg-id="{tvg_id}" tvg-name="{tvg_name}" tvg-logo="{tvg_logo}" '
|
||||
f'tvg-chno="{channel_number}" group-title="{group_title}",{channel.name}\n'
|
||||
)
|
||||
stream_url = request.build_absolute_uri(reverse('output:stream', args=[channel.id]))
|
||||
|
||||
base_url = request.build_absolute_uri('/')[:-1]
|
||||
stream_url = f"{base_url}/proxy/ts/stream/{channel.uuid}"
|
||||
|
||||
#stream_url = request.build_absolute_uri(reverse('output:stream', args=[channel.id]))
|
||||
m3u_content += extinf_line + stream_url + "\n"
|
||||
|
||||
response = HttpResponse(m3u_content, content_type="application/x-mpegURL")
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ def lock_or_create_profiles(apps, schema_editor):
|
|||
"name": "ffmpeg",
|
||||
"command": "ffmpeg",
|
||||
"parameters": "-i {streamUrl} -c:v copy -c:a copy -f mpegts pipe:1",
|
||||
"new_parameters": "-i {streamUrl} -user_agent {userAgent} -c:v copy -c:a copy -f mpegts pipe:1",
|
||||
"new_parameters": "-user_agent {userAgent} -i {streamUrl} -c copy -f mpegts pipe:1",
|
||||
},
|
||||
{
|
||||
"name": "streamlink",
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ def settings_view(request):
|
|||
return render(request, 'settings.html')
|
||||
|
||||
|
||||
def stream_view(request, stream_id):
|
||||
def stream_view(request, channel_uuid):
|
||||
"""
|
||||
Streams the first available stream for the given channel.
|
||||
It uses the channel’s assigned StreamProfile.
|
||||
|
|
@ -40,7 +40,7 @@ def stream_view(request, stream_id):
|
|||
redis_client = redis.Redis(host=settings.REDIS_HOST, port=6379, db=int(getattr(settings, "REDIS_DB", "0")))
|
||||
|
||||
# Retrieve the channel by the provided stream_id.
|
||||
channel = Channel.objects.get(channel_number=stream_id)
|
||||
channel = Channel.objects.get(uuid=channel_uuid)
|
||||
logger.debug("Channel retrieved: ID=%s, Name=%s", channel.id, channel.name)
|
||||
|
||||
# Ensure the channel has at least one stream.
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ server {
|
|||
location / {
|
||||
include uwsgi_params;
|
||||
uwsgi_pass unix:/app/uwsgi.sock;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /assets/ {
|
||||
|
|
@ -25,6 +27,8 @@ server {
|
|||
proxy_pass http://127.0.0.1:5656;
|
||||
proxy_buffering off;
|
||||
proxy_set_header Connection keep-alive;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
# WebSockets for real-time communication
|
||||
|
|
@ -46,5 +50,7 @@ server {
|
|||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
client_max_body_size 0;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ const App = () => {
|
|||
withNormalizeCSS
|
||||
>
|
||||
<WebsocketProvider>
|
||||
<Notifications containerWidth={250} />
|
||||
<Notifications containerWidth={350} />
|
||||
<Router>
|
||||
<AppShell
|
||||
header={{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue