Compare commits

...

2 commits

Author SHA1 Message Date
dependabot[bot] ee622e64b4
no log: Bump @types/react in /frontend in the react group (#2636)
Bumps the react group in /frontend with 1 update: [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react).


Updates `@types/react` from 18.3.3 to 18.3.4
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: react
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-27 09:01:06 +09:00
Anderson Shindy Oki 0e876fcc93
Added sonarr and radarr settings tags validation (#2634) 2024-08-27 09:00:44 +09:00
6 changed files with 37 additions and 9 deletions

View file

@ -37,6 +37,12 @@ def validate_ip_address(ip_string):
except ValueError: except ValueError:
return False return False
def validate_tags(tags):
if not tags:
return True
return all(re.match( r'^[a-z0-9_-]+$', item) for item in tags)
ONE_HUNDRED_YEARS_IN_MINUTES = 52560000 ONE_HUNDRED_YEARS_IN_MINUTES = 52560000
ONE_HUNDRED_YEARS_IN_HOURS = 876000 ONE_HUNDRED_YEARS_IN_HOURS = 876000
@ -178,7 +184,7 @@ validators = [
Validator('sonarr.only_monitored', must_exist=True, default=False, is_type_of=bool), Validator('sonarr.only_monitored', must_exist=True, default=False, is_type_of=bool),
Validator('sonarr.series_sync', must_exist=True, default=60, is_type_of=int, Validator('sonarr.series_sync', must_exist=True, default=60, is_type_of=int,
is_in=[15, 60, 180, 360, 720, 1440, 10080, ONE_HUNDRED_YEARS_IN_MINUTES]), is_in=[15, 60, 180, 360, 720, 1440, 10080, ONE_HUNDRED_YEARS_IN_MINUTES]),
Validator('sonarr.excluded_tags', must_exist=True, default=[], is_type_of=list), Validator('sonarr.excluded_tags', must_exist=True, default=[], is_type_of=list, condition=validate_tags),
Validator('sonarr.excluded_series_types', must_exist=True, default=[], is_type_of=list), Validator('sonarr.excluded_series_types', must_exist=True, default=[], is_type_of=list),
Validator('sonarr.use_ffprobe_cache', must_exist=True, default=True, is_type_of=bool), Validator('sonarr.use_ffprobe_cache', must_exist=True, default=True, is_type_of=bool),
Validator('sonarr.exclude_season_zero', must_exist=True, default=False, is_type_of=bool), Validator('sonarr.exclude_season_zero', must_exist=True, default=False, is_type_of=bool),
@ -201,7 +207,7 @@ validators = [
Validator('radarr.only_monitored', must_exist=True, default=False, is_type_of=bool), Validator('radarr.only_monitored', must_exist=True, default=False, is_type_of=bool),
Validator('radarr.movies_sync', must_exist=True, default=60, is_type_of=int, Validator('radarr.movies_sync', must_exist=True, default=60, is_type_of=int,
is_in=[15, 60, 180, 360, 720, 1440, 10080, ONE_HUNDRED_YEARS_IN_MINUTES]), is_in=[15, 60, 180, 360, 720, 1440, 10080, ONE_HUNDRED_YEARS_IN_MINUTES]),
Validator('radarr.excluded_tags', must_exist=True, default=[], is_type_of=list), Validator('radarr.excluded_tags', must_exist=True, default=[], is_type_of=list, condition=validate_tags),
Validator('radarr.use_ffprobe_cache', must_exist=True, default=True, is_type_of=bool), Validator('radarr.use_ffprobe_cache', must_exist=True, default=True, is_type_of=bool),
Validator('radarr.defer_search_signalr', must_exist=True, default=False, is_type_of=bool), Validator('radarr.defer_search_signalr', must_exist=True, default=False, is_type_of=bool),
Validator('radarr.sync_only_monitored_movies', must_exist=True, default=False, is_type_of=bool), Validator('radarr.sync_only_monitored_movies', must_exist=True, default=False, is_type_of=bool),

View file

@ -38,7 +38,7 @@
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/lodash": "^4.17.1", "@types/lodash": "^4.17.1",
"@types/node": "^20.12.6", "@types/node": "^20.12.6",
"@types/react": "^18.3.3", "@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@vite-pwa/assets-generator": "^0.2.4", "@vite-pwa/assets-generator": "^0.2.4",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.2.1",
@ -3876,9 +3876,9 @@
"devOptional": true "devOptional": true
}, },
"node_modules/@types/react": { "node_modules/@types/react": {
"version": "18.3.3", "version": "18.3.4",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.4.tgz",
"integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", "integrity": "sha512-J7W30FTdfCxDDjmfRM+/JqLHBIyl7xUIp9kwK637FGmY7+mkSFSe6L4jpZzhj5QMfLssSDP4/i75AKkrdC7/Jw==",
"devOptional": true, "devOptional": true,
"dependencies": { "dependencies": {
"@types/prop-types": "*", "@types/prop-types": "*",

View file

@ -42,7 +42,7 @@
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/lodash": "^4.17.1", "@types/lodash": "^4.17.1",
"@types/node": "^20.12.6", "@types/node": "^20.12.6",
"@types/react": "^18.3.3", "@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@vite-pwa/assets-generator": "^0.2.4", "@vite-pwa/assets-generator": "^0.2.4",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.2.1",

View file

@ -54,6 +54,11 @@ const SettingsRadarrView: FunctionComponent = () => {
<Chips <Chips
label="Excluded Tags" label="Excluded Tags"
settingKey="settings-radarr-excluded_tags" settingKey="settings-radarr-excluded_tags"
sanitizeFn={(values: string[] | null) =>
values?.map((item) =>
item.replace(/[^a-z0-9_-]/gi, "").toLowerCase(),
)
}
></Chips> ></Chips>
<Message> <Message>
Movies with those tags (case sensitive) in Radarr will be excluded Movies with those tags (case sensitive) in Radarr will be excluded

View file

@ -56,6 +56,11 @@ const SettingsSonarrView: FunctionComponent = () => {
<Chips <Chips
label="Excluded Tags" label="Excluded Tags"
settingKey="settings-sonarr-excluded_tags" settingKey="settings-sonarr-excluded_tags"
sanitizeFn={(values: string[] | null) =>
values?.map((item) =>
item.replace(/[^a-z0-9_-]/gi, "").toLowerCase(),
)
}
></Chips> ></Chips>
<Message> <Message>
Episodes from series with those tags (case sensitive) in Sonarr will Episodes from series with those tags (case sensitive) in Sonarr will

View file

@ -160,13 +160,25 @@ export const Slider: FunctionComponent<SliderProps> = (props) => {
}; };
type ChipsProp = BaseInput<string[]> & type ChipsProp = BaseInput<string[]> &
Omit<ChipInputProps, "onChange" | "data">; Omit<ChipInputProps, "onChange" | "data"> & {
sanitizeFn?: (values: string[] | null) => string[] | undefined;
};
export const Chips: FunctionComponent<ChipsProp> = (props) => { export const Chips: FunctionComponent<ChipsProp> = (props) => {
const { value, update, rest } = useBaseInput(props); const { value, update, rest } = useBaseInput(props);
const handleChange = (value: string[] | null) => {
const sanitizedValues = props.sanitizeFn?.(value) ?? value;
update(sanitizedValues || null);
};
return ( return (
<ChipInput {...rest} value={value ?? []} onChange={update}></ChipInput> <ChipInput
{...rest}
value={value ?? []}
onChange={handleChange}
></ChipInput>
); );
}; };