ipx 0.9.10 → 0.9.11
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/dist/cli.cjs
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import consola from 'consola';
|
|
2
2
|
import { listen } from 'listhen';
|
|
3
|
-
import { c as createIPX, a as createIPXMiddleware } from './
|
|
3
|
+
import { c as createIPX, a as createIPXMiddleware } from './shared/ipx.72b0591f.mjs';
|
|
4
4
|
import 'defu';
|
|
5
5
|
import 'image-meta';
|
|
6
6
|
import 'ufo';
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -106,6 +106,7 @@ function isValidPath(fp) {
|
|
|
106
106
|
return true;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
const HTTP_RE = /^https?:\/\//;
|
|
109
110
|
const createHTTPSource = (options) => {
|
|
110
111
|
const httpsAgent = new https.Agent({ keepAlive: true });
|
|
111
112
|
const httpAgent = new http.Agent({ keepAlive: true });
|
|
@@ -114,7 +115,7 @@ const createHTTPSource = (options) => {
|
|
|
114
115
|
_domains = _domains.split(",").map((s) => s.trim());
|
|
115
116
|
}
|
|
116
117
|
const domains = _domains.map((d) => {
|
|
117
|
-
if (!
|
|
118
|
+
if (!HTTP_RE.test(d)) {
|
|
118
119
|
d = "http://" + d;
|
|
119
120
|
}
|
|
120
121
|
return new URL(d).hostname;
|
|
@@ -529,6 +530,7 @@ async function _handleRequest(req, ipx) {
|
|
|
529
530
|
if (format) {
|
|
530
531
|
res.headers["Content-Type"] = `image/${format}`;
|
|
531
532
|
}
|
|
533
|
+
res.headers["Content-Security-Policy"] = "default-src 'none'";
|
|
532
534
|
res.body = data;
|
|
533
535
|
return sanetizeReponse(res);
|
|
534
536
|
}
|
|
@@ -117,6 +117,7 @@ function isValidPath(fp) {
|
|
|
117
117
|
return true;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
const HTTP_RE = /^https?:\/\//;
|
|
120
121
|
const createHTTPSource = (options) => {
|
|
121
122
|
const httpsAgent = new https__default.Agent({ keepAlive: true });
|
|
122
123
|
const httpAgent = new http__default.Agent({ keepAlive: true });
|
|
@@ -125,7 +126,7 @@ const createHTTPSource = (options) => {
|
|
|
125
126
|
_domains = _domains.split(",").map((s) => s.trim());
|
|
126
127
|
}
|
|
127
128
|
const domains = _domains.map((d) => {
|
|
128
|
-
if (!
|
|
129
|
+
if (!HTTP_RE.test(d)) {
|
|
129
130
|
d = "http://" + d;
|
|
130
131
|
}
|
|
131
132
|
return new URL(d).hostname;
|
|
@@ -540,6 +541,7 @@ async function _handleRequest(req, ipx) {
|
|
|
540
541
|
if (format) {
|
|
541
542
|
res.headers["Content-Type"] = `image/${format}`;
|
|
542
543
|
}
|
|
544
|
+
res.headers["Content-Security-Policy"] = "default-src 'none'";
|
|
543
545
|
res.body = data;
|
|
544
546
|
return sanetizeReponse(res);
|
|
545
547
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ipx",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.11",
|
|
4
4
|
"repository": "unjs/ipx",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
@@ -19,34 +19,35 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"consola": "^2.15.3",
|
|
22
|
-
"defu": "^6.
|
|
22
|
+
"defu": "^6.1.0",
|
|
23
23
|
"destr": "^1.1.1",
|
|
24
24
|
"etag": "^1.8.1",
|
|
25
25
|
"image-meta": "^0.1.1",
|
|
26
|
-
"listhen": "^0.2.
|
|
26
|
+
"listhen": "^0.2.15",
|
|
27
27
|
"ohmyfetch": "^0.4.18",
|
|
28
|
-
"pathe": "^0.3.
|
|
28
|
+
"pathe": "^0.3.5",
|
|
29
29
|
"sharp": "^0.30.7",
|
|
30
30
|
"ufo": "^0.8.5",
|
|
31
|
-
"xss": "^1.0.
|
|
31
|
+
"xss": "^1.0.14"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@nuxtjs/eslint-config-typescript": "
|
|
35
|
-
"@types/etag": "
|
|
36
|
-
"@types/is-valid-path": "
|
|
37
|
-
"@types/node-fetch": "
|
|
38
|
-
"@types/sharp": "
|
|
39
|
-
"c8": "
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
34
|
+
"@nuxtjs/eslint-config-typescript": "^11.0.0",
|
|
35
|
+
"@types/etag": "^1.8.1",
|
|
36
|
+
"@types/is-valid-path": "^0.1.0",
|
|
37
|
+
"@types/node-fetch": "^2.6.2",
|
|
38
|
+
"@types/sharp": "^0.30.5",
|
|
39
|
+
"@vitest/coverage-c8": "^0.22.1",
|
|
40
|
+
"changelogen": "^0.3.0",
|
|
41
|
+
"eslint": "^8.23.0",
|
|
42
|
+
"jiti": "^1.14.0",
|
|
43
|
+
"nodemon": "^2.0.19",
|
|
43
44
|
"serve-handler": "^6.1.3",
|
|
44
|
-
"standard-version": "
|
|
45
|
-
"typescript": "
|
|
46
|
-
"unbuild": "
|
|
47
|
-
"vitest": "
|
|
45
|
+
"standard-version": "^9.5.0",
|
|
46
|
+
"typescript": "^4.8.2",
|
|
47
|
+
"unbuild": "^0.8.10",
|
|
48
|
+
"vitest": "^0.22.1"
|
|
48
49
|
},
|
|
49
|
-
"packageManager": "pnpm@7.5
|
|
50
|
+
"packageManager": "pnpm@7.9.5",
|
|
50
51
|
"scripts": {
|
|
51
52
|
"build": "unbuild",
|
|
52
53
|
"dev": "nodemon",
|