nodebb-plugin-onekite-discord 1.0.10 → 1.0.11

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 CHANGED
@@ -1,3 +1,5 @@
1
+ 'use strict';
2
+
1
3
  /**
2
4
  * Normalize links for Discord embeds.
3
5
  * Discord does NOT support masked links in embed descriptions.
@@ -17,12 +19,12 @@ function formatDiscordLinks(str) {
17
19
  return url;
18
20
  };
19
21
 
20
- // HTML <a href>
22
+ // HTML <a href="...">...</a> -> URL
21
23
  str = str.replace(/<a\s+[^>]*href=["']([^"']+)["'][^>]*>.*?<\/a>/gi, (_m, href) => {
22
24
  return normalizeUrl(href);
23
25
  });
24
26
 
25
- // Markdown [text](url)
27
+ // Markdown [text](url) -> URL
26
28
  str = str.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, _text, url) => {
27
29
  return normalizeUrl(url);
28
30
  });
@@ -35,25 +37,6 @@ function formatDiscordLinks(str) {
35
37
  return str;
36
38
  }
37
39
 
38
- 'use strict';
39
-
40
-
41
-
42
- ;
43
-
44
- // HTML links -> URL
45
- str = str.replace(/<a\s+[^>]*href=["']([^"']+)["'][^>]*>(.*?)<\/a>/gi, (_m, href, _text) => {
46
- return normalizeUrl(href);
47
- });
48
-
49
- // Markdown links [text](url) -> URL
50
- str = str.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, _text, url) => {
51
- return normalizeUrl(url);
52
- });
53
-
54
- return str;
55
- }
56
-
57
40
  const { request } = require('undici');
58
41
 
59
42
  const routeHelpers = require.main.require('./src/routes/helpers');
@@ -318,4 +301,4 @@ Plugin.onTopicReply = async (data) => {
318
301
  await sendDiscord(settings.webhookUrl, { content: built.content, embeds: [built.embed] });
319
302
  };
320
303
 
321
- module.exports = Plugin;
304
+ module.exports = Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-onekite-discord",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Discord webhook notifier for Onekite (NodeBB v4.x only)",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/plugin.json CHANGED
@@ -31,5 +31,5 @@
31
31
  "acpScripts": [
32
32
  "public/admin.js"
33
33
  ],
34
- "version": "1.0.10"
34
+ "version": "1.0.11"
35
35
  }