2017-03-14 05:02:43 +00:00
|
|
|
'use strict'
|
2017-03-08 10:45:51 +00:00
|
|
|
// response
|
|
|
|
// external modules
|
2019-08-05 02:21:20 +00:00
|
|
|
const request = require('request')
|
2015-05-04 07:53:29 +00:00
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
// core
|
2019-08-05 02:21:20 +00:00
|
|
|
const config = require('./config')
|
|
|
|
const logger = require('./logger')
|
|
|
|
const models = require('./models')
|
|
|
|
const utils = require('./utils')
|
2020-01-04 22:30:23 +00:00
|
|
|
const history = require('./history')
|
2015-05-04 07:53:29 +00:00
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
// public
|
2020-01-04 21:59:57 +00:00
|
|
|
exports.responseError = responseError
|
2019-08-05 02:21:20 +00:00
|
|
|
exports.errorForbidden = errorForbidden
|
|
|
|
exports.errorNotFound = errorNotFound
|
|
|
|
exports.errorBadRequest = errorBadRequest
|
|
|
|
exports.errorTooLong = errorTooLong
|
|
|
|
exports.errorInternalError = errorInternalError
|
|
|
|
exports.errorServiceUnavailable = errorServiceUnavailable
|
|
|
|
exports.newNote = newNote
|
|
|
|
exports.showPublishSlide = showPublishSlide
|
|
|
|
exports.publishNoteActions = publishNoteActions
|
|
|
|
exports.publishSlideActions = publishSlideActions
|
|
|
|
exports.githubActions = githubActions
|
|
|
|
exports.gitlabActions = gitlabActions
|
2020-01-04 21:59:57 +00:00
|
|
|
exports.checkViewPermission = checkViewPermission
|
2020-01-04 22:58:40 +00:00
|
|
|
exports.newCheckViewPermission = newCheckViewPermission
|
|
|
|
exports.responseCodiMD = responseCodiMD
|
2019-08-05 02:21:20 +00:00
|
|
|
|
2020-02-26 03:13:45 +00:00
|
|
|
function errorForbidden (req, res) {
|
2019-08-04 19:51:00 +00:00
|
|
|
if (req.user) {
|
|
|
|
responseError(res, '403', 'Forbidden', 'oh no.')
|
|
|
|
} else {
|
2020-08-03 08:53:21 +00:00
|
|
|
var nextURL = new URL('', config.serverURL)
|
|
|
|
nextURL.search = new URLSearchParams({ next: req.originalUrl })
|
2019-08-04 19:51:00 +00:00
|
|
|
req.flash('error', 'You are not allowed to access this page. Maybe try logging in?')
|
2020-08-03 08:53:21 +00:00
|
|
|
res.redirect(nextURL.toString())
|
2019-08-04 19:51:00 +00:00
|
|
|
}
|
|
|
|
}
|
2020-01-04 22:58:40 +00:00
|
|
|
|
2020-02-26 03:20:42 +00:00
|
|
|
function errorNotFound (req, res) {
|
2019-08-04 19:51:00 +00:00
|
|
|
responseError(res, '404', 'Not Found', 'oops.')
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
2020-01-04 22:58:40 +00:00
|
|
|
|
2020-02-26 03:22:59 +00:00
|
|
|
function errorBadRequest (req, res) {
|
2019-08-04 19:51:00 +00:00
|
|
|
responseError(res, '400', 'Bad Request', 'something not right.')
|
|
|
|
}
|
2020-01-04 22:58:40 +00:00
|
|
|
|
2020-02-26 03:23:55 +00:00
|
|
|
function errorTooLong (req, res) {
|
2019-08-04 19:51:00 +00:00
|
|
|
responseError(res, '413', 'Payload Too Large', 'Shorten your note!')
|
|
|
|
}
|
2020-01-04 22:58:40 +00:00
|
|
|
|
2020-02-26 03:26:01 +00:00
|
|
|
function errorInternalError (req, res) {
|
2019-08-04 19:51:00 +00:00
|
|
|
responseError(res, '500', 'Internal Error', 'wtf.')
|
|
|
|
}
|
2020-01-04 22:58:40 +00:00
|
|
|
|
2020-02-26 03:26:56 +00:00
|
|
|
function errorServiceUnavailable (req, res) {
|
2020-01-04 22:58:40 +00:00
|
|
|
res.status(503).send('I\'m busy right now, try again later.')
|
2019-08-04 19:51:00 +00:00
|
|
|
}
|
2015-05-04 07:53:29 +00:00
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function responseError (res, code, detail, msg) {
|
2018-09-10 20:35:38 +00:00
|
|
|
res.status(code).render('error.ejs', {
|
2017-03-08 10:45:51 +00:00
|
|
|
title: code + ' ' + detail + ' ' + msg,
|
|
|
|
code: code,
|
|
|
|
detail: detail,
|
2018-09-13 19:26:39 +00:00
|
|
|
msg: msg
|
2017-03-08 10:45:51 +00:00
|
|
|
})
|
2015-05-04 07:53:29 +00:00
|
|
|
}
|
|
|
|
|
2018-06-24 11:59:18 +00:00
|
|
|
function responseCodiMD (res, note) {
|
2017-03-08 10:45:51 +00:00
|
|
|
var body = note.content
|
|
|
|
var extracted = models.Note.extractMeta(body)
|
|
|
|
var meta = models.Note.parseMeta(extracted.meta)
|
|
|
|
var title = models.Note.decodeTitle(note.title)
|
|
|
|
title = models.Note.generateWebTitle(meta.title || title)
|
|
|
|
res.set({
|
|
|
|
'Cache-Control': 'private', // only cache by client
|
|
|
|
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
|
|
|
|
})
|
2018-09-10 20:35:38 +00:00
|
|
|
res.render('codimd.ejs', {
|
2021-07-23 17:01:34 +00:00
|
|
|
title: title,
|
|
|
|
alias: note.alias
|
2017-03-08 10:45:51 +00:00
|
|
|
})
|
2015-05-04 07:53:29 +00:00
|
|
|
}
|
|
|
|
|
2019-03-24 16:42:12 +00:00
|
|
|
function updateHistory (userId, note, document, time) {
|
|
|
|
var noteId = note.alias ? note.alias : models.Note.encodeNoteId(note.id)
|
|
|
|
history.updateHistory(userId, noteId, document, time)
|
2019-04-15 05:36:44 +00:00
|
|
|
logger.info('history updated')
|
2019-03-24 16:42:12 +00:00
|
|
|
}
|
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function newNote (req, res, next) {
|
|
|
|
var owner = null
|
2018-09-26 14:00:01 +00:00
|
|
|
var body = ''
|
|
|
|
if (req.body && req.body.length > config.documentMaxLength) {
|
2020-02-26 03:23:55 +00:00
|
|
|
return errorTooLong(req, res)
|
2018-09-27 22:17:34 +00:00
|
|
|
} else if (req.body) {
|
2018-09-26 14:00:01 +00:00
|
|
|
body = req.body
|
|
|
|
}
|
2018-06-23 22:32:41 +00:00
|
|
|
body = body.replace(/[\r]/g, '')
|
2017-03-08 10:45:51 +00:00
|
|
|
if (req.isAuthenticated()) {
|
|
|
|
owner = req.user.id
|
2018-03-07 14:17:35 +00:00
|
|
|
} else if (!config.allowAnonymous) {
|
2020-02-26 03:13:45 +00:00
|
|
|
return errorForbidden(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
|
|
|
models.Note.create({
|
|
|
|
ownerId: owner,
|
2018-01-10 23:51:22 +00:00
|
|
|
alias: req.alias ? req.alias : null,
|
2018-06-23 22:32:41 +00:00
|
|
|
content: body
|
2017-03-08 10:45:51 +00:00
|
|
|
}).then(function (note) {
|
2019-03-24 16:42:12 +00:00
|
|
|
if (req.isAuthenticated()) {
|
2019-04-15 05:36:44 +00:00
|
|
|
updateHistory(owner, note, body)
|
2019-03-24 16:42:12 +00:00
|
|
|
}
|
|
|
|
|
2018-03-07 14:17:35 +00:00
|
|
|
return res.redirect(config.serverURL + '/' + models.Note.encodeNoteId(note.id))
|
2017-03-08 10:45:51 +00:00
|
|
|
}).catch(function (err) {
|
|
|
|
logger.error(err)
|
2020-02-26 03:26:01 +00:00
|
|
|
return errorInternalError(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
})
|
2015-05-04 07:53:29 +00:00
|
|
|
}
|
|
|
|
|
2020-01-04 22:58:40 +00:00
|
|
|
function newCheckViewPermission (note, isLogin, userId) {
|
|
|
|
if (note.permission === 'private') {
|
|
|
|
return note.ownerId === userId
|
|
|
|
}
|
|
|
|
if (note.permission === 'limited' || note.permission === 'protected') {
|
|
|
|
return isLogin
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function checkViewPermission (req, note) {
|
|
|
|
if (note.permission === 'private') {
|
|
|
|
if (!req.isAuthenticated() || note.ownerId !== req.user.id) { return false } else { return true }
|
|
|
|
} else if (note.permission === 'limited' || note.permission === 'protected') {
|
|
|
|
if (!req.isAuthenticated()) { return false } else { return true }
|
|
|
|
} else {
|
|
|
|
return true
|
|
|
|
}
|
2015-05-04 07:53:29 +00:00
|
|
|
}
|
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function findNote (req, res, callback, include) {
|
|
|
|
var noteId = req.params.noteId
|
|
|
|
var id = req.params.noteId || req.params.shortid
|
|
|
|
models.Note.parseNoteId(id, function (err, _id) {
|
|
|
|
if (err) {
|
2018-02-16 16:47:50 +00:00
|
|
|
logger.error(err)
|
2020-02-26 03:26:01 +00:00
|
|
|
return errorInternalError(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
|
|
|
models.Note.findOne({
|
|
|
|
where: {
|
|
|
|
id: _id
|
|
|
|
},
|
|
|
|
include: include || null
|
|
|
|
}).then(function (note) {
|
|
|
|
if (!note) {
|
2018-11-12 23:14:25 +00:00
|
|
|
if (config.allowFreeURL && noteId && !config.forbiddenNoteIDs.includes(noteId)) {
|
2017-03-08 10:45:51 +00:00
|
|
|
req.alias = noteId
|
|
|
|
return newNote(req, res)
|
|
|
|
} else {
|
2020-02-26 03:20:42 +00:00
|
|
|
return errorNotFound(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!checkViewPermission(req, note)) {
|
2020-02-26 03:13:45 +00:00
|
|
|
return errorForbidden(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
} else {
|
|
|
|
return callback(note)
|
|
|
|
}
|
|
|
|
}).catch(function (err) {
|
|
|
|
logger.error(err)
|
2020-02-26 03:26:01 +00:00
|
|
|
return errorInternalError(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
})
|
|
|
|
})
|
2015-05-04 07:53:29 +00:00
|
|
|
}
|
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function actionDownload (req, res, note) {
|
|
|
|
var body = note.content
|
|
|
|
var title = models.Note.decodeTitle(note.title)
|
|
|
|
var filename = title
|
|
|
|
filename = encodeURIComponent(filename)
|
|
|
|
res.set({
|
|
|
|
'Access-Control-Allow-Origin': '*', // allow CORS as API
|
|
|
|
'Access-Control-Allow-Headers': 'Range',
|
|
|
|
'Access-Control-Expose-Headers': 'Cache-Control, Content-Encoding, Content-Range',
|
|
|
|
'Content-Type': 'text/markdown; charset=UTF-8',
|
|
|
|
'Cache-Control': 'private',
|
|
|
|
'Content-disposition': 'attachment; filename=' + filename + '.md',
|
|
|
|
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
|
|
|
|
})
|
|
|
|
res.send(body)
|
2016-08-19 03:31:23 +00:00
|
|
|
}
|
2016-08-19 03:24:36 +00:00
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function publishNoteActions (req, res, next) {
|
|
|
|
findNote(req, res, function (note) {
|
|
|
|
var action = req.params.action
|
|
|
|
switch (action) {
|
2018-10-27 23:55:14 +00:00
|
|
|
case 'download':
|
|
|
|
actionDownload(req, res, note)
|
2018-10-28 00:54:01 +00:00
|
|
|
break
|
2017-03-08 10:45:51 +00:00
|
|
|
case 'edit':
|
2018-03-07 14:17:35 +00:00
|
|
|
res.redirect(config.serverURL + '/' + (note.alias ? note.alias : models.Note.encodeNoteId(note.id)))
|
2017-03-08 10:45:51 +00:00
|
|
|
break
|
|
|
|
default:
|
2018-03-07 14:17:35 +00:00
|
|
|
res.redirect(config.serverURL + '/s/' + note.shortid)
|
2017-03-08 10:45:51 +00:00
|
|
|
break
|
|
|
|
}
|
|
|
|
})
|
2015-07-01 16:10:20 +00:00
|
|
|
}
|
2016-01-31 21:42:26 +00:00
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function publishSlideActions (req, res, next) {
|
|
|
|
findNote(req, res, function (note) {
|
|
|
|
var action = req.params.action
|
|
|
|
switch (action) {
|
|
|
|
case 'edit':
|
2018-03-07 14:17:35 +00:00
|
|
|
res.redirect(config.serverURL + '/' + (note.alias ? note.alias : models.Note.encodeNoteId(note.id)))
|
2017-03-08 10:45:51 +00:00
|
|
|
break
|
|
|
|
default:
|
2018-03-07 14:17:35 +00:00
|
|
|
res.redirect(config.serverURL + '/p/' + note.shortid)
|
2017-03-08 10:45:51 +00:00
|
|
|
break
|
|
|
|
}
|
|
|
|
})
|
2016-08-15 03:25:27 +00:00
|
|
|
}
|
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function githubActions (req, res, next) {
|
|
|
|
var noteId = req.params.noteId
|
|
|
|
findNote(req, res, function (note) {
|
|
|
|
var action = req.params.action
|
|
|
|
switch (action) {
|
|
|
|
case 'gist':
|
|
|
|
githubActionGist(req, res, note)
|
|
|
|
break
|
|
|
|
default:
|
2018-03-07 14:17:35 +00:00
|
|
|
res.redirect(config.serverURL + '/' + noteId)
|
2017-03-08 10:45:51 +00:00
|
|
|
break
|
|
|
|
}
|
|
|
|
})
|
2016-01-31 21:42:26 +00:00
|
|
|
}
|
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function githubActionGist (req, res, note) {
|
|
|
|
var code = req.query.code
|
|
|
|
var state = req.query.state
|
|
|
|
if (!code || !state) {
|
2020-02-26 03:13:45 +00:00
|
|
|
return errorForbidden(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
} else {
|
|
|
|
var data = {
|
|
|
|
client_id: config.github.clientID,
|
|
|
|
client_secret: config.github.clientSecret,
|
|
|
|
code: code,
|
|
|
|
state: state
|
|
|
|
}
|
|
|
|
var authUrl = 'https://github.com/login/oauth/access_token'
|
|
|
|
request({
|
|
|
|
url: authUrl,
|
|
|
|
method: 'POST',
|
|
|
|
json: data
|
|
|
|
}, function (error, httpResponse, body) {
|
|
|
|
if (!error && httpResponse.statusCode === 200) {
|
|
|
|
var accessToken = body.access_token
|
|
|
|
if (accessToken) {
|
|
|
|
var content = note.content
|
|
|
|
var title = models.Note.decodeTitle(note.title)
|
|
|
|
var filename = title.replace('/', ' ') + '.md'
|
|
|
|
var gist = {
|
2019-08-01 17:01:46 +00:00
|
|
|
files: {}
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
|
|
|
gist.files[filename] = {
|
2019-08-01 17:01:46 +00:00
|
|
|
content: content
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
|
|
|
var gistUrl = 'https://api.github.com/gists'
|
|
|
|
request({
|
|
|
|
url: gistUrl,
|
|
|
|
headers: {
|
2018-06-24 12:13:38 +00:00
|
|
|
'User-Agent': 'CodiMD',
|
2019-08-01 17:01:46 +00:00
|
|
|
Authorization: 'token ' + accessToken
|
2017-03-08 10:45:51 +00:00
|
|
|
},
|
|
|
|
method: 'POST',
|
|
|
|
json: gist
|
|
|
|
}, function (error, httpResponse, body) {
|
|
|
|
if (!error && httpResponse.statusCode === 201) {
|
|
|
|
res.setHeader('referer', '')
|
|
|
|
res.redirect(body.html_url)
|
2016-04-20 10:03:55 +00:00
|
|
|
} else {
|
2020-02-26 03:13:45 +00:00
|
|
|
return errorForbidden(req, res)
|
2016-04-20 10:03:55 +00:00
|
|
|
}
|
2017-03-08 10:45:51 +00:00
|
|
|
})
|
|
|
|
} else {
|
2020-02-26 03:13:45 +00:00
|
|
|
return errorForbidden(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-02-26 03:13:45 +00:00
|
|
|
return errorForbidden(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2016-01-31 21:42:26 +00:00
|
|
|
}
|
2015-07-01 16:10:20 +00:00
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function gitlabActions (req, res, next) {
|
|
|
|
var noteId = req.params.noteId
|
|
|
|
findNote(req, res, function (note) {
|
|
|
|
var action = req.params.action
|
|
|
|
switch (action) {
|
|
|
|
case 'projects':
|
|
|
|
gitlabActionProjects(req, res, note)
|
|
|
|
break
|
|
|
|
default:
|
2018-03-07 14:17:35 +00:00
|
|
|
res.redirect(config.serverURL + '/' + noteId)
|
2017-03-08 10:45:51 +00:00
|
|
|
break
|
|
|
|
}
|
|
|
|
})
|
2016-05-16 10:16:45 +00:00
|
|
|
}
|
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function gitlabActionProjects (req, res, note) {
|
|
|
|
if (req.isAuthenticated()) {
|
|
|
|
models.User.findOne({
|
|
|
|
where: {
|
|
|
|
id: req.user.id
|
|
|
|
}
|
|
|
|
}).then(function (user) {
|
2020-02-26 03:20:42 +00:00
|
|
|
if (!user) { return errorNotFound(req, res) }
|
2018-07-30 13:47:09 +00:00
|
|
|
var ret = { baseURL: config.gitlab.baseURL, version: config.gitlab.version }
|
2017-03-08 10:45:51 +00:00
|
|
|
ret.accesstoken = user.accessToken
|
|
|
|
ret.profileid = user.profileid
|
|
|
|
request(
|
2019-04-12 09:56:36 +00:00
|
|
|
config.gitlab.baseURL + '/api/' + config.gitlab.version + '/projects?membership=yes&per_page=100&access_token=' + user.accessToken,
|
|
|
|
function (error, httpResponse, body) {
|
|
|
|
if (!error && httpResponse.statusCode === 200) {
|
|
|
|
ret.projects = JSON.parse(body)
|
|
|
|
return res.send(ret)
|
|
|
|
} else {
|
|
|
|
return res.send(ret)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
2017-03-08 10:45:51 +00:00
|
|
|
}).catch(function (err) {
|
|
|
|
logger.error('gitlab action projects failed: ' + err)
|
2020-02-26 03:26:01 +00:00
|
|
|
return errorInternalError(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
})
|
|
|
|
} else {
|
2020-02-26 03:13:45 +00:00
|
|
|
return errorForbidden(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
2016-05-16 10:16:45 +00:00
|
|
|
}
|
|
|
|
|
2017-03-08 10:45:51 +00:00
|
|
|
function showPublishSlide (req, res, next) {
|
|
|
|
var include = [{
|
|
|
|
model: models.User,
|
|
|
|
as: 'owner'
|
|
|
|
}, {
|
|
|
|
model: models.User,
|
|
|
|
as: 'lastchangeuser'
|
|
|
|
}]
|
|
|
|
findNote(req, res, function (note) {
|
|
|
|
// force to use short id
|
|
|
|
var shortid = req.params.shortid
|
2018-03-07 14:17:35 +00:00
|
|
|
if ((note.alias && shortid !== note.alias) || (!note.alias && shortid !== note.shortid)) { return res.redirect(config.serverURL + '/p/' + (note.alias || note.shortid)) }
|
2017-03-08 10:45:51 +00:00
|
|
|
note.increment('viewcount').then(function (note) {
|
|
|
|
if (!note) {
|
2020-02-26 03:20:42 +00:00
|
|
|
return errorNotFound(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
|
|
|
var body = note.content
|
|
|
|
var extracted = models.Note.extractMeta(body)
|
|
|
|
var markdown = extracted.markdown
|
|
|
|
var meta = models.Note.parseMeta(extracted.meta)
|
|
|
|
var createtime = note.createdAt
|
|
|
|
var updatetime = note.lastchangeAt
|
|
|
|
var title = models.Note.decodeTitle(note.title)
|
|
|
|
title = models.Note.generateWebTitle(meta.title || title)
|
|
|
|
var data = {
|
|
|
|
title: title,
|
|
|
|
description: meta.description || (markdown ? models.Note.generateDescription(markdown) : null),
|
|
|
|
viewcount: note.viewcount,
|
|
|
|
createtime: createtime,
|
|
|
|
updatetime: updatetime,
|
|
|
|
body: markdown,
|
2017-06-04 17:12:40 +00:00
|
|
|
theme: meta.slideOptions && utils.isRevealTheme(meta.slideOptions.theme),
|
2017-03-08 10:45:51 +00:00
|
|
|
meta: JSON.stringify(extracted.meta),
|
|
|
|
owner: note.owner ? note.owner.id : null,
|
|
|
|
ownerprofile: note.owner ? models.User.getProfile(note.owner) : null,
|
|
|
|
lastchangeuser: note.lastchangeuser ? note.lastchangeuser.id : null,
|
|
|
|
lastchangeuserprofile: note.lastchangeuser ? models.User.getProfile(note.lastchangeuser) : null,
|
|
|
|
robots: meta.robots || false, // default allow robots
|
|
|
|
GA: meta.GA,
|
2017-10-18 15:48:53 +00:00
|
|
|
disqus: meta.disqus,
|
|
|
|
cspNonce: res.locals.nonce
|
2017-03-08 10:45:51 +00:00
|
|
|
}
|
2020-01-04 23:43:01 +00:00
|
|
|
res.set({
|
|
|
|
'Cache-Control': 'private' // only cache by client
|
|
|
|
})
|
|
|
|
res.render('slide.ejs', data)
|
2017-03-08 10:45:51 +00:00
|
|
|
}).catch(function (err) {
|
|
|
|
logger.error(err)
|
2020-02-26 03:26:01 +00:00
|
|
|
return errorInternalError(req, res)
|
2017-03-08 10:45:51 +00:00
|
|
|
})
|
|
|
|
}, include)
|
2015-11-23 12:38:26 +00:00
|
|
|
}
|