|
|
|
@ -4,6 +4,8 @@ import Render from '../../data/Render';
|
|
|
|
|
import Settings, { SETTINGS_FILE, SETTINGS_FOLKS } from '../../data/Settings';
|
|
|
|
|
import Navigation from '../../data/Navigation';
|
|
|
|
|
import Book from '../../data/Book';
|
|
|
|
|
import Utils from '../../data/Utils';
|
|
|
|
|
import { util } from 'prettier';
|
|
|
|
|
const express = require('express');
|
|
|
|
|
const router = express.Router();
|
|
|
|
|
const multer = require('multer');
|
|
|
|
@ -15,6 +17,7 @@ const render = new Render();
|
|
|
|
|
const book = new Book();
|
|
|
|
|
const settings = new Settings();
|
|
|
|
|
const nav = new Navigation();
|
|
|
|
|
const utils = new Utils();
|
|
|
|
|
const uploadPath =
|
|
|
|
|
'./public/assets/images/user/' + moment().format('YYYY') + '/' + moment().format('MM');
|
|
|
|
|
|
|
|
|
@ -204,6 +207,56 @@ router.post('/add-feature-background', background_upload, (req, res) => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/***
|
|
|
|
|
CREATE BACK UP
|
|
|
|
|
*/
|
|
|
|
|
router.post('/create-backup', (req, res) => {
|
|
|
|
|
auth.authCheck(req)
|
|
|
|
|
.then(() => {
|
|
|
|
|
utils
|
|
|
|
|
.createBackup()
|
|
|
|
|
.then(() => {
|
|
|
|
|
res.json({
|
|
|
|
|
type: DataEvent.API_BACKUP_CREATE,
|
|
|
|
|
message: "You're backed up. Hi fives"
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
res.json({
|
|
|
|
|
type: err.type,
|
|
|
|
|
message: err.message
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
res.json({
|
|
|
|
|
type: err.type,
|
|
|
|
|
message: err.message
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
router.get('/download-backup', (req, res) => {
|
|
|
|
|
var filePath = 'content/backup.zip'; // Or format the path using the `id` rest param
|
|
|
|
|
var fileName = 'backup.zip'; // The default name the browser will use
|
|
|
|
|
|
|
|
|
|
res.download(filePath, fileName);
|
|
|
|
|
//Make secure
|
|
|
|
|
/*
|
|
|
|
|
auth.authCheck(req)
|
|
|
|
|
.then(() => {
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
res.json({
|
|
|
|
|
type: err.type,
|
|
|
|
|
message: err.message
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
*/
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
module.exports = router;
|
|
|
|
|
|
|
|
|
|
function getBookData() {
|
|
|
|
|