diff --git a/CyberCP/settings.py b/CyberCP/settings.py
index 38d2cc4d5..c4d987dd8 100644
--- a/CyberCP/settings.py
+++ b/CyberCP/settings.py
@@ -141,6 +141,7 @@ TEMPLATES = [
'baseTemplate.context_processors.cosmetic_context',
'baseTemplate.context_processors.notification_preferences_context',
'baseTemplate.context_processors.firewall_static_context',
+ 'baseTemplate.context_processors.dns_static_context',
],
},
},
diff --git a/baseTemplate/context_processors.py b/baseTemplate/context_processors.py
index db7aa8d90..83215a38a 100644
--- a/baseTemplate/context_processors.py
+++ b/baseTemplate/context_processors.py
@@ -77,4 +77,29 @@ def firewall_static_context(request):
version = int(time.time())
return {
'FIREWALL_STATIC_VERSION': version
+ }
+
+
+def dns_static_context(request):
+ """Cache-busting for DNS static assets (bumps when dns.js changes). Avoids stale JS/layout."""
+ try:
+ from django.conf import settings
+ base = settings.BASE_DIR
+ paths = [
+ os.path.join(base, 'dns', 'static', 'dns', 'dns.js'),
+ os.path.join(base, 'static', 'dns', 'dns.js'),
+ os.path.join(base, 'public', 'static', 'dns', 'dns.js'),
+ ]
+ version = 0
+ for p in paths:
+ try:
+ version = max(version, int(os.path.getmtime(p)))
+ except (OSError, TypeError):
+ pass
+ if version <= 0:
+ version = int(time.time())
+ except (OSError, AttributeError):
+ version = int(time.time())
+ return {
+ 'DNS_STATIC_VERSION': version
}
\ No newline at end of file
diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html
index 1be72d59e..57d215791 100644
--- a/baseTemplate/templates/baseTemplate/index.html
+++ b/baseTemplate/templates/baseTemplate/index.html
@@ -2220,7 +2220,7 @@
-
+
diff --git a/dns/views.py b/dns/views.py
index f2f3930d0..ba07d9bdd 100644
--- a/dns/views.py
+++ b/dns/views.py
@@ -199,7 +199,12 @@ def addDeleteDNSRecordsCloudFlare(request):
try:
userID = request.session['userID']
dm = DNSManager()
- return dm.addDeleteDNSRecordsCloudFlare(request, userID)
+ response = dm.addDeleteDNSRecordsCloudFlare(request, userID)
+ if hasattr(response, 'headers'):
+ response['Cache-Control'] = 'no-cache, no-store, must-revalidate, max-age=0'
+ response['Pragma'] = 'no-cache'
+ response['Expires'] = '0'
+ return response
except KeyError:
return redirect(loadLoginPage)