verdaccio 6.7.4 → 6.9.0
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 +2 -2
- package/bin/verdaccio +5 -1
- package/build/_virtual/_rolldown/runtime.js +23 -0
- package/build/api/debug/index.js +23 -26
- package/build/api/debug/index.js.map +1 -0
- package/build/api/debug/index.mjs +19 -0
- package/build/api/debug/index.mjs.map +1 -0
- package/build/api/endpoint/api/dist-tags.js +62 -75
- package/build/api/endpoint/api/dist-tags.js.map +1 -0
- package/build/api/endpoint/api/dist-tags.mjs +56 -0
- package/build/api/endpoint/api/dist-tags.mjs.map +1 -0
- package/build/api/endpoint/api/package.js +91 -99
- package/build/api/endpoint/api/package.js.map +1 -0
- package/build/api/endpoint/api/package.mjs +89 -0
- package/build/api/endpoint/api/package.mjs.map +1 -0
- package/build/api/endpoint/api/ping.js +13 -11
- package/build/api/endpoint/api/ping.js.map +1 -0
- package/build/api/endpoint/api/ping.mjs +11 -0
- package/build/api/endpoint/api/ping.mjs.map +1 -0
- package/build/api/endpoint/api/publish.d.ts +2 -2
- package/build/api/endpoint/api/publish.js +278 -343
- package/build/api/endpoint/api/publish.js.map +1 -0
- package/build/api/endpoint/api/publish.mjs +280 -0
- package/build/api/endpoint/api/publish.mjs.map +1 -0
- package/build/api/endpoint/api/search.js +57 -105
- package/build/api/endpoint/api/search.js.map +1 -0
- package/build/api/endpoint/api/search.mjs +54 -0
- package/build/api/endpoint/api/search.mjs.map +1 -0
- package/build/api/endpoint/api/star.js +60 -71
- package/build/api/endpoint/api/star.js.map +1 -0
- package/build/api/endpoint/api/star.mjs +54 -0
- package/build/api/endpoint/api/star.mjs.map +1 -0
- package/build/api/endpoint/api/stars.js +40 -40
- package/build/api/endpoint/api/stars.js.map +1 -0
- package/build/api/endpoint/api/stars.mjs +35 -0
- package/build/api/endpoint/api/stars.mjs.map +1 -0
- package/build/api/endpoint/api/user.js +69 -82
- package/build/api/endpoint/api/user.js.map +1 -0
- package/build/api/endpoint/api/user.mjs +64 -0
- package/build/api/endpoint/api/user.mjs.map +1 -0
- package/build/api/endpoint/api/v1/profile.js +50 -67
- package/build/api/endpoint/api/v1/profile.js.map +1 -0
- package/build/api/endpoint/api/v1/profile.mjs +46 -0
- package/build/api/endpoint/api/v1/profile.mjs.map +1 -0
- package/build/api/endpoint/api/v1/search.d.ts +2 -1
- package/build/api/endpoint/api/v1/search.js +149 -168
- package/build/api/endpoint/api/v1/search.js.map +1 -0
- package/build/api/endpoint/api/v1/search.mjs +154 -0
- package/build/api/endpoint/api/v1/search.mjs.map +1 -0
- package/build/api/endpoint/api/v1/token.js +122 -155
- package/build/api/endpoint/api/v1/token.js.map +1 -0
- package/build/api/endpoint/api/v1/token.mjs +119 -0
- package/build/api/endpoint/api/v1/token.mjs.map +1 -0
- package/build/api/endpoint/api/whoami.js +13 -13
- package/build/api/endpoint/api/whoami.js.map +1 -0
- package/build/api/endpoint/api/whoami.mjs +11 -0
- package/build/api/endpoint/api/whoami.mjs.map +1 -0
- package/build/api/endpoint/index.js +58 -67
- package/build/api/endpoint/index.js.map +1 -0
- package/build/api/endpoint/index.mjs +54 -0
- package/build/api/endpoint/index.mjs.map +1 -0
- package/build/api/index.js +85 -106
- package/build/api/index.js.map +1 -0
- package/build/api/index.mjs +78 -0
- package/build/api/index.mjs.map +1 -0
- package/build/api/middleware.js +60 -54
- package/build/api/middleware.js.map +1 -0
- package/build/api/middleware.mjs +55 -0
- package/build/api/middleware.mjs.map +1 -0
- package/build/api/web/api/index.js +25 -29
- package/build/api/web/api/index.js.map +1 -0
- package/build/api/web/api/index.mjs +23 -0
- package/build/api/web/api/index.mjs.map +1 -0
- package/build/api/web/api/package.js +142 -161
- package/build/api/web/api/package.js.map +1 -0
- package/build/api/web/api/package.mjs +139 -0
- package/build/api/web/api/package.mjs.map +1 -0
- package/build/api/web/api/search.js +37 -50
- package/build/api/web/api/search.js.map +1 -0
- package/build/api/web/api/search.mjs +36 -0
- package/build/api/web/api/search.mjs.map +1 -0
- package/build/api/web/api/user.js +52 -73
- package/build/api/web/api/user.js.map +1 -0
- package/build/api/web/api/user.mjs +49 -0
- package/build/api/web/api/user.mjs.map +1 -0
- package/build/api/web/api/utils.js +9 -10
- package/build/api/web/api/utils.js.map +1 -0
- package/build/api/web/api/utils.mjs +11 -0
- package/build/api/web/api/utils.mjs.map +1 -0
- package/build/api/web/index.js +76 -88
- package/build/api/web/index.js.map +1 -0
- package/build/api/web/index.mjs +70 -0
- package/build/api/web/index.mjs.map +1 -0
- package/build/index.js +43 -60
- package/build/index.mjs +5 -0
- package/build/lib/auth-utils.js +12 -14
- package/build/lib/auth-utils.js.map +1 -0
- package/build/lib/auth-utils.mjs +11 -0
- package/build/lib/auth-utils.mjs.map +1 -0
- package/build/lib/bootstrap.js +125 -157
- package/build/lib/bootstrap.js.map +1 -0
- package/build/lib/bootstrap.mjs +125 -0
- package/build/lib/bootstrap.mjs.map +1 -0
- package/build/lib/cli/cli.js +22 -24
- package/build/lib/cli/cli.js.map +1 -0
- package/build/lib/cli/cli.mjs +23 -0
- package/build/lib/cli/cli.mjs.map +1 -0
- package/build/lib/cli/commands/info.js +34 -25
- package/build/lib/cli/commands/info.js.map +1 -0
- package/build/lib/cli/commands/info.mjs +32 -0
- package/build/lib/cli/commands/info.mjs.map +1 -0
- package/build/lib/cli/commands/init.js +61 -79
- package/build/lib/cli/commands/init.js.map +1 -0
- package/build/lib/cli/commands/init.mjs +70 -0
- package/build/lib/cli/commands/init.mjs.map +1 -0
- package/build/lib/cli/commands/version.js +14 -16
- package/build/lib/cli/commands/version.js.map +1 -0
- package/build/lib/cli/commands/version.mjs +14 -0
- package/build/lib/cli/commands/version.mjs.map +1 -0
- package/build/lib/cli/utils.d.ts +2 -2
- package/build/lib/cli/utils.js +16 -15
- package/build/lib/cli/utils.js.map +1 -0
- package/build/lib/cli/utils.mjs +14 -0
- package/build/lib/cli/utils.mjs.map +1 -0
- package/build/lib/cli.js +11 -14
- package/build/lib/cli.js.map +1 -0
- package/build/lib/cli.mjs +12 -0
- package/build/lib/cli.mjs.map +1 -0
- package/build/lib/config.js +19 -21
- package/build/lib/config.js.map +1 -0
- package/build/lib/config.mjs +16 -0
- package/build/lib/config.mjs.map +1 -0
- package/build/lib/constants.js +100 -93
- package/build/lib/constants.js.map +1 -0
- package/build/lib/constants.mjs +28 -0
- package/build/lib/constants.mjs.map +1 -0
- package/build/lib/experiments.js +19 -27
- package/build/lib/experiments.js.map +1 -0
- package/build/lib/experiments.mjs +20 -0
- package/build/lib/experiments.mjs.map +1 -0
- package/build/lib/local-storage.d.ts +5 -2
- package/build/lib/local-storage.js +606 -757
- package/build/lib/local-storage.js.map +1 -0
- package/build/lib/local-storage.mjs +600 -0
- package/build/lib/local-storage.mjs.map +1 -0
- package/build/lib/logger/index.js +24 -19
- package/build/lib/logger/index.js.map +1 -0
- package/build/lib/logger/index.mjs +17 -0
- package/build/lib/logger/index.mjs.map +1 -0
- package/build/lib/metadata-utils.js +24 -36
- package/build/lib/metadata-utils.js.map +1 -0
- package/build/lib/metadata-utils.mjs +23 -0
- package/build/lib/metadata-utils.mjs.map +1 -0
- package/build/lib/run-server.js +83 -114
- package/build/lib/run-server.js.map +1 -0
- package/build/lib/run-server.mjs +82 -0
- package/build/lib/run-server.mjs.map +1 -0
- package/build/lib/storage-utils.d.ts +120 -8
- package/build/lib/storage-utils.js +390 -251
- package/build/lib/storage-utils.js.map +1 -0
- package/build/lib/storage-utils.mjs +400 -0
- package/build/lib/storage-utils.mjs.map +1 -0
- package/build/lib/storage.d.ts +127 -57
- package/build/lib/storage.js +674 -681
- package/build/lib/storage.js.map +1 -0
- package/build/lib/storage.mjs +665 -0
- package/build/lib/storage.mjs.map +1 -0
- package/build/lib/up-storage.js +490 -599
- package/build/lib/up-storage.js.map +1 -0
- package/build/lib/up-storage.mjs +484 -0
- package/build/lib/up-storage.mjs.map +1 -0
- package/build/lib/uplink-util.js +21 -31
- package/build/lib/uplink-util.js.map +1 -0
- package/build/lib/uplink-util.mjs +24 -0
- package/build/lib/uplink-util.mjs.map +1 -0
- package/build/lib/utils.js +172 -231
- package/build/lib/utils.js.map +1 -0
- package/build/lib/utils.mjs +188 -0
- package/build/lib/utils.mjs.map +1 -0
- package/package.json +105 -100
package/build/api/middleware.js
CHANGED
|
@@ -1,56 +1,62 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
3
|
+
require("../lib/constants.js");
|
|
4
|
+
let lodash = require("lodash");
|
|
5
|
+
lodash = require_runtime.__toESM(lodash);
|
|
6
|
+
let debug = require("debug");
|
|
7
|
+
debug = require_runtime.__toESM(debug);
|
|
8
|
+
let path = require("path");
|
|
9
|
+
path = require_runtime.__toESM(path);
|
|
10
|
+
let fs = require("fs");
|
|
11
|
+
fs = require_runtime.__toESM(fs);
|
|
12
|
+
let url = require("url");
|
|
13
|
+
let _verdaccio_url = require("@verdaccio/url");
|
|
14
|
+
let _verdaccio_core = require("@verdaccio/core");
|
|
15
|
+
//#region src/api/middleware.ts
|
|
16
|
+
var debug$1 = (0, debug.default)("verdaccio:middleware:favicon");
|
|
15
17
|
function serveFavicon(config) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
18
|
+
return function(_req, res) {
|
|
19
|
+
try {
|
|
20
|
+
const logoConf = config?.web?.favicon;
|
|
21
|
+
if (logoConf === "") {
|
|
22
|
+
debug$1("favicon disabled");
|
|
23
|
+
res.status(404);
|
|
24
|
+
} else if (!lodash.default.isEmpty(logoConf)) {
|
|
25
|
+
debug$1("custom favicon");
|
|
26
|
+
if ((0, _verdaccio_url.isURL)(logoConf, {
|
|
27
|
+
require_host: true,
|
|
28
|
+
require_valid_protocol: true
|
|
29
|
+
})) {
|
|
30
|
+
debug$1("redirect to %o", logoConf);
|
|
31
|
+
res.redirect(logoConf);
|
|
32
|
+
return;
|
|
33
|
+
} else {
|
|
34
|
+
const faviconPath = path.default.normalize(logoConf);
|
|
35
|
+
debug$1("serving favicon from %o", faviconPath);
|
|
36
|
+
fs.default.access(faviconPath, fs.default.constants.R_OK, (err) => {
|
|
37
|
+
if (err) {
|
|
38
|
+
debug$1("no read permissions to read: %o, reason:", logoConf, err?.message);
|
|
39
|
+
return res.status(_verdaccio_core.HTTP_STATUS.NOT_FOUND).end();
|
|
40
|
+
} else {
|
|
41
|
+
res.setHeader("content-type", "image/x-icon");
|
|
42
|
+
fs.default.createReadStream(faviconPath).pipe(res);
|
|
43
|
+
debug$1("rendered custom ico");
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
res.setHeader("content-type", "image/x-icon");
|
|
49
|
+
const moduleDir = typeof __dirname === "undefined" ? path.default.dirname((0, url.fileURLToPath)({}.url)) : __dirname;
|
|
50
|
+
fs.default.createReadStream(path.default.join(moduleDir, "./web/html/favicon.ico")).pipe(res);
|
|
51
|
+
debug$1("rendered ico");
|
|
52
|
+
}
|
|
53
|
+
} catch (err) {
|
|
54
|
+
debug$1("error triggered, favicon not found %s", err?.message);
|
|
55
|
+
res.status(_verdaccio_core.HTTP_STATUS.NOT_FOUND).end();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
55
58
|
}
|
|
56
|
-
//#
|
|
59
|
+
//#endregion
|
|
60
|
+
exports.serveFavicon = serveFavicon;
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","names":[],"sources":["../../src/api/middleware.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'fs';\nimport _ from 'lodash';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport type { Config } from '@verdaccio/types';\nimport { isURL } from '@verdaccio/url';\n\nimport { HTTP_STATUS } from '../lib/constants';\nimport type { $RequestExtend, $ResponseExtend } from '../types';\n\nconst debug = buildDebug('verdaccio:middleware:favicon');\n\nexport function serveFavicon(config: Config) {\n return function (_req: $RequestExtend, res: $ResponseExtend) {\n try {\n const logoConf: string = config?.web?.favicon as string;\n if (logoConf === '') {\n debug('favicon disabled');\n res.status(404);\n } else if (!_.isEmpty(logoConf)) {\n debug('custom favicon');\n if (\n isURL(logoConf, {\n require_host: true,\n require_valid_protocol: true,\n })\n ) {\n debug('redirect to %o', logoConf);\n res.redirect(logoConf);\n return;\n } else {\n const faviconPath = path.normalize(logoConf);\n debug('serving favicon from %o', faviconPath);\n fs.access(faviconPath, fs.constants.R_OK, (err) => {\n if (err) {\n debug('no read permissions to read: %o, reason:', logoConf, err?.message);\n return res.status(HTTP_STATUS.NOT_FOUND).end();\n } else {\n res.setHeader('content-type', 'image/x-icon');\n fs.createReadStream(faviconPath).pipe(res);\n debug('rendered custom ico');\n }\n });\n }\n } else {\n res.setHeader('content-type', 'image/x-icon');\n // __dirname only exists in the CJS build; the ESM build resolves from import.meta.url\n const moduleDir =\n typeof __dirname === 'undefined'\n ? path.dirname(fileURLToPath(import.meta.url))\n : __dirname;\n fs.createReadStream(path.join(moduleDir, './web/html/favicon.ico')).pipe(res);\n debug('rendered ico');\n }\n } catch (err: any) {\n debug('error triggered, favicon not found %s', err?.message);\n res.status(HTTP_STATUS.NOT_FOUND).end();\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAYA,IAAM,WAAA,GAAA,MAAA,QAAA,CAAmB,8BAA8B;AAEvD,SAAgB,aAAa,QAAgB;CAC3C,OAAO,SAAU,MAAsB,KAAsB;EAC3D,IAAI;GACF,MAAM,WAAmB,QAAQ,KAAK;GACtC,IAAI,aAAa,IAAI;IACnB,QAAM,kBAAkB;IACxB,IAAI,OAAO,GAAG;GAChB,OAAO,IAAI,CAAC,OAAA,QAAE,QAAQ,QAAQ,GAAG;IAC/B,QAAM,gBAAgB;IACtB,KAAA,GAAA,eAAA,MAAA,CACQ,UAAU;KACd,cAAc;KACd,wBAAwB;IAC1B,CAAC,GACD;KACA,QAAM,kBAAkB,QAAQ;KAChC,IAAI,SAAS,QAAQ;KACrB;IACF,OAAO;KACL,MAAM,cAAc,KAAA,QAAK,UAAU,QAAQ;KAC3C,QAAM,2BAA2B,WAAW;KAC5C,GAAA,QAAG,OAAO,aAAa,GAAA,QAAG,UAAU,OAAO,QAAQ;MACjD,IAAI,KAAK;OACP,QAAM,4CAA4C,UAAU,KAAK,OAAO;OACxE,OAAO,IAAI,OAAO,gBAAA,YAAY,SAAS,CAAC,CAAC,IAAI;MAC/C,OAAO;OACL,IAAI,UAAU,gBAAgB,cAAc;OAC5C,GAAA,QAAG,iBAAiB,WAAW,CAAC,CAAC,KAAK,GAAG;OACzC,QAAM,qBAAqB;MAC7B;KACF,CAAC;IACH;GACF,OAAO;IACL,IAAI,UAAU,gBAAgB,cAAc;IAE5C,MAAM,YACJ,OAAO,cAAc,cACjB,KAAA,QAAK,SAAA,GAAA,IAAA,cAAA,CAAA,CAAA,EAAkC,GAAG,CAAC,IAC3C;IACN,GAAA,QAAG,iBAAiB,KAAA,QAAK,KAAK,WAAW,wBAAwB,CAAC,CAAC,CAAC,KAAK,GAAG;IAC5E,QAAM,cAAc;GACtB;EACF,SAAS,KAAU;GACjB,QAAM,yCAAyC,KAAK,OAAO;GAC3D,IAAI,OAAO,gBAAA,YAAY,SAAS,CAAC,CAAC,IAAI;EACxC;CACF;AACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { HTTP_STATUS } from "../lib/constants.mjs";
|
|
2
|
+
import _ from "lodash";
|
|
3
|
+
import createDebug from "debug";
|
|
4
|
+
import Path from "path";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import { isURL } from "@verdaccio/url";
|
|
8
|
+
//#region src/api/middleware.ts
|
|
9
|
+
var debug = createDebug("verdaccio:middleware:favicon");
|
|
10
|
+
function serveFavicon(config) {
|
|
11
|
+
return function(_req, res) {
|
|
12
|
+
try {
|
|
13
|
+
const logoConf = config?.web?.favicon;
|
|
14
|
+
if (logoConf === "") {
|
|
15
|
+
debug("favicon disabled");
|
|
16
|
+
res.status(404);
|
|
17
|
+
} else if (!_.isEmpty(logoConf)) {
|
|
18
|
+
debug("custom favicon");
|
|
19
|
+
if (isURL(logoConf, {
|
|
20
|
+
require_host: true,
|
|
21
|
+
require_valid_protocol: true
|
|
22
|
+
})) {
|
|
23
|
+
debug("redirect to %o", logoConf);
|
|
24
|
+
res.redirect(logoConf);
|
|
25
|
+
return;
|
|
26
|
+
} else {
|
|
27
|
+
const faviconPath = Path.normalize(logoConf);
|
|
28
|
+
debug("serving favicon from %o", faviconPath);
|
|
29
|
+
fs.access(faviconPath, fs.constants.R_OK, (err) => {
|
|
30
|
+
if (err) {
|
|
31
|
+
debug("no read permissions to read: %o, reason:", logoConf, err?.message);
|
|
32
|
+
return res.status(HTTP_STATUS.NOT_FOUND).end();
|
|
33
|
+
} else {
|
|
34
|
+
res.setHeader("content-type", "image/x-icon");
|
|
35
|
+
fs.createReadStream(faviconPath).pipe(res);
|
|
36
|
+
debug("rendered custom ico");
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
res.setHeader("content-type", "image/x-icon");
|
|
42
|
+
const moduleDir = typeof __dirname === "undefined" ? Path.dirname(fileURLToPath(import.meta.url)) : __dirname;
|
|
43
|
+
fs.createReadStream(Path.join(moduleDir, "./web/html/favicon.ico")).pipe(res);
|
|
44
|
+
debug("rendered ico");
|
|
45
|
+
}
|
|
46
|
+
} catch (err) {
|
|
47
|
+
debug("error triggered, favicon not found %s", err?.message);
|
|
48
|
+
res.status(HTTP_STATUS.NOT_FOUND).end();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { serveFavicon };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=middleware.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.mjs","names":[],"sources":["../../src/api/middleware.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'fs';\nimport _ from 'lodash';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport type { Config } from '@verdaccio/types';\nimport { isURL } from '@verdaccio/url';\n\nimport { HTTP_STATUS } from '../lib/constants';\nimport type { $RequestExtend, $ResponseExtend } from '../types';\n\nconst debug = buildDebug('verdaccio:middleware:favicon');\n\nexport function serveFavicon(config: Config) {\n return function (_req: $RequestExtend, res: $ResponseExtend) {\n try {\n const logoConf: string = config?.web?.favicon as string;\n if (logoConf === '') {\n debug('favicon disabled');\n res.status(404);\n } else if (!_.isEmpty(logoConf)) {\n debug('custom favicon');\n if (\n isURL(logoConf, {\n require_host: true,\n require_valid_protocol: true,\n })\n ) {\n debug('redirect to %o', logoConf);\n res.redirect(logoConf);\n return;\n } else {\n const faviconPath = path.normalize(logoConf);\n debug('serving favicon from %o', faviconPath);\n fs.access(faviconPath, fs.constants.R_OK, (err) => {\n if (err) {\n debug('no read permissions to read: %o, reason:', logoConf, err?.message);\n return res.status(HTTP_STATUS.NOT_FOUND).end();\n } else {\n res.setHeader('content-type', 'image/x-icon');\n fs.createReadStream(faviconPath).pipe(res);\n debug('rendered custom ico');\n }\n });\n }\n } else {\n res.setHeader('content-type', 'image/x-icon');\n // __dirname only exists in the CJS build; the ESM build resolves from import.meta.url\n const moduleDir =\n typeof __dirname === 'undefined'\n ? path.dirname(fileURLToPath(import.meta.url))\n : __dirname;\n fs.createReadStream(path.join(moduleDir, './web/html/favicon.ico')).pipe(res);\n debug('rendered ico');\n }\n } catch (err: any) {\n debug('error triggered, favicon not found %s', err?.message);\n res.status(HTTP_STATUS.NOT_FOUND).end();\n }\n };\n}\n"],"mappings":";;;;;;;;AAYA,IAAM,QAAQ,YAAW,8BAA8B;AAEvD,SAAgB,aAAa,QAAgB;CAC3C,OAAO,SAAU,MAAsB,KAAsB;EAC3D,IAAI;GACF,MAAM,WAAmB,QAAQ,KAAK;GACtC,IAAI,aAAa,IAAI;IACnB,MAAM,kBAAkB;IACxB,IAAI,OAAO,GAAG;GAChB,OAAO,IAAI,CAAC,EAAE,QAAQ,QAAQ,GAAG;IAC/B,MAAM,gBAAgB;IACtB,IACE,MAAM,UAAU;KACd,cAAc;KACd,wBAAwB;IAC1B,CAAC,GACD;KACA,MAAM,kBAAkB,QAAQ;KAChC,IAAI,SAAS,QAAQ;KACrB;IACF,OAAO;KACL,MAAM,cAAc,KAAK,UAAU,QAAQ;KAC3C,MAAM,2BAA2B,WAAW;KAC5C,GAAG,OAAO,aAAa,GAAG,UAAU,OAAO,QAAQ;MACjD,IAAI,KAAK;OACP,MAAM,4CAA4C,UAAU,KAAK,OAAO;OACxE,OAAO,IAAI,OAAO,YAAY,SAAS,CAAC,CAAC,IAAI;MAC/C,OAAO;OACL,IAAI,UAAU,gBAAgB,cAAc;OAC5C,GAAG,iBAAiB,WAAW,CAAC,CAAC,KAAK,GAAG;OACzC,MAAM,qBAAqB;MAC7B;KACF,CAAC;IACH;GACF,OAAO;IACL,IAAI,UAAU,gBAAgB,cAAc;IAE5C,MAAM,YACJ,OAAO,cAAc,cACjB,KAAK,QAAQ,cAAc,OAAO,KAAK,GAAG,CAAC,IAC3C;IACN,GAAG,iBAAiB,KAAK,KAAK,WAAW,wBAAwB,CAAC,CAAC,CAAC,KAAK,GAAG;IAC5E,MAAM,cAAc;GACtB;EACF,SAAS,KAAU;GACjB,MAAM,yCAAyC,KAAK,OAAO;GAC3D,IAAI,OAAO,YAAY,SAAS,CAAC,CAAC,IAAI;EACxC;CACF;AACF"}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
4
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
router.use((0, _search.default)(storage, auth));
|
|
25
|
-
if ((0, _utils.hasLogin)(config)) {
|
|
26
|
-
router.use((0, _user.default)(auth, config));
|
|
27
|
-
}
|
|
28
|
-
return router;
|
|
5
|
+
const require_lib_utils = require("../../../lib/utils.js");
|
|
6
|
+
const require_api_web_api_package = require("./package.js");
|
|
7
|
+
const require_api_web_api_search = require("./search.js");
|
|
8
|
+
const require_api_web_api_user = require("./user.js");
|
|
9
|
+
let _verdaccio_middleware = require("@verdaccio/middleware");
|
|
10
|
+
let express = require("express");
|
|
11
|
+
//#region src/api/web/api/index.ts
|
|
12
|
+
var api_default = (auth, storage, config) => {
|
|
13
|
+
const router = (0, express.Router)();
|
|
14
|
+
router.use((0, _verdaccio_middleware.rateLimit)({
|
|
15
|
+
windowMs: 120 * 1e3,
|
|
16
|
+
max: 5e3,
|
|
17
|
+
...config?.web?.rateLimit
|
|
18
|
+
}));
|
|
19
|
+
router.use(require_api_web_api_package.default(storage, auth, config));
|
|
20
|
+
router.use(require_api_web_api_search.default(storage, auth));
|
|
21
|
+
if (require_lib_utils.hasLogin(config)) router.use(require_api_web_api_user.default(auth, config));
|
|
22
|
+
return router;
|
|
29
23
|
};
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.default = api_default;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/api/web/api/index.ts"],"sourcesContent":["import { Router } from 'express';\n\nimport { rateLimit } from '@verdaccio/middleware';\n\nimport { hasLogin } from '../../../lib/utils';\nimport packageApi from './package';\nimport search from './search';\nimport user from './user';\n\nexport default (auth, storage, config) => {\n const router = Router();\n router.use(\n rateLimit({\n windowMs: 2 * 60 * 1000, // 2 minutes\n max: 5000, // limit each IP to 1000 requests per windowMs\n ...config?.web?.rateLimit,\n })\n );\n router.use(packageApi(storage, auth, config));\n router.use(search(storage, auth));\n if (hasLogin(config)) {\n router.use(user(auth, config));\n }\n return router;\n};\n"],"mappings":";;;;;;;;;;;AASA,IAAA,eAAgB,MAAM,SAAS,WAAW;CACxC,MAAM,UAAA,GAAA,QAAA,OAAA,CAAgB;CACtB,OAAO,KAAA,GAAA,sBAAA,UAAA,CACK;EACR,UAAU,MAAS;EACnB,KAAK;EACL,GAAG,QAAQ,KAAK;CAClB,CAAC,CACH;CACA,OAAO,IAAI,4BAAA,QAAW,SAAS,MAAM,MAAM,CAAC;CAC5C,OAAO,IAAI,2BAAA,QAAO,SAAS,IAAI,CAAC;CAChC,IAAI,kBAAA,SAAS,MAAM,GACjB,OAAO,IAAI,yBAAA,QAAK,MAAM,MAAM,CAAC;CAE/B,OAAO;AACT"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { hasLogin } from "../../../lib/utils.mjs";
|
|
2
|
+
import addPackageWebApi from "./package.mjs";
|
|
3
|
+
import addSearchWebApi from "./search.mjs";
|
|
4
|
+
import addUserAuthApi from "./user.mjs";
|
|
5
|
+
import { rateLimit } from "@verdaccio/middleware";
|
|
6
|
+
import { Router } from "express";
|
|
7
|
+
//#region src/api/web/api/index.ts
|
|
8
|
+
var api_default = (auth, storage, config) => {
|
|
9
|
+
const router = Router();
|
|
10
|
+
router.use(rateLimit({
|
|
11
|
+
windowMs: 120 * 1e3,
|
|
12
|
+
max: 5e3,
|
|
13
|
+
...config?.web?.rateLimit
|
|
14
|
+
}));
|
|
15
|
+
router.use(addPackageWebApi(storage, auth, config));
|
|
16
|
+
router.use(addSearchWebApi(storage, auth));
|
|
17
|
+
if (hasLogin(config)) router.use(addUserAuthApi(auth, config));
|
|
18
|
+
return router;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { api_default as default };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/api/web/api/index.ts"],"sourcesContent":["import { Router } from 'express';\n\nimport { rateLimit } from '@verdaccio/middleware';\n\nimport { hasLogin } from '../../../lib/utils';\nimport packageApi from './package';\nimport search from './search';\nimport user from './user';\n\nexport default (auth, storage, config) => {\n const router = Router();\n router.use(\n rateLimit({\n windowMs: 2 * 60 * 1000, // 2 minutes\n max: 5000, // limit each IP to 1000 requests per windowMs\n ...config?.web?.rateLimit,\n })\n );\n router.use(packageApi(storage, auth, config));\n router.use(search(storage, auth));\n if (hasLogin(config)) {\n router.use(user(auth, config));\n }\n return router;\n};\n"],"mappings":";;;;;;;AASA,IAAA,eAAgB,MAAM,SAAS,WAAW;CACxC,MAAM,SAAS,OAAO;CACtB,OAAO,IACL,UAAU;EACR,UAAU,MAAS;EACnB,KAAK;EACL,GAAG,QAAQ,KAAK;CAClB,CAAC,CACH;CACA,OAAO,IAAI,iBAAW,SAAS,MAAM,MAAM,CAAC;CAC5C,OAAO,IAAI,gBAAO,SAAS,IAAI,CAAC;CAChC,IAAI,SAAS,MAAM,GACjB,OAAO,IAAI,eAAK,MAAM,MAAM,CAAC;CAE/B,OAAO;AACT"}
|