diff --git a/docs/using-seerr/notifications/ntfy.md b/docs/using-seerr/notifications/ntfy.md index 946dca78..72a3790f 100644 --- a/docs/using-seerr/notifications/ntfy.md +++ b/docs/using-seerr/notifications/ntfy.md @@ -24,6 +24,10 @@ Set this to the username and password for your ntfy.sh server. Set this to the token for your ntfy.sh server. +### Priority (optional) + +Set the priority level for notifications. Options range from Minimum (1) to Urgent (5), with Default (3) being the standard level. Higher priority notifications may bypass Do Not Disturb settings on some devices. + :::info Please refer to the [ntfy.sh API documentation](https://docs.ntfy.sh/) for more details on configuring these notifications. ::: diff --git a/server/lib/notifications/agents/ntfy.ts b/server/lib/notifications/agents/ntfy.ts index 561df2c8..a67373e8 100644 --- a/server/lib/notifications/agents/ntfy.ts +++ b/server/lib/notifications/agents/ntfy.ts @@ -27,7 +27,7 @@ class NtfyAgent const { embedPoster } = settings.notifications.agents.ntfy; const topic = this.getSettings().options.topic; - const priority = 3; + const priority = this.getSettings().options.priority ?? 3; const title = payload.event ? `${payload.event} - ${payload.subject}` diff --git a/server/lib/settings/index.ts b/server/lib/settings/index.ts index 670d36b2..261e19b5 100644 --- a/server/lib/settings/index.ts +++ b/server/lib/settings/index.ts @@ -298,6 +298,7 @@ export interface NotificationAgentNtfy extends NotificationAgentConfig { password?: string; authMethodToken?: boolean; token?: string; + priority?: number; }; } @@ -531,6 +532,7 @@ class Settings { options: { url: '', topic: '', + priority: 3, }, }, }, diff --git a/src/components/Settings/Notifications/NotificationsNtfy/index.tsx b/src/components/Settings/Notifications/NotificationsNtfy/index.tsx index 00821f12..4588bdae 100644 --- a/src/components/Settings/Notifications/NotificationsNtfy/index.tsx +++ b/src/components/Settings/Notifications/NotificationsNtfy/index.tsx @@ -27,6 +27,7 @@ const messages = defineMessages( password: 'Password', tokenAuth: 'Token authentication', token: 'Token', + priority: 'Priority', ntfysettingssaved: 'Ntfy notification settings saved successfully!', ntfysettingsfailed: 'Ntfy notification settings failed to save.', toastNtfyTestSending: 'Sending ntfy test notification…', @@ -34,6 +35,7 @@ const messages = defineMessages( toastNtfyTestFailed: 'Ntfy test notification failed to send.', validationNtfyUrl: 'You must provide a valid URL', validationNtfyTopic: 'You must provide a topic', + validationPriorityRequired: 'You must provide a priority between 1 and 5', validationTypes: 'You must select at least one notification type', } ); @@ -71,6 +73,14 @@ const NotificationsNtfy = () => { otherwise: Yup.string().nullable(), }) .defined(intl.formatMessage(messages.validationNtfyTopic)), + priority: Yup.number().when('enabled', { + is: true, + then: Yup.number() + .min(1) + .max(5) + .required(intl.formatMessage(messages.validationPriorityRequired)), + otherwise: Yup.number().nullable(), + }), }); if (!data && !error) { @@ -90,6 +100,7 @@ const NotificationsNtfy = () => { password: data?.options.password, authMethodToken: data?.options.authMethodToken, token: data?.options.token, + priority: data?.options.priority, }} validationSchema={NotificationsNtfySchema} onSubmit={async (values) => { @@ -106,6 +117,7 @@ const NotificationsNtfy = () => { password: values.password, authMethodToken: values.authMethodToken, token: values.token, + priority: values.priority, }, }); @@ -157,6 +169,7 @@ const NotificationsNtfy = () => { password: values.password, authMethodToken: values.authMethodToken, token: values.token, + priority: values.priority, }, }); @@ -313,6 +326,22 @@ const NotificationsNtfy = () => { )} +