feat(project): silence web alert popup while PC notifier is running

If the user has a non-revoked notifier token seen in the last 3 minutes,
/api/notifications/alerts returns only the baseline with desktop=true;
the web marks it seen so alerts resume on the web after the app stops.
A failing check keeps the web popup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 11:35:14 +09:00
parent 4715de9b5b
commit 84113d1fd7
6 changed files with 62 additions and 4 deletions
+7 -1
View File
@@ -10912,7 +10912,13 @@
me = res.me;
after = readSeen();
if (after == null) writeSeen(res.latest_id || 0); // 처음 — 지금까지 온 알림은 띄우지 않는다
else if (after < (res.latest_id || 0)) res = await api("GET", "/project/api/notifications/alerts?after=" + after);
else if (after < (res.latest_id || 0) && !res.desktop) res = await api("GET", "/project/api/notifications/alerts?after=" + after);
}
// PC 알림 프로그램이 켜져 있으면 웹 팝업은 쉰다 — 지금까지 온 것은 본 것으로(프로그램을 끄면 그 뒤 알림부터 웹에)
if (res && res.desktop) {
if ((res.latest_id || 0) > (readSeen() || 0)) writeSeen(res.latest_id || 0);
if (pop) { shown.clear(); pop.remove(); pop = null; }
return;
}
((res && res.alerts) || []).forEach(function (n) { if (!shown.has(n.id)) shown.set(n.id, n); });
if (shown.size) render();