nodebb-plugin-link-preview 2.1.0 → 2.1.1
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
|
@@ -130,7 +130,8 @@ async function process(content, { type, pid, tid, attachments }) {
|
|
|
130
130
|
// Post attachments
|
|
131
131
|
if (pid && Array.isArray(attachments) && attachments.length) {
|
|
132
132
|
const attachmentData = await posts.attachments.getAttachments(attachments);
|
|
133
|
-
await Promise.all(attachmentData.filter(Boolean).map(async (
|
|
133
|
+
await Promise.all(attachmentData.filter(Boolean).map(async (attachment) => {
|
|
134
|
+
const { url, _type } = attachment;
|
|
134
135
|
const isInlineImage = new RegExp(`<img.+?src="${url}".+?>`).test(content);
|
|
135
136
|
if (isInlineImage) {
|
|
136
137
|
return;
|
|
@@ -142,6 +143,14 @@ async function process(content, { type, pid, tid, attachments }) {
|
|
|
142
143
|
return;
|
|
143
144
|
}
|
|
144
145
|
|
|
146
|
+
if (attachment.hasOwnProperty('mediaType') && attachment.mediaType.startsWith('video/')) { // ActivityPub
|
|
147
|
+
cache.set(`link-preview:${url}`, {
|
|
148
|
+
...attachment,
|
|
149
|
+
contentType: attachment.mediaType,
|
|
150
|
+
mediaType: 'video',
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
145
154
|
const type = _type || 'attachment';
|
|
146
155
|
requests.set(url, { type });
|
|
147
156
|
}));
|
|
@@ -237,8 +246,8 @@ async function process(content, { type, pid, tid, attachments }) {
|
|
|
237
246
|
}
|
|
238
247
|
|
|
239
248
|
content = $.html();
|
|
240
|
-
content += attachmentHtml ? `\n\n<div class="row"><div class="col-12">${attachmentHtml}</div></div>` : '';
|
|
241
|
-
content += placeholderHtml ? `\n\n<div class="row"><div class="col-12">${placeholderHtml}</div></div>` : '';
|
|
249
|
+
content += attachmentHtml ? `\n\n<div class="row"><div class="col-12 mt-3">${attachmentHtml}</div></div>` : '';
|
|
250
|
+
content += placeholderHtml ? `\n\n<div class="row"><div class="col-12 mt-3">${placeholderHtml}</div></div>` : '';
|
|
242
251
|
return content;
|
|
243
252
|
}
|
|
244
253
|
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-link-preview",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "nodebb-plugin-link-preview",
|
|
9
|
-
"version": "2.1.
|
|
9
|
+
"version": "2.1.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"cheerio": "^1.0.0-rc.12",
|
package/package.json
CHANGED