@verdaccio/web 6.0.0-6-next.33 → 6.0.0-6-next.35
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 +96 -0
- package/build/api/user.js +3 -3
- package/build/api/user.js.map +1 -1
- package/build/middleware/render-web.d.ts +2 -2
- package/build/middleware/render-web.js +20 -6
- package/build/middleware/render-web.js.map +1 -1
- package/build/web-middleware.d.ts +1 -1
- package/build/web-middleware.js +2 -2
- package/build/web-middleware.js.map +1 -1
- package/package.json +17 -17
- package/src/api/user.ts +7 -3
- package/src/middleware/render-web.ts +21 -14
- package/src/web-middleware.ts +2 -2
- package/test/__snapshots__/template.test.ts.snap +56 -56
- package/test/__snapshots__/utils.spec.ts.snap +16 -16
- package/test/helper.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,101 @@
|
|
|
1
1
|
# @verdaccio/web
|
|
2
2
|
|
|
3
|
+
## 6.0.0-6-next.35
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 9fc2e796: feat(plugins): improve plugin loader
|
|
8
|
+
|
|
9
|
+
### Changes
|
|
10
|
+
|
|
11
|
+
- Add scope plugin support to 6.x https://github.com/verdaccio/verdaccio/pull/3227
|
|
12
|
+
- Avoid config collisions https://github.com/verdaccio/verdaccio/issues/928
|
|
13
|
+
- https://github.com/verdaccio/verdaccio/issues/1394
|
|
14
|
+
- `config.plugins` plugin path validations
|
|
15
|
+
- Updated algorithm for plugin loader.
|
|
16
|
+
- improved documentation (included dev)
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Add scope plugin support to 6.x https://github.com/verdaccio/verdaccio/pull/3227
|
|
21
|
+
- Custom prefix:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
// config.yaml
|
|
25
|
+
server:
|
|
26
|
+
pluginPrefix: mycompany
|
|
27
|
+
middleware:
|
|
28
|
+
audit:
|
|
29
|
+
foo: 1
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This configuration will look up for `mycompany-audit` instead `Verdaccio-audit`.
|
|
33
|
+
|
|
34
|
+
## Breaking Changes
|
|
35
|
+
|
|
36
|
+
### sinopia plugins
|
|
37
|
+
|
|
38
|
+
- `sinopia` fallback support is removed, but can be restored using `pluginPrefix`
|
|
39
|
+
|
|
40
|
+
### plugin filter
|
|
41
|
+
|
|
42
|
+
- method rename `filter_metadata`->`filterMetadata`
|
|
43
|
+
|
|
44
|
+
### Plugin constructor does not merge configs anymore https://github.com/verdaccio/verdaccio/issues/928
|
|
45
|
+
|
|
46
|
+
The plugin receives as first argument `config`, which represents the config of the plugin. Example:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
// config.yaml
|
|
50
|
+
auth:
|
|
51
|
+
plugin:
|
|
52
|
+
foo: 1
|
|
53
|
+
bar: 2
|
|
54
|
+
|
|
55
|
+
export class Plugin<T> {
|
|
56
|
+
public constructor(config: T, options: PluginOptions) {
|
|
57
|
+
console.log(config);
|
|
58
|
+
// {foo:1, bar: 2}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Minor Changes
|
|
64
|
+
|
|
65
|
+
- 62c24b63: feat: add passwordValidationRegex property
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [43f32687]
|
|
70
|
+
- Updated dependencies [9fc2e796]
|
|
71
|
+
- Updated dependencies [62c24b63]
|
|
72
|
+
- @verdaccio/core@6.0.0-6-next.48
|
|
73
|
+
- @verdaccio/store@6.0.0-6-next.28
|
|
74
|
+
- @verdaccio/auth@6.0.0-6-next.27
|
|
75
|
+
- @verdaccio/config@6.0.0-6-next.48
|
|
76
|
+
- @verdaccio/loaders@6.0.0-6-next.17
|
|
77
|
+
- @verdaccio/utils@6.0.0-6-next.16
|
|
78
|
+
- @verdaccio/tarball@11.0.0-6-next.17
|
|
79
|
+
- @verdaccio/url@11.0.0-6-next.14
|
|
80
|
+
- @verdaccio/logger@6.0.0-6-next.16
|
|
81
|
+
- @verdaccio/middleware@6.0.0-6-next.27
|
|
82
|
+
- @verdaccio/readme@11.0.0-6-next.6
|
|
83
|
+
|
|
84
|
+
## 6.0.0-6-next.34
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- @verdaccio/core@6.0.0-6-next.47
|
|
89
|
+
- @verdaccio/config@6.0.0-6-next.47
|
|
90
|
+
- @verdaccio/auth@6.0.0-6-next.26
|
|
91
|
+
- @verdaccio/tarball@11.0.0-6-next.16
|
|
92
|
+
- @verdaccio/url@11.0.0-6-next.13
|
|
93
|
+
- @verdaccio/loaders@6.0.0-6-next.16
|
|
94
|
+
- @verdaccio/logger@6.0.0-6-next.15
|
|
95
|
+
- @verdaccio/middleware@6.0.0-6-next.26
|
|
96
|
+
- @verdaccio/store@6.0.0-6-next.27
|
|
97
|
+
- @verdaccio/utils@6.0.0-6-next.15
|
|
98
|
+
|
|
3
99
|
## 6.0.0-6-next.33
|
|
4
100
|
|
|
5
101
|
### Patch Changes
|
package/build/api/user.js
CHANGED
|
@@ -13,8 +13,6 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
13
13
|
|
|
14
14
|
var _core = require("@verdaccio/core");
|
|
15
15
|
|
|
16
|
-
var _utils = require("@verdaccio/utils");
|
|
17
|
-
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
17
|
|
|
20
18
|
const debug = (0, _debug.default)('verdaccio:web:api:user');
|
|
@@ -49,6 +47,8 @@ function addUserAuthApi(auth, config) {
|
|
|
49
47
|
|
|
50
48
|
if ((config === null || config === void 0 ? void 0 : (_config$flags = config.flags) === null || _config$flags === void 0 ? void 0 : _config$flags.changePassword) === true) {
|
|
51
49
|
route.put('/reset_password', function (req, res, next) {
|
|
50
|
+
var _config$serverSetting;
|
|
51
|
+
|
|
52
52
|
if (_lodash.default.isNil(req.remote_user.name)) {
|
|
53
53
|
res.status(_core.HTTP_STATUS.UNAUTHORIZED);
|
|
54
54
|
return next({
|
|
@@ -64,7 +64,7 @@ function addUserAuthApi(auth, config) {
|
|
|
64
64
|
name
|
|
65
65
|
} = req.remote_user;
|
|
66
66
|
|
|
67
|
-
if (
|
|
67
|
+
if (_core.validatioUtils.validatePassword(password.new, config === null || config === void 0 ? void 0 : (_config$serverSetting = config.serverSettings) === null || _config$serverSetting === void 0 ? void 0 : _config$serverSetting.passwordValidationRegex) === false) {
|
|
68
68
|
auth.changePassword(name, password.old, password.new, (err, isUpdated) => {
|
|
69
69
|
if (_lodash.default.isNil(err) && isUpdated) {
|
|
70
70
|
next({
|
package/build/api/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","names":["debug","buildDebug","addUserAuthApi","auth","config","route","Router","post","req","res","next","username","password","body","authenticate","err","user","errorCode","message","HTTP_STATUS","UNAUTHORIZED","INTERNAL_ERROR","errorUtils","getCode","remote_user","jWTSignOptions","security","web","sign","token","jwtEncrypt","name","flags","changePassword","put","_","isNil","status","API_ERROR","MUST_BE_LOGGED","validatePassword","new","old","isUpdated","ok","getInternalError","INTERNAL_SERVER_ERROR","BAD_REQUEST","APP_ERROR","PASSWORD_VALIDATION"],"sources":["../../src/api/user.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { Request, Response, Router } from 'express';\nimport _ from 'lodash';\n\nimport { IAuth } from '@verdaccio/auth';\nimport { API_ERROR, APP_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core';\nimport { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types';\
|
|
1
|
+
{"version":3,"file":"user.js","names":["debug","buildDebug","addUserAuthApi","auth","config","route","Router","post","req","res","next","username","password","body","authenticate","err","user","errorCode","message","HTTP_STATUS","UNAUTHORIZED","INTERNAL_ERROR","errorUtils","getCode","remote_user","jWTSignOptions","security","web","sign","token","jwtEncrypt","name","flags","changePassword","put","_","isNil","status","API_ERROR","MUST_BE_LOGGED","validatioUtils","validatePassword","new","serverSettings","passwordValidationRegex","old","isUpdated","ok","getInternalError","INTERNAL_SERVER_ERROR","BAD_REQUEST","APP_ERROR","PASSWORD_VALIDATION"],"sources":["../../src/api/user.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { Request, Response, Router } from 'express';\nimport _ from 'lodash';\n\nimport { IAuth } from '@verdaccio/auth';\nimport { API_ERROR, APP_ERROR, HTTP_STATUS, errorUtils, validatioUtils } from '@verdaccio/core';\nimport { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types';\n\nimport { $NextFunctionVer } from './package';\n\nconst debug = buildDebug('verdaccio:web:api:user');\n\nfunction addUserAuthApi(auth: IAuth, config: Config): Router {\n const route = Router(); /* eslint new-cap: 0 */\n route.post('/login', function (req: Request, res: Response, next: $NextFunctionVer): void {\n const { username, password } = req.body;\n debug('authenticate %o', username);\n auth.authenticate(username, password, async (err, user: RemoteUser): Promise<void> => {\n if (err) {\n const errorCode = err.message ? HTTP_STATUS.UNAUTHORIZED : HTTP_STATUS.INTERNAL_ERROR;\n debug('error authenticate %o', errorCode);\n next(errorUtils.getCode(errorCode, err.message));\n } else {\n req.remote_user = user;\n const jWTSignOptions: JWTSignOptions = config.security.web.sign;\n\n next({\n token: await auth.jwtEncrypt(user, jWTSignOptions),\n username: req.remote_user.name,\n });\n }\n });\n });\n\n if (config?.flags?.changePassword === true) {\n route.put(\n '/reset_password',\n function (req: Request, res: Response, next: $NextFunctionVer): void {\n if (_.isNil(req.remote_user.name)) {\n res.status(HTTP_STATUS.UNAUTHORIZED);\n return next({\n // FUTURE: update to a more meaningful message\n message: API_ERROR.MUST_BE_LOGGED,\n });\n }\n\n const { password } = req.body;\n const { name } = req.remote_user;\n\n if (\n validatioUtils.validatePassword(\n password.new,\n config?.serverSettings?.passwordValidationRegex\n ) === false\n ) {\n auth.changePassword(\n name as string,\n password.old,\n password.new,\n (err, isUpdated): void => {\n if (_.isNil(err) && isUpdated) {\n next({\n ok: true,\n });\n } else {\n return next(errorUtils.getInternalError(API_ERROR.INTERNAL_SERVER_ERROR));\n }\n }\n );\n } else {\n return next(errorUtils.getCode(HTTP_STATUS.BAD_REQUEST, APP_ERROR.PASSWORD_VALIDATION));\n }\n }\n );\n }\n\n return route;\n}\n\nexport default addUserAuthApi;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAGA;;;;AAKA,MAAMA,KAAK,GAAG,IAAAC,cAAA,EAAW,wBAAX,CAAd;;AAEA,SAASC,cAAT,CAAwBC,IAAxB,EAAqCC,MAArC,EAA6D;EAAA;;EAC3D,MAAMC,KAAK,GAAG,IAAAC,eAAA,GAAd;EAAwB;;EACxBD,KAAK,CAACE,IAAN,CAAW,QAAX,EAAqB,UAAUC,GAAV,EAAwBC,GAAxB,EAAuCC,IAAvC,EAAqE;IACxF,MAAM;MAAEC,QAAF;MAAYC;IAAZ,IAAyBJ,GAAG,CAACK,IAAnC;IACAb,KAAK,CAAC,iBAAD,EAAoBW,QAApB,CAAL;IACAR,IAAI,CAACW,YAAL,CAAkBH,QAAlB,EAA4BC,QAA5B,EAAsC,OAAOG,GAAP,EAAYC,IAAZ,KAAgD;MACpF,IAAID,GAAJ,EAAS;QACP,MAAME,SAAS,GAAGF,GAAG,CAACG,OAAJ,GAAcC,iBAAA,CAAYC,YAA1B,GAAyCD,iBAAA,CAAYE,cAAvE;QACArB,KAAK,CAAC,uBAAD,EAA0BiB,SAA1B,CAAL;QACAP,IAAI,CAACY,gBAAA,CAAWC,OAAX,CAAmBN,SAAnB,EAA8BF,GAAG,CAACG,OAAlC,CAAD,CAAJ;MACD,CAJD,MAIO;QACLV,GAAG,CAACgB,WAAJ,GAAkBR,IAAlB;QACA,MAAMS,cAA8B,GAAGrB,MAAM,CAACsB,QAAP,CAAgBC,GAAhB,CAAoBC,IAA3D;QAEAlB,IAAI,CAAC;UACHmB,KAAK,EAAE,MAAM1B,IAAI,CAAC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CAAUW,qBAAtC,CAAD,CAAX;UACD;QACF,CAZH;MAcD,CApBD,MAoBO;QACL,OAAOvC,IAAI,CAACY,gBAAA,CAAWC,OAAX,CAAmBJ,iBAAA,CAAY+B,WAA/B,EAA4CC,eAAA,CAAUC,mBAAtD,CAAD,CAAX;MACD;IACF,CArCH;EAuCD;;EAED,OAAO/C,KAAP;AACD;;eAEcH,c"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function loadTheme(config: any):
|
|
2
|
-
export declare function renderWebMiddleware(config: any, auth: any): any
|
|
1
|
+
export declare function loadTheme(config: any): Promise<unknown>;
|
|
2
|
+
export declare function renderWebMiddleware(config: any, auth: any): Promise<any>;
|
|
@@ -18,6 +18,8 @@ var _core = require("@verdaccio/core");
|
|
|
18
18
|
|
|
19
19
|
var _loaders = require("@verdaccio/loaders");
|
|
20
20
|
|
|
21
|
+
var _logger = require("@verdaccio/logger");
|
|
22
|
+
|
|
21
23
|
var _url = require("@verdaccio/url");
|
|
22
24
|
|
|
23
25
|
var _renderHTML = _interopRequireDefault(require("../renderHTML"));
|
|
@@ -28,11 +30,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
28
30
|
|
|
29
31
|
const debug = (0, _debug.default)('verdaccio:web:render');
|
|
30
32
|
|
|
31
|
-
function loadTheme(config) {
|
|
33
|
+
async function loadTheme(config) {
|
|
32
34
|
if (_lodash.default.isNil(config.theme) === false) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
var _config$serverSetting;
|
|
36
|
+
|
|
37
|
+
const plugin = await (0, _loaders.asyncLoadPlugin)(config.theme, // @ts-ignore
|
|
38
|
+
{
|
|
39
|
+
config,
|
|
40
|
+
logger: _logger.logger
|
|
41
|
+
}, function (plugin) {
|
|
42
|
+
return typeof plugin === 'string';
|
|
43
|
+
}, (config === null || config === void 0 ? void 0 : (_config$serverSetting = config.serverSettings) === null || _config$serverSetting === void 0 ? void 0 : _config$serverSetting.pluginPrefix) ?? 'verdaccio-theme');
|
|
44
|
+
|
|
45
|
+
if (plugin.length > 1) {
|
|
46
|
+
_logger.logger.warn('multiple ui themes has been detected and is not supported, only the first one will be used');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return _lodash.default.head(plugin);
|
|
36
50
|
}
|
|
37
51
|
}
|
|
38
52
|
|
|
@@ -48,14 +62,14 @@ const sendFileCallback = next => err => {
|
|
|
48
62
|
}
|
|
49
63
|
};
|
|
50
64
|
|
|
51
|
-
function renderWebMiddleware(config, auth) {
|
|
65
|
+
async function renderWebMiddleware(config, auth) {
|
|
52
66
|
var _config$web;
|
|
53
67
|
|
|
54
68
|
const {
|
|
55
69
|
staticPath,
|
|
56
70
|
manifest,
|
|
57
71
|
manifestFiles
|
|
58
|
-
} = require('@verdaccio/ui-theme')();
|
|
72
|
+
} = (await loadTheme(config)) || require('@verdaccio/ui-theme')();
|
|
59
73
|
|
|
60
74
|
debug('static path %o', staticPath);
|
|
61
75
|
/* eslint new-cap:off */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-web.js","names":["debug","buildDebug","loadTheme","config","_","isNil","theme","
|
|
1
|
+
{"version":3,"file":"render-web.js","names":["debug","buildDebug","loadTheme","config","_","isNil","theme","plugin","asyncLoadPlugin","logger","serverSettings","pluginPrefix","length","warn","head","sendFileCallback","next","err","status","HTTP_STATUS","NOT_FOUND","renderWebMiddleware","auth","staticPath","manifest","manifestFiles","require","router","express","Router","use","webUIJWTmiddleware","setSecurityWebHeaders","logoURI","web","logo","isURLhasValidProtocol","path","posix","join","basename","get","req","res","sendFile","resolve","filename","params","file","renderHTML"],"sources":["../../src/middleware/render-web.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport express from 'express';\nimport _ from 'lodash';\nimport path from 'path';\n\nimport { HTTP_STATUS } from '@verdaccio/core';\nimport { asyncLoadPlugin } from '@verdaccio/loaders';\nimport { logger } from '@verdaccio/logger';\nimport { isURLhasValidProtocol } from '@verdaccio/url';\n\nimport renderHTML from '../renderHTML';\nimport { setSecurityWebHeaders } from './security';\n\nconst debug = buildDebug('verdaccio:web:render');\n\nexport async function loadTheme(config: any) {\n if (_.isNil(config.theme) === false) {\n const plugin = await asyncLoadPlugin(\n config.theme,\n // @ts-ignore\n { config, logger },\n function (plugin: string) {\n return typeof plugin === 'string';\n },\n config?.serverSettings?.pluginPrefix ?? 'verdaccio-theme'\n );\n if (plugin.length > 1) {\n logger.warn(\n 'multiple ui themes has been detected and is not supported, only the first one will be used'\n );\n }\n\n return _.head(plugin);\n }\n}\n\nconst sendFileCallback = (next) => (err) => {\n if (!err) {\n return;\n }\n if (err.status === HTTP_STATUS.NOT_FOUND) {\n next();\n } else {\n next(err);\n }\n};\n\nexport async function renderWebMiddleware(config, auth): Promise<any> {\n const { staticPath, manifest, manifestFiles } =\n (await loadTheme(config)) || require('@verdaccio/ui-theme')();\n debug('static path %o', staticPath);\n\n /* eslint new-cap:off */\n const router = express.Router();\n router.use(auth.webUIJWTmiddleware());\n router.use(setSecurityWebHeaders);\n\n // Logo\n let logoURI = config?.web?.logo ?? '';\n if (logoURI && !isURLhasValidProtocol(logoURI)) {\n // URI related to a local file\n\n // Note: `path.join` will break on Windows, because it transforms `/` to `\\`\n // Use POSIX version `path.posix.join` instead.\n logoURI = path.posix.join('/-/static/', path.basename(logoURI));\n router.get(logoURI, function (req, res, next) {\n res.sendFile(path.resolve(config.web.logo), sendFileCallback(next));\n debug('render static');\n });\n }\n\n // Static\n router.get('/-/static/*', function (req, res, next) {\n const filename = req.params[0];\n const file = `${staticPath}/${filename}`;\n debug('render static file %o', file);\n res.sendFile(file, sendFileCallback(next));\n });\n\n router.get('/-/web/:section/*', function (req, res) {\n renderHTML(config, manifest, manifestFiles, req, res);\n debug('render html section');\n });\n\n router.get('/', function (req, res) {\n renderHTML(config, manifest, manifestFiles, req, res);\n debug('render root');\n });\n\n return router;\n}\n"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;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AAAM,mBAAA,EAAW9C,MAAX,EAAmBqB,QAAnB,EAA6BC,aAA7B,EAA4CiB,GAA5C,EAAiDC,GAAjD;IACA3C,KAAK,CAAC,qBAAD,CAAL;EACD,CAHD;EAKA2B,MAAM,CAACc,GAAP,CAAW,GAAX,EAAgB,UAAUC,GAAV,EAAeC,GAAf,EAAoB;IAClC,IAAAM,mBAAA,EAAW9C,MAAX,EAAmBqB,QAAnB,EAA6BC,aAA7B,EAA4CiB,GAA5C,EAAiDC,GAAjD;IACA3C,KAAK,CAAC,aAAD,CAAL;EACD,CAHD;EAKA,OAAO2B,MAAP;AACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (config: any, auth: any, storage: any) => import("express-serve-static-core").Router
|
|
1
|
+
declare const _default: (config: any, auth: any, storage: any) => Promise<import("express-serve-static-core").Router>;
|
|
2
2
|
export default _default;
|
package/build/web-middleware.js
CHANGED
|
@@ -13,12 +13,12 @@ var _webApi = require("./middleware/web-api");
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
var _default = (config, auth, storage) => {
|
|
16
|
+
var _default = async (config, auth, storage) => {
|
|
17
17
|
// eslint-disable-next-line new-cap
|
|
18
18
|
const app = _express.default.Router(); // load application
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
app.use('/', (0, _renderWeb.renderWebMiddleware)(config, auth)); // web endpoints, search, packages, etc
|
|
21
|
+
app.use('/', await (0, _renderWeb.renderWebMiddleware)(config, auth)); // web endpoints, search, packages, etc
|
|
22
22
|
|
|
23
23
|
app.use('/-/verdaccio/', (0, _webApi.webAPI)(config, auth, storage));
|
|
24
24
|
return app;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-middleware.js","names":["config","auth","storage","app","express","Router","use","renderWebMiddleware","webAPI"],"sources":["../src/web-middleware.ts"],"sourcesContent":["import express from 'express';\n\nimport { renderWebMiddleware } from './middleware/render-web';\nimport { webAPI } from './middleware/web-api';\n\nexport default (config, auth, storage) => {\n // eslint-disable-next-line new-cap\n const app = express.Router();\n // load application\n app.use('/', renderWebMiddleware(config, auth));\n // web endpoints, search, packages, etc\n app.use('/-/verdaccio/', webAPI(config, auth, storage));\n return app;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;eAEe,
|
|
1
|
+
{"version":3,"file":"web-middleware.js","names":["config","auth","storage","app","express","Router","use","renderWebMiddleware","webAPI"],"sources":["../src/web-middleware.ts"],"sourcesContent":["import express from 'express';\n\nimport { renderWebMiddleware } from './middleware/render-web';\nimport { webAPI } from './middleware/web-api';\n\nexport default async (config, auth, storage) => {\n // eslint-disable-next-line new-cap\n const app = express.Router();\n // load application\n app.use('/', await renderWebMiddleware(config, auth));\n // web endpoints, search, packages, etc\n app.use('/-/verdaccio/', webAPI(config, auth, storage));\n return app;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;eAEe,OAAOA,MAAP,EAAeC,IAAf,EAAqBC,OAArB,KAAiC;EAC9C;EACA,MAAMC,GAAG,GAAGC,gBAAA,CAAQC,MAAR,EAAZ,CAF8C,CAG9C;;;EACAF,GAAG,CAACG,GAAJ,CAAQ,GAAR,EAAa,MAAM,IAAAC,8BAAA,EAAoBP,MAApB,EAA4BC,IAA5B,CAAnB,EAJ8C,CAK9C;;EACAE,GAAG,CAACG,GAAJ,CAAQ,eAAR,EAAyB,IAAAE,cAAA,EAAOR,MAAP,EAAeC,IAAf,EAAqBC,OAArB,CAAzB;EACA,OAAOC,GAAP;AACD,C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/web",
|
|
3
|
-
"version": "6.0.0-6-next.
|
|
3
|
+
"version": "6.0.0-6-next.35",
|
|
4
4
|
"description": "web ui middleware",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@verdaccio/auth": "6.0.0-6-next.
|
|
29
|
-
"@verdaccio/core": "6.0.0-6-next.
|
|
30
|
-
"@verdaccio/config": "6.0.0-6-next.
|
|
31
|
-
"@verdaccio/loaders": "6.0.0-6-next.
|
|
32
|
-
"@verdaccio/logger": "6.0.0-6-next.
|
|
33
|
-
"@verdaccio/middleware": "6.0.0-6-next.
|
|
28
|
+
"@verdaccio/auth": "6.0.0-6-next.27",
|
|
29
|
+
"@verdaccio/core": "6.0.0-6-next.48",
|
|
30
|
+
"@verdaccio/config": "6.0.0-6-next.48",
|
|
31
|
+
"@verdaccio/loaders": "6.0.0-6-next.17",
|
|
32
|
+
"@verdaccio/logger": "6.0.0-6-next.16",
|
|
33
|
+
"@verdaccio/middleware": "6.0.0-6-next.27",
|
|
34
34
|
"@verdaccio/readme": "11.0.0-6-next.6",
|
|
35
|
-
"@verdaccio/store": "6.0.0-6-next.
|
|
36
|
-
"@verdaccio/tarball": "11.0.0-6-next.
|
|
37
|
-
"@verdaccio/url": "11.0.0-6-next.
|
|
38
|
-
"@verdaccio/utils": "6.0.0-6-next.
|
|
35
|
+
"@verdaccio/store": "6.0.0-6-next.28",
|
|
36
|
+
"@verdaccio/tarball": "11.0.0-6-next.17",
|
|
37
|
+
"@verdaccio/url": "11.0.0-6-next.14",
|
|
38
|
+
"@verdaccio/utils": "6.0.0-6-next.16",
|
|
39
39
|
"body-parser": "1.20.0",
|
|
40
40
|
"debug": "4.3.4",
|
|
41
41
|
"express": "4.18.1",
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"lru-cache": "6.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/node": "16.11.
|
|
47
|
-
"@verdaccio/types": "11.0.0-6-next.
|
|
48
|
-
"@verdaccio/test-helper": "
|
|
49
|
-
"@verdaccio/api": "6.0.0-6-next.
|
|
46
|
+
"@types/node": "16.11.60",
|
|
47
|
+
"@verdaccio/types": "11.0.0-6-next.17",
|
|
48
|
+
"@verdaccio/test-helper": "2.0.0-6-next.5",
|
|
49
|
+
"@verdaccio/api": "6.0.0-6-next.31",
|
|
50
50
|
"node-html-parser": "4.1.5",
|
|
51
51
|
"supertest": "6.2.4",
|
|
52
52
|
"nock": "13.2.9",
|
|
53
53
|
"jsdom": "20.0.0",
|
|
54
54
|
"undici": "4.16.0",
|
|
55
|
-
"verdaccio-auth-memory": "11.0.0-6-next.
|
|
56
|
-
"verdaccio-memory": "11.0.0-6-next.
|
|
55
|
+
"verdaccio-auth-memory": "11.0.0-6-next.13",
|
|
56
|
+
"verdaccio-memory": "11.0.0-6-next.15"
|
|
57
57
|
},
|
|
58
58
|
"funding": {
|
|
59
59
|
"type": "opencollective",
|
package/src/api/user.ts
CHANGED
|
@@ -3,9 +3,8 @@ import { Request, Response, Router } from 'express';
|
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
|
|
5
5
|
import { IAuth } from '@verdaccio/auth';
|
|
6
|
-
import { API_ERROR, APP_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core';
|
|
6
|
+
import { API_ERROR, APP_ERROR, HTTP_STATUS, errorUtils, validatioUtils } from '@verdaccio/core';
|
|
7
7
|
import { Config, JWTSignOptions, RemoteUser } from '@verdaccio/types';
|
|
8
|
-
import { validatePassword } from '@verdaccio/utils';
|
|
9
8
|
|
|
10
9
|
import { $NextFunctionVer } from './package';
|
|
11
10
|
|
|
@@ -48,7 +47,12 @@ function addUserAuthApi(auth: IAuth, config: Config): Router {
|
|
|
48
47
|
const { password } = req.body;
|
|
49
48
|
const { name } = req.remote_user;
|
|
50
49
|
|
|
51
|
-
if (
|
|
50
|
+
if (
|
|
51
|
+
validatioUtils.validatePassword(
|
|
52
|
+
password.new,
|
|
53
|
+
config?.serverSettings?.passwordValidationRegex
|
|
54
|
+
) === false
|
|
55
|
+
) {
|
|
52
56
|
auth.changePassword(
|
|
53
57
|
name as string,
|
|
54
58
|
password.old,
|
|
@@ -4,7 +4,8 @@ import _ from 'lodash';
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
|
|
6
6
|
import { HTTP_STATUS } from '@verdaccio/core';
|
|
7
|
-
import {
|
|
7
|
+
import { asyncLoadPlugin } from '@verdaccio/loaders';
|
|
8
|
+
import { logger } from '@verdaccio/logger';
|
|
8
9
|
import { isURLhasValidProtocol } from '@verdaccio/url';
|
|
9
10
|
|
|
10
11
|
import renderHTML from '../renderHTML';
|
|
@@ -12,19 +13,24 @@ import { setSecurityWebHeaders } from './security';
|
|
|
12
13
|
|
|
13
14
|
const debug = buildDebug('verdaccio:web:render');
|
|
14
15
|
|
|
15
|
-
export function loadTheme(config) {
|
|
16
|
+
export async function loadTheme(config: any) {
|
|
16
17
|
if (_.isNil(config.theme) === false) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
'verdaccio-theme'
|
|
26
|
-
)
|
|
18
|
+
const plugin = await asyncLoadPlugin(
|
|
19
|
+
config.theme,
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
{ config, logger },
|
|
22
|
+
function (plugin: string) {
|
|
23
|
+
return typeof plugin === 'string';
|
|
24
|
+
},
|
|
25
|
+
config?.serverSettings?.pluginPrefix ?? 'verdaccio-theme'
|
|
27
26
|
);
|
|
27
|
+
if (plugin.length > 1) {
|
|
28
|
+
logger.warn(
|
|
29
|
+
'multiple ui themes has been detected and is not supported, only the first one will be used'
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return _.head(plugin);
|
|
28
34
|
}
|
|
29
35
|
}
|
|
30
36
|
|
|
@@ -39,8 +45,9 @@ const sendFileCallback = (next) => (err) => {
|
|
|
39
45
|
}
|
|
40
46
|
};
|
|
41
47
|
|
|
42
|
-
export function renderWebMiddleware(config, auth): any {
|
|
43
|
-
const { staticPath, manifest, manifestFiles } =
|
|
48
|
+
export async function renderWebMiddleware(config, auth): Promise<any> {
|
|
49
|
+
const { staticPath, manifest, manifestFiles } =
|
|
50
|
+
(await loadTheme(config)) || require('@verdaccio/ui-theme')();
|
|
44
51
|
debug('static path %o', staticPath);
|
|
45
52
|
|
|
46
53
|
/* eslint new-cap:off */
|
package/src/web-middleware.ts
CHANGED
|
@@ -3,11 +3,11 @@ import express from 'express';
|
|
|
3
3
|
import { renderWebMiddleware } from './middleware/render-web';
|
|
4
4
|
import { webAPI } from './middleware/web-api';
|
|
5
5
|
|
|
6
|
-
export default (config, auth, storage) => {
|
|
6
|
+
export default async (config, auth, storage) => {
|
|
7
7
|
// eslint-disable-next-line new-cap
|
|
8
8
|
const app = express.Router();
|
|
9
9
|
// load application
|
|
10
|
-
app.use('/', renderWebMiddleware(config, auth));
|
|
10
|
+
app.use('/', await renderWebMiddleware(config, auth));
|
|
11
11
|
// web endpoints, search, packages, etc
|
|
12
12
|
app.use('/-/verdaccio/', webAPI(config, auth, storage));
|
|
13
13
|
return app;
|
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
exports[`template custom body after 1`] = `
|
|
4
4
|
"
|
|
5
5
|
<!DOCTYPE html>
|
|
6
|
-
<html lang
|
|
6
|
+
<html lang="en-us">
|
|
7
7
|
<head>
|
|
8
|
-
<meta charset
|
|
9
|
-
<base href
|
|
8
|
+
<meta charset="utf-8">
|
|
9
|
+
<base href="http://domain.com">
|
|
10
10
|
<title></title>
|
|
11
|
-
<link rel
|
|
12
|
-
<meta name
|
|
11
|
+
<link rel="icon" href="http://domain.com-/static/favicon.ico"/>
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
13
13
|
<script>
|
|
14
|
-
window.__VERDACCIO_BASENAME_UI_OPTIONS={
|
|
14
|
+
window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com"}
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
</head>
|
|
18
|
-
<body class
|
|
18
|
+
<body class="body">
|
|
19
19
|
|
|
20
|
-
<div id
|
|
21
|
-
<script defer
|
|
22
|
-
<script src
|
|
20
|
+
<div id="root"></div>
|
|
21
|
+
<script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script><script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
|
|
22
|
+
<script src="foo"/>
|
|
23
23
|
</body>
|
|
24
24
|
</html>
|
|
25
25
|
"
|
|
@@ -28,22 +28,22 @@ exports[`template custom body after 1`] = `
|
|
|
28
28
|
exports[`template custom body before 1`] = `
|
|
29
29
|
"
|
|
30
30
|
<!DOCTYPE html>
|
|
31
|
-
<html lang
|
|
31
|
+
<html lang="en-us">
|
|
32
32
|
<head>
|
|
33
|
-
<meta charset
|
|
34
|
-
<base href
|
|
33
|
+
<meta charset="utf-8">
|
|
34
|
+
<base href="http://domain.com">
|
|
35
35
|
<title></title>
|
|
36
|
-
<link rel
|
|
37
|
-
<meta name
|
|
36
|
+
<link rel="icon" href="http://domain.com-/static/favicon.ico"/>
|
|
37
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
38
38
|
<script>
|
|
39
|
-
window.__VERDACCIO_BASENAME_UI_OPTIONS={
|
|
39
|
+
window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com"}
|
|
40
40
|
</script>
|
|
41
41
|
|
|
42
42
|
</head>
|
|
43
|
-
<body class
|
|
44
|
-
<script src
|
|
45
|
-
<div id
|
|
46
|
-
<script defer
|
|
43
|
+
<body class="body">
|
|
44
|
+
<script src="fooBefore"/><script src="barBefore"/>
|
|
45
|
+
<div id="root"></div>
|
|
46
|
+
<script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script><script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
|
|
47
47
|
|
|
48
48
|
</body>
|
|
49
49
|
</html>
|
|
@@ -53,22 +53,22 @@ exports[`template custom body before 1`] = `
|
|
|
53
53
|
exports[`template custom render 1`] = `
|
|
54
54
|
"
|
|
55
55
|
<!DOCTYPE html>
|
|
56
|
-
<html lang
|
|
56
|
+
<html lang="en-us">
|
|
57
57
|
<head>
|
|
58
|
-
<meta charset
|
|
59
|
-
<base href
|
|
58
|
+
<meta charset="utf-8">
|
|
59
|
+
<base href="http://domain.com">
|
|
60
60
|
<title></title>
|
|
61
|
-
<link rel
|
|
62
|
-
<meta name
|
|
61
|
+
<link rel="icon" href="http://domain.com-/static/favicon.ico"/>
|
|
62
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
63
63
|
<script>
|
|
64
|
-
window.__VERDACCIO_BASENAME_UI_OPTIONS={
|
|
64
|
+
window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com"}
|
|
65
65
|
</script>
|
|
66
66
|
|
|
67
67
|
</head>
|
|
68
|
-
<body class
|
|
68
|
+
<body class="body">
|
|
69
69
|
|
|
70
|
-
<div id
|
|
71
|
-
<script defer
|
|
70
|
+
<div id="root"></div>
|
|
71
|
+
<script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script><script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
|
|
72
72
|
|
|
73
73
|
</body>
|
|
74
74
|
</html>
|
|
@@ -78,22 +78,22 @@ exports[`template custom render 1`] = `
|
|
|
78
78
|
exports[`template custom title 1`] = `
|
|
79
79
|
"
|
|
80
80
|
<!DOCTYPE html>
|
|
81
|
-
<html lang
|
|
81
|
+
<html lang="en-us">
|
|
82
82
|
<head>
|
|
83
|
-
<meta charset
|
|
84
|
-
<base href
|
|
83
|
+
<meta charset="utf-8">
|
|
84
|
+
<base href="http://domain.com">
|
|
85
85
|
<title>foo title</title>
|
|
86
|
-
<link rel
|
|
87
|
-
<meta name
|
|
86
|
+
<link rel="icon" href="http://domain.com-/static/favicon.ico"/>
|
|
87
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
88
88
|
<script>
|
|
89
|
-
window.__VERDACCIO_BASENAME_UI_OPTIONS={
|
|
89
|
+
window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com","title":"foo title"}
|
|
90
90
|
</script>
|
|
91
91
|
|
|
92
92
|
</head>
|
|
93
|
-
<body class
|
|
93
|
+
<body class="body">
|
|
94
94
|
|
|
95
|
-
<div id
|
|
96
|
-
<script defer
|
|
95
|
+
<div id="root"></div>
|
|
96
|
+
<script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script><script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
|
|
97
97
|
|
|
98
98
|
</body>
|
|
99
99
|
</html>
|
|
@@ -103,22 +103,22 @@ exports[`template custom title 1`] = `
|
|
|
103
103
|
exports[`template custom title 2`] = `
|
|
104
104
|
"
|
|
105
105
|
<!DOCTYPE html>
|
|
106
|
-
<html lang
|
|
106
|
+
<html lang="en-us">
|
|
107
107
|
<head>
|
|
108
|
-
<meta charset
|
|
109
|
-
<base href
|
|
108
|
+
<meta charset="utf-8">
|
|
109
|
+
<base href="http://domain.com">
|
|
110
110
|
<title>foo title</title>
|
|
111
|
-
<link rel
|
|
112
|
-
<meta name
|
|
111
|
+
<link rel="icon" href="http://domain.com-/static/favicon.ico"/>
|
|
112
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
113
113
|
<script>
|
|
114
|
-
window.__VERDACCIO_BASENAME_UI_OPTIONS={
|
|
114
|
+
window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com","title":"foo title"}
|
|
115
115
|
</script>
|
|
116
116
|
|
|
117
117
|
</head>
|
|
118
|
-
<body class
|
|
118
|
+
<body class="body">
|
|
119
119
|
|
|
120
|
-
<div id
|
|
121
|
-
<script defer
|
|
120
|
+
<div id="root"></div>
|
|
121
|
+
<script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script><script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
|
|
122
122
|
|
|
123
123
|
</body>
|
|
124
124
|
</html>
|
|
@@ -128,22 +128,22 @@ exports[`template custom title 2`] = `
|
|
|
128
128
|
exports[`template meta scripts 1`] = `
|
|
129
129
|
"
|
|
130
130
|
<!DOCTYPE html>
|
|
131
|
-
<html lang
|
|
131
|
+
<html lang="en-us">
|
|
132
132
|
<head>
|
|
133
|
-
<meta charset
|
|
134
|
-
<base href
|
|
133
|
+
<meta charset="utf-8">
|
|
134
|
+
<base href="http://domain.com">
|
|
135
135
|
<title></title>
|
|
136
|
-
<link rel
|
|
137
|
-
<meta name
|
|
136
|
+
<link rel="icon" href="http://domain.com-/static/favicon.ico"/>
|
|
137
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
138
138
|
<script>
|
|
139
|
-
window.__VERDACCIO_BASENAME_UI_OPTIONS={
|
|
139
|
+
window.__VERDACCIO_BASENAME_UI_OPTIONS={"base":"http://domain.com"}
|
|
140
140
|
</script>
|
|
141
141
|
<style>.someclass{font-size:10px;}</style>
|
|
142
142
|
</head>
|
|
143
|
-
<body class
|
|
143
|
+
<body class="body">
|
|
144
144
|
|
|
145
|
-
<div id
|
|
146
|
-
<script defer
|
|
145
|
+
<div id="root"></div>
|
|
146
|
+
<script defer="defer" src="http://domain.com/-/static/runtime.6126058572f989c948b1.js"></script><script defer="defer" src="http://domain.com/-/static/main.6126058572f989c948b1.js"></script>
|
|
147
147
|
|
|
148
148
|
</body>
|
|
149
149
|
</html>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`Utilities parseReadme should parse makrdown text to html template 1`] = `
|
|
4
|
-
"<h1 id
|
|
4
|
+
"<h1 id="project-title">Project Title</h1>
|
|
5
5
|
<p>One Paragraph of project description goes here</p>
|
|
6
|
-
<h2 id
|
|
6
|
+
<h2 id="getting-started">Getting Started</h2>
|
|
7
7
|
<p>These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.</p>
|
|
8
|
-
<h3 id
|
|
8
|
+
<h3 id="prerequisites">Prerequisites</h3>
|
|
9
9
|
<p>What things you need to install the software and how to install them</p>
|
|
10
10
|
<pre><code>Give examples
|
|
11
11
|
</code></pre>
|
|
12
|
-
<h3 id
|
|
12
|
+
<h3 id="installing">Installing</h3>
|
|
13
13
|
<p>A step by step series of examples that tell you how to get a development env running</p>
|
|
14
14
|
<p>Say what the step will be</p>
|
|
15
15
|
<pre><code>Give the example
|
|
@@ -18,31 +18,31 @@ exports[`Utilities parseReadme should parse makrdown text to html template 1`] =
|
|
|
18
18
|
<pre><code>until finished
|
|
19
19
|
</code></pre>
|
|
20
20
|
<p>End with an example of getting some data out of the system or using it for a little demo</p>
|
|
21
|
-
<h2 id
|
|
21
|
+
<h2 id="running-the-tests">Running the tests</h2>
|
|
22
22
|
<p>Explain how to run the automated tests for this system</p>
|
|
23
|
-
<h3 id
|
|
23
|
+
<h3 id="break-down-into-end-to-end-tests">Break down into end to end tests</h3>
|
|
24
24
|
<p>Explain what these tests test and why</p>
|
|
25
25
|
<pre><code>Give an example
|
|
26
26
|
</code></pre>
|
|
27
|
-
<h3 id
|
|
27
|
+
<h3 id="and-coding-style-tests">And coding style tests</h3>
|
|
28
28
|
<p>Explain what these tests test and why</p>
|
|
29
29
|
<pre><code>Give an example
|
|
30
30
|
</code></pre>
|
|
31
|
-
<h2 id
|
|
31
|
+
<h2 id="deployment">Deployment</h2>
|
|
32
32
|
<p>Add additional notes about how to deploy this on a live system</p>
|
|
33
|
-
<h2 id
|
|
33
|
+
<h2 id="built-with">Built With</h2>
|
|
34
34
|
<ul>
|
|
35
35
|
<li>The web framework used</li>
|
|
36
36
|
<li>Dependency Management</li>
|
|
37
37
|
<li>Used to generate RSS Feeds</li>
|
|
38
38
|
</ul>
|
|
39
|
-
<h2 id
|
|
40
|
-
<p>Please read <a href
|
|
41
|
-
<h2 id
|
|
42
|
-
<p>We use <a href
|
|
43
|
-
<h2 id
|
|
44
|
-
<p>This project is licensed under the MIT License - see the <a href
|
|
45
|
-
<h2 id
|
|
39
|
+
<h2 id="contributing">Contributing</h2>
|
|
40
|
+
<p>Please read <a href="CONTRIBUTING.md">CONTRIBUTING.md</a> for details on our code of conduct, and the process for submitting pull requests to us.</p>
|
|
41
|
+
<h2 id="versioning">Versioning</h2>
|
|
42
|
+
<p>We use <a href="http://semver.org/">SemVer</a> for versioning. For the versions available, see the <a href="https://github.com/your/project/tags">tags on this repository</a>.</p>
|
|
43
|
+
<h2 id="license">License</h2>
|
|
44
|
+
<p>This project is licensed under the MIT License - see the <a href="LICENSE.md">LICENSE.md</a> file for details</p>
|
|
45
|
+
<h2 id="acknowledgments">Acknowledgments</h2>
|
|
46
46
|
<ul>
|
|
47
47
|
<li>Hat tip to anyone whose code was used</li>
|
|
48
48
|
<li>Inspiration</li>
|
package/test/helper.ts
CHANGED
|
@@ -18,5 +18,9 @@ export const getConf = (configName: string) => {
|
|
|
18
18
|
|
|
19
19
|
// @deprecated
|
|
20
20
|
export async function initializeServer(configName): Promise<Application> {
|
|
21
|
-
return initializeServerHelper(
|
|
21
|
+
return initializeServerHelper(
|
|
22
|
+
getConf(configName),
|
|
23
|
+
[apiMiddleware, { async: true, routes }],
|
|
24
|
+
Storage
|
|
25
|
+
);
|
|
22
26
|
}
|