nodebb-plugin-link-preview 2.1.1 → 2.1.3
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 +21 -6
- package/package.json +1 -1
- package/package-lock.json +0 -4889
package/library.js
CHANGED
|
@@ -143,12 +143,27 @@ async function process(content, { type, pid, tid, attachments }) {
|
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
// ActivityPub attachments
|
|
147
|
+
if (attachment.hasOwnProperty('mediaType') && attachment.mediaType) {
|
|
148
|
+
switch (true) {
|
|
149
|
+
case attachment.mediaType.startsWith('video/'): {
|
|
150
|
+
cache.set(`link-preview:${url}`, {
|
|
151
|
+
...attachment,
|
|
152
|
+
contentType: attachment.mediaType,
|
|
153
|
+
mediaType: 'video',
|
|
154
|
+
});
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
case attachment.mediaType.startsWith('image/'): {
|
|
159
|
+
cache.set(`link-preview:${url}`, {
|
|
160
|
+
...attachment,
|
|
161
|
+
contentType: attachment.mediaType,
|
|
162
|
+
mediaType: 'image',
|
|
163
|
+
});
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
152
167
|
}
|
|
153
168
|
|
|
154
169
|
const type = _type || 'attachment';
|