feat: Add NTFY API token field for Token-based authentication to ntfy server
- Add the api_token field for NTFY notifications in both the dialog and service to save it to PB. NTFY schema to include api_token field.
This commit is contained in:
+19
@@ -83,6 +83,7 @@ const emailSchema = baseSchema.extend({
|
|||||||
const ntfySchema = baseSchema.extend({
|
const ntfySchema = baseSchema.extend({
|
||||||
notification_type: z.literal("ntfy"),
|
notification_type: z.literal("ntfy"),
|
||||||
ntfy_endpoint: z.string().url("Must be a valid NTFY endpoint URL"),
|
ntfy_endpoint: z.string().url("Must be a valid NTFY endpoint URL"),
|
||||||
|
api_token: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const pushoverSchema = baseSchema.extend({
|
const pushoverSchema = baseSchema.extend({
|
||||||
@@ -595,6 +596,7 @@ export const NotificationChannelDialog = ({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{notificationType === "ntfy" && (
|
{notificationType === "ntfy" && (
|
||||||
|
<>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="ntfy_endpoint"
|
name="ntfy_endpoint"
|
||||||
@@ -611,6 +613,23 @@ export const NotificationChannelDialog = ({
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="api_token"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>API Token (Optional)</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="Enter NTFY API token" {...field} type="password" />
|
||||||
|
</FormControl>
|
||||||
|
<FormDescription>
|
||||||
|
Optional API token for authentication with NTFY server
|
||||||
|
</FormDescription>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{notificationType === "pushover" && (
|
{notificationType === "pushover" && (
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ 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 || "";
|
||||||
|
cleanConfig.api_token = config.api_token || "";
|
||||||
|
|
||||||
} else if (config.notification_type === "pushover") {
|
} else if (config.notification_type === "pushover") {
|
||||||
cleanConfig.api_token = config.api_token || "";
|
cleanConfig.api_token = config.api_token || "";
|
||||||
|
|||||||
Reference in New Issue
Block a user