From 81f4c24b7bca70dbae821b99f026e43e0686c8c8 Mon Sep 17 00:00:00 2001 From: fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Sun, 23 Feb 2025 03:34:57 +0800 Subject: [PATCH] feat: make dnsCache optional and enable-able through network settings --- server/lib/settings/index.ts | 4 +-- .../Settings/SettingsNetwork/index.tsx | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/server/lib/settings/index.ts b/server/lib/settings/index.ts index 92e314bb..4b14a8da 100644 --- a/server/lib/settings/index.ts +++ b/server/lib/settings/index.ts @@ -143,7 +143,7 @@ export interface NetworkSettings { forceIpv4First: boolean; trustProxy: boolean; proxy: ProxySettings; - cacheDns: boolean; + dnsCache: boolean; } interface PublicSettings { @@ -543,7 +543,7 @@ class Settings { bypassFilter: '', bypassLocalAddresses: true, }, - cacheDns: false, + dnsCache: false, }, }; if (initialSettings) { diff --git a/src/components/Settings/SettingsNetwork/index.tsx b/src/components/Settings/SettingsNetwork/index.tsx index e02b7bfc..ac3d1bd9 100644 --- a/src/components/Settings/SettingsNetwork/index.tsx +++ b/src/components/Settings/SettingsNetwork/index.tsx @@ -45,6 +45,11 @@ const messages = defineMessages('components.Settings.SettingsNetwork', { forceIpv4First: 'Force IPv4 Resolution First', forceIpv4FirstTip: 'Force Jellyseerr to resolve IPv4 addresses first instead of IPv6', + dnsCache: 'DNS Cache', + dnsCacheTip: + 'Enable caching of DNS lookups to optimize performance and avoid making unnecessary API calls', + dnsCacheHoverTip: + 'Do NOT enable this if you are experiencing issues with DNS lookups', }); const SettingsNetwork = () => { @@ -90,6 +95,7 @@ const SettingsNetwork = () => { initialValues={{ csrfProtection: data?.csrfProtection, forceIpv4First: data?.forceIpv4First, + dnsCache: data?.dnsCache, trustProxy: data?.trustProxy, proxyEnabled: data?.proxy?.enabled, proxyHostname: data?.proxy?.hostname, @@ -108,6 +114,7 @@ const SettingsNetwork = () => { csrfProtection: values.csrfProtection, forceIpv4First: values.forceIpv4First, trustProxy: values.trustProxy, + dnsCache: values.dnsCache, proxy: { enabled: values.proxyEnabled, hostname: values.proxyHostname, @@ -221,6 +228,33 @@ const SettingsNetwork = () => { /> +
+ +
+ + { + setFieldValue('dnsCache', !values.dnsCache); + }} + /> + +
+