@ecency/render-helper 2.2.20 → 2.2.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecency/render-helper",
3
- "version": "2.2.20",
3
+ "version": "2.2.22",
4
4
  "description": "Markdown+Html Render helper",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -4,6 +4,12 @@ import { createDoc, makeEntryCacheKey } from './helper'
4
4
  import { cacheGet, cacheSet } from './cache'
5
5
  import { Entry } from './types'
6
6
 
7
+ const gifLinkRegex = /\.(gif)$/i;
8
+
9
+ function isGifLink(link: string) {
10
+ return gifLinkRegex.test(link);
11
+ }
12
+
7
13
  function getImage(entry: Entry, width = 0, height = 0, format = 'match'): string | null {
8
14
  /*
9
15
  * Return from json metadata if exists
@@ -21,6 +27,9 @@ function getImage(entry: Entry, width = 0, height = 0, format = 'match'): string
21
27
  }
22
28
 
23
29
  if (meta && meta.image && !!meta.image.length && meta.image[0]) {
30
+ if (isGifLink(meta.image[0])) {
31
+ return proxifyImageSrc(meta.image[0], 0, 0, format)
32
+ }
24
33
  return proxifyImageSrc(meta.image[0], width, height, format)
25
34
  }
26
35
 
@@ -34,6 +43,9 @@ function getImage(entry: Entry, width = 0, height = 0, format = 'match'): string
34
43
  const imgEls = doc.getElementsByTagName('img')
35
44
  if (imgEls.length >= 1) {
36
45
  const src = imgEls[0].getAttribute('src')
46
+ if (isGifLink(src)) {
47
+ return proxifyImageSrc(src, 0, 0, format)
48
+ }
37
49
  return proxifyImageSrc(src, width, height, format)
38
50
  }
39
51
 
@@ -14,5 +14,6 @@ export const SECTION_LIST = [
14
14
  'permissions',
15
15
  'referrals',
16
16
  'payout',
17
- 'activities'
17
+ 'activities',
18
+ 'spk'
18
19
  ]