2018-12-11 18:35:29 +01:00
|
|
|
const express = require('express');
|
|
|
|
const router = express.Router();
|
|
|
|
const FileHound = require('filehound');
|
2019-02-27 17:17:51 +01:00
|
|
|
const fs = require('fs-extra');
|
2018-12-11 18:35:29 +01:00
|
|
|
var settings = [];
|
|
|
|
//--------------------------
|
|
|
|
// SETTINGS
|
|
|
|
//--------------------------
|
2019-02-27 17:17:51 +01:00
|
|
|
router.get('/', function(req, res) {
|
|
|
|
fs.readJson('config/site-settings.json')
|
|
|
|
.then(obj => {
|
|
|
|
settings = obj;
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
//console.error(err)
|
|
|
|
});
|
|
|
|
let themes = [];
|
|
|
|
FileHound.create()
|
|
|
|
.paths('themes')
|
|
|
|
.ext('json')
|
|
|
|
.find()
|
|
|
|
.then(files => {
|
|
|
|
files.forEach(file => {
|
|
|
|
fs.readJson(file)
|
|
|
|
.then(theme => {
|
|
|
|
if (theme.name == settings.theme) {
|
|
|
|
themes.push({
|
|
|
|
theme: theme,
|
|
|
|
current: 'true'
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
themes.push({
|
|
|
|
theme: theme,
|
|
|
|
current: 'false'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
//console.error(err)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (req.session.user) {
|
|
|
|
let memberInfo = [];
|
|
|
|
} else {
|
|
|
|
res.redirect('/@/dashboard');
|
|
|
|
}
|
|
|
|
});
|
2018-12-11 18:35:29 +01:00
|
|
|
});
|
2019-02-27 17:17:51 +01:00
|
|
|
module.exports = router;
|