feat: Add Pushover notification channel
- Adds Pushover as a new notification channel option. Includes fields for `api_token` and `user_key` in the `alert_configurations` schema and integrates it into the channel type dropdown and form handling.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
+52
-2
@@ -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", "webhook"]),
|
notification_type: z.enum(["telegram", "discord", "slack", "signal", "google_chat", "email", "ntfy", "pushover", "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(),
|
||||||
@@ -89,6 +89,12 @@ const webhookSchema = baseSchema.extend({
|
|||||||
webhook_payload_template: z.string().optional(),
|
webhook_payload_template: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pushoverSchema = baseSchema.extend({
|
||||||
|
notification_type: z.literal("pushover"),
|
||||||
|
api_token: z.string().min(1, "API token is required"),
|
||||||
|
user_key: z.string().min(1, "User key is required"),
|
||||||
|
});
|
||||||
|
|
||||||
const formSchema = z.discriminatedUnion("notification_type", [
|
const formSchema = z.discriminatedUnion("notification_type", [
|
||||||
telegramSchema,
|
telegramSchema,
|
||||||
discordSchema,
|
discordSchema,
|
||||||
@@ -97,7 +103,8 @@ const formSchema = z.discriminatedUnion("notification_type", [
|
|||||||
googleChatSchema,
|
googleChatSchema,
|
||||||
emailSchema,
|
emailSchema,
|
||||||
ntfySchema,
|
ntfySchema,
|
||||||
webhookSchema
|
pushoverSchema,
|
||||||
|
webhookSchema,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
type FormValues = z.infer<typeof formSchema>;
|
type FormValues = z.infer<typeof formSchema>;
|
||||||
@@ -145,6 +152,12 @@ const notificationTypeOptions = [
|
|||||||
description: "Send notifications via NTFY push service",
|
description: "Send notifications via NTFY push service",
|
||||||
icon: "/upload/notification/ntfy.png"
|
icon: "/upload/notification/ntfy.png"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: "pushover",
|
||||||
|
label: "Pushover",
|
||||||
|
description: "Send push notifications via Pushover",
|
||||||
|
icon: "/upload/notification/pushover.png"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: "webhook",
|
value: "webhook",
|
||||||
label: "Webhook",
|
label: "Webhook",
|
||||||
@@ -571,6 +584,43 @@ export const NotificationChannelDialog = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{notificationType === "pushover" && (
|
||||||
|
<>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="api_token"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>API Token</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="Your Pushover API token" {...field} type="password" />
|
||||||
|
</FormControl>
|
||||||
|
<FormDescription>
|
||||||
|
Your Pushover application API token
|
||||||
|
</FormDescription>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="user_key"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>User Key</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="Your Pushover user key" {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormDescription>
|
||||||
|
Your Pushover user key (or group key)
|
||||||
|
</FormDescription>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{notificationType === "webhook" && (
|
{notificationType === "webhook" && (
|
||||||
<>
|
<>
|
||||||
<FormField
|
<FormField
|
||||||
|
|||||||
@@ -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" | "webhook";
|
notification_type: "telegram" | "discord" | "slack" | "signal" | "google_chat" | "email" | "ntfy" | "pushover" | "webhook";
|
||||||
telegram_chat_id?: string;
|
telegram_chat_id?: string;
|
||||||
discord_webhook_url?: string;
|
discord_webhook_url?: string;
|
||||||
signal_number?: string;
|
signal_number?: string;
|
||||||
@@ -29,6 +29,8 @@ export interface AlertConfiguration {
|
|||||||
webhook_id?: string;
|
webhook_id?: string;
|
||||||
channel_id?: string;
|
channel_id?: string;
|
||||||
ntfy_endpoint?: string;
|
ntfy_endpoint?: string;
|
||||||
|
api_token?: string;
|
||||||
|
user_key?: string;
|
||||||
webhook_url?: string;
|
webhook_url?: string;
|
||||||
webhook_payload_template?: string;
|
webhook_payload_template?: string;
|
||||||
}
|
}
|
||||||
@@ -86,6 +88,10 @@ export const alertConfigService = {
|
|||||||
} else if (config.notification_type === "ntfy") {
|
} else if (config.notification_type === "ntfy") {
|
||||||
cleanConfig.ntfy_endpoint = config.ntfy_endpoint || "";
|
cleanConfig.ntfy_endpoint = config.ntfy_endpoint || "";
|
||||||
|
|
||||||
|
} else if (config.notification_type === "pushover") {
|
||||||
|
cleanConfig.api_token = config.api_token || "";
|
||||||
|
cleanConfig.user_key = config.user_key || "";
|
||||||
|
|
||||||
} else if (config.notification_type === "webhook") {
|
} else if (config.notification_type === "webhook") {
|
||||||
cleanConfig.webhook_url = config.webhook_url || "";
|
cleanConfig.webhook_url = config.webhook_url || "";
|
||||||
cleanConfig.webhook_payload_template = config.webhook_payload_template || "";
|
cleanConfig.webhook_payload_template = config.webhook_payload_template || "";
|
||||||
|
|||||||
Reference in New Issue
Block a user