|
|
@ -78,8 +78,8 @@ router.get('/list/:filter?/:page?', function (req, res) {
|
|
|
|
.then(() => {
|
|
|
|
.then(() => {
|
|
|
|
//console.log(value);
|
|
|
|
//console.log(value);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
.catch(err => {
|
|
|
|
//next(err);
|
|
|
|
res.render('error', { error: err });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
@ -92,27 +92,24 @@ router.get('/list/:filter?/:page?', function (req, res) {
|
|
|
|
router.get('/add/new', function (req, res) {
|
|
|
|
router.get('/add/new', function (req, res) {
|
|
|
|
if (req.session.user) {
|
|
|
|
if (req.session.user) {
|
|
|
|
//need to grab a few copy of settings for the lastest index
|
|
|
|
//need to grab a few copy of settings for the lastest index
|
|
|
|
fs.ensureDir(
|
|
|
|
fs.readJSON('site/settings.jso')
|
|
|
|
'./public/assets/images/blog/' + moment().format('YYYY') + '/' + moment().format('MM'),
|
|
|
|
.then(config => {
|
|
|
|
() => {
|
|
|
|
res.render('page-edit', {
|
|
|
|
fs.readJSON('site/settings.json')
|
|
|
|
id: config.library_stats.current_index,
|
|
|
|
.then(config => {
|
|
|
|
uuid: uuidv4(),
|
|
|
|
res.render('page-edit', {
|
|
|
|
title: 'Add New Page',
|
|
|
|
id: config.library_stats.current_index,
|
|
|
|
user_status: true,
|
|
|
|
uuid: uuidv4(),
|
|
|
|
welcome: 'Add New Page',
|
|
|
|
title: 'Add New Page',
|
|
|
|
date: moment(Date.now()).format('YYYY MMM DD'),
|
|
|
|
user_status: true,
|
|
|
|
page: [],
|
|
|
|
welcome: 'Add New Page',
|
|
|
|
rawDate: moment(Date.now()).format(),
|
|
|
|
date: moment(Date.now()).format('YYYY MMM DD'),
|
|
|
|
status: ['false', 'false', 'false'],
|
|
|
|
page: [],
|
|
|
|
edit: false
|
|
|
|
rawDate: moment(Date.now()).format(),
|
|
|
|
});
|
|
|
|
status: ['false', 'false', 'false'],
|
|
|
|
})
|
|
|
|
edit: false
|
|
|
|
.catch(err => {
|
|
|
|
});
|
|
|
|
res.render('error', { error: err });
|
|
|
|
})
|
|
|
|
});
|
|
|
|
.catch(err => {}); //render error page
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -145,7 +142,7 @@ router.get('/edit/:id', function (req, res) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
.catch(err => {
|
|
|
|
res.json({ type: err });
|
|
|
|
res.render('error', { error: err });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
|