Code style and performance fixes

This commit is contained in:
NGPixel
2016-10-17 19:52:04 -04:00
parent 847c81946a
commit 9454065ab9
12 changed files with 57 additions and 54 deletions

View File

@@ -111,7 +111,7 @@ module.exports = {
self._git.exec('config', ['--local', 'user.email', self._signature.email])
).then(() => {
return self._git.exec('remote', ['add', 'origin', self._url]);
})
});
}
});

View File

@@ -19,7 +19,7 @@ module.exports = {
generateKey() {
return crypto.randomBytes(20).toString('hex')
return crypto.randomBytes(20).toString('hex');
},

View File

@@ -47,7 +47,7 @@ module.exports = {
this.uploadImgHandler = multer({
storage: multer.diskStorage({
destination: (req, f, cb) => {
cb(null, path.resolve(ROOTPATH, appconfig.paths.data, 'temp-upload'))
cb(null, path.resolve(ROOTPATH, appconfig.paths.data, 'temp-upload'));
}
}),
fileFilter: (req, f, cb) => {

View File

@@ -86,7 +86,7 @@ const parseTree = (content) => {
content = heading.children[1].content;
anchor = _.kebabCase(content);
} else {
content = heading.content
content = heading.content;
anchor = _.kebabCase(heading.children.reduce((acc, t) => acc + t.content, ""));
}

View File

@@ -156,7 +156,7 @@ module.exports = {
return upl.watch();
})
});
},
@@ -218,7 +218,7 @@ module.exports = {
filename: f,
basename: fPathObj.name,
filesize: s.size
}
};
// Generate thumbnail
@@ -258,6 +258,7 @@ module.exports = {
* Generate thumbnail of image
*
* @param {String} sourcePath The source path
* @param {String} destPath The destination path
* @return {Promise<Object>} Promise returning the resized image info
*/
generateThumbnail(sourcePath, destPath) {

View File

@@ -95,7 +95,7 @@ module.exports = {
return db.UplFolder.findOne({ name: folderName }).then((f) => {
return (f) ? path.resolve(this._uploadsPath, folderName) : false;
})
});
},
@@ -180,7 +180,7 @@ module.exports = {
let self = this;
let fUrlObj = url.parse(fUrl);
let fUrlFilename = _.last(_.split(fUrlObj.pathname, '/'))
let fUrlFilename = _.last(_.split(fUrlObj.pathname, '/'));
let destFolder = _.chain(fFolder).trim().toLower().value();
return upl.validateUploadsFolder(destFolder).then((destFolderPath) => {

View File

@@ -4,7 +4,7 @@ var winston = require('winston');
module.exports = (isDebug) => {
winston.remove(winston.transports.Console)
winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, {
level: (isDebug) ? 'info' : 'warn',
prettyPrint: true,