Skip to content

Commit 69823f3

Browse files
committed
update dep package version
1 parent 020a350 commit 69823f3

File tree

7 files changed

+44
-46
lines changed

7 files changed

+44
-46
lines changed

Diff for: bin/www

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ var http = require('http');
99
var validator = require('validator')
1010
var _ = require('lodash')
1111
var config = require('../core/config');
12-
log4js.configure(_.get(config, 'log4js', {appenders: [{ type: 'console'}], levels : {"[all]": "ERROR", http: "ERROR"} }));
12+
log4js.configure(_.get(config, 'log4js', {
13+
appenders: {console: { type: 'console'}},
14+
categories : { default: { appenders: ['console'], level: 'info' }}
15+
}));
1316
var log = log4js.getLogger("startup")
1417

1518
var app = require('../app');

Diff for: config/config.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ config.development = {
4040
// Binary files storage dir, Do not use tmpdir and it's public download dir.
4141
storageDir: process.env.STORAGE_DIR || "/Users/tablee/workspaces/storage",
4242
// Binary files download host address which Code Push Server listen to. the files storage in storageDir.
43-
downloadUrl: process.env.LOCAL_DOWNLOAD_URL || "http://localhost:3000/download",
43+
downloadUrl: process.env.LOCAL_DOWNLOAD_URL || "http://127.0.0.1:3000/download",
4444
// public static download spacename.
4545
public: process.env.PUBLIC || '/download'
4646
},
@@ -57,7 +57,7 @@ config.development = {
5757
*/
5858
tryLoginTimes: 0,
5959
// CodePush Web(https://github.com/lisong/code-push-web) login address.
60-
//codePushWebUrl: "http://localhost:3001/login",
60+
//codePushWebUrl: "http://127.0.0.1:3001/login",
6161
// create patch updates's number. default value is 3
6262
diffNums: 3,
6363
// data dir for caclulate diff files. it's optimization.
@@ -103,13 +103,11 @@ config.development = {
103103
}
104104

105105
config.development.log4js = {
106-
appenders: [
107-
{ type: 'console'}
108-
],
109-
levels : {
110-
"[all]": "ERROR",
111-
"startup": "INFO",
112-
"http" : "INFO"
106+
appenders: {console: { type: 'console'}},
107+
categories : {
108+
"default": { appenders: ['console'], level:'error'},
109+
"startup": { appenders: ['console'], level:'info'},
110+
"http": { appenders: ['console'], level:'info'}
113111
}
114112
}
115113

Diff for: config/config.test.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ config.test = {
1313
},
1414
local: {
1515
storageDir: os.tmpdir(),
16-
downloadUrl: "http://localhost:3000/download",
16+
downloadUrl: "http://127.0.0.1:3000/download",
1717
public: '/download'
1818
},
1919
jwt: {
@@ -47,13 +47,11 @@ config.test = {
4747
}
4848
}
4949
config.test.log4js = {
50-
appenders: [
51-
{ type: 'console'}
52-
],
53-
levels : {
54-
"[all]": "ERROR",
55-
"startup": "INFO",
56-
"http" : "INFO"
50+
appenders: {console: { type: 'console'}},
51+
categories : {
52+
"default": { appenders: ['console'], level:'error'},
53+
"startup": { appenders: ['console'], level:'info'},
54+
"http": { appenders: ['console'], level:'info'}
5755
}
5856
}
5957
module.exports = config;

Diff for: config/config.testwin.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ config.test = {
1313
},
1414
local: {
1515
storageDir: os.tmpdir(),
16-
downloadUrl: "http://localhost:3000/download",
16+
downloadUrl: "http://127.0.0.1:3000/download",
1717
public: '/download'
1818
},
1919
jwt: {
@@ -48,13 +48,11 @@ config.test = {
4848
}
4949
}
5050
config.test.log4js = {
51-
appenders: [
52-
{ type: 'console'}
53-
],
54-
levels : {
55-
"[all]": "ERROR",
56-
"startup": "INFO",
57-
"http" : "INFO"
51+
appenders: {console: { type: 'console'}},
52+
categories : {
53+
"default": { appenders: ['console'], level:'error'},
54+
"startup": { appenders: ['console'], level:'info'},
55+
"http": { appenders: ['console'], level:'info'}
5856
}
5957
}
6058
module.exports = config;

Diff for: core/utils/common.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var fsextra = require("fs-extra");
55
var extract = require('extract-zip')
66
var config = require('../config');
77
var _ = require('lodash');
8+
var validator = require('validator');
89
var qiniu = require("qiniu");
910
var common = {};
1011
var AppError = require('../app-error');
@@ -17,6 +18,7 @@ common.createFileFromRequest = function (url, filePath) {
1718
fs.exists(filePath, function (exists) {
1819
if (!exists) {
1920
var request = require('request');
21+
log.debug(`createFileFromRequest url:${url}`)
2022
request(url).on('error', function (error) {
2123
reject(error);
2224
})
@@ -179,7 +181,7 @@ common.uploadFileToLocal = function (key, filePath) {
179181
stats = fs.statSync(filePath);
180182
if (!stats.isFile()) {
181183
var e = new AppError.AppError(`${filePath} must be file`);
182-
log.debug(e);
184+
log.error(e);
183185
throw e;
184186
}
185187
fsextra.copy(filePath, fileName,(err) => {
@@ -194,17 +196,16 @@ common.uploadFileToLocal = function (key, filePath) {
194196
};
195197

196198
common.getBlobDownloadUrl = function (blobUrl) {
197-
var downloadUrl = '';
198199
var fileName = blobUrl;
199-
if (_.get(config, 'common.storageType') === 'local') {
200-
downloadUrl = _.get(config, 'local.downloadUrl');
200+
var storageType = _.get(config, 'common.storageType');
201+
var downloadUrl = _.get(config, `${storageType}.downloadUrl`);
202+
if ( storageType === 'local') {
201203
fileName = blobUrl.substr(0, 2).toLowerCase() + '/' + blobUrl;
202-
} else if (_.get(config, 'common.storageType') === 's3') {
203-
downloadUrl = _.get(config, 's3.downloadUrl');
204-
} else if (_.get(config, 'common.storageType') === 'oss') {
205-
downloadUrl = _.get(config, 'oss.downloadUrl');
206-
}else if (_.get(config, 'common.storageType') === 'qiniu') {
207-
downloadUrl = _.get(config, 'qiniu.downloadUrl');
204+
}
205+
if (!validator.isURL(downloadUrl)) {
206+
var e = new AppError.AppError(`Please config ${storageType}.downloadUrl in config.js`);
207+
log.error(e);
208+
throw e;
208209
}
209210
return `${downloadUrl}/${fileName}`
210211
};

Diff for: package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"dependencies": {
4141
"aliyun-oss-upload-stream": "^1.3.0",
42-
"aliyun-sdk": "^1.9.17",
42+
"aliyun-sdk": "^1.11.5",
4343
"aws-sdk": "^2.7.0",
4444
"bcryptjs": "^2.3.0",
4545
"bluebird": "^3.4.1",
@@ -52,24 +52,24 @@
5252
"fs-extra": "^3.0.1",
5353
"helmet": "^3.1.0",
5454
"i18n": "^0.8.3",
55-
"jsonwebtoken": "^7.1.7",
56-
"lodash": "^4.5.1",
57-
"log4js": "^1.1.0",
55+
"jsonwebtoken": "^8.2.0",
56+
"lodash": "^4.17.5",
57+
"log4js": "^2.5.3",
5858
"markdown-it": "^8.0.1",
5959
"moment": "^2.14.1",
6060
"morgan": "^1.7.0",
6161
"mysql2": "^1.3.5",
6262
"nodemailer": "^4.0.1",
63-
"pug": "^2.0.0-beta6",
64-
"qiniu": "^7.0.4",
63+
"pug": "^2.0.1",
64+
"qiniu": "^7.1.3",
6565
"rand-token": "^0.3.0",
6666
"recursive-readdir": "^2.1.1",
6767
"redis": "^2.6.2",
6868
"request": "^2.72.0",
69-
"sequelize": "^4.2.1",
69+
"sequelize": "^4.37.1",
7070
"serve-favicon": "^2.4.0",
7171
"slash": "^1.0.0",
72-
"validator": "^7.0.0",
72+
"validator": "^9.4.1",
7373
"yargs": "^8.0.2",
7474
"yazl": "^2.3.0"
7575
},

Diff for: test/api/auth/auth.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('api/auth/test.js', function() {
1010

1111
describe('sign in view', function(done) {
1212
it('should show sign in redirect view successful', function(done) {
13-
_.set(config, 'common.codePushWebUrl', 'http://localhost:3001')
13+
_.set(config, 'common.codePushWebUrl', 'http://127.0.0.1:3001')
1414
request.get('/auth/login')
1515
.send()
1616
.end(function(err, res) {
@@ -34,7 +34,7 @@ describe('api/auth/test.js', function() {
3434

3535
describe('sign up view', function(done) {
3636
it('should show sign up redirect view successful', function(done) {
37-
_.set(config, 'common.codePushWebUrl', 'http://localhost:3001')
37+
_.set(config, 'common.codePushWebUrl', 'http://127.0.0.1:3001')
3838
request.get('/auth/register')
3939
.send()
4040
.end(function(err, res) {

0 commit comments

Comments
 (0)