feat: Add Gotify to notification channels
- Add Gotify as a new channel type in the notification settings. The Gotify channel will use the `api_token` and `server_url` field for API key storage in PB.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
+51
-1
@@ -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", "notifiarr", "webhook"]),
|
notification_type: z.enum(["telegram", "discord", "slack", "signal", "google_chat", "email", "ntfy", "pushover", "notifiarr", "gotify", "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(),
|
||||||
@@ -101,6 +101,12 @@ const webhookSchema = baseSchema.extend({
|
|||||||
webhook_payload_template: z.string().optional(),
|
webhook_payload_template: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const gotifySchema = baseSchema.extend({
|
||||||
|
notification_type: z.literal("gotify"),
|
||||||
|
api_token: z.string().min(1, "API token is required"),
|
||||||
|
server_url: z.string().url("Must be a valid server URL"),
|
||||||
|
});
|
||||||
|
|
||||||
const formSchema = z.discriminatedUnion("notification_type", [
|
const formSchema = z.discriminatedUnion("notification_type", [
|
||||||
telegramSchema,
|
telegramSchema,
|
||||||
discordSchema,
|
discordSchema,
|
||||||
@@ -111,6 +117,7 @@ const formSchema = z.discriminatedUnion("notification_type", [
|
|||||||
ntfySchema,
|
ntfySchema,
|
||||||
pushoverSchema,
|
pushoverSchema,
|
||||||
notifiarrSchema,
|
notifiarrSchema,
|
||||||
|
gotifySchema,
|
||||||
webhookSchema,
|
webhookSchema,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -172,6 +179,12 @@ const notificationTypeOptions = [
|
|||||||
description: "Send notifications via Notifiarr",
|
description: "Send notifications via Notifiarr",
|
||||||
icon: "/upload/notification/notifiarr.png"
|
icon: "/upload/notification/notifiarr.png"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: "gotify",
|
||||||
|
label: "Gotify",
|
||||||
|
description: "Send push notifications via Gotify",
|
||||||
|
icon: "/upload/notification/gotify.png"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: "webhook",
|
value: "webhook",
|
||||||
label: "Webhook",
|
label: "Webhook",
|
||||||
@@ -671,6 +684,43 @@ export const NotificationChannelDialog = ({
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{notificationType === "gotify" && (
|
||||||
|
<>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="api_token"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>API Token</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="Your Gotify API token" {...field} type="password" />
|
||||||
|
</FormControl>
|
||||||
|
<FormDescription>
|
||||||
|
Your Gotify application API token
|
||||||
|
</FormDescription>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="server_url"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Server URL</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="https://your-gotify-server.com" {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormDescription>
|
||||||
|
The URL of your Gotify server
|
||||||
|
</FormDescription>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{notificationType === "webhook" && (
|
{notificationType === "webhook" && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -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" | "notifiarr" | "webhook";
|
notification_type: "telegram" | "discord" | "slack" | "signal" | "google_chat" | "email" | "ntfy" | "pushover" | "notifiarr" | "gotify" | "webhook";
|
||||||
telegram_chat_id?: string;
|
telegram_chat_id?: string;
|
||||||
discord_webhook_url?: string;
|
discord_webhook_url?: string;
|
||||||
signal_number?: string;
|
signal_number?: string;
|
||||||
@@ -31,6 +31,7 @@ export interface AlertConfiguration {
|
|||||||
ntfy_endpoint?: string;
|
ntfy_endpoint?: string;
|
||||||
api_token?: string;
|
api_token?: string;
|
||||||
user_key?: string;
|
user_key?: string;
|
||||||
|
server_url?: string;
|
||||||
webhook_url?: string;
|
webhook_url?: string;
|
||||||
webhook_payload_template?: string;
|
webhook_payload_template?: string;
|
||||||
}
|
}
|
||||||
@@ -95,6 +96,10 @@ export const alertConfigService = {
|
|||||||
} else if (config.notification_type === "notifiarr") {
|
} else if (config.notification_type === "notifiarr") {
|
||||||
cleanConfig.api_token = config.api_token || "";
|
cleanConfig.api_token = config.api_token || "";
|
||||||
cleanConfig.channel_id = config.channel_id || "";
|
cleanConfig.channel_id = config.channel_id || "";
|
||||||
|
|
||||||
|
} else if (config.notification_type === "gotify") {
|
||||||
|
cleanConfig.api_token = config.api_token || "";
|
||||||
|
cleanConfig.server_url = config.server_url || "";
|
||||||
|
|
||||||
} 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