nodebb-plugin-link-preview 1.0.0 → 1.0.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 +6 -0
- package/package.json +1 -1
- package/static/templates/partials/link-preview/html.tpl +3 -3
- package/yarn-error.log +0 -2557
package/library.js
CHANGED
|
@@ -101,6 +101,8 @@ async function process(content) {
|
|
|
101
101
|
}));
|
|
102
102
|
|
|
103
103
|
// Replace match with embed
|
|
104
|
+
previews.reverse();
|
|
105
|
+
matches.reverse();
|
|
104
106
|
previews.forEach((preview, idx) => {
|
|
105
107
|
if (preview) {
|
|
106
108
|
const match = matches[idx];
|
|
@@ -120,6 +122,10 @@ async function render(preview) {
|
|
|
120
122
|
|
|
121
123
|
winston.verbose(`[link-preview] ${preview.url} (${preview.contentType || 'invalid'}, cache: hit)`);
|
|
122
124
|
|
|
125
|
+
if (!preview.contentType) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
|
|
123
129
|
if (embedHtml && preview.contentType.startsWith('text/html')) {
|
|
124
130
|
return await app.renderAsync('partials/link-preview/html', preview);
|
|
125
131
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<div class="card col-6 position-relative link-preview">
|
|
1
|
+
<div class="card col-md-9 col-lg-6 position-relative link-preview">
|
|
2
2
|
{{{ if images.length }}}
|
|
3
3
|
{{{ each images }}}
|
|
4
4
|
{{{ if @first }}}
|
|
5
|
-
<img src="{@value}" class="card-img-top" style="max-height: 15rem;" />
|
|
5
|
+
<img src="{@value}" class="card-img-top not-responsive" style="max-height: 15rem;" />
|
|
6
6
|
{{{ end }}}
|
|
7
7
|
{{{ end }}}
|
|
8
8
|
{{{ end }}}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
{{{ if favicons.length }}}
|
|
19
19
|
{{{ each favicons }}}
|
|
20
20
|
{{{ if @first }}}
|
|
21
|
-
<img src="{@value}" alt="favicon" style="max-width: 21px; max-height: 21px;" />
|
|
21
|
+
<img src="{@value}" alt="favicon" class="not-responsive" style="max-width: 21px; max-height: 21px;" />
|
|
22
22
|
{{{ end }}}
|
|
23
23
|
{{{ end }}}
|
|
24
24
|
{{{ end }}}
|