diff --git a/cypress/config/settings.cypress.json b/cypress/config/settings.cypress.json index f376d8804..0f18ad162 100644 --- a/cypress/config/settings.cypress.json +++ b/cypress/config/settings.cypress.json @@ -19,6 +19,8 @@ "discoverRegion": "", "streamingRegion": "", "originalLanguage": "", + "blacktags": "", + "blacktagsLimit": 50, "trustProxy": false, "mediaServerType": 1, "partialRequestsEnabled": true, diff --git a/server/interfaces/api/settingsInterfaces.ts b/server/interfaces/api/settingsInterfaces.ts index 0e97c2bf4..eb55d3111 100644 --- a/server/interfaces/api/settingsInterfaces.ts +++ b/server/interfaces/api/settingsInterfaces.ts @@ -36,6 +36,8 @@ export interface PublicSettingsResponse { discoverRegion: string; streamingRegion: string; originalLanguage: string; + blacktags: string; + blacktagsLimit: number; mediaServerType: number; partialRequestsEnabled: boolean; enableSpecialEpisodes: boolean; diff --git a/server/lib/settings/index.ts b/server/lib/settings/index.ts index 7fc09fb3f..28d7e260d 100644 --- a/server/lib/settings/index.ts +++ b/server/lib/settings/index.ts @@ -128,6 +128,8 @@ export interface MainSettings { discoverRegion: string; streamingRegion: string; originalLanguage: string; + blacktags: string; + blacktagsLimit: number; mediaServerType: number; partialRequestsEnabled: boolean; enableSpecialEpisodes: boolean; @@ -350,6 +352,8 @@ class Settings { discoverRegion: '', streamingRegion: '', originalLanguage: '', + blacktags: '', + blacktagsLimit: 50, mediaServerType: MediaServerType.NOT_CONFIGURED, partialRequestsEnabled: true, enableSpecialEpisodes: false, diff --git a/src/components/Settings/SettingsMain/index.tsx b/src/components/Settings/SettingsMain/index.tsx index 5ccfaaa2a..75d0168c7 100644 --- a/src/components/Settings/SettingsMain/index.tsx +++ b/src/components/Settings/SettingsMain/index.tsx @@ -4,6 +4,7 @@ import PageTitle from '@app/components/Common/PageTitle'; import SensitiveInput from '@app/components/Common/SensitiveInput'; import LanguageSelector from '@app/components/LanguageSelector'; import RegionSelector from '@app/components/RegionSelector'; +import { KeywordSelector } from '@app/components/Selector'; import CopyButton from '@app/components/Settings/CopyButton'; import SettingsBadge from '@app/components/Settings/SettingsBadge'; import type { AvailableLocale } from '@app/context/LanguageContext'; @@ -34,6 +35,12 @@ const messages = defineMessages('components.Settings.SettingsMain', { discoverRegionTip: 'Filter content by regional availability', originallanguage: 'Discover Language', originallanguageTip: 'Filter content by original language', + blacktags: 'Blacklist Content with Tags', + blacktagsTip: + 'Automatically add content with tags to the blacklist using the "Process Blacktags" job', + blacktagsLimit: 'Limit Content Blacklisted per Tag', + blacktagsLimitTip: + 'The "Process Blacktags" job will blacklist this many pages into each sort. Larger numbers will create a more accurate blacklist, but use more space.', streamingRegion: 'Streaming Region', streamingRegionTip: 'Show streaming sites by regional availability', toastApiKeySuccess: 'New API key generated successfully!', @@ -80,6 +87,17 @@ const SettingsMain = () => { intl.formatMessage(messages.validationApplicationUrlTrailingSlash), (value) => !value || !value.endsWith('/') ), + blacktagsLimit: Yup.number() + .test( + 'positive', + 'Number must be greater than 0.', + (value) => (value ?? 0) >= 0 + ) + .test( + 'lte-250', + 'Number must be less than or equal to 250.', + (value) => (value ?? 0) <= 250 + ), }); const regenerate = async () => { @@ -132,6 +150,8 @@ const SettingsMain = () => { discoverRegion: data?.discoverRegion, originalLanguage: data?.originalLanguage, streamingRegion: data?.streamingRegion || 'US', + blacktags: data?.blacktags, + blacktagsLimit: data?.blacktagsLimit || 50, partialRequestsEnabled: data?.partialRequestsEnabled, enableSpecialEpisodes: data?.enableSpecialEpisodes, cacheImages: data?.cacheImages, @@ -153,6 +173,8 @@ const SettingsMain = () => { discoverRegion: values.discoverRegion, streamingRegion: values.streamingRegion, originalLanguage: values.originalLanguage, + blacktags: values.blacktags, + blacktagsLimit: values.blacktagsLimit, partialRequestsEnabled: values.partialRequestsEnabled, enableSpecialEpisodes: values.enableSpecialEpisodes, cacheImages: values.cacheImages, @@ -361,6 +383,54 @@ const SettingsMain = () => { +
+ +
+
+ { + setFieldValue( + 'blacktags', + value?.map((v) => v.value).join(',') + ); + }} + defaultValue={values.blacktags} + /> +
+
+
+
+ +
+ + {errors.blacktagsLimit && + touched.blacktagsLimit && + typeof errors.blacktagsLimit === 'string' && ( +
{errors.blacktagsLimit}
+ )} +
+