From 9142c509228f90d91a98186e679c35f5ce20a6bc Mon Sep 17 00:00:00 2001 From: Y-PLONI <7353755@gmail.com> Date: Tue, 27 Jan 2026 13:59:13 +0200 Subject: [PATCH 1/4] Add Hebrew translation --- public/languages/he-IL/web-push.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 public/languages/he-IL/web-push.json diff --git a/public/languages/he-IL/web-push.json b/public/languages/he-IL/web-push.json new file mode 100644 index 0000000..7d63066 --- /dev/null +++ b/public/languages/he-IL/web-push.json @@ -0,0 +1,11 @@ +{ + "profile.label": "התראות דחיפה", + "profile.introduction": "בנוסף להתראות בתוך האפליקציה ולהתראות בדוא״ל, ניתן לבחור לקבל גם התראות דחיפה. כך תוכלו לקבל התראות גם כשהאפליקציה אינה פתוחה במכשיר.", + "profile.option": "הפעלת התראות דחיפה במכשיר זה", + "profile.devices": "כרגע נשלחות התראות ל־%1 מכשיר(ים).", + "profile.permissionBlocked": "המכשיר שלך אינו מאפשר כרגע לקבל התראות מאתר זה. יש לאשר את הרשאת ההתראות כדי להמשיך.", + "profile.send-test": "שליחת התראת בדיקה", + + "toast.test_success": "התראת הבדיקה נשלחה.", + "toast.test_unavailable": "לא ניתן לשלוח התראת בדיקה כי התראות דחיפה אינן מופעלות במכשיר זה." +} From 552619b815c705563fdc557fe5ff4b8551e8fb5f Mon Sep 17 00:00:00 2001 From: ClickAndGoScript Date: Wed, 4 Feb 2026 13:52:14 +0200 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=D7=A2=D7=93=D7=9B=D7=95=D7=A0?= =?UTF-8?q?=D7=99=D7=9D=20=D7=9E=D7=99=D7=A0=D7=95=D7=A8=D7=99=D7=99=D7=9D?= =?UTF-8?q?=20=D7=9C=D7=94=D7=92=D7=93=D7=A8=D7=95=D7=AA=20=D7=95=D7=AA?= =?UTF-8?q?=D7=A8=D7=92=D7=95=D7=9D=20web-push?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - הוספת nodebb-plugin-web-push-1.xml ל-.gitignore כדי למנוע מעקב אחר קבצי תצורה או יומנים שנוצרו על ידי הפלאגין, מה שמסייע בשמירה על ניקיון המאגר - תיקון רווח קטן בטקסט ההתראה בקובץ השפה העברית כדי לשפר את הקריאות והעיצוב, ללא שינוי בתוכן הפונקציונלי --- .gitignore | 1 + public/languages/he-IL/web-push.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d77e539..f1ff4ad 100644 --- a/.gitignore +++ b/.gitignore @@ -216,3 +216,4 @@ pip-log.txt sftp-config.json node_modules/ +nodebb-plugin-web-push-1.xml diff --git a/public/languages/he-IL/web-push.json b/public/languages/he-IL/web-push.json index 7d63066..1a5ee43 100644 --- a/public/languages/he-IL/web-push.json +++ b/public/languages/he-IL/web-push.json @@ -2,7 +2,7 @@ "profile.label": "התראות דחיפה", "profile.introduction": "בנוסף להתראות בתוך האפליקציה ולהתראות בדוא״ל, ניתן לבחור לקבל גם התראות דחיפה. כך תוכלו לקבל התראות גם כשהאפליקציה אינה פתוחה במכשיר.", "profile.option": "הפעלת התראות דחיפה במכשיר זה", - "profile.devices": "כרגע נשלחות התראות ל־%1 מכשיר(ים).", + "profile.devices": "כרגע נשלחות התראות ל־ %1 מכשיר(ים).", "profile.permissionBlocked": "המכשיר שלך אינו מאפשר כרגע לקבל התראות מאתר זה. יש לאשר את הרשאת ההתראות כדי להמשיך.", "profile.send-test": "שליחת התראת בדיקה", From 98b9b72c5b2c4c25c2af79cb004b18bacc073b2f Mon Sep 17 00:00:00 2001 From: ClickAndGoScript Date: Mon, 27 Apr 2026 07:50:11 +0300 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20=D7=A9=D7=99=D7=A0=D7=95=D7=99=20?= =?UTF-8?q?=D7=A9=D7=9D=20=D7=AA=D7=99=D7=A7=D7=99=D7=99=D7=AA=20=D7=94?= =?UTF-8?q?=D7=9C=D7=95=D7=A7=D7=9C=D7=99=D7=96=D7=A6=D7=99=D7=94=20=D7=9E?= =?UTF-8?q?-he-IL=20=D7=9C-he?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - שינוי שם התיקיה public/languages/he-IL ל-public/languages/he עבור קבצי השפה העברית (ללא שינוי בתוכן) --- public/languages/{he-IL => he}/web-push.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename public/languages/{he-IL => he}/web-push.json (100%) diff --git a/public/languages/he-IL/web-push.json b/public/languages/he/web-push.json similarity index 100% rename from public/languages/he-IL/web-push.json rename to public/languages/he/web-push.json From d1d5e14460960679d683cfbb6f9c5eea76a55327 Mon Sep 17 00:00:00 2001 From: ClickAndGoScript Date: Fri, 1 May 2026 13:09:15 +0300 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=D7=94=D7=95=D7=A1=D7=A4=D7=AA=20?= =?UTF-8?q?=D7=98=D7=99=D7=A4=D7=95=D7=9C=20=D7=91=D7=94=D7=A8=D7=A9=D7=90?= =?UTF-8?q?=D7=95=D7=AA=20=D7=94=D7=AA=D7=A8=D7=90=D7=95=D7=AA=20=D7=95?= =?UTF-8?q?=D7=A9=D7=92=D7=99=D7=90=D7=95=D7=AA=20=D7=94=D7=A8=D7=A9=D7=9E?= =?UTF-8?q?=D7=94=20=D7=9C=D7=A4=D7=95=D7=A9=20=D7=A0=D7=95=D7=98=D7=99?= =?UTF-8?q?=D7=A4=D7=99=D7=A7=D7=99=D7=99=D7=A9=D7=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - הוספת בדיקת 'denied' לפני ניסיון הרשמה להתראות ב-settings.js - טיפול ב-iOS Safari: שמירה על activation לפני בקשת הרשמה - הוספת rollback אם הרשמה נכשלה אחרי יצירת subscription בדפדפן - הוספת מפתחות תרגום חדשים: permission_denied ו-subscribe_failed באנגלית, עברית וסינית --- public/languages/en-GB/web-push.json | 4 +++- public/languages/he/web-push.json | 4 +++- public/languages/zh-CN/web-push.json | 4 +++- public/lib/settings.js | 33 +++++++++++++++++++++++++++- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/public/languages/en-GB/web-push.json b/public/languages/en-GB/web-push.json index 2e8f3ab..44f106c 100644 --- a/public/languages/en-GB/web-push.json +++ b/public/languages/en-GB/web-push.json @@ -7,5 +7,7 @@ "profile.send-test": "Send Test Notification", "toast.test_success": "Test notification sent.", - "toast.test_unavailable": "Cannot send test notification as push notifications are not enabled on this device." + "toast.test_unavailable": "Cannot send test notification as push notifications are not enabled on this device.", + "toast.permission_denied": "Notification permission was denied. Please enable notifications for this site in your browser settings.", + "toast.subscribe_failed": "Could not enable push notifications on this device. Please try again." } \ No newline at end of file diff --git a/public/languages/he/web-push.json b/public/languages/he/web-push.json index 1a5ee43..c55f550 100644 --- a/public/languages/he/web-push.json +++ b/public/languages/he/web-push.json @@ -7,5 +7,7 @@ "profile.send-test": "שליחת התראת בדיקה", "toast.test_success": "התראת הבדיקה נשלחה.", - "toast.test_unavailable": "לא ניתן לשלוח התראת בדיקה כי התראות דחיפה אינן מופעלות במכשיר זה." + "toast.test_unavailable": "לא ניתן לשלוח התראת בדיקה כי התראות דחיפה אינן מופעלות במכשיר זה.", + "toast.permission_denied": "הרשאת ההתראות נדחתה. יש לאפשר התראות עבור אתר זה בהגדרות הדפדפן.", + "toast.subscribe_failed": "לא ניתן להפעיל התראות דחיפה במכשיר זה. נסו שוב." } diff --git a/public/languages/zh-CN/web-push.json b/public/languages/zh-CN/web-push.json index ab3abcd..be81cf3 100644 --- a/public/languages/zh-CN/web-push.json +++ b/public/languages/zh-CN/web-push.json @@ -7,5 +7,7 @@ "profile.send-test": "发送测试通知", "toast.test_success": "测试通知已发送。", - "toast.test_unavailable": "由于此设备未启用推送通知,因此无法发送测试通知。" + "toast.test_unavailable": "由于此设备未启用推送通知,因此无法发送测试通知。", + "toast.permission_denied": "通知权限已被拒绝。请在浏览器设置中允许此站点发送通知。", + "toast.subscribe_failed": "无法在此设备上启用推送通知。请重试。" } \ No newline at end of file diff --git a/public/lib/settings.js b/public/lib/settings.js index 5c5cee4..6daf084 100644 --- a/public/lib/settings.js +++ b/public/lib/settings.js @@ -33,7 +33,30 @@ export async function init() { case 'toggle': { const countEl = document.querySelector('#deviceCount strong'); if (!subscription) { + // iOS Safari is strict about user activation: subscribe() must be + // called from the same synchronous task as the click. We branch BEFORE + // any await: if permission is already granted, call subscribe() first + // (no awaits in between). Otherwise request permission, which itself + // preserves activation on Chrome but may lose it on iOS — the user can + // just tap again. + if (Notification.permission === 'denied') { + subselector.checked = false; + warning('[[web-push:toast.permission_denied]]'); + document.getElementById('permission-warning').classList.remove('d-none'); + break; + } + try { + if (Notification.permission !== 'granted') { + const permission = await Notification.requestPermission(); + if (permission !== 'granted') { + subselector.checked = false; + warning('[[web-push:toast.permission_denied]]'); + document.getElementById('permission-warning').classList.remove('d-none'); + break; + } + } + subscription = await registration.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: convertedVapidKey, @@ -45,8 +68,16 @@ export async function init() { let count = parseInt(countEl.textContent, 10); count += 1; countEl.innerText = count; - } catch (e) { + } catch (err) { + console.error('[web-push] subscribe failed:', err); subselector.checked = false; + // Roll back any browser-level subscription created before the failure. + const stale = await registration.pushManager.getSubscription(); + if (stale) { + await stale.unsubscribe(); + } + subscription = null; + warning('[[web-push:toast.subscribe_failed]]'); } } else { await subscription.unsubscribe();