From b7d343af38730d5f16b7e46a01f0a0be3ed0d953 Mon Sep 17 00:00:00 2001 From: "Juan Picado @jotadeveloper" Date: Wed, 4 Apr 2018 08:04:54 +0200 Subject: [PATCH 1/2] refactor: config file update --- src/lib/auth.js | 7 +- src/lib/config.js | 167 +++++++++++++++++++++++----------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/lib/auth.js b/src/lib/auth.js index 4622247c4..7ecc3de11 100644 --- a/src/lib/auth.js +++ b/src/lib/auth.js @@ -4,7 +4,6 @@ import {loadPlugin} from '../lib/plugin-loader'; import Crypto from 'crypto'; import jwt from 'jsonwebtoken'; import {ErrorCode} from './utils'; -const Error = require('http-errors'); import type {Config, Logger, Callback} from '@verdaccio/types'; import type {$Response, NextFunction} from 'express'; @@ -47,7 +46,9 @@ class Auth { return prev; }, false); - if (ok) return cb(null, true); + if (ok) { + return cb(null, true); + } if (user.name) { cb(ErrorCode.get403('user ' + user.name + ' is not allowed to ' + action + ' package ' + pkg.name)); @@ -373,7 +374,7 @@ class Auth { try { decoded = jwt.verify(token, this.secret); } catch (err) { - throw Error[401](err.message); + throw ErrorCode.getCode(401, err.message); } return decoded; diff --git a/src/lib/config.js b/src/lib/config.js index 6e6927419..5fffac74b 100644 --- a/src/lib/config.js +++ b/src/lib/config.js @@ -8,6 +8,8 @@ const Utils = require('./utils'); const pkginfo = require('pkginfo')(module); // eslint-disable-line no-unused-vars const pkgVersion = module.exports.version; const pkgName = module.exports.name; +const strategicConfigProps = ['users', 'uplinks', 'packages']; +const allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy']; /** * [[a, [b, c]], d] -> [a, b, c, d] @@ -16,7 +18,7 @@ const pkgName = module.exports.name; */ function flatten(array) { let result = []; - for (let i=0; i Date: Wed, 4 Apr 2018 08:11:20 +0200 Subject: [PATCH 2/2] fix: should fix flow performance issues --- package.json | 4 ++-- yarn.lock | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index bd5a455cd..1b28cc0a0 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@commitlint/cli": "6.1.3", "@commitlint/config-conventional": "6.1.3", "@commitlint/travis-cli": "6.1.3", - "@verdaccio/types": "2.0.2", + "@verdaccio/types": "2.0.3", "babel-cli": "6.26.0", "babel-core": "6.26.0", "babel-eslint": "8.2.2", @@ -90,7 +90,7 @@ "eslint-plugin-react": "7.7.0", "extract-text-webpack-plugin": "3.0.2", "file-loader": "1.1.11", - "flow-bin": "0.67.1", + "flow-bin": "0.69.0", "flow-runtime": "0.17.0", "friendly-errors-webpack-plugin": "1.6.1", "github-markdown-css": "2.10.0", diff --git a/yarn.lock b/yarn.lock index a85b3d14f..f27fb3623 100644 --- a/yarn.lock +++ b/yarn.lock @@ -242,9 +242,9 @@ version "1.0.0" resolved "https://registry.npmjs.org/@verdaccio/streams/-/streams-1.0.0.tgz#d5d24c6747208728b9fd16b908e3932c3fb1f864" -"@verdaccio/types@2.0.2": - version "2.0.2" - resolved "https://registry.npmjs.org/@verdaccio/types/-/types-2.0.2.tgz#2a60faa458bbb5eaf3cdb6db1ef95c8d2e2fa5ed" +"@verdaccio/types@2.0.3": + version "2.0.3" + resolved "https://registry.npmjs.org/@verdaccio/types/-/types-2.0.3.tgz#ae72544af5f867975bc68d8862b040611f1b80ed" JSONStream@1.3.2, JSONStream@^1.0.4: version "1.3.2" @@ -3652,9 +3652,9 @@ flatten@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" -flow-bin@0.67.1: - version "0.67.1" - resolved "https://registry.npmjs.org/flow-bin/-/flow-bin-0.67.1.tgz#eabb7197cce870ac9442cfd04251c7ddc30377db" +flow-bin@0.69.0: + version "0.69.0" + resolved "https://registry.npmjs.org/flow-bin/-/flow-bin-0.69.0.tgz#053159a684a6051fcbf0b71a2eb19a9679082da6" flow-config-parser@^0.3.0: version "0.3.0"