Revert "feat: replace Web Push with ntfy for medication reminders"

This reverts commit 1cada42370.
This commit is contained in:
Frank Schwenk
2026-07-08 08:25:34 +02:00
parent 1cada42370
commit bff14167c9
17 changed files with 323 additions and 251 deletions
+14 -14
View File
@@ -2,7 +2,7 @@ import { api } from "./lib/api.js";
import { getToken, setToken, clearToken, isLoggedIn } from "./lib/auth.js";
import { setStreakBadge } from "./lib/badge.js";
import { enqueue, flushQueue } from "./lib/offlineQueue.js";
import { registerPwa, wirePwaInstall } from "./lib/pwa.js";
import { registerPwa, wirePwaInstall, subscribePush } from "./lib/pwa.js";
import { renderSlots, renderHeatmap, updateStats, showToast, showConfetti, showEasterEgg } from "./lib/ui.js";
const STATUS = { upcoming: "Noch nicht", pending: "Jetzt!", overdue: "Überfällig", snoozed: "Snoozed", taken: "Genommen", missed: "Verpasst" };
@@ -153,20 +153,20 @@ async function initApp() {
location.reload();
});
try {
const notify = await api.notifyConfig();
const topicEl = document.getElementById("notifyTopic");
const linkEl = document.getElementById("notifySubscribeLink");
if (notify.configured && notify.subscribe_url) {
topicEl.textContent = `Topic: ${notify.topic}`;
linkEl.href = notify.subscribe_url;
} else {
topicEl.textContent = "ntfy nicht konfiguriert (NTFY_URL + NTFY_TOPIC in .env).";
linkEl.hidden = true;
document.getElementById("enablePush").addEventListener("click", async () => {
const statusEl = document.getElementById("pushStatus");
try {
const perm = await Notification.requestPermission();
if (perm !== "granted") { statusEl.textContent = "Permission verweigert."; return; }
const { key } = await api.vapidKey();
if (!key) { statusEl.textContent = "VAPID keys nicht konfiguriert."; return; }
const sub = await subscribePush(key);
await api.pushSubscribe(sub);
statusEl.textContent = "Push aktiv! Du wirst dezent erinnert.";
} catch (e) {
statusEl.textContent = e.message || "Push-Setup fehlgeschlagen.";
}
} catch {
document.getElementById("notifyTopic").textContent = "Notify-Config konnte nicht geladen werden.";
}
});
await flushQueue((data) => api.log(data));
await refreshDashboard();