@verdaccio/server 6.0.0-6-next.55 → 6.0.0-6-next.57

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/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @verdaccio/server
2
2
 
3
+ ## 6.0.0-6-next.57
4
+
5
+ ### Patch Changes
6
+
7
+ - @verdaccio/auth@6.0.0-6-next.47
8
+ - @verdaccio/api@6.0.0-6-next.51
9
+ - verdaccio-audit@11.0.0-6-next.31
10
+ - @verdaccio/web@6.0.0-6-next.55
11
+ - @verdaccio/core@6.0.0-6-next.68
12
+ - @verdaccio/config@6.0.0-6-next.68
13
+ - @verdaccio/loaders@6.0.0-6-next.37
14
+ - @verdaccio/middleware@6.0.0-6-next.47
15
+ - @verdaccio/store@6.0.0-6-next.48
16
+ - @verdaccio/utils@6.0.0-6-next.36
17
+ - @verdaccio/logger@6.0.0-6-next.36
18
+
19
+ ## 6.0.0-6-next.56
20
+
21
+ ### Minor Changes
22
+
23
+ - 16e38df8: feat: trustProxy property
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [16e38df8]
28
+ - @verdaccio/config@6.0.0-6-next.67
29
+ - @verdaccio/core@6.0.0-6-next.67
30
+ - @verdaccio/store@6.0.0-6-next.47
31
+ - @verdaccio/api@6.0.0-6-next.50
32
+ - @verdaccio/auth@6.0.0-6-next.46
33
+ - @verdaccio/loaders@6.0.0-6-next.36
34
+ - @verdaccio/middleware@6.0.0-6-next.46
35
+ - verdaccio-audit@11.0.0-6-next.30
36
+ - @verdaccio/web@6.0.0-6-next.54
37
+ - @verdaccio/utils@6.0.0-6-next.35
38
+ - @verdaccio/logger@6.0.0-6-next.35
39
+
3
40
  ## 6.0.0-6-next.55
4
41
 
5
42
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["app","configPath","get","req","res","next","global","gc","pid","process","main","conf","mem","memoryUsage"],"sources":["../../src/debug/index.ts"],"sourcesContent":["import { Application } from 'express';\n\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../types/custom';\n\nexport default (app: Application, configPath?: string): void => {\n // Hook for tests only\n app.get(\n '/-/_debug',\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n if (global.gc) {\n global.gc();\n }\n\n next({\n pid: process.pid,\n // @ts-ignore\n main: process.main,\n conf: configPath,\n mem: process.memoryUsage(),\n gc: global.gc,\n });\n }\n );\n};\n"],"mappings":";;;;;;eAIe,CAACA,GAAgB,EAAEC,UAAmB,KAAW;EAC9D;EACAD,GAAG,CAACE,GAAG,CACL,WAAW,EACX,UAAUC,GAAmB,EAAEC,GAAoB,EAAEC,IAAsB,EAAQ;IACjF,IAAIC,MAAM,CAACC,EAAE,EAAE;MACbD,MAAM,CAACC,EAAE,EAAE;IACb;IAEAF,IAAI,CAAC;MACHG,GAAG,EAAEC,OAAO,CAACD,GAAG;MAChB;MACAE,IAAI,EAAED,OAAO,CAACC,IAAI;MAClBC,IAAI,EAAEV,UAAU;MAChBW,GAAG,EAAEH,OAAO,CAACI,WAAW,EAAE;MAC1BN,EAAE,EAAED,MAAM,CAACC;IACb,CAAC,CAAC;EACJ,CAAC,CACF;AACH,CAAC;AAAA"}
1
+ {"version":3,"file":"index.js","names":["_default","app","configPath","get","req","res","next","global","gc","pid","process","main","conf","mem","memoryUsage","exports","default"],"sources":["../../src/debug/index.ts"],"sourcesContent":["import { Application } from 'express';\n\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../types/custom';\n\nexport default (app: Application, configPath?: string): void => {\n // Hook for tests only\n app.get(\n '/-/_debug',\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n if (global.gc) {\n global.gc();\n }\n\n next({\n pid: process.pid,\n // @ts-ignore\n main: process.main,\n conf: configPath,\n mem: process.memoryUsage(),\n gc: global.gc,\n });\n }\n );\n};\n"],"mappings":";;;;;;eAIeA,CAACC,GAAgB,EAAEC,UAAmB,KAAW;EAC9D;EACAD,GAAG,CAACE,GAAG,CACL,WAAW,EACX,UAAUC,GAAmB,EAAEC,GAAoB,EAAEC,IAAsB,EAAQ;IACjF,IAAIC,MAAM,CAACC,EAAE,EAAE;MACbD,MAAM,CAACC,EAAE,EAAE;IACb;IAEAF,IAAI,CAAC;MACHG,GAAG,EAAEC,OAAO,CAACD,GAAG;MAChB;MACAE,IAAI,EAAED,OAAO,CAACC,IAAI;MAClBC,IAAI,EAAEV,UAAU;MAChBW,GAAG,EAAEH,OAAO,CAACI,WAAW,EAAE;MAC1BN,EAAE,EAAED,MAAM,CAACC;IACb,CAAC,CAAC;EACJ,CAAC,CACF;AACH,CAAC;AAAAO,OAAA,CAAAC,OAAA,GAAAhB,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export { default } from './server';\n"],"mappings":";;;;;;;;;;;AAAA;AAAmC"}
1
+ {"version":3,"file":"index.js","names":["_server","_interopRequireDefault","require","obj","__esModule","default"],"sources":["../src/index.ts"],"sourcesContent":["export { default } from './server';\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
package/build/server.js CHANGED
@@ -26,12 +26,16 @@ const {
26
26
  version
27
27
  } = require('../package.json');
28
28
  const defineAPI = async function (config, storage) {
29
+ var _config$server;
29
30
  const auth = new _auth.Auth(config);
30
31
  await auth.init();
31
32
  const app = (0, _express.default)();
32
33
  // run in production mode by default, just in case
33
34
  // it shouldn't make any difference anyway
34
35
  app.set('env', process.env.NODE_ENV || 'production');
36
+ if ((_config$server = config.server) !== null && _config$server !== void 0 && _config$server.trustProxy) {
37
+ app.set('trust proxy', config.server.trustProxy);
38
+ }
35
39
  app.use((0, _cors.default)());
36
40
  app.use((0, _middleware.rateLimit)(config.serverSettings.rateLimit));
37
41
  const errorReportingMiddlewareWrap = (0, _middleware.errorReportingMiddleware)(_logger.logger);
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","names":["debug","buildDebug","version","require","defineAPI","config","storage","auth","Auth","init","app","express","set","process","env","NODE_ENV","use","cors","rateLimit","serverSettings","errorReportingMiddlewareWrap","errorReportingMiddleware","logger","log","userAgent","compression","get","req","res","next","url","_debug","hookDebug","configPath","plugins","asyncLoadPlugin","middlewares","plugin","register_middlewares","length","info","push","AuditMiddleware","enabled","strict_ssl","forEach","apiEndpoint","_","_req","locals","app_version","webMiddleware","errorUtils","getNotFound","API_ERROR","WEB_DISABLED","err","isError","code","statusCode","HTTP_STATUS","NOT_MODIFIED","isFunction","report_error","noop","final","startServer","configHash","AppConfig","Storage","error","msg","Error"],"sources":["../src/server.ts"],"sourcesContent":["import compression from 'compression';\nimport cors from 'cors';\nimport buildDebug from 'debug';\nimport express from 'express';\nimport { HttpError } from 'http-errors';\nimport _ from 'lodash';\nimport AuditMiddleware from 'verdaccio-audit';\n\nimport apiEndpoint from '@verdaccio/api';\nimport { Auth } from '@verdaccio/auth';\nimport { Config as AppConfig } from '@verdaccio/config';\nimport { API_ERROR, HTTP_STATUS, errorUtils, pluginUtils } from '@verdaccio/core';\nimport { asyncLoadPlugin } from '@verdaccio/loaders';\nimport { logger } from '@verdaccio/logger';\nimport { errorReportingMiddleware, final, log, rateLimit, userAgent } from '@verdaccio/middleware';\nimport { Storage } from '@verdaccio/store';\nimport { ConfigYaml } from '@verdaccio/types';\nimport { Config as IConfig } from '@verdaccio/types';\nimport webMiddleware from '@verdaccio/web';\n\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';\nimport hookDebug from './debug';\n\nconst debug = buildDebug('verdaccio:server');\nconst { version } = require('../package.json');\n\nconst defineAPI = async function (config: IConfig, storage: Storage): Promise<any> {\n const auth: Auth = new Auth(config);\n await auth.init();\n const app = express();\n // run in production mode by default, just in case\n // it shouldn't make any difference anyway\n app.set('env', process.env.NODE_ENV || 'production');\n app.use(cors());\n app.use(rateLimit(config.serverSettings.rateLimit));\n\n const errorReportingMiddlewareWrap = errorReportingMiddleware(logger);\n\n // Router setup\n app.use(log(logger));\n app.use(errorReportingMiddlewareWrap);\n app.use(userAgent(config));\n app.use(compression());\n\n app.get(\n '/favicon.ico',\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n req.url = '/-/static/favicon.png';\n next();\n }\n );\n\n // Hook for tests only\n if (config._debug) {\n hookDebug(app, config.configPath);\n }\n\n const plugins: pluginUtils.ExpressMiddleware<IConfig, {}, Auth>[] = await asyncLoadPlugin(\n config.middlewares,\n {\n config,\n logger,\n },\n function (plugin) {\n return typeof plugin.register_middlewares !== 'undefined';\n }\n );\n\n if (plugins.length === 0) {\n logger.info('none middleware plugins has been defined, adding audit middleware by default');\n // @ts-ignore\n plugins.push(new AuditMiddleware({ enabled: true, strict_ssl: true }, { config, logger }));\n }\n\n plugins.forEach((plugin: pluginUtils.ExpressMiddleware<IConfig, {}, Auth>) => {\n plugin.register_middlewares(app, auth, storage);\n });\n\n // For npm request\n // @ts-ignore\n app.use(apiEndpoint(config, auth, storage));\n\n // For WebUI & WebUI API\n if (_.get(config, 'web.enable', true)) {\n app.use((_req, res, next) => {\n res.locals.app_version = version ?? '';\n next();\n });\n app.use(await webMiddleware(config, auth, storage));\n } else {\n app.get('/', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound(API_ERROR.WEB_DISABLED));\n });\n }\n\n // Catch 404\n app.get('/*', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound('resource not found'));\n });\n\n app.use(function (\n err: HttpError,\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ) {\n if (_.isError(err)) {\n if (err.code === 'ECONNABORT' && res.statusCode === HTTP_STATUS.NOT_MODIFIED) {\n return next();\n }\n if (_.isFunction(res.locals.report_error) === false) {\n // in case of very early error this middleware may not be loaded before error is generated\n // fixing that\n errorReportingMiddlewareWrap(req, res, _.noop);\n }\n res.locals.report_error(err);\n } else {\n // Fall to Middleware.final\n return next(err);\n }\n });\n\n app.use(final);\n\n return app;\n};\n\nexport default (async function startServer(configHash: ConfigYaml): Promise<any> {\n debug('start server');\n const config: IConfig = new AppConfig({ ...configHash } as any);\n // register middleware plugins\n debug('loaded filter plugin');\n // @ts-ignore\n const storage: Storage = new Storage(config);\n try {\n // waits until init calls have been initialized\n debug('storage init start');\n await storage.init(config);\n debug('storage init end');\n } catch (err: any) {\n logger.error({ error: err.msg }, 'storage has failed: @{error}');\n throw new Error(err);\n }\n return await defineAPI(config, storage);\n});\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAGA;AAAgC;AAEhC,MAAMA,KAAK,GAAG,IAAAC,cAAU,EAAC,kBAAkB,CAAC;AAC5C,MAAM;EAAEC;AAAQ,CAAC,GAAGC,OAAO,CAAC,iBAAiB,CAAC;AAE9C,MAAMC,SAAS,GAAG,gBAAgBC,MAAe,EAAEC,OAAgB,EAAgB;EACjF,MAAMC,IAAU,GAAG,IAAIC,UAAI,CAACH,MAAM,CAAC;EACnC,MAAME,IAAI,CAACE,IAAI,EAAE;EACjB,MAAMC,GAAG,GAAG,IAAAC,gBAAO,GAAE;EACrB;EACA;EACAD,GAAG,CAACE,GAAG,CAAC,KAAK,EAAEC,OAAO,CAACC,GAAG,CAACC,QAAQ,IAAI,YAAY,CAAC;EACpDL,GAAG,CAACM,GAAG,CAAC,IAAAC,aAAI,GAAE,CAAC;EACfP,GAAG,CAACM,GAAG,CAAC,IAAAE,qBAAS,EAACb,MAAM,CAACc,cAAc,CAACD,SAAS,CAAC,CAAC;EAEnD,MAAME,4BAA4B,GAAG,IAAAC,oCAAwB,EAACC,cAAM,CAAC;;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,CAACO,GAAG,EAAEC,GAAG,EAAEmB,eAAC,CAACiB,IAAI,CAAC;MAChD;MACApC,GAAG,CAACqB,MAAM,CAACc,YAAY,CAACP,GAAG,CAAC;IAC9B,CAAC,MAAM;MACL;MACA,OAAO3B,IAAI,CAAC2B,GAAG,CAAC;IAClB;EACF,CAAC,CAAC;EAEF9C,GAAG,CAACM,GAAG,CAACiD,iBAAK,CAAC;EAEd,OAAOvD,GAAG;AACZ,CAAC;AAAC,IAE6BwD,WAAW,GAA1B,eAAeA,WAAW,CAACC,UAAsB,EAAgB;EAC/EnE,KAAK,CAAC,cAAc,CAAC;EACrB,MAAMK,MAAe,GAAG,IAAI+D,cAAS,CAAC;IAAE,GAAGD;EAAW,CAAC,CAAQ;EAC/D;EACAnE,KAAK,CAAC,sBAAsB,CAAC;EAC7B;EACA,MAAMM,OAAgB,GAAG,IAAI+D,cAAO,CAAChE,MAAM,CAAC;EAC5C,IAAI;IACF;IACAL,KAAK,CAAC,oBAAoB,CAAC;IAC3B,MAAMM,OAAO,CAACG,IAAI,CAACJ,MAAM,CAAC;IAC1BL,KAAK,CAAC,kBAAkB,CAAC;EAC3B,CAAC,CAAC,OAAOwD,GAAQ,EAAE;IACjBlC,cAAM,CAACgD,KAAK,CAAC;MAAEA,KAAK,EAAEd,GAAG,CAACe;IAAI,CAAC,EAAE,8BAA8B,CAAC;IAChE,MAAM,IAAIC,KAAK,CAAChB,GAAG,CAAC;EACtB;EACA,OAAO,MAAMpD,SAAS,CAACC,MAAM,EAAEC,OAAO,CAAC;AACzC,CAAC;AAAA"}
1
+ {"version":3,"file":"server.js","names":["_compression","_interopRequireDefault","require","_cors","_debug","_express","_lodash","_verdaccioAudit","_api","_auth","_config","_core","_loaders","_logger","_middleware","_store","_web","_debug2","obj","__esModule","default","debug","buildDebug","version","defineAPI","config","storage","_config$server","auth","Auth","init","app","express","set","process","env","NODE_ENV","server","trustProxy","use","cors","rateLimit","serverSettings","errorReportingMiddlewareWrap","errorReportingMiddleware","logger","log","userAgent","compression","get","req","res","next","url","hookDebug","configPath","plugins","asyncLoadPlugin","middlewares","plugin","register_middlewares","length","info","push","AuditMiddleware","enabled","strict_ssl","forEach","apiEndpoint","_","_req","locals","app_version","webMiddleware","errorUtils","getNotFound","API_ERROR","WEB_DISABLED","err","isError","code","statusCode","HTTP_STATUS","NOT_MODIFIED","isFunction","report_error","noop","final","startServer","configHash","AppConfig","Storage","error","msg","Error","exports"],"sources":["../src/server.ts"],"sourcesContent":["import compression from 'compression';\nimport cors from 'cors';\nimport buildDebug from 'debug';\nimport express from 'express';\nimport { HttpError } from 'http-errors';\nimport _ from 'lodash';\nimport AuditMiddleware from 'verdaccio-audit';\n\nimport apiEndpoint from '@verdaccio/api';\nimport { Auth } from '@verdaccio/auth';\nimport { Config as AppConfig } from '@verdaccio/config';\nimport { API_ERROR, HTTP_STATUS, errorUtils, pluginUtils } from '@verdaccio/core';\nimport { asyncLoadPlugin } from '@verdaccio/loaders';\nimport { logger } from '@verdaccio/logger';\nimport { errorReportingMiddleware, final, log, rateLimit, userAgent } from '@verdaccio/middleware';\nimport { Storage } from '@verdaccio/store';\nimport { ConfigYaml } from '@verdaccio/types';\nimport { Config as IConfig } from '@verdaccio/types';\nimport webMiddleware from '@verdaccio/web';\n\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';\nimport hookDebug from './debug';\n\nconst debug = buildDebug('verdaccio:server');\nconst { version } = require('../package.json');\n\nconst defineAPI = async function (config: IConfig, storage: Storage): Promise<any> {\n const auth: Auth = new Auth(config);\n await auth.init();\n const app = express();\n // run in production mode by default, just in case\n // it shouldn't make any difference anyway\n app.set('env', process.env.NODE_ENV || 'production');\n if (config.server?.trustProxy) {\n app.set('trust proxy', config.server.trustProxy);\n }\n app.use(cors());\n app.use(rateLimit(config.serverSettings.rateLimit));\n\n const errorReportingMiddlewareWrap = errorReportingMiddleware(logger);\n\n // Router setup\n app.use(log(logger));\n app.use(errorReportingMiddlewareWrap);\n app.use(userAgent(config));\n app.use(compression());\n\n app.get(\n '/favicon.ico',\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n req.url = '/-/static/favicon.png';\n next();\n }\n );\n\n // Hook for tests only\n if (config._debug) {\n hookDebug(app, config.configPath);\n }\n\n const plugins: pluginUtils.ExpressMiddleware<IConfig, {}, Auth>[] = await asyncLoadPlugin(\n config.middlewares,\n {\n config,\n logger,\n },\n function (plugin) {\n return typeof plugin.register_middlewares !== 'undefined';\n }\n );\n\n if (plugins.length === 0) {\n logger.info('none middleware plugins has been defined, adding audit middleware by default');\n // @ts-ignore\n plugins.push(new AuditMiddleware({ enabled: true, strict_ssl: true }, { config, logger }));\n }\n\n plugins.forEach((plugin: pluginUtils.ExpressMiddleware<IConfig, {}, Auth>) => {\n plugin.register_middlewares(app, auth, storage);\n });\n\n // For npm request\n // @ts-ignore\n app.use(apiEndpoint(config, auth, storage));\n\n // For WebUI & WebUI API\n if (_.get(config, 'web.enable', true)) {\n app.use((_req, res, next) => {\n res.locals.app_version = version ?? '';\n next();\n });\n app.use(await webMiddleware(config, auth, storage));\n } else {\n app.get('/', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound(API_ERROR.WEB_DISABLED));\n });\n }\n\n // Catch 404\n app.get('/*', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound('resource not found'));\n });\n\n app.use(function (\n err: HttpError,\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ) {\n if (_.isError(err)) {\n if (err.code === 'ECONNABORT' && res.statusCode === HTTP_STATUS.NOT_MODIFIED) {\n return next();\n }\n if (_.isFunction(res.locals.report_error) === false) {\n // in case of very early error this middleware may not be loaded before error is generated\n // fixing that\n errorReportingMiddlewareWrap(req, res, _.noop);\n }\n res.locals.report_error(err);\n } else {\n // Fall to Middleware.final\n return next(err);\n }\n });\n\n app.use(final);\n\n return app;\n};\n\nexport default (async function startServer(configHash: ConfigYaml): Promise<any> {\n debug('start server');\n const config: IConfig = new AppConfig({ ...configHash } as any);\n // register middleware plugins\n debug('loaded filter plugin');\n // @ts-ignore\n const storage: Storage = new Storage(config);\n try {\n // waits until init calls have been initialized\n debug('storage init start');\n await storage.init(config);\n debug('storage init end');\n } catch (err: any) {\n logger.error({ error: err.msg }, 'storage has failed: @{error}');\n throw new Error(err);\n }\n return await defineAPI(config, storage);\n});\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,IAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AAGA,IAAAc,IAAA,GAAAf,sBAAA,CAAAC,OAAA;AAGA,IAAAe,OAAA,GAAAhB,sBAAA,CAAAC,OAAA;AAAgC,SAAAD,uBAAAiB,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,kBAAkB,CAAC;AAC5C,MAAM;EAAEC;AAAQ,CAAC,GAAGrB,OAAO,CAAC,iBAAiB,CAAC;AAE9C,MAAMsB,SAAS,GAAG,eAAAA,CAAgBC,MAAe,EAAEC,O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O,CAAClE,MAAM,CAAC;EAC5C,IAAI;IACF;IACAJ,KAAK,CAAC,oBAAoB,CAAC;IAC3B,MAAMK,OAAO,CAACI,IAAI,CAACL,MAAM,CAAC;IAC1BJ,KAAK,CAAC,kBAAkB,CAAC;EAC3B,CAAC,CAAC,OAAOyD,GAAQ,EAAE;IACjBjC,cAAM,CAAC+C,KAAK,CAAC;MAAEA,KAAK,EAAEd,GAAG,CAACe;IAAI,CAAC,EAAE,8BAA8B,CAAC;IAChE,MAAM,IAAIC,KAAK,CAAChB,GAAG,CAAC;EACtB;EACA,OAAO,MAAMtD,SAAS,CAACC,MAAM,EAAEC,OAAO,CAAC;AACzC,CAAC;AAAAqE,OAAA,CAAA3E,OAAA,GAAAoE,WAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/server",
3
- "version": "6.0.0-6-next.55",
3
+ "version": "6.0.0-6-next.57",
4
4
  "description": "server logic",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -30,17 +30,17 @@
30
30
  "npm": ">=6"
31
31
  },
32
32
  "dependencies": {
33
- "@verdaccio/api": "6.0.0-6-next.49",
34
- "@verdaccio/auth": "6.0.0-6-next.45",
35
- "@verdaccio/core": "6.0.0-6-next.66",
36
- "@verdaccio/config": "6.0.0-6-next.66",
37
- "@verdaccio/loaders": "6.0.0-6-next.35",
38
- "@verdaccio/logger": "6.0.0-6-next.34",
39
- "@verdaccio/middleware": "6.0.0-6-next.45",
40
- "@verdaccio/store": "6.0.0-6-next.46",
41
- "@verdaccio/utils": "6.0.0-6-next.34",
42
- "@verdaccio/web": "6.0.0-6-next.53",
43
- "verdaccio-audit": "11.0.0-6-next.29",
33
+ "@verdaccio/api": "6.0.0-6-next.51",
34
+ "@verdaccio/auth": "6.0.0-6-next.47",
35
+ "@verdaccio/core": "6.0.0-6-next.68",
36
+ "@verdaccio/config": "6.0.0-6-next.68",
37
+ "@verdaccio/loaders": "6.0.0-6-next.37",
38
+ "@verdaccio/logger": "6.0.0-6-next.36",
39
+ "@verdaccio/middleware": "6.0.0-6-next.47",
40
+ "@verdaccio/store": "6.0.0-6-next.48",
41
+ "@verdaccio/utils": "6.0.0-6-next.36",
42
+ "@verdaccio/web": "6.0.0-6-next.55",
43
+ "verdaccio-audit": "11.0.0-6-next.31",
44
44
  "compression": "1.7.4",
45
45
  "cors": "2.8.5",
46
46
  "debug": "4.3.4",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "16.18.10",
52
- "@verdaccio/proxy": "6.0.0-6-next.44",
52
+ "@verdaccio/proxy": "6.0.0-6-next.46",
53
53
  "@verdaccio/test-helper": "2.0.0-6-next.8",
54
54
  "http-errors": "1.8.1"
55
55
  },
@@ -65,6 +65,5 @@
65
65
  "watch": "pnpm build:js -- --watch",
66
66
  "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
67
67
  "build": "pnpm run build:js && pnpm run build:types"
68
- },
69
- "readme": "# @verdaccio/server\n\n[![backers](https://opencollective.com/verdaccio/tiers/backer/badge.svg?label=Backer&color=brightgreen)](https://opencollective.com/verdaccio)\n[![stackshare](https://img.shields.io/badge/Follow%20on-StackShare-blue.svg?logo=stackshare&style=flat)](https://stackshare.io/verdaccio)\n[![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/verdaccio/verdaccio/blob/master/LICENSE)\n[![Crowdin](https://d322cqt584bo4o.cloudfront.net/verdaccio/localized.svg)](https://crowdin.com/project/verdaccio)\n[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/verdaccio/verdaccio)](https://www.tickgit.com/browse?repo=github.com/verdaccio/verdaccio)\n\n[![Twitter followers](https://img.shields.io/twitter/follow/verdaccio_npm.svg?style=social&label=Follow)](https://twitter.com/verdaccio_npm)\n[![Github](https://img.shields.io/github/stars/verdaccio/verdaccio.svg?style=social&label=Stars)](https://github.com/verdaccio/verdaccio/stargazers)\n\n## Donations\n\nVerdaccio is run by **volunteers**; nobody is working full-time on it. If you find this project to be useful and would like to support its development, consider making a donation - **your logo might end up in this readme.** 😉\n\n**[Donate](https://opencollective.com/verdaccio)** 💵👍🏻 starting from _\\$1/month_ or just one single contribution.\n\n## Report a vulnerability\n\nIf you want to report a security vulnerability, please follow the steps which we have defined for you in our [security policy](https://github.com/verdaccio/verdaccio/security/policy).\n\n## Open Collective Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/verdaccio#sponsor)]\n\n[![sponsor](https://opencollective.com/verdaccio/sponsor/0/avatar.svg)](https://opencollective.com/verdaccio/sponsor/0/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/1/avatar.svg)](https://opencollective.com/verdaccio/sponsor/1/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/2/avatar.svg)](https://opencollective.com/verdaccio/sponsor/2/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/3/avatar.svg)](https://opencollective.com/verdaccio/sponsor/3/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/4/avatar.svg)](https://opencollective.com/verdaccio/sponsor/4/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/5/avatar.svg)](https://opencollective.com/verdaccio/sponsor/5/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/6/avatar.svg)](https://opencollective.com/verdaccio/sponsor/6/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/7/avatar.svg)](https://opencollective.com/verdaccio/sponsor/7/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/8/avatar.svg)](https://opencollective.com/verdaccio/sponsor/8/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/9/avatar.svg)](https://opencollective.com/verdaccio/sponsor/9/website)\n\n## Open Collective Backers\n\nThank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/verdaccio#backer)]\n\n[![backers](https://opencollective.com/verdaccio/backers.svg?width=890)](https://opencollective.com/verdaccio#backers)\n\n## Special Thanks\n\nThanks to the following companies to help us to achieve our goals providing free open source licenses.\n\n[![jetbrain](assets/thanks/jetbrains/logo.png)](https://www.jetbrains.com/)\n[![crowdin](assets/thanks/crowdin/logo.png)](https://crowdin.com/)\n[![balsamiq](assets/thanks/balsamiq/logo.jpg)](https://balsamiq.com/)\n\n## Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].\n\n[![contributors](https://opencollective.com/verdaccio/contributors.svg?width=890&button=true)](../../graphs/contributors)\n\n### FAQ / Contact / Troubleshoot\n\nIf you have any issue you can try the following options, do no desist to ask or check our issues database, perhaps someone has asked already what you are looking for.\n\n- [Blog](https://verdaccio.org/blog/)\n- [Donations](https://opencollective.com/verdaccio)\n- [Reporting an issue](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md#reporting-a-bug)\n- [Running discussions](https://github.com/verdaccio/verdaccio/issues?q=is%3Aissue+is%3Aopen+label%3Adiscuss)\n- [Chat](http://chat.verdaccio.org/)\n- [Logos](https://verdaccio.org/docs/en/logo)\n- [Docker Examples](https://github.com/verdaccio/docker-examples)\n- [FAQ](https://github.com/verdaccio/verdaccio/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20)\n\n### License\n\nVerdaccio is [MIT licensed](https://github.com/verdaccio/verdaccio/blob/master/LICENSE)\n\nThe Verdaccio documentation and logos (excluding /thanks, e.g., .md, .png, .sketch) files within the /assets folder) is\n[Creative Commons licensed](https://github.com/verdaccio/verdaccio/blob/master/LICENSE-docs).\n"
68
+ }
70
69
  }
package/src/server.ts CHANGED
@@ -31,6 +31,9 @@ const defineAPI = async function (config: IConfig, storage: Storage): Promise<an
31
31
  // run in production mode by default, just in case
32
32
  // it shouldn't make any difference anyway
33
33
  app.set('env', process.env.NODE_ENV || 'production');
34
+ if (config.server?.trustProxy) {
35
+ app.set('trust proxy', config.server.trustProxy);
36
+ }
34
37
  app.use(cors());
35
38
  app.use(rateLimit(config.serverSettings.rateLimit));
36
39