@ecency/render-helper 2.2.31 → 2.2.33
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/lib/catch-post-image.js +6 -0
- package/lib/catch-post-image.js.map +1 -1
- package/lib/consts/allowed-attributes.const.js +1 -1
- package/lib/consts/allowed-attributes.const.js.map +1 -1
- package/lib/consts/regexes.const.d.ts +1 -0
- package/lib/consts/regexes.const.js +2 -1
- package/lib/consts/regexes.const.js.map +1 -1
- package/lib/methods/iframe.method.js +6 -0
- package/lib/methods/iframe.method.js.map +1 -1
- package/lib/methods/p.method.d.ts +1 -0
- package/lib/methods/p.method.js +11 -0
- package/lib/methods/p.method.js.map +1 -0
- package/lib/methods/traverse.method.js +4 -0
- package/lib/methods/traverse.method.js.map +1 -1
- package/lib/render-helper.js +1 -1
- package/package.json +1 -1
- package/src/catch-post-image.spec.ts +10 -0
- package/src/catch-post-image.ts +7 -0
- package/src/consts/allowed-attributes.const.ts +1 -1
- package/src/consts/regexes.const.ts +1 -0
- package/src/markdown-2-html.spec.ts +90 -90
- package/src/methods/iframe.method.ts +80 -73
- package/src/methods/p.method.ts +6 -0
- package/src/methods/traverse.method.ts +4 -0
- package/src/test/data/legacy/10.json +1 -1
- package/src/test/data/legacy/21.json +1 -1
- package/src/test/data/legacy/2112524.json +2 -2
- package/src/test/data/legacy/22.json +1 -1
- package/src/test/data/legacy/23.json +1 -1
- package/src/test/data/legacy/25.json +1 -1
- package/src/test/data/legacy/26.json +1 -1
- package/src/test/data/legacy/27.JSON +1 -1
- package/src/test/data/legacy/31.json +1 -1
package/package.json
CHANGED
|
@@ -131,4 +131,14 @@ describe('catchPostImage', () => {
|
|
|
131
131
|
}
|
|
132
132
|
expect(catchPostImage(input as any)).toBe('')
|
|
133
133
|
})
|
|
134
|
+
|
|
135
|
+
it('11- Image field is string', () => {
|
|
136
|
+
const input = {
|
|
137
|
+
'json_metadata': {
|
|
138
|
+
'image': 'https://files.peakd.com/file/peakd-hive/aggroed/agtirkG8-image.png'
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const expected = 'https://images.ecency.com/p/hgjbks2vRxvf3xsYr6qQ7dm31DuBHGui8pKMdEVPxhLfEeEoVMPfUw4Z6QduNMpLay65R9vadbefhmDKmhM6HD8w8a.png?format=match&mode=fit'
|
|
142
|
+
expect(catchPostImage(input as any)).toBe(expected)
|
|
143
|
+
})
|
|
134
144
|
})
|
package/src/catch-post-image.ts
CHANGED
|
@@ -26,6 +26,13 @@ function getImage(entry: Entry, width = 0, height = 0, format = 'match'): string
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
if (meta && typeof meta.image === 'string' && meta.image.length > 0) {
|
|
30
|
+
if (isGifLink(meta.image)) {
|
|
31
|
+
return proxifyImageSrc(meta.image, 0, 0, format)
|
|
32
|
+
}
|
|
33
|
+
return proxifyImageSrc(meta.image, width, height, format)
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
if (meta && meta.image && !!meta.image.length && meta.image[0]) {
|
|
30
37
|
if (isGifLink(meta.image[0])) {
|
|
31
38
|
return proxifyImageSrc(meta.image[0], 0, 0, format)
|
|
@@ -24,6 +24,7 @@ export const DAPPLR_REGEX = /^(https?:)?\/\/[a-z]*\.dapplr.in\/file\/dapplr-vide
|
|
|
24
24
|
export const TRUVVL_REGEX = /^https?:\/\/embed.truvvl.com\/(@[\w.\d-]+)\/(.*)/i
|
|
25
25
|
export const LBRY_REGEX = /^(https?:)?\/\/lbry.tv\/\$\/embed\/.*/i
|
|
26
26
|
export const ODYSEE_REGEX = /^(https?:)?\/\/odysee.com\/\$\/embed\/.*/i
|
|
27
|
+
export const SKATEHIVE_IPFS_REGEX = /^https?:\/\/ipfs\.skatehive\.app\/ipfs\/([^/?#]+)/i
|
|
27
28
|
export const ARCH_REGEX = /^(https?:)?\/\/archive.org\/embed\/.*/i
|
|
28
29
|
export const SPEAK_REGEX = /(?:https?:\/\/(?:3speak.([a-z]+)\/watch\?v=)|(?:3speak.([a-z]+)\/embed\?v=))([A-Za-z0-9\_\-\.\/]+)(&.*)?/i
|
|
29
30
|
export const SPEAK_EMBED_REGEX = /^(https?:)?\/\/3speak.([a-z]+)\/embed\?.*/i
|