@ecency/render-helper 2.5.26 → 2.5.28
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/README.md +1 -1
- package/dist/THIRD-PARTY-NOTICES.md +85 -0
- package/dist/browser/index.js +21 -8
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +8368 -309
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +8364 -304
- package/dist/node/index.mjs.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Built and maintained by [Ecency](https://ecency.com), an open-source social plat
|
|
|
15
15
|
|
|
16
16
|
### From Monorepo Root
|
|
17
17
|
- `pnpm render-helper` - Build render-helper package
|
|
18
|
-
- `pnpm build:packages` - Build all packages (sdk, wallets,
|
|
18
|
+
- `pnpm build:packages` - Build all packages (sdk, wallets, render-helper, ui)
|
|
19
19
|
- `pnpm publish:render-helper` - Manually publish to npm
|
|
20
20
|
|
|
21
21
|
### CI/CD
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`@ecency/render-helper` bundles the following packages into its published build output.
|
|
4
|
+
Their licences and copyright notices are reproduced here in full, as those licences require.
|
|
5
|
+
|
|
6
|
+
This file is generated during the build from the bundler's own metafile, so it lists what was
|
|
7
|
+
actually inlined. Do not edit it by hand.
|
|
8
|
+
|
|
9
|
+
## autolinker 3.16.2
|
|
10
|
+
|
|
11
|
+
License: MIT
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
The MIT License (MIT)
|
|
15
|
+
|
|
16
|
+
Copyright (c) 2014 Gregory Jacobs (http://greg-jacobs.com)
|
|
17
|
+
|
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
19
|
+
a copy of this software and associated documentation files (the
|
|
20
|
+
"Software"), to deal in the Software without restriction, including
|
|
21
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
22
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
23
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
24
|
+
the following conditions:
|
|
25
|
+
|
|
26
|
+
The above copyright notice and this permission notice shall be
|
|
27
|
+
included in all copies or substantial portions of the Software.
|
|
28
|
+
|
|
29
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
30
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
31
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
32
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
33
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
34
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
35
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## remarkable 2.0.1
|
|
39
|
+
|
|
40
|
+
License: MIT
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
The MIT License (MIT)
|
|
44
|
+
|
|
45
|
+
Copyright (c) 2014-2016, Jon Schlinkert
|
|
46
|
+
Copyright (c) 2014 Jon Schlinkert, Vitaly Puzrin.
|
|
47
|
+
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
49
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
50
|
+
in the Software without restriction, including without limitation the rights
|
|
51
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
52
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
53
|
+
furnished to do so, subject to the following conditions:
|
|
54
|
+
|
|
55
|
+
The above copyright notice and this permission notice shall be included in
|
|
56
|
+
all copies or substantial portions of the Software.
|
|
57
|
+
|
|
58
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
59
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
60
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
61
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
62
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
63
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
64
|
+
THE SOFTWARE.
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## tslib 2.8.1
|
|
68
|
+
|
|
69
|
+
License: 0BSD
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Copyright (c) Microsoft Corporation.
|
|
73
|
+
|
|
74
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
75
|
+
purpose with or without fee is hereby granted.
|
|
76
|
+
|
|
77
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
78
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
79
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
80
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
81
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
82
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
83
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
84
|
+
```
|
|
85
|
+
|
package/dist/browser/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOMParser as DOMParser$1, XMLSerializer } from '@xmldom/xmldom';
|
|
2
|
-
import
|
|
2
|
+
import { decodeHTML } from 'entities';
|
|
3
3
|
import xss from 'xss';
|
|
4
4
|
import querystring from 'querystring';
|
|
5
5
|
import { LRUCache } from 'lru-cache';
|
|
@@ -282,8 +282,19 @@ function createParser() {
|
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
284
|
var DOMParser = createParser();
|
|
285
|
+
var LEADING_ZEROS_DEC = /�+(?=[0-9])/g;
|
|
286
|
+
var LEADING_ZEROS_HEX = /�+(?=[0-9a-f])/gi;
|
|
287
|
+
var OVERLONG_NUMERIC_REF = /&#(?:x[0-9a-f]{256,}|[0-9]{309,});?/gi;
|
|
288
|
+
function decodeEntities(value) {
|
|
289
|
+
const safe = value.replace(LEADING_ZEROS_DEC, "&#").replace(LEADING_ZEROS_HEX, (m) => m.slice(0, 3)).replace(OVERLONG_NUMERIC_REF, "\uFFFD");
|
|
290
|
+
try {
|
|
291
|
+
return decodeHTML(safe);
|
|
292
|
+
} catch {
|
|
293
|
+
return safe;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
285
296
|
function decodeImageSrc(src) {
|
|
286
|
-
const entityDecoded =
|
|
297
|
+
const entityDecoded = decodeEntities(src);
|
|
287
298
|
try {
|
|
288
299
|
return decodeURIComponent(entityDecoded).trim();
|
|
289
300
|
} catch {
|
|
@@ -738,7 +749,7 @@ var isSafeNavValue = (value) => {
|
|
|
738
749
|
const isRelative = /^(\/\/|\/[^/]?|#|\?|[a-z0-9._\-]+(\/|$))/i.test(trimmed);
|
|
739
750
|
return isSafeScheme || isRelative;
|
|
740
751
|
};
|
|
741
|
-
var
|
|
752
|
+
var decodeEntities2 = (input) => input.replace(/&#(\d+);?/g, (_, dec) => String.fromCodePoint(Number(dec))).replace(/&#x([0-9a-f]+);?/gi, (_, hex) => String.fromCodePoint(parseInt(hex, 16)));
|
|
742
753
|
var isProxyPSrcset = (srcset) => {
|
|
743
754
|
const base = trimTrailingSlash(getProxyBase());
|
|
744
755
|
const candidates = srcset.split(",").map((c) => c.trim().split(/\s+/)[0]).filter(Boolean);
|
|
@@ -752,7 +763,7 @@ function sanitizeHtml(html) {
|
|
|
752
763
|
css: false,
|
|
753
764
|
// block style attrs entirely for safety
|
|
754
765
|
onTagAttr: (tag, name, value) => {
|
|
755
|
-
const decoded =
|
|
766
|
+
const decoded = decodeEntities2(value.trim());
|
|
756
767
|
const decodedLower = decoded.toLowerCase();
|
|
757
768
|
if (name.startsWith("on")) return "";
|
|
758
769
|
if (tag === "img" && name === "src" && !/^https?:\/\//.test(decodedLower)) return "";
|
|
@@ -2178,6 +2189,8 @@ function markdown2Html(obj, forApp = true, _webp = false, parentDomain = "ecency
|
|
|
2178
2189
|
cacheSet(key, res);
|
|
2179
2190
|
return res;
|
|
2180
2191
|
}
|
|
2192
|
+
|
|
2193
|
+
// src/catch-post-image.ts
|
|
2181
2194
|
var gifLinkRegex = /\.(gif)$/i;
|
|
2182
2195
|
function isGifLink(link) {
|
|
2183
2196
|
return gifLinkRegex.test(link);
|
|
@@ -2234,7 +2247,7 @@ function findFirstImageUrl(body, includeBareUrls = false) {
|
|
|
2234
2247
|
return candidates[0].url;
|
|
2235
2248
|
}
|
|
2236
2249
|
function proxifyFound(src, width, height, format) {
|
|
2237
|
-
const decoded =
|
|
2250
|
+
const decoded = decodeEntities(src);
|
|
2238
2251
|
if (isGifLink(decoded)) {
|
|
2239
2252
|
return proxifyImageSrc(decoded, 0, 0, format);
|
|
2240
2253
|
}
|
|
@@ -2252,7 +2265,7 @@ function getImage(entry, width = 0, height = 0, format = "match") {
|
|
|
2252
2265
|
}
|
|
2253
2266
|
}
|
|
2254
2267
|
if (meta && typeof meta.image === "string" && meta.image.length > 0) {
|
|
2255
|
-
const decodedImage =
|
|
2268
|
+
const decodedImage = decodeEntities(meta.image);
|
|
2256
2269
|
if (isGifLink(decodedImage)) {
|
|
2257
2270
|
return proxifyImageSrc(decodedImage, 0, 0, format);
|
|
2258
2271
|
}
|
|
@@ -2260,7 +2273,7 @@ function getImage(entry, width = 0, height = 0, format = "match") {
|
|
|
2260
2273
|
}
|
|
2261
2274
|
if (meta && meta.image && !!meta.image.length && meta.image[0]) {
|
|
2262
2275
|
if (typeof meta.image[0] === "string") {
|
|
2263
|
-
const decodedImage =
|
|
2276
|
+
const decodedImage = decodeEntities(meta.image[0]);
|
|
2264
2277
|
if (isGifLink(decodedImage)) {
|
|
2265
2278
|
return proxifyImageSrc(decodedImage, 0, 0, format);
|
|
2266
2279
|
}
|
|
@@ -2415,7 +2428,7 @@ function postBodySummary(entryBody, length = 200, platform = "web") {
|
|
|
2415
2428
|
text2 = joint(text2.split(" "), length);
|
|
2416
2429
|
}
|
|
2417
2430
|
if (text2) {
|
|
2418
|
-
text2 =
|
|
2431
|
+
text2 = decodeEntities(text2);
|
|
2419
2432
|
}
|
|
2420
2433
|
return text2;
|
|
2421
2434
|
}
|