feat: allow changing YouTube host for trailers (#643)
* feat(server settings, movie/tv/settings components): allow changing YouTube URL for trailers * fix: add i18n messages * fix(i18n): remove unwanted translation change --------- Co-authored-by: Gauthier <mail@gauthierth.fr>
This commit is contained in:
@@ -64,6 +64,9 @@ const messages = defineMessages('components.Settings.SettingsMain', {
|
||||
partialRequestsEnabled: 'Allow Partial Series Requests',
|
||||
enableSpecialEpisodes: 'Allow Special Episodes Requests',
|
||||
locale: 'Display Language',
|
||||
youtubeUrl: 'YouTube URL',
|
||||
validationUrl: 'You must provide a valid URL',
|
||||
validationUrlTrailingSlash: 'URL must not end in a trailing slash',
|
||||
});
|
||||
|
||||
const SettingsMain = () => {
|
||||
@@ -105,6 +108,13 @@ const SettingsMain = () => {
|
||||
'Number must be less than or equal to 250.',
|
||||
(value) => (value ?? 0) <= 250
|
||||
),
|
||||
youtubeUrl: Yup.string()
|
||||
.url(intl.formatMessage(messages.validationUrl))
|
||||
.test(
|
||||
'no-trailing-slash',
|
||||
intl.formatMessage(messages.validationUrlTrailingSlash),
|
||||
(value) => !value || !value.endsWith('/')
|
||||
),
|
||||
});
|
||||
|
||||
const regenerate = async () => {
|
||||
@@ -160,6 +170,7 @@ const SettingsMain = () => {
|
||||
partialRequestsEnabled: data?.partialRequestsEnabled,
|
||||
enableSpecialEpisodes: data?.enableSpecialEpisodes,
|
||||
cacheImages: data?.cacheImages,
|
||||
youtubeUrl: data?.youtubeUrl,
|
||||
}}
|
||||
enableReinitialize
|
||||
validationSchema={MainSettingsSchema}
|
||||
@@ -179,6 +190,7 @@ const SettingsMain = () => {
|
||||
partialRequestsEnabled: values.partialRequestsEnabled,
|
||||
enableSpecialEpisodes: values.enableSpecialEpisodes,
|
||||
cacheImages: values.cacheImages,
|
||||
youtubeUrl: values.youtubeUrl,
|
||||
});
|
||||
mutate('/api/v1/settings/public');
|
||||
mutate('/api/v1/status');
|
||||
@@ -519,6 +531,26 @@ const SettingsMain = () => {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label htmlFor="youtubeUrl" className="text-label">
|
||||
{intl.formatMessage(messages.youtubeUrl)}
|
||||
</label>
|
||||
<div className="form-input-area">
|
||||
<div className="form-input-field">
|
||||
<Field
|
||||
id="youtubeUrl"
|
||||
name="youtubeUrl"
|
||||
type="text"
|
||||
inputMode="url"
|
||||
/>
|
||||
</div>
|
||||
{errors.youtubeUrl &&
|
||||
touched.youtubeUrl &&
|
||||
typeof errors.youtubeUrl === 'string' && (
|
||||
<div className="error">{errors.youtubeUrl}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="actions">
|
||||
<div className="flex justify-end">
|
||||
<span className="ml-3 inline-flex rounded-md shadow-sm">
|
||||
|
||||
Reference in New Issue
Block a user