Skip to content

Commit e052850

Browse files
authored
Merge pull request #3148 from Dokploy/2938-not-all-ntfy-topics-need-access-tokens
feat: update notification handling to make accessToken optional
2 parents 9e98f9c + e06f597 commit e052850

File tree

7 files changed

+6855
-10
lines changed

7 files changed

+6855
-10
lines changed

apps/dokploy/components/dashboard/settings/notifications/handle-notifications.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const notificationSchema = z.discriminatedUnion("type", [
103103
type: z.literal("ntfy"),
104104
serverUrl: z.string().min(1, { message: "Server URL is required" }),
105105
topic: z.string().min(1, { message: "Topic is required" }),
106-
accessToken: z.string().min(1, { message: "Access Token is required" }),
106+
accessToken: z.string().optional(),
107107
priority: z.number().min(1).max(5).default(3),
108108
})
109109
.merge(notificationBaseSchema),
@@ -303,7 +303,7 @@ export const HandleNotifications = ({ notificationId }: Props) => {
303303
dokployRestart: notification.dokployRestart,
304304
databaseBackup: notification.databaseBackup,
305305
type: notification.notificationType,
306-
accessToken: notification.ntfy?.accessToken,
306+
accessToken: notification.ntfy?.accessToken || "",
307307
topic: notification.ntfy?.topic,
308308
priority: notification.ntfy?.priority,
309309
serverUrl: notification.ntfy?.serverUrl,
@@ -432,7 +432,7 @@ export const HandleNotifications = ({ notificationId }: Props) => {
432432
dokployRestart: dokployRestart,
433433
databaseBackup: databaseBackup,
434434
serverUrl: data.serverUrl,
435-
accessToken: data.accessToken,
435+
accessToken: data.accessToken || "",
436436
topic: data.topic,
437437
priority: data.priority,
438438
name: data.name,
@@ -1001,8 +1001,12 @@ export const HandleNotifications = ({ notificationId }: Props) => {
10011001
<Input
10021002
placeholder="AzxcvbnmKjhgfdsa..."
10031003
{...field}
1004+
value={field.value ?? ""}
10041005
/>
10051006
</FormControl>
1007+
<FormDescription>
1008+
Optional. Leave blank for public topics.
1009+
</FormDescription>
10061010
<FormMessage />
10071011
</FormItem>
10081012
)}
@@ -1258,7 +1262,7 @@ export const HandleNotifications = ({ notificationId }: Props) => {
12581262
await testNtfyConnection({
12591263
serverUrl: data.serverUrl,
12601264
topic: data.topic,
1261-
accessToken: data.accessToken,
1265+
accessToken: data.accessToken || "",
12621266
priority: data.priority,
12631267
});
12641268
} else if (data.type === "lark") {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "ntfy" ALTER COLUMN "accessToken" DROP NOT NULL;

0 commit comments

Comments
 (0)