nodebb-plugin-web-push 0.7.6 → 0.7.8

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.
@@ -1,11 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const user = require.main.require('./src/user');
3
+ const user = nodebb.require('./src/user');
4
+ const helpers = nodebb.require('./src/controllers/helpers');
4
5
 
5
6
  const subscriptions = require('./subscriptions');
6
7
 
7
- const helpers = require.main.require('./src/controllers/helpers');
8
-
9
8
  const Controllers = module.exports;
10
9
 
11
10
  Controllers.renderSettings = async function (req, res) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const db = require.main.require('./src/database');
3
+ const db = nodebb.require('./src/database');
4
4
 
5
5
  const Subscriptions = module.exports;
6
6
 
package/library.js CHANGED
@@ -1,23 +1,24 @@
1
1
  'use strict';
2
2
 
3
- const nconf = require.main.require('nconf');
4
- const winston = require.main.require('winston');
5
3
  const webPush = require('web-push');
6
4
  const validator = require('validator');
7
5
 
8
- const db = require.main.require('./src/database');
9
- const user = require.main.require('./src/user');
10
- const meta = require.main.require('./src/meta');
11
- const utils = require.main.require('./src/utils');
12
- const translator = require.main.require('./src/translator');
13
- const notifications = require.main.require('./src/notifications');
6
+ const nconf = nodebb.require('nconf');
7
+ const winston = nodebb.require('winston');
8
+
9
+ const db = nodebb.require('./src/database');
10
+ const user = nodebb.require('./src/user');
11
+ const meta = nodebb.require('./src/meta');
12
+ const utils = nodebb.require('./src/utils');
13
+ const translator = nodebb.require('./src/translator');
14
+ const notifications = nodebb.require('./src/notifications');
15
+
16
+ const routeHelpers = nodebb.require('./src/routes/helpers');
14
17
 
15
18
  const controllers = require('./lib/controllers');
16
19
  const subscriptions = require('./lib/subscriptions');
17
20
 
18
- const routeHelpers = require.main.require('./src/routes/helpers');
19
-
20
- const plugin = {};
21
+ const plugin = module.exports;
21
22
 
22
23
  plugin.init = async (params) => {
23
24
  const { router, middleware/* , controllers */ } = params;
@@ -218,6 +219,7 @@ async function constructPayload(notification, uid, lang) {
218
219
 
219
220
  let [title, body] = await translator.translateKeys([bodyShort, bodyLong], lang);
220
221
  ([title, body] = [title, body].map(str => validator.unescape(utils.stripHTMLTags(str))));
222
+ title = `${dir === 'rtl' ? '\u200f' : '\u200e'}${title}`;
221
223
  const tag = mergeId || nid;
222
224
  const url = `${nconf.get('url')}${path}`;
223
225
 
@@ -246,5 +248,3 @@ async function constructPayload(notification, uid, lang) {
246
248
  data: { url, icon, badge },
247
249
  };
248
250
  }
249
-
250
- module.exports = plugin;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nodebb-plugin-web-push",
3
- "version": "0.7.6",
4
- "description": "A starter kit for quickly creating NodeBB plugins",
3
+ "version": "0.7.8",
4
+ "description": "A plugin for adding native push notifications to NodeBB via the Web Push API.",
5
5
  "main": "library.js",
6
6
  "repository": {
7
7
  "type": "git",
@@ -35,16 +35,15 @@
35
35
  },
36
36
  "readmeFilename": "README.md",
37
37
  "nbbpm": {
38
- "compatibility": "^4.0.0"
38
+ "compatibility": "^4.12.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@commitlint/cli": "20.1.0",
42
- "@commitlint/config-angular": "20.0.0",
43
- "eslint": "^9.25.1",
44
- "eslint-config-nodebb": "^1.1.4",
45
- "eslint-plugin-import": "^2.31.0",
41
+ "@commitlint/cli": "21.0.2",
42
+ "@commitlint/config-angular": "21.0.2",
43
+ "@eslint/js": "^10.0.1",
44
+ "eslint-config-nodebb": "^2.0.2",
46
45
  "husky": "9.1.7",
47
- "lint-staged": "16.2.6"
46
+ "lint-staged": "17.0.5"
48
47
  },
49
48
  "dependencies": {
50
49
  "validator": "^13.12.0",
package/test/index.js CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  const assert = require('assert');
22
22
 
23
- const db = require.main.require('./test/mocks/databasemock');
23
+ const db = nodebb.require('./test/mocks/databasemock');
24
24
 
25
25
  describe('nodebb-plugin-web-push', () => {
26
26
  before(() => {