Skip to content

fix(notifications): a browser removed in Puter stays off, and status() checks with Puter - #4458

Merged
Salazareo merged 1 commit into
mainfrom
DS/push-device-removed
Nov 2, 2026
Merged

Salazareo merged 1 commit into
mainfrom
DS/push-device-removed

Conversation

@Salazareo

Copy link
Copy Markdown
Member

On a website, a browser the user removed in Puter's settings re-registered itself on the next page load, and status() kept saying 'on' after the user removed the browser or turned the app off, because it only looked at browser state.

  • Page load: when the re-register is refused with push_device_removed, the page ends this browser's subscription locally and records pushes as off. It logs nothing, and later loads don't try again.
  • enable(): on push_device_removed, at the register or the verify step, it drops the old subscription, subscribes again and registers the new one, once. The on-load sync never renews. Renewal is skipped once a disable() has aborted the enable. The Puter desktop goes through the same enable().
  • status(): when the local answer would be 'on' (website or GUI), it asks POST /push/web/subscriptions/status. removed drops the subscription and returns 'off'. revoked records the opt-in as off and returns 'off', and enable() still rejects with push_revoked. active and unknown return 'on'. Any failure, including a server without the route, falls back to 'on'. The check never opens a sign-in.
  • Docs: status, removeDevice, enable, onPush and the push guide are updated.

Tests: 19 new tests across webPush.test.js and notifications.test.js, with 184 notification tests passing. check:puterjs:types is clean.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for puter.js SDK

Status Category Percentage Covered / Total
🔵 Lines 53.01%
⬇️ -0.09 pp
5801 / 10943
🔵 Statements 51.1%
⬇️ -0.07 pp
6166 / 12065
🔵 Functions 53.15%
⬇️ -0.05 pp
1037 / 1951
🔵 Branches 44.71%
⬇️ -0.09 pp
3760 / 8409
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/puter-js/src/modules/notifications/enable.js 0%
🟰 ±0 pp
0%
🟰 ±0 pp
0%
🟰 ±0 pp
0%
🟰 ±0 pp
24-46
src/puter-js/src/modules/notifications/index.js 20.27%
⬇️ -0.70 pp
5.5%
⬇️ -0.19 pp
8.88%
🟰 ±0 pp
22.46%
⬇️ -1.04 pp
67-72, 77-78, 84-101, 110-115, 124-141, 189, 241-313, 325-412, 428-447, 469-472, 478-522, 530, 542-554, 572, 574-621, 634-826
src/puter-js/src/modules/notifications/status.js 58.33%
🟰 ±0 pp
63.63%
🟰 ±0 pp
100%
🟰 ±0 pp
60%
🟰 ±0 pp
24-32, 35
src/puter-js/src/modules/notifications/lib/api.js 7.69%
🟰 ±0 pp
0%
🟰 ±0 pp
0%
🟰 ±0 pp
8.33%
🟰 ±0 pp
21-56
src/puter-js/src/modules/notifications/lib/webPush.js 17.75%
⬆️ +0.25 pp
11.82%
⬇️ -1.12 pp
8.57%
⬇️ -0.52 pp
19.07%
⬆️ +0.19 pp
38-40, 44-46, 56-59, 64-68, 72-111, 123-133, 137-154, 166-199, 203-204, 208-218, 224-227, 231-237, 242-243, 255-265, 279-388, 405-424
Generated in workflow #1869 for commit 0cb4562 by the Vitest Coverage Report Action

@Salazareo
Salazareo merged commit ef99893 into main Nov 2, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant