Initial commit: Cat Sitting Planner with PWA, SQLite, and Webhook Notifications

This commit is contained in:
2026-01-12 20:48:23 +01:00
commit 3121ef223d
52 changed files with 13722 additions and 0 deletions

23
lib/notifications.ts Normal file
View File

@@ -0,0 +1,23 @@
export async function sendNotification(webhookUrl: string | null, message: string) {
if (!webhookUrl) return;
try {
const response = await fetch(webhookUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
"User-Agent": "CatSittingPlanner/1.0"
},
// Works for Discord (content) and generic Telegram Webhook bridges (text)
body: JSON.stringify({
content: message,
text: message
}),
});
if (!response.ok) {
console.error(`[Notification] Webhook failed with status ${response.status}`);
}
} catch (error) {
console.error("Failed to send notification:", error);
}
}