feat: make dnsCache optional and enable-able through network settings

This commit is contained in:
fallenbagel
2025-02-23 03:34:57 +08:00
committed by gauthier-th
parent 73fd763890
commit 81f4c24b7b
2 changed files with 36 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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 = () => {
/>
</div>
</div>
<div className="form-row">
<label htmlFor="dnsCache" className="checkbox-label">
<span className="mr-2">
{intl.formatMessage(messages.dnsCache)}
</span>
<SettingsBadge badgeType="advanced" className="mr-2" />
<SettingsBadge badgeType="restartRequired" />
<SettingsBadge badgeType="experimental" className="mr-2" />
<span className="label-tip">
{intl.formatMessage(messages.dnsCacheTip)}
</span>
</label>
<div className="form-input-area">
<Tooltip
content={intl.formatMessage(messages.dnsCacheHoverTip)}
>
<Field
type="checkbox"
id="dnsCache"
name="dnsCache"
onChange={() => {
setFieldValue('dnsCache', !values.dnsCache);
}}
/>
</Tooltip>
</div>
</div>
<div className="form-row">
<label htmlFor="proxyEnabled" className="checkbox-label">
<span className="mr-2">