Skip to content

Commit d40b776

Browse files
Merge pull request #788 from nimbleghost/clarify-web-push-other-server
Clarify that web push is not supported on other servers
2 parents d294a69 + 9dbac2c commit d40b776

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

Diff for: docs/known-issues.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Known issues
2-
This is an incomplete list of known issues with the ntfy server, Android app, and iOS app. You can find a complete
2+
This is an incomplete list of known issues with the ntfy server, web app, Android app, and iOS app. You can find a complete
33
list [on GitHub](https://github.com/binwiederhier/ntfy/labels/%F0%9F%AA%B2%20bug), but I thought it may be helpful
44
to have the prominent ones here to link to.
55

@@ -27,7 +27,7 @@ Be sure that in your selfhosted server:
2727
* Set `upstream-base-url: "https://ntfy.sh"` (**not your own hostname!**)
2828
* Ensure that the URL you set in `base-url` **matches exactly** what you set the Default Server in iOS to
2929

30-
## Firefox on Android not automatically subscribing to web push
30+
## Firefox on Android not automatically subscribing to web push (see [#789](https://github.com/binwiederhier/ntfy/issues/789))
3131
ntfy defaults to web-push based subscriptions when installed as a [progressive web app](./subscribe/pwa.md). Firefox
3232
Android has an [open bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1796434) where it reports the PWA mode incorrectly.
3333
This causes ntfy to not automatically subscribe to web push, and requires you to go to the ntfy Settings page to enable
@@ -36,3 +36,7 @@ it manually.
3636
## Safari does not play sounds for web push notifications
3737
Safari does not support playing sounds for web push notifications, and treats them all as silent. This will be fixed with
3838
iOS 17 / Safari 17, which will be released later in 2023.
39+
40+
## PWA on iOS sometimes crashes with an IndexedDB error (see [#787](https://github.com/binwiederhier/ntfy/issues/787))
41+
When resuming the installed PWA from the background, it sometimes crashes with an error from IndexedDB/Dexie, due to a
42+
[WebKit bug]( https://bugs.webkit.org/show_bug.cgi?id=197050). A reload will fix it until a permanent fix is found.

Diff for: web/public/static/langs/en.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
"subscribe_dialog_subscribe_description": "Topics may not be password-protected, so choose a name that's not easy to guess. Once subscribed, you can PUT/POST notifications.",
172172
"subscribe_dialog_subscribe_topic_placeholder": "Topic name, e.g. phil_alerts",
173173
"subscribe_dialog_subscribe_use_another_label": "Use another server",
174+
"subscribe_dialog_subscribe_use_another_background_info": "Notifications from other servers will not be received when the web app is not open",
174175
"subscribe_dialog_subscribe_base_url_label": "Service URL",
175176
"subscribe_dialog_subscribe_button_generate_topic_name": "Generate name",
176177
"subscribe_dialog_subscribe_button_cancel": "Cancel",
@@ -333,9 +334,9 @@
333334
"prefs_notifications_delete_after_one_week_description": "Notifications are auto-deleted after one week",
334335
"prefs_notifications_delete_after_one_month_description": "Notifications are auto-deleted after one month",
335336
"prefs_notifications_web_push_title": "Background notifications",
336-
"prefs_notifications_web_push_enabled_description": "Notifications are received even when web app is not running (via Web Push)",
337-
"prefs_notifications_web_push_disabled_description": "Notification are received when web app is running (via WebSocket)",
338-
"prefs_notifications_web_push_enabled": "Enabled",
337+
"prefs_notifications_web_push_enabled_description": "Notifications are received even when the web app is not running (via Web Push)",
338+
"prefs_notifications_web_push_disabled_description": "Notification are received when the web app is running (via WebSocket)",
339+
"prefs_notifications_web_push_enabled": "Enabled for {{server}}",
339340
"prefs_notifications_web_push_disabled": "Disabled",
340341
"prefs_users_title": "Manage users",
341342
"prefs_users_description": "Add/remove users for your protected topics here. Please note that username and password are stored in the browser's local storage.",

Diff for: web/src/components/Preferences.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { Info } from "@mui/icons-material";
3636
import { useOutletContext } from "react-router-dom";
3737
import theme from "./theme";
3838
import userManager from "../app/UserManager";
39-
import { playSound, shuffle, sounds, validUrl } from "../app/utils";
39+
import { playSound, shortUrl, shuffle, sounds, validUrl } from "../app/utils";
4040
import session from "../app/Session";
4141
import routes from "./routes";
4242
import accountApi, { Permission, Role } from "../app/AccountApi";
@@ -253,7 +253,7 @@ const WebPushEnabled = () => {
253253
>
254254
<FormControl fullWidth variant="standard" sx={{ m: 1 }}>
255255
<Select value={enabled ?? false} onChange={handleChange} aria-labelledby={labelId}>
256-
<MenuItem value>{t("prefs_notifications_web_push_enabled")}</MenuItem>
256+
<MenuItem value>{t("prefs_notifications_web_push_enabled", { server: shortUrl(config.base_url) })}</MenuItem>
257257
<MenuItem value={false}>{t("prefs_notifications_web_push_disabled")}</MenuItem>
258258
</Select>
259259
</FormControl>

Diff for: web/src/components/SubscribeDialog.jsx

+17-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
Switch,
1515
} from "@mui/material";
1616
import { useTranslation } from "react-i18next";
17+
import { useLiveQuery } from "dexie-react-hooks";
1718
import theme from "./theme";
1819
import api from "../app/Api";
1920
import { randomAlphanumericString, topicUrl, validTopic, validUrl } from "../app/utils";
@@ -28,6 +29,7 @@ import ReserveTopicSelect from "./ReserveTopicSelect";
2829
import { AccountContext } from "./App";
2930
import { TopicReservedError, UnauthorizedError } from "../app/errors";
3031
import { ReserveLimitChip } from "./SubscriptionPopup";
32+
import prefs from "../app/Prefs";
3133

3234
const publicBaseUrl = "https://ntfy.sh";
3335

@@ -96,6 +98,8 @@ const SubscribePage = (props) => {
9698
const reserveTopicEnabled =
9799
session.exists() && (account?.role === Role.ADMIN || (account?.role === Role.USER && (account?.stats.reservations_remaining || 0) > 0));
98100

101+
const webPushEnabled = useLiveQuery(() => prefs.webPushEnabled());
102+
99103
const handleSubscribe = async () => {
100104
const user = await userManager.get(baseUrl); // May be undefined
101105
const username = user ? user.username : t("subscribe_dialog_error_user_anonymous");
@@ -233,12 +237,19 @@ const SubscribePage = (props) => {
233237
inputValue={props.baseUrl}
234238
onInputChange={updateBaseUrl}
235239
renderInput={(params) => (
236-
<TextField
237-
{...params}
238-
placeholder={config.base_url}
239-
variant="standard"
240-
aria-label={t("subscribe_dialog_subscribe_base_url_label")}
241-
/>
240+
<>
241+
<TextField
242+
{...params}
243+
placeholder={config.base_url}
244+
variant="standard"
245+
aria-label={t("subscribe_dialog_subscribe_base_url_label")}
246+
/>
247+
{webPushEnabled && (
248+
<div style={{ width: "100%", color: "#aaa", fontSize: "0.75rem", marginTop: "0.5rem" }}>
249+
{t("subscribe_dialog_subscribe_use_another_background_info")}
250+
</div>
251+
)}
252+
</>
242253
)}
243254
/>
244255
)}

0 commit comments

Comments
 (0)