Let users see and unsubscribe their own push devices
Fixes duplicate/triple OS notifications on machines where more than one browser (e.g. both Chrome and Edge on Windows) independently got notification permission for the site — each held its own valid subscription, so every event pushed to both. Adds a userAgent column (captured client-side at subscribe time, display-only) and a Settings > Account section listing a user's own subscribed browsers with a friendly label plus an unsubscribe button, backed by new GET/DELETE /api/push/subscriptions endpoints scoped to the caller's own rows. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gh2UXUQUVBWroWEnn1FLFG
This commit is contained in:
1 parent
4d393aec91
commit
f5e49b5c53
11 files changed
+1374
-6
No files matched your search
@@ -57,7 +57,7 @@ export async function ensurePushSubscribed(): Promise<void> {
|
||||
const saveRes = await fetch("/api/push/subscribe", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(subscription.toJSON()),
|
||||
body: JSON.stringify({ ...subscription.toJSON(), userAgent: navigator.userAgent }),
|
||||
});
|
||||
if (saveRes.ok) {
|
||||
console.log("[push] subscription saved server-side — done");
|
||||
|
||||
Reference in new issue
Block a user