From 6d098fd96fa5e26566fdd9510e5817f97c39b8e3 Mon Sep 17 00:00:00 2001 From: Sami Date: Tue, 17 Mar 2026 19:31:12 -0700 Subject: [PATCH] Exempt DNS logs from rate limiting and hide Tokens button when no DNS configured Co-Authored-By: Claude Opus 4.6 --- dashcaddy-api/middleware.js | 2 +- status/js/globals.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dashcaddy-api/middleware.js b/dashcaddy-api/middleware.js index 60d0588..653818f 100644 --- a/dashcaddy-api/middleware.js +++ b/dashcaddy-api/middleware.js @@ -384,7 +384,7 @@ module.exports = function configureMiddleware(app, { ...RATE_LIMITS.GENERAL, standardHeaders: true, legacyHeaders: false, - skip: (req) => isTest || req.path === '/health' || req.path === '/api/health' || req.path.startsWith('/probe/') || req.path.startsWith('/api/auth/gate/') || req.path === '/api/totp/check-session' || req.path.endsWith('/health-checks/status') || req.path.endsWith('/csrf-token'), + skip: (req) => isTest || req.path === '/health' || req.path === '/api/health' || req.path.startsWith('/probe/') || req.path.startsWith('/api/auth/gate/') || req.path === '/api/totp/check-session' || req.path.endsWith('/health-checks/status') || req.path.endsWith('/csrf-token') || req.path === '/api/v1/dns/logs', message: { success: false, error: 'Too many requests, please try again later' } }); diff --git a/status/js/globals.js b/status/js/globals.js index 7dad7b0..9a5fc63 100644 --- a/status/js/globals.js +++ b/status/js/globals.js @@ -66,6 +66,9 @@ window.__dashcaddySiteConfigLoaded = (async function loadSiteConfig() { })); // Render DNS cards dynamically based on configured servers renderDnsCards(); + // Hide Tokens button if no DNS servers configured + const tokensBtn = document.getElementById('manage-tokens'); + if (tokensBtn) tokensBtn.style.display = Object.keys(SITE.dnsServers).length ? '' : 'none'; } } catch (_) {} // Update static HTML elements with configured TLD