feat(plex): add support for custom Plex Web App URLs (#1581)

* feat(plex): add support for custom Plex Web App URLs

* refactor: clean up Yup validation in *arr modals & email settings

* fix(lang): change Web App URL tip

* fix: remove web app URL validation and add 'Advanced' badge
This commit is contained in:
TheCatLady
2021-05-06 04:40:22 -04:00
committed by GitHub
parent 93c441ef66
commit a640a91390
8 changed files with 90 additions and 84 deletions

View File

@@ -41,7 +41,7 @@ const messages = defineMessages({
servername: 'Server Name',
hostname: 'Hostname or IP Address',
port: 'Port',
ssl: 'Enable SSL',
ssl: 'Use SSL',
apiKey: 'API Key',
baseUrl: 'URL Base',
syncEnabled: 'Enable Scan',
@@ -116,7 +116,7 @@ const RadarrModal: React.FC<RadarrModalProps> = ({
intl.formatMessage(messages.validationHostnameRequired)
),
port: Yup.number()
.typeError(intl.formatMessage(messages.validationPortRequired))
.nullable()
.required(intl.formatMessage(messages.validationPortRequired)),
apiKey: Yup.string().required(
intl.formatMessage(messages.validationApiKeyRequired)
@@ -135,33 +135,18 @@ const RadarrModal: React.FC<RadarrModalProps> = ({
.test(
'no-trailing-slash',
intl.formatMessage(messages.validationApplicationUrlTrailingSlash),
(value) => {
if (value?.substr(value.length - 1) === '/') {
return false;
}
return true;
}
(value) => !value || !value.endsWith('/')
),
baseUrl: Yup.string()
.test(
'leading-slash',
intl.formatMessage(messages.validationBaseUrlLeadingSlash),
(value) => {
if (value && value?.substr(0, 1) !== '/') {
return false;
}
return true;
}
(value) => !value || value.startsWith('/')
)
.test(
'no-trailing-slash',
intl.formatMessage(messages.validationBaseUrlTrailingSlash),
(value) => {
if (value?.substr(value.length - 1) === '/') {
return false;
}
return true;
}
(value) => !value || !value.endsWith('/')
),
});