Fixed trailing slash

Fixed trailing slash on main urls
Fixed trailing slash on output urls
This commit is contained in:
Dispatcharr 2025-02-27 09:51:54 -06:00
parent 9a027f1cc7
commit d1121504d1
3 changed files with 17 additions and 7 deletions

View file

@ -1,12 +1,16 @@
from django.urls import path, include
from django.urls import path, re_path, include
from .views import generate_m3u, generate_epg
from core.views import stream_view
app_name = 'output'
urlpatterns = [
path('m3u/', generate_m3u, name='generate_m3u'),
path('epg/', generate_epg, name='generate_epg'),
path('stream/<int:stream_id>/', stream_view, name='stream'),
# Allow both `/m3u` and `/m3u/`
re_path(r'^m3u/?$', generate_m3u, name='generate_m3u'),
# Allow both `/epg` and `/epg/`
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'),
]

View file

@ -124,6 +124,7 @@ SERVER_IP = "127.0.0.1"
CORS_ALLOW_ALL_ORIGINS = True
CORS_ALLOW_CREDENTIALS = True
APPEND_SLASH = True
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [

View file

@ -1,8 +1,8 @@
from django.contrib import admin
from django.urls import path, include
from django.urls import path, include, re_path
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.views.generic import TemplateView, RedirectView
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
@ -27,8 +27,13 @@ urlpatterns = [
path('output/', include('apps.output.urls', namespace='output')),
# Admin
path('admin', RedirectView.as_view(url='/admin/', permanent=True)), # This fixes the issue
path('admin/', admin.site.urls),
# Admin
path('output', RedirectView.as_view(url='/output/', permanent=True)), # This fixes the issue
path('output/', include(('apps.output.urls', 'output'), namespace='output')),
# Swagger UI
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),