nodebb-plugin-link-preview 1.0.5 → 1.0.6
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 +7 -4
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable no-continue */
|
|
2
|
+
|
|
1
3
|
'use strict';
|
|
2
4
|
|
|
3
5
|
const winston = require.main.require('winston');
|
|
@@ -51,15 +53,16 @@ async function process(content, opts) {
|
|
|
51
53
|
const url = $anchor.attr('href');
|
|
52
54
|
|
|
53
55
|
if ($anchor.hasClass('plugin-mentions-a')) {
|
|
54
|
-
// eslint-disable-next-line no-continue
|
|
55
56
|
continue;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
const cached = cache.get(`link-preview:${url}`);
|
|
59
60
|
if (cached) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
if (cached.contentType) {
|
|
62
|
+
// eslint-disable-next-line no-await-in-loop
|
|
63
|
+
$anchor.replaceWith($(await render(cached)));
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
// Generate the preview, but return false for now so as to not block response
|