Skip to content

Commit

Permalink
remove log & fix thumb instead of references
Browse files Browse the repository at this point in the history
  • Loading branch information
wonknu committed Dec 5, 2016
1 parent d532d6d commit 5412d5f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/cli/cms/data/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function urlList(obj, tplPath, match, jsonPage) {
}

var body = ''
console.log(options)

var localReq = httpUse.request(options, (localRes) => {
localRes.setEncoding('utf8')
localRes.on('data', (chunk) => {
Expand Down
6 changes: 0 additions & 6 deletions src/cli/cms/media/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ export function generateThumbnail(file) {
var cropThumb = smartCropAndSaveFile([250, 250], file, thumbFileName)
cropThumb.then(function (result) {
var stderr = result.stderr
if(thumbsList != null) {
thumbsList.push({
originalFile: file.replace(path.join(config.root, config.publish.url), ''),
thumbFile: thumbFileNameRelative
})
}
if(stderr) {
cropAndSaveFile([250, 250], file, thumbFileName).then(function () {
resolve({thumb: thumbFileNameRelative})
Expand Down
4 changes: 4 additions & 0 deletions src/cli/core/manager/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ class Manager {
return this._thumbs
}

addThumbsToList(thumb) {
if(this._thumbs) this._thumbs.push(thumb)
}

getReferences() {
if(typeof this._references === 'undefined' || this._references === null) this.updateReferences()
return this._references
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/get-thumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {

var route = function(req, res){
res.set('Content-Type', 'application/json')
res.send(JSON.stringify({thumbs: Manager.instance.getReferences()}))
res.send(JSON.stringify({thumbs: Manager.instance.getThumbsList()}))
}

export default route
7 changes: 6 additions & 1 deletion src/server/routes/post-upload.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
abeExtend,
cmsMedia
cmsMedia,
Manager
} from '../../cli'

var route = function(req, res, next){
Expand All @@ -10,6 +11,10 @@ var route = function(req, res, next){
var image = cmsMedia.image.saveFile(req)

image.then(function (resp) {
Manager.instance.addThumbsToList({
originalFile: resp.filePath,
thumbFile: resp.thumbnail
})
res.set('Content-Type', 'application/json')
res.send(JSON.stringify(resp))
}).catch(function(e) {
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/nodemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nodemon({
'NODE_ENV': 'development'
},
ignore: [
// 'docs/*'
// 'docs/*' //TODO: find out why in dev mode this line uncommented break server reload on file change
],
watch: [
'src/cli/*',
Expand Down

0 comments on commit 5412d5f

Please sign in to comment.