From 69029777a8dac9c8f90b84a993e2853f94885948 Mon Sep 17 00:00:00 2001 From: master3395 Date: Mon, 19 Jan 2026 17:26:58 +0100 Subject: [PATCH] Fix static file serving: Allow /static/ paths in secMiddleware and add static file URL pattern --- CyberCP/secMiddleware.py | 2 +- CyberCP/urls.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CyberCP/secMiddleware.py b/CyberCP/secMiddleware.py index 4f998c190..29061ce9e 100644 --- a/CyberCP/secMiddleware.py +++ b/CyberCP/secMiddleware.py @@ -39,7 +39,7 @@ class secMiddleware: webhook_pattern = re.compile(r'^/websites/[^/]+/(webhook|gitNotify)/?$') if pathActual == "/backup/localInitiate" or pathActual == '/' or pathActual == '/verifyLogin' or pathActual == '/logout' or pathActual.startswith('/api')\ - or webhook_pattern.match(pathActual) or pathActual.startswith('/cloudAPI'): + or webhook_pattern.match(pathActual) or pathActual.startswith('/cloudAPI') or pathActual.startswith('/static/'): pass else: # Session check logging removed diff --git a/CyberCP/urls.py b/CyberCP/urls.py index 83ed80688..e2d058f9d 100644 --- a/CyberCP/urls.py +++ b/CyberCP/urls.py @@ -15,11 +15,15 @@ Including another URLconf """ from django.urls import path, re_path, include from django.contrib import admin +from django.conf import settings +from django.conf.urls.static import static +from django.views.static import serve from firewall import views as firewall_views urlpatterns = [ + # Serve static files first (before catch-all routes) + re_path(r'^static/(?P.*)$', serve, {'document_root': settings.STATIC_ROOT}), path('base/', include('baseTemplate.urls')), - path('', include('loginSystem.urls')), path('imunifyav/', firewall_views.imunifyAV, name='imunifyav_root'), path('ImunifyAV/', firewall_views.imunifyAV, name='imunifyav_root_legacy'), path('packages/', include('packages.urls')), @@ -40,7 +44,8 @@ urlpatterns = [ path('filemanager/', include('filemanager.urls')), path('emailPremium/', include('emailPremium.urls')), path('manageservices/', include('manageServices.urls')), - path('plugins/testPlugin/', include('testPlugin.urls')), path('plugins/discordWebhooks/',include('discordWebhooks.urls')), + path('plugins/testPlugin/', include('testPlugin.urls')), + # path('plugins/discordWebhooks/',include('discordWebhooks.urls')), # Module not available in v2.5.5-dev path('plugins/', include('pluginHolder.urls')), path('emailMarketing/', include('emailMarketing.urls')), path('cloudAPI/', include('cloudAPI.urls')), @@ -50,4 +55,5 @@ path('plugins/', include('pluginHolder.urls')), path('IncrementalBackups/', include('IncBackups.urls')), path('aiscanner/', include('aiScanner.urls')), # path('Terminal/', include('WebTerminal.urls')), + path('', include('loginSystem.urls')), ]