Add Docker support and notification URL enhancement
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import prisma from "@/lib/prisma"
|
||||
import { revalidatePath } from "next/cache"
|
||||
import { headers } from "next/headers"
|
||||
import { sendNotification } from "@/lib/notifications"
|
||||
|
||||
export async function updatePlan(planId: string, data: { instructions?: string; webhookUrl?: string; notifyAll?: boolean }) {
|
||||
@@ -15,7 +16,10 @@ export async function updatePlan(planId: string, data: { instructions?: string;
|
||||
})
|
||||
|
||||
if (data.instructions && plan.webhookUrl && plan.notifyAll) {
|
||||
await sendNotification(plan.webhookUrl, `📝 UPDATED: Cat instructions have been modified.`)
|
||||
const host = (await headers()).get("host")
|
||||
const protocol = host?.includes("localhost") ? "http" : "https"
|
||||
const planUrl = `${protocol}://${host}/dashboard/${planId}`
|
||||
await sendNotification(plan.webhookUrl, `📝 UPDATED: Cat instructions have been modified.\nPlan: ${planUrl}`)
|
||||
}
|
||||
|
||||
revalidatePath(`/dashboard/${planId}`)
|
||||
|
||||
Reference in New Issue
Block a user