[PR #1669] fix: token extension for PWAs #1683

Open
opened 2026-05-07 01:03:14 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/1669
Author: @nihalgonsalves
Created: 3/21/2026
Status: 🔄 Open

Base: mainHead: ng/pwa-token-extend


📝 Commits (1)

  • 6a7c1c4 fix: token extension for PWAs

📊 Changes

5 files changed (+139 additions, -9 deletions)

View changed files

📝 docs/develop.md (+1 -0)
📝 web/public/sw.js (+80 -9)
📝 web/src/app/AccountApi.js (+1 -0)
📝 web/src/app/Session.js (+13 -0)
📝 web/src/components/hooks.js (+44 -0)

📄 Description

This adds two things:

  • A token extension call max once per hour when receiving a push notification. The timestamp is also set from the tab's Account worker, so if that gets to it first, the service worker skips.
  • A periodicsync handler for the service worker, that will automatically refresh once per day.

In reality, the latter is not guaranteed, and is only supported in a very niche case: specifically Chrome PWAs that are installed. No other browser supports it, and normal Chrome tabs deny the periodic sync with PermissionDenied. Still nice to have and reuses the same code the push notification handler uses!

(Probably) fixes #1203, fixes #1533


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/binwiederhier/ntfy/pull/1669 **Author:** [@nihalgonsalves](https://github.com/nihalgonsalves) **Created:** 3/21/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ng/pwa-token-extend` --- ### 📝 Commits (1) - [`6a7c1c4`](https://github.com/binwiederhier/ntfy/commit/6a7c1c47aa962d8d0fc5de2cab389e47ca1be434) fix: token extension for PWAs ### 📊 Changes **5 files changed** (+139 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `docs/develop.md` (+1 -0) 📝 `web/public/sw.js` (+80 -9) 📝 `web/src/app/AccountApi.js` (+1 -0) 📝 `web/src/app/Session.js` (+13 -0) 📝 `web/src/components/hooks.js` (+44 -0) </details> ### 📄 Description This adds two things: - A token extension call max once per hour when receiving a push notification. The timestamp is also set from the tab's Account worker, so if that gets to it first, the service worker skips. - A [`periodicsync`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Periodic_Background_Synchronization_API) handler for the service worker, that will automatically refresh once per day. In reality, the latter is not guaranteed, and is only supported in a very niche case: specifically Chrome PWAs that are _installed_. No other browser supports it, and normal Chrome tabs deny the periodic sync with `PermissionDenied`. Still nice to have and reuses the same code the push notification handler uses! (Probably) fixes #1203, fixes #1533 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#1683
No description provided.