|
|
@ -1,4 +1,5 @@
|
|
|
|
import * as DataEvent from '../../../src/com/events/DataEvent';
|
|
|
|
import * as DataEvent from '../../../src/com/events/DataEvent';
|
|
|
|
|
|
|
|
import Auth from '../../data/Auth';
|
|
|
|
const express = require('express');
|
|
|
|
const express = require('express');
|
|
|
|
const router = express.Router();
|
|
|
|
const router = express.Router();
|
|
|
|
const multer = require('multer');
|
|
|
|
const multer = require('multer');
|
|
|
@ -7,6 +8,7 @@ const moment = require('moment');
|
|
|
|
const _ = require('lodash');
|
|
|
|
const _ = require('lodash');
|
|
|
|
const settings = require('../../../site/settings.json');
|
|
|
|
const settings = require('../../../site/settings.json');
|
|
|
|
const folks = require('../../../site/folks.json');
|
|
|
|
const folks = require('../../../site/folks.json');
|
|
|
|
|
|
|
|
const auth = new Auth();
|
|
|
|
const uploadPath =
|
|
|
|
const uploadPath =
|
|
|
|
'./public/assets/images/user/' + moment().format('YYYY') + '/' + moment().format('MM');
|
|
|
|
'./public/assets/images/user/' + moment().format('YYYY') + '/' + moment().format('MM');
|
|
|
|
fs.ensureDir(uploadPath, () => {
|
|
|
|
fs.ensureDir(uploadPath, () => {
|
|
|
@ -108,18 +110,20 @@ router.post('/nav-sync', (req, res) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
router.post('/publish-pages', (req, res) => {
|
|
|
|
router.post('/publish-pages', (req, res) => {
|
|
|
|
if (req.session.user) {
|
|
|
|
auth.authCheck(req)
|
|
|
|
|
|
|
|
.then(() => {
|
|
|
|
console.log('PUBLISHING');
|
|
|
|
console.log('PUBLISHING');
|
|
|
|
res.json({
|
|
|
|
res.json({
|
|
|
|
type: DataEvent.API_RENDER_PAGES,
|
|
|
|
type: DataEvent.API_RENDER_PAGES,
|
|
|
|
message: 'All Pages Rendered and Published'
|
|
|
|
message: 'All Pages Rendered and Published'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(err => {
|
|
|
|
res.json({
|
|
|
|
res.json({
|
|
|
|
type: DataEvent.REQUEST_LAME,
|
|
|
|
type: err.type,
|
|
|
|
message: "You're not logged in, champ"
|
|
|
|
message: err.message
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/***
|
|
|
|
/***
|
|
|
|