forge
Explore
Log in

Don't you dare go Hollow

forge

Clone
★ 0

0 watching0 forksRustAGPL-3.010.2 MiBeb7e617Tahinli1 month ago137 commits

notifications.md3.4 KiBHistoryRawDownload

Notifications

Forge keeps an inbox of notifications for each user (the bell in the top bar). The same notifications can also reach you by email, and by Web Push on your devices.

Web Push

Web Push delivers a notification to a device even when no Forge tab is open. It works in Chromium-based browsers, Firefox and Safari, on desktop and on Android. On iPhone and iPad it works only for an app installed to the Home Screen.

Requirements

  • HTTPS. Browsers only offer push on a secure origin. Serve Forge over HTTPS (the usual reverse-proxy setup). localhost also counts as secure for testing.
  • iOS and iPadOS. Open Forge in Safari, use Share, then Add to Home Screen, and open Forge from that icon. Then turn push on in the notification settings. Safari in a normal tab cannot receive push. iOS 16.4 or later is needed.
  • Permission. The browser asks for permission the first time you turn push on. If you refused, allow notifications for the site in the browser's site settings and try again.

Turning it on

  1. Open Settings, Notifications.
  2. Under Push notifications on this device, choose Turn on for this device, then allow notifications when the browser asks.
  3. Choose Send test notification to check that the device gets one.

Each browser profile, and each installed app, is a separate device. The Devices list shows every device with push on, when it was added and when it last received a notification. Remove a device there to stop its notifications; Turn off for this device does the same for the device you are using.

What is sent

A notification carries a short title (for example owner/repo#12), a one-line body (the activity and the start of the title, at most 140 characters) and the link it opens. Nothing else is sent: no token, no email address and no body text. The push service sees that a message was delivered to your device, as with any push service.

Only notifications that reach your inbox are pushed. The same rules apply: you hear about activity on threads you follow, when you are mentioned, assigned or asked to review, and so on. Watching a repo or ignoring a thread changes what reaches your inbox, and so what is pushed. Security alerts and site admin alerts are pushed the same way.

Notifications on a lock screen can show the title of a private repository. Turn push off for a device you share.

Devices that stop working

A push service answers 404 or 410 for a subscription that no longer exists, for example after the browser was reset or the app was uninstalled. Forge removes such a device by itself. A device that keeps failing is kept, so a temporary outage does not drop it.

Operator notes

  • Forge creates one VAPID key pair the first time push is used and stores it in the database. The private key is sealed with the instance key (data_dir/forge.key). Keep both in your backups: a restore that loses the VAPID key makes every device subscribe again.
  • The VAPID contact is the base_url of the instance when it is an https URL. Behind plain HTTP the contact falls back to https://localhost.
  • Pushes go out from a background task and never delay the request that caused them. The server makes outgoing requests to the push services, so it needs outbound HTTPS.
  • Each account can turn push on for at most 20 devices.
  • The service worker is served at /sw.js, the web app manifest at /manifest.webmanifest.