nodebb-plugin-web-push 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library.js +11 -7
- package/package.json +5 -5
package/library.js
CHANGED
|
@@ -165,26 +165,30 @@ plugin.onNotificationRescind = async ({ nids }) => {
|
|
|
165
165
|
subs = new Set(...Object.values(Object.fromEntries(subs))); // wtf
|
|
166
166
|
|
|
167
167
|
if (subs.size) {
|
|
168
|
-
subs.
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
await Promise.all(Array.from(subs).map(async (subscription) => {
|
|
169
|
+
try {
|
|
170
|
+
await webPush.sendNotification(subscription, JSON.stringify({ tag }));
|
|
171
|
+
} catch (e) {
|
|
172
|
+
winston.info(`[plugins/web-push] Push failed: ${e.code}; ${e.message}; statusCode: ${e.statusCode}`);
|
|
173
|
+
}
|
|
174
|
+
}));
|
|
171
175
|
}
|
|
172
|
-
}));
|
|
176
|
+
})).catch(err => winston.error(err.stack));
|
|
173
177
|
};
|
|
174
178
|
|
|
175
|
-
plugin.addProfileItem =
|
|
176
|
-
const title = await translator.translate('[[web-push:profile.label]]');
|
|
179
|
+
plugin.addProfileItem = (data) => {
|
|
177
180
|
data.links.push({
|
|
178
181
|
id: 'web-push',
|
|
179
182
|
route: 'web-push',
|
|
180
183
|
icon: 'fa-bell-o',
|
|
181
|
-
name:
|
|
184
|
+
name: '[[web-push:profile.label]]',
|
|
182
185
|
visibility: {
|
|
183
186
|
self: true,
|
|
184
187
|
other: false,
|
|
185
188
|
moderator: false,
|
|
186
189
|
globalMod: false,
|
|
187
190
|
admin: false,
|
|
191
|
+
canViewInfo: false,
|
|
188
192
|
},
|
|
189
193
|
});
|
|
190
194
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-web-push",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "A starter kit for quickly creating NodeBB plugins",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"repository": {
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"compatibility": "^3.10.x"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@commitlint/cli": "19.
|
|
38
|
-
"@commitlint/config-angular": "19.
|
|
37
|
+
"@commitlint/cli": "19.6.1",
|
|
38
|
+
"@commitlint/config-angular": "19.6.0",
|
|
39
39
|
"eslint": "8.x",
|
|
40
40
|
"eslint-config-nodebb": "0.2.1",
|
|
41
41
|
"eslint-plugin-import": "2.x",
|
|
42
|
-
"husky": "9.1.
|
|
43
|
-
"lint-staged": "15.
|
|
42
|
+
"husky": "9.1.7",
|
|
43
|
+
"lint-staged": "15.3.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"validator": "^13.12.0",
|