forked from projects/fipamo
50 lines
1,000 B
JavaScript
50 lines
1,000 B
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const FileHound = require('filehound');
|
|
const fs = require('fs-extra');
|
|
var settings = [];
|
|
//--------------------------
|
|
// SETTINGS
|
|
//--------------------------
|
|
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');
|
|
}
|
|
});
|
|
});
|
|
module.exports = router;
|