feat: Add Notifiarr to notification channels (UI)
- Add Notifiarr as a new channel type in the notification settings. The Notifiarr channel will use the `api_token` field for API key storage in PB.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
+39
-7
@@ -36,7 +36,7 @@ interface NotificationChannelDialogProps {
|
|||||||
|
|
||||||
const baseSchema = z.object({
|
const baseSchema = z.object({
|
||||||
notify_name: z.string().min(1, "Name is required"),
|
notify_name: z.string().min(1, "Name is required"),
|
||||||
notification_type: z.enum(["telegram", "discord", "slack", "signal", "google_chat", "email", "ntfy", "pushover", "webhook"]),
|
notification_type: z.enum(["telegram", "discord", "slack", "signal", "google_chat", "email", "ntfy", "pushover", "notifiarr", "webhook"]),
|
||||||
enabled: z.boolean().default(true),
|
enabled: z.boolean().default(true),
|
||||||
service_id: z.string().default("global"),
|
service_id: z.string().default("global"),
|
||||||
template_id: z.string().optional(),
|
template_id: z.string().optional(),
|
||||||
@@ -83,18 +83,23 @@ const ntfySchema = baseSchema.extend({
|
|||||||
ntfy_endpoint: z.string().url("Must be a valid NTFY endpoint URL"),
|
ntfy_endpoint: z.string().url("Must be a valid NTFY endpoint URL"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const webhookSchema = baseSchema.extend({
|
|
||||||
notification_type: z.literal("webhook"),
|
|
||||||
webhook_url: z.string().url("Must be a valid URL"),
|
|
||||||
webhook_payload_template: z.string().optional(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const pushoverSchema = baseSchema.extend({
|
const pushoverSchema = baseSchema.extend({
|
||||||
notification_type: z.literal("pushover"),
|
notification_type: z.literal("pushover"),
|
||||||
api_token: z.string().min(1, "API token is required"),
|
api_token: z.string().min(1, "API token is required"),
|
||||||
user_key: z.string().min(1, "User key is required"),
|
user_key: z.string().min(1, "User key is required"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const notifiarrSchema = baseSchema.extend({
|
||||||
|
notification_type: z.literal("notifiarr"),
|
||||||
|
api_token: z.string().min(1, "API token is required"),
|
||||||
|
});
|
||||||
|
|
||||||
|
const webhookSchema = baseSchema.extend({
|
||||||
|
notification_type: z.literal("webhook"),
|
||||||
|
webhook_url: z.string().url("Must be a valid URL"),
|
||||||
|
webhook_payload_template: z.string().optional(),
|
||||||
|
});
|
||||||
|
|
||||||
const formSchema = z.discriminatedUnion("notification_type", [
|
const formSchema = z.discriminatedUnion("notification_type", [
|
||||||
telegramSchema,
|
telegramSchema,
|
||||||
discordSchema,
|
discordSchema,
|
||||||
@@ -104,6 +109,7 @@ const formSchema = z.discriminatedUnion("notification_type", [
|
|||||||
emailSchema,
|
emailSchema,
|
||||||
ntfySchema,
|
ntfySchema,
|
||||||
pushoverSchema,
|
pushoverSchema,
|
||||||
|
notifiarrSchema,
|
||||||
webhookSchema,
|
webhookSchema,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -158,6 +164,13 @@ const notificationTypeOptions = [
|
|||||||
description: "Send push notifications via Pushover",
|
description: "Send push notifications via Pushover",
|
||||||
icon: "/upload/notification/pushover.png"
|
icon: "/upload/notification/pushover.png"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
value: "notifiarr",
|
||||||
|
label: "Notifiarr",
|
||||||
|
description: "Send notifications via Notifiarr",
|
||||||
|
icon: "/upload/notification/notifiarr.png"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: "webhook",
|
value: "webhook",
|
||||||
label: "Webhook",
|
label: "Webhook",
|
||||||
@@ -620,6 +633,25 @@ export const NotificationChannelDialog = ({
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{notificationType === "notifiarr" && (
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="api_token"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>API Token</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="Your Notifiarr API token" {...field} type="password" />
|
||||||
|
</FormControl>
|
||||||
|
<FormDescription>
|
||||||
|
Your Notifiarr API token for sending notifications
|
||||||
|
</FormDescription>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{notificationType === "webhook" && (
|
{notificationType === "webhook" && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ export const NotificationChannelList = ({
|
|||||||
case "signal": return "Signal";
|
case "signal": return "Signal";
|
||||||
case "google_chat": return "Google Chat";
|
case "google_chat": return "Google Chat";
|
||||||
case "email": return "Email";
|
case "email": return "Email";
|
||||||
|
case "pushover": return "Pushover";
|
||||||
|
case "notifiarr": return "Notifiarr";
|
||||||
case "webhook": return "Webhook";
|
case "webhook": return "Webhook";
|
||||||
default: return type || "Unknown";
|
default: return type || "Unknown";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export interface AlertConfiguration {
|
|||||||
collectionId?: string;
|
collectionId?: string;
|
||||||
collectionName?: string;
|
collectionName?: string;
|
||||||
service_id: string;
|
service_id: string;
|
||||||
notification_type: "telegram" | "discord" | "slack" | "signal" | "google_chat" | "email" | "ntfy" | "pushover" | "webhook";
|
notification_type: "telegram" | "discord" | "slack" | "signal" | "google_chat" | "email" | "ntfy" | "pushover" | "notifiarr" | "webhook";
|
||||||
telegram_chat_id?: string;
|
telegram_chat_id?: string;
|
||||||
discord_webhook_url?: string;
|
discord_webhook_url?: string;
|
||||||
signal_number?: string;
|
signal_number?: string;
|
||||||
@@ -91,6 +91,9 @@ export const alertConfigService = {
|
|||||||
} else if (config.notification_type === "pushover") {
|
} else if (config.notification_type === "pushover") {
|
||||||
cleanConfig.api_token = config.api_token || "";
|
cleanConfig.api_token = config.api_token || "";
|
||||||
cleanConfig.user_key = config.user_key || "";
|
cleanConfig.user_key = config.user_key || "";
|
||||||
|
|
||||||
|
} else if (config.notification_type === "notifiarr") {
|
||||||
|
cleanConfig.api_token = config.api_token || "";
|
||||||
|
|
||||||
} else if (config.notification_type === "webhook") {
|
} else if (config.notification_type === "webhook") {
|
||||||
cleanConfig.webhook_url = config.webhook_url || "";
|
cleanConfig.webhook_url = config.webhook_url || "";
|
||||||
|
|||||||
Reference in New Issue
Block a user