@ecency/render-helper 2.2.9 → 2.2.10

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.9",
3
+ "version": "2.2.10",
4
4
  "description": "Markdown+Html Render helper",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -25,4 +25,5 @@ export const WHITE_LIST = [
25
25
  'hiveblockexplorer.com',
26
26
  'proofofbrain.blog',
27
27
  'liketu.com',
28
+ 'inji.com'
28
29
  ]
@@ -49,16 +49,22 @@ export function markdownToHTML(input: string, forApp: boolean, webp: boolean): s
49
49
  //encrypt entities
50
50
  const entities = input.match(/&(.*?);/g);
51
51
  const encEntities:string[] = [];
52
- if(entities && forApp){
53
- entities.forEach((entity)=>{
54
- const CryptoJS = require("react-native-crypto-js");
55
- const encData = CryptoJS.AES.encrypt(entity, 'key').toString();
56
- const encyptedEntity = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encData));
57
- encEntities.push(encyptedEntity);
58
- input = input.replace(entity, encyptedEntity);
59
- })
52
+
53
+ try{
54
+ if(entities && forApp){
55
+ entities.forEach((entity)=>{
56
+ const CryptoJS = require("react-native-crypto-js");
57
+ const encData = CryptoJS.AES.encrypt(entity, 'key').toString();
58
+ const encyptedEntity = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encData));
59
+ encEntities.push(encyptedEntity);
60
+ input = input.replace(entity, encyptedEntity);
61
+ })
62
+ }
63
+ } catch (err){
64
+ console.log("failed to encrypt entities, ignore if not using mobile");
60
65
  }
61
66
 
67
+
62
68
  try {
63
69
  output = md.render(input)
64
70
  const doc = DOMParser.parseFromString(`<body id="root">${output}</body>`, 'text/html')