@ecency/render-helper 2.2.12 → 2.2.16
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 +7 -7
- package/lib/catch-post-image.js.map +1 -1
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/consts/index.js.map +1 -1
- package/lib/consts/regexes.const.d.ts +1 -0
- package/lib/consts/regexes.const.js +3 -2
- package/lib/consts/regexes.const.js.map +1 -1
- package/lib/consts/section-list.const.d.ts +1 -0
- package/lib/consts/section-list.const.js +19 -0
- package/lib/consts/section-list.const.js.map +1 -0
- package/lib/helper.js +1 -1
- package/lib/helper.js.map +1 -1
- package/lib/markdown-2-html.js +7 -7
- package/lib/markdown-2-html.js.map +1 -1
- package/lib/methods/a.method.js +75 -61
- package/lib/methods/a.method.js.map +1 -1
- package/lib/methods/clean-reply.method.js +2 -2
- package/lib/methods/iframe.method.js +5 -5
- package/lib/methods/iframe.method.js.map +1 -1
- package/lib/methods/img.method.js +1 -1
- package/lib/methods/img.method.js.map +1 -1
- package/lib/methods/linkify.method.js +11 -11
- package/lib/methods/linkify.method.js.map +1 -1
- package/lib/methods/markdown-to-html.method.js +5 -5
- package/lib/methods/markdown-to-html.method.js.map +1 -1
- package/lib/methods/sanitize-html.method.js +1 -1
- package/lib/methods/sanitize-html.method.js.map +1 -1
- package/lib/methods/text.method.js +12 -12
- package/lib/methods/text.method.js.map +1 -1
- package/lib/methods/traverse.method.js +4 -4
- package/lib/methods/traverse.method.js.map +1 -1
- package/lib/post-body-summary.js +6 -5
- package/lib/post-body-summary.js.map +1 -1
- package/lib/proxify-image-src.js +12 -8
- package/lib/proxify-image-src.js.map +1 -1
- package/lib/render-helper.js +1 -1
- package/package.json +1 -1
- package/src/consts/index.ts +1 -0
- package/src/consts/regexes.const.ts +2 -1
- package/src/consts/section-list.const.ts +15 -0
- package/src/markdown-2-html.spec.ts +56 -8
- package/src/methods/a.method.ts +38 -20
- package/src/methods/clean-reply.method.ts +2 -2
- package/src/methods/linkify.method.ts +2 -2
- package/src/methods/markdown-to-html.method.ts +2 -2
- package/src/post-body-summary.ts +3 -1
- package/src/test/data/legacy/23.json +1 -1
- package/src/test/data/legacy/27.JSON +1 -1
package/package.json
CHANGED
package/src/consts/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const MENTION_REGEX = /^https?:\/\/(.*)\/(@[\w.\d-]+)$/i
|
|
|
8
8
|
export const TOPIC_REGEX = /^https?:\/\/(.*)\/(trending|hot|created|promoted|muted|payout)\/(.*)$/i
|
|
9
9
|
export const INTERNAL_MENTION_REGEX = /^\/@[\w.\d-]+$/i
|
|
10
10
|
export const INTERNAL_TOPIC_REGEX = /^\/(trending|hot|created|promoted|muted|payout)\/(.*)$/i
|
|
11
|
-
export const INTERNAL_POST_TAG_REGEX =
|
|
11
|
+
export const INTERNAL_POST_TAG_REGEX = /(.*)\/(@[\w.\d-]+)\/(.*)/i
|
|
12
12
|
export const INTERNAL_POST_REGEX = /^\/(@[\w.\d-]+)\/(.*)$/i
|
|
13
13
|
export const CUSTOM_COMMUNITY_REGEX = /^https?:\/\/(.*)\/c\/(hive-\d+)(.*)/i
|
|
14
14
|
export const YOUTUBE_REGEX = /(?:youtube.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu.be\/)([^"&?\/\s]{11})/g
|
|
@@ -39,3 +39,4 @@ export const BRAND_NEW_TUBE_REGEX = /^https:\/\/brandnewtube\.com\/embed\/[a-z0-
|
|
|
39
39
|
export const LOOM_REGEX = /^(https?:)?\/\/www.loom.com\/share\/(.*)/i
|
|
40
40
|
export const LOOM_EMBED_REGEX = /^(https?:)?\/\/www.loom.com\/embed\/(.*)/i
|
|
41
41
|
export const AUREAL_EMBED_REGEX = /^(https?:\/\/)?(www\.)?(?:aureal-embed)\.web\.app\/([0-9]+)/i
|
|
42
|
+
export const ENTITY_REGEX = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/ig;
|
|
@@ -99,6 +99,30 @@ describe('Markdown2Html', () => {
|
|
|
99
99
|
expect(markdown2Html(input)).toBe(expected)
|
|
100
100
|
})
|
|
101
101
|
|
|
102
|
+
it('7.1- Should handle raw d.tube videos without thumbnail', () => {
|
|
103
|
+
const input = {
|
|
104
|
+
author: 'foo37.1',
|
|
105
|
+
permlink: 'bar37.1',
|
|
106
|
+
last_update: '2020-05-10T09:15:21',
|
|
107
|
+
body: 'https://d.tube/#!/v/techcoderx/QmVdEYicJwiTxSk2U9ER1Yc8Rumb1Nek4KynqAYGyQs7ga'
|
|
108
|
+
}
|
|
109
|
+
const expected = '<p><a class="markdown-video-link markdown-video-link-dtube" data-embed-src="https://emb.d.tube/#!/techcoderx/QmVdEYicJwiTxSk2U9ER1Yc8Rumb1Nek4KynqAYGyQs7ga"><span class="markdown-video-play"></span></a></p>'
|
|
110
|
+
|
|
111
|
+
expect(markdown2Html(input)).toBe(expected)
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('7.2- Should handle raw d.tube videos different format', () => {
|
|
115
|
+
const input = {
|
|
116
|
+
author: 'foo37.2',
|
|
117
|
+
permlink: 'bar37.2',
|
|
118
|
+
last_update: '2020-05-10T09:15:21',
|
|
119
|
+
body: 'https://d.tube/v/techcoderx/QmVdEYicJwiTxSk2U9ER1Yc8Rumb1Nek4KynqAYGyQs7ga'
|
|
120
|
+
}
|
|
121
|
+
const expected = '<p><a class="markdown-video-link markdown-video-link-dtube" data-embed-src="https://emb.d.tube/#!/techcoderx/QmVdEYicJwiTxSk2U9ER1Yc8Rumb1Nek4KynqAYGyQs7ga"><span class="markdown-video-play"></span></a></p>'
|
|
122
|
+
|
|
123
|
+
expect(markdown2Html(input)).toBe(expected)
|
|
124
|
+
})
|
|
125
|
+
|
|
102
126
|
it('9- Should handle witnesses links', () => {
|
|
103
127
|
const input = {
|
|
104
128
|
author: 'foo39',
|
|
@@ -142,7 +166,7 @@ describe('Markdown2Html', () => {
|
|
|
142
166
|
last_update: '2019-05-10T09:15:21',
|
|
143
167
|
body: '<iframe width="560" height="315" src="https://www.youtube.com/embed/I3f9ixg59no?foo=bar&baz=000" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
|
144
168
|
}
|
|
145
|
-
const expected = '<iframe src=\"https://www.youtube.com/embed/I3f9ixg59no\" allowfullscreen=\"allowfullscreen\"></iframe>'
|
|
169
|
+
const expected = '<iframe src=\"https://www.youtube.com/embed/I3f9ixg59no\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"></iframe>'
|
|
146
170
|
|
|
147
171
|
expect(markdown2Html(input)).toBe(expected)
|
|
148
172
|
})
|
|
@@ -620,7 +644,7 @@ describe('Markdown2Html', () => {
|
|
|
620
644
|
expect(markdown2Html(input)).toBe(expected)
|
|
621
645
|
})
|
|
622
646
|
|
|
623
|
-
it('43- Should handle dtube iframe', () => {
|
|
647
|
+
it('43 - Should handle dtube iframe', () => {
|
|
624
648
|
const input = {
|
|
625
649
|
author: 'foo343',
|
|
626
650
|
permlink: 'bar343',
|
|
@@ -632,7 +656,7 @@ describe('Markdown2Html', () => {
|
|
|
632
656
|
expect(markdown2Html(input)).toBe(expected)
|
|
633
657
|
})
|
|
634
658
|
|
|
635
|
-
it('44- Should handle vimm iframe', () => {
|
|
659
|
+
it('44 - Should handle vimm iframe', () => {
|
|
636
660
|
const input = {
|
|
637
661
|
author: 'foo344',
|
|
638
662
|
permlink: 'bar344',
|
|
@@ -656,7 +680,7 @@ describe('Markdown2Html', () => {
|
|
|
656
680
|
expect(markdown2Html(input)).toBe(expected)
|
|
657
681
|
})
|
|
658
682
|
|
|
659
|
-
it('46- Should handle copied md links', () => {
|
|
683
|
+
it('46 - Should handle copied md links', () => {
|
|
660
684
|
const input = {
|
|
661
685
|
author: 'foo346',
|
|
662
686
|
permlink: 'bar346',
|
|
@@ -668,7 +692,7 @@ describe('Markdown2Html', () => {
|
|
|
668
692
|
expect(markdown2Html(input)).toBe(expected)
|
|
669
693
|
})
|
|
670
694
|
|
|
671
|
-
it('47- Should handle internal links', () => {
|
|
695
|
+
it('47 - Should handle internal links', () => {
|
|
672
696
|
const input = {
|
|
673
697
|
author: 'foo347',
|
|
674
698
|
permlink: 'bar347',
|
|
@@ -878,10 +902,10 @@ describe('Markdown2Html', () => {
|
|
|
878
902
|
expect(markdown2Html(input, false)).toBe(expected)
|
|
879
903
|
})
|
|
880
904
|
|
|
881
|
-
it('65- Should handle youtube.com/embed videos', () => {
|
|
905
|
+
it('65 - Should handle youtube.com/embed videos', () => {
|
|
882
906
|
const input = {
|
|
883
|
-
author: '
|
|
884
|
-
permlink: '
|
|
907
|
+
author: 'foo365',
|
|
908
|
+
permlink: 'bar365',
|
|
885
909
|
last_update: '2019-05-10T09:15:21',
|
|
886
910
|
body: 'https://www.youtube.com/embed/UuyS7YAkECA?start=295&autoplay=1'
|
|
887
911
|
}
|
|
@@ -889,6 +913,30 @@ describe('Markdown2Html', () => {
|
|
|
889
913
|
|
|
890
914
|
expect(markdown2Html(input)).toBe(expected)
|
|
891
915
|
})
|
|
916
|
+
|
|
917
|
+
it('66 - Should handle internal links with params', () => {
|
|
918
|
+
const input = {
|
|
919
|
+
author: 'foo366',
|
|
920
|
+
permlink: 'bar366',
|
|
921
|
+
last_update: '2019-05-10T09:15:21',
|
|
922
|
+
body: 'direct link https://ecency.com/@ecency/faq?history'
|
|
923
|
+
}
|
|
924
|
+
const expected = '<p>direct link <a class=\"markdown-post-link\" data-tag=\"post\" data-author=\"ecency\" data-permlink=\"faq?history\">@ecency/faq?history</a></p>'
|
|
925
|
+
|
|
926
|
+
expect(markdown2Html(input)).toBe(expected)
|
|
927
|
+
})
|
|
928
|
+
|
|
929
|
+
it('67 - Should handle section links with params', () => {
|
|
930
|
+
const input = {
|
|
931
|
+
author: 'foo367',
|
|
932
|
+
permlink: 'bar367',
|
|
933
|
+
last_update: '2019-05-10T09:15:21',
|
|
934
|
+
body: 'direct link https://ecency.com/@ecency/posts?q=games'
|
|
935
|
+
}
|
|
936
|
+
const expected = '<p>direct link <a href=\"https://ecency.com/@ecency/posts?q=games\" class=\"markdown-profile-link\">@ecency/posts?q=games</a></p>'
|
|
937
|
+
|
|
938
|
+
expect(markdown2Html(input)).toBe(expected)
|
|
939
|
+
})
|
|
892
940
|
})
|
|
893
941
|
|
|
894
942
|
describe("Rumble support", () => {
|
package/src/methods/a.method.ts
CHANGED
|
@@ -23,7 +23,8 @@ import {
|
|
|
23
23
|
RUMBLE_REGEX,
|
|
24
24
|
BRIGHTEON_REGEX,
|
|
25
25
|
DOMParser,
|
|
26
|
-
LOOM_REGEX
|
|
26
|
+
LOOM_REGEX,
|
|
27
|
+
SECTION_LIST
|
|
27
28
|
} from '../consts'
|
|
28
29
|
import { getSerializedInnerHTML } from './get-inner-html.method'
|
|
29
30
|
import { proxifyImageSrc } from '../proxify-image-src'
|
|
@@ -139,9 +140,10 @@ export function a(el: HTMLElement, forApp: boolean, webp: boolean): void {
|
|
|
139
140
|
// If a tagged post and profile section links
|
|
140
141
|
const tpostMatch = href.match(INTERNAL_POST_TAG_REGEX)
|
|
141
142
|
if (
|
|
142
|
-
(tpostMatch && WHITE_LIST.
|
|
143
|
+
(tpostMatch && tpostMatch.length === 4 && WHITE_LIST.some(v => tpostMatch[1].includes(v))) || (tpostMatch && tpostMatch.length === 4 && tpostMatch[1].indexOf('/') == 0)
|
|
143
144
|
) {
|
|
144
|
-
|
|
145
|
+
// check if permlink is section or section with params ?q=xyz
|
|
146
|
+
if (SECTION_LIST.some(v => tpostMatch[3].includes(v))) {
|
|
145
147
|
el.setAttribute('class', 'markdown-profile-link')
|
|
146
148
|
const author = tpostMatch[2].replace('@', '').toLowerCase()
|
|
147
149
|
const section = tpostMatch[3]
|
|
@@ -158,13 +160,18 @@ export function a(el: HTMLElement, forApp: boolean, webp: boolean): void {
|
|
|
158
160
|
}
|
|
159
161
|
return
|
|
160
162
|
} else {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
// check if domain is not whitelist and does contain dot (not tag e.g. `/ecency`)
|
|
164
|
+
if (tpostMatch[1] && tpostMatch[1].includes('.') && !WHITE_LIST.some(v => tpostMatch[1].includes(v))) {
|
|
165
|
+
return
|
|
166
|
+
}
|
|
163
167
|
let tag = 'post'
|
|
164
|
-
if
|
|
168
|
+
// check if tag does exist and doesn't include dot likely word/tag
|
|
169
|
+
if (tpostMatch[1] && !tpostMatch[1].includes('.')) {
|
|
165
170
|
[, tag] = tpostMatch
|
|
171
|
+
tag = tag.replace('/', '')
|
|
166
172
|
}
|
|
167
173
|
|
|
174
|
+
el.setAttribute('class', 'markdown-post-link')
|
|
168
175
|
const author = tpostMatch[2].replace('@', '')
|
|
169
176
|
const permlink = tpostMatch[3]
|
|
170
177
|
if (el.textContent === href) {
|
|
@@ -210,7 +217,7 @@ export function a(el: HTMLElement, forApp: boolean, webp: boolean): void {
|
|
|
210
217
|
if (
|
|
211
218
|
(cpostMatch && cpostMatch.length === 3 && cpostMatch[1].indexOf('@') === 0)
|
|
212
219
|
) {
|
|
213
|
-
if (
|
|
220
|
+
if (SECTION_LIST.some(v => cpostMatch[2].includes(v))) {
|
|
214
221
|
el.setAttribute('class', 'markdown-profile-link')
|
|
215
222
|
const author = cpostMatch[1].replace('@', '').toLowerCase()
|
|
216
223
|
const section = cpostMatch[2]
|
|
@@ -539,37 +546,46 @@ export function a(el: HTMLElement, forApp: boolean, webp: boolean): void {
|
|
|
539
546
|
// If a d.tube video
|
|
540
547
|
match = href.match(D_TUBE_REGEX)
|
|
541
548
|
if (match) {
|
|
542
|
-
// Only d.tube links contains an image
|
|
543
|
-
const imgEls = el.getElementsByTagName('img')
|
|
544
549
|
|
|
545
|
-
|
|
550
|
+
// Only d.tube links contains an image
|
|
551
|
+
const imgEls = el.getElementsByTagName('img')
|
|
552
|
+
|
|
553
|
+
if (imgEls.length === 1 || el.textContent.trim() === href) {
|
|
546
554
|
const e = D_TUBE_REGEX.exec(href)
|
|
547
555
|
// e[2] = username, e[3] object id
|
|
548
556
|
if (e[2] && e[3]) {
|
|
549
557
|
el.setAttribute('class', 'markdown-video-link markdown-video-link-dtube')
|
|
550
558
|
el.removeAttribute('href')
|
|
559
|
+
|
|
551
560
|
|
|
552
|
-
const thumbnail = proxifyImageSrc(imgEls[0].getAttribute('src').replace(/\s+/g, ''), 0, 0, webp ? 'webp' : 'match')
|
|
553
561
|
const videoHref = `https://emb.d.tube/#!/${e[2]}/${e[3]}`
|
|
554
562
|
|
|
555
563
|
// el.setAttribute('data-video-href', videoHref)
|
|
556
564
|
el.setAttribute('data-embed-src', videoHref)
|
|
557
565
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
566
|
+
//process thumb img element
|
|
567
|
+
if (imgEls.length === 1) {
|
|
568
|
+
const thumbnail = proxifyImageSrc(imgEls[0].getAttribute('src').replace(/\s+/g, ''), 0, 0, webp ? 'webp' : 'match')
|
|
569
|
+
const thumbImg = el.ownerDocument.createElement('img')
|
|
570
|
+
|
|
571
|
+
thumbImg.setAttribute('class', 'no-replace video-thumbnail')
|
|
572
|
+
thumbImg.setAttribute('itemprop', 'thumbnailUrl')
|
|
573
|
+
|
|
574
|
+
thumbImg.setAttribute('src', thumbnail)
|
|
575
|
+
el.appendChild(thumbImg)
|
|
576
|
+
|
|
577
|
+
// Remove image.
|
|
578
|
+
el.removeChild(imgEls[0])
|
|
579
|
+
} else {
|
|
580
|
+
el.textContent = '';
|
|
581
|
+
}
|
|
563
582
|
|
|
564
583
|
const play = el.ownerDocument.createElement('span')
|
|
565
584
|
play.setAttribute('class', 'markdown-video-play')
|
|
566
585
|
|
|
567
|
-
|
|
586
|
+
|
|
568
587
|
el.appendChild(play)
|
|
569
588
|
|
|
570
|
-
// Remove image.
|
|
571
|
-
el.removeChild(imgEls[0])
|
|
572
|
-
|
|
573
589
|
return
|
|
574
590
|
}
|
|
575
591
|
}
|
|
@@ -581,6 +597,7 @@ export function a(el: HTMLElement, forApp: boolean, webp: boolean): void {
|
|
|
581
597
|
if (e[2] && e[3]) {
|
|
582
598
|
el.setAttribute('class', 'markdown-video-link markdown-video-link-dtube')
|
|
583
599
|
el.removeAttribute('href')
|
|
600
|
+
el.textContent = '';
|
|
584
601
|
|
|
585
602
|
const videoHref = `https://emb.d.tube/#!/${e[2]}/${e[3]}`
|
|
586
603
|
|
|
@@ -590,6 +607,7 @@ export function a(el: HTMLElement, forApp: boolean, webp: boolean): void {
|
|
|
590
607
|
play.setAttribute('class', 'markdown-video-play')
|
|
591
608
|
|
|
592
609
|
el.appendChild(play)
|
|
610
|
+
|
|
593
611
|
|
|
594
612
|
return
|
|
595
613
|
}
|
|
@@ -18,8 +18,8 @@ export function cleanReply(s: string): string {
|
|
|
18
18
|
.filter(item => item.toLowerCase().includes('read this post on travelfeed.io for the best experience') === false)
|
|
19
19
|
.filter(item => item.toLowerCase().includes('posted via <a href="https://www.dporn.co/"') === false)
|
|
20
20
|
.filter(item => item.toLowerCase().includes('▶️ [watch on 3speak](https://3speak') === false)
|
|
21
|
-
.filter(item => item.toLowerCase().includes('<sup><sub>
|
|
22
|
-
.filter(item => item.toLowerCase().includes('view this post on [
|
|
21
|
+
.filter(item => item.toLowerCase().includes('<sup><sub>posted via [inji.com]') === false)
|
|
22
|
+
.filter(item => item.toLowerCase().includes('view this post on [liketu]') === false)
|
|
23
23
|
.join('\n') : '')
|
|
24
24
|
.replace('Posted via <a href="https://d.buzz" data-link="promote-link">D.Buzz</a>', '')
|
|
25
25
|
.replace('<div class="pull-right"><a href="/@hive.engage"></a></div>', '')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMG_REGEX } from '../consts'
|
|
1
|
+
import { IMG_REGEX, SECTION_LIST } from '../consts'
|
|
2
2
|
import { proxifyImageSrc } from '../proxify-image-src'
|
|
3
3
|
|
|
4
4
|
export function linkify(content: string, forApp: boolean, webp: boolean): string {
|
|
@@ -34,7 +34,7 @@ export function linkify(content: string, forApp: boolean, webp: boolean): string
|
|
|
34
34
|
/((^|\s)(\/|)@[\w.\d-]+)\/(\S+)/gi, (match, u, p1, p2, p3) => {
|
|
35
35
|
const uu = u.trim().toLowerCase().replace('/@','').replace('@','');
|
|
36
36
|
const perm = p3;
|
|
37
|
-
if (
|
|
37
|
+
if (SECTION_LIST.some(v => p3.includes(v))) {
|
|
38
38
|
const attrs = forApp ? `https://ecency.com/@${uu}/${perm}` : `href="/@${uu}/${perm}"`
|
|
39
39
|
return ` <a class="markdown-profile-link" ${attrs}>@${uu}/${perm}</a>`
|
|
40
40
|
} else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { traverse } from './traverse.method'
|
|
2
2
|
import { sanitizeHtml } from './sanitize-html.method'
|
|
3
|
-
import { DOMParser } from '../consts'
|
|
3
|
+
import { DOMParser, ENTITY_REGEX } from '../consts'
|
|
4
4
|
import xmldom from 'xmldom'
|
|
5
5
|
|
|
6
6
|
const lolight = require('lolight')
|
|
@@ -47,7 +47,7 @@ export function markdownToHTML(input: string, forApp: boolean, webp: boolean): s
|
|
|
47
47
|
let output = '';
|
|
48
48
|
|
|
49
49
|
//encrypt entities
|
|
50
|
-
const entities = input.match(
|
|
50
|
+
const entities = input.match(ENTITY_REGEX);
|
|
51
51
|
const encEntities:string[] = [];
|
|
52
52
|
|
|
53
53
|
try{
|
package/src/post-body-summary.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { makeEntryCacheKey } from './helper'
|
|
|
3
3
|
import { cacheGet, cacheSet } from './cache'
|
|
4
4
|
import { Entry } from './types'
|
|
5
5
|
import { cleanReply } from './methods'
|
|
6
|
+
import { ENTITY_REGEX } from './consts'
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
const { Remarkable } = require('remarkable')
|
|
8
10
|
const { linkify } = require('remarkable/linkify')
|
|
@@ -58,7 +60,7 @@ function postBodySummary(entryBody: string, length?: number, platform:'ios'|'and
|
|
|
58
60
|
]);
|
|
59
61
|
|
|
60
62
|
//encrypt entities
|
|
61
|
-
const entities = entryBody.match(
|
|
63
|
+
const entities = entryBody.match(ENTITY_REGEX);
|
|
62
64
|
const encEntities:string[] = [];
|
|
63
65
|
if(entities && platform !== 'web'){
|
|
64
66
|
entities.forEach((entity)=>{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": 23,
|
|
3
3
|
"input": "<IMG SRC=/ onerror=\"alert(String.fromCharCode(88,83,83))\"></img> <img src=x onerror=\"javascript:alert('XSS')\"> <IMG SRC=javascript:alert('XSS')> <IMG SRC=javascript:alert('XSS')> <IMG SRC=\"  javascript:alert('XSS');\">",
|
|
4
|
-
"result": "<p><IMG SRC=/ onerror=\"alert(String.fromCharCode(88,83,83))\"> <img src=\"https://images.ecency.com/p/35.png?format=match&mode=fit\"
|
|
4
|
+
"result": "<p><IMG SRC=/ onerror=\"alert(String.fromCharCode(88,83,83))\"> <img src=\"https://images.ecency.com/p/35.png?format=match&mode=fit\" /> <IMG SRC=javascript:alert('XSS')> <img /> <img /></p>"
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": 27,
|
|
3
3
|
"input": "<BR SIZE=\"&{alert('XSS')}\"> <LINK REL=\"stylesheet\" HREF=\"javascript:alert('XSS');\"> <STYLE>body{}</STYLE> <META HTTP-EQUIV=\"Link\" Content=\"<http://xss.rocks/xss.css>; REL=stylesheet\"> <IFRAME SRC=\"javascript:alert('XSS');\"></IFRAME> foo <IFRAME SRC=# onmouseover=\"alert(document.cookie)\"></IFRAME> bar <FRAMESET><FRAME SRC=\"javascript:alert('XSS');\"></FRAMESET> baz ",
|
|
4
|
-
"result": "<p><br
|
|
4
|
+
"result": "<p><br /> foo bar baz\n</p>"
|
|
5
5
|
}
|