forge
Explore
Log in

Don't you dare go Hollow

forge

Clone
★ 0

0 watching0 forksRustAGPL-3.07.1 MiB490f099Tahinli7 hours ago322 commits

notifications.md65 lines, 3.4 KiBHistoryRawDownload
1# Notifications
2
3Forge keeps an inbox of notifications for each user (the bell in the top bar). The same
4notifications can also reach you by email, and by Web Push on your devices.
5
6## Web Push
7
8Web Push delivers a notification to a device even when no Forge tab is open. It works in
9Chromium-based browsers, Firefox and Safari, on desktop and on Android. On iPhone and iPad it works
10only for an app installed to the Home Screen.
11
12### Requirements
13
14- **HTTPS.** Browsers only offer push on a secure origin. Serve Forge over HTTPS (the usual
15 reverse-proxy setup). `localhost` also counts as secure for testing.
16- **iOS and iPadOS.** Open Forge in Safari, use Share, then Add to Home Screen, and open Forge from
17 that icon. Then turn push on in the notification settings. Safari in a normal tab cannot receive
18 push. iOS 16.4 or later is needed.
19- **Permission.** The browser asks for permission the first time you turn push on. If you refused,
20 allow notifications for the site in the browser's site settings and try again.
21
22### Turning it on
23
241. Open **Settings, Notifications**.
252. Under **Push notifications on this device**, choose **Turn on for this device**, then allow
26 notifications when the browser asks.
273. Choose **Send test notification** to check that the device gets one.
28
29Each browser profile, and each installed app, is a separate device. The **Devices** list shows
30every device with push on, when it was added and when it last received a notification. Remove a
31device there to stop its notifications; **Turn off for this device** does the same for the device
32you are using.
33
34### What is sent
35
36A notification carries a short title (for example `owner/repo#12`), a one-line body (the activity
37and the start of the title, at most 140 characters) and the link it opens. Nothing else is sent: no
38token, no email address and no body text. The push service sees that a message was delivered to
39your device, as with any push service.
40
41Only notifications that reach your inbox are pushed. The same rules apply: you hear about activity
42on threads you follow, when you are mentioned, assigned or asked to review, and so on. Watching a
43repo or ignoring a thread changes what reaches your inbox, and so what is pushed. Security alerts
44and site admin alerts are pushed the same way.
45
46Notifications on a lock screen can show the title of a private repository. Turn push off for a
47device you share.
48
49### Devices that stop working
50
51A push service answers `404` or `410` for a subscription that no longer exists, for example after
52the browser was reset or the app was uninstalled. Forge removes such a device by itself. A device
53that keeps failing is kept, so a temporary outage does not drop it.
54
55### Operator notes
56
57- Forge creates one VAPID key pair the first time push is used and stores it in the database. The
58 private key is sealed with the instance key (`data_dir/forge.key`). Keep both in your backups: a
59 restore that loses the VAPID key makes every device subscribe again.
60- The VAPID contact is the `base_url` of the instance when it is an `https` URL. Behind plain HTTP
61 the contact falls back to `https://localhost`.
62- Pushes go out from a background task and never delay the request that caused them. The server
63 makes outgoing requests to the push services, so it needs outbound HTTPS.
64- Each account can turn push on for at most 20 devices.
65- The service worker is served at `/sw.js`, the web app manifest at `/manifest.webmanifest`.