1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-19 02:53:17 +02:00

Fix auth base64, fix iPhone things

This commit is contained in:
Philipp Heckel 2022-03-10 18:11:12 -05:00
parent ccb9da9333
commit 160c72997f
7 changed files with 48 additions and 11 deletions
web/src/app

View file

@ -5,6 +5,9 @@ import logo from "../img/ntfy.png";
class Notifier {
async notify(subscriptionId, notification, onClickFallback) {
if (!this.supported()) {
return;
}
const subscription = await subscriptionManager.get(subscriptionId);
const shouldNotify = await this.shouldNotify(subscription, notification);
if (!shouldNotify) {
@ -38,10 +41,14 @@ class Notifier {
}
granted() {
return Notification.permission === 'granted';
return this.supported() && Notification.permission === 'granted';
}
maybeRequestPermission(cb) {
if (!this.supported()) {
cb(false);
return;
}
if (!this.granted()) {
Notification.requestPermission().then((permission) => {
const granted = permission === 'granted';
@ -61,6 +68,10 @@ class Notifier {
}
return true;
}
supported() {
return 'Notification' in window;
}
}
const notifier = new Notifier();