You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1000 B
JavaScript
50 lines
1000 B
JavaScript
6 years ago
|
const express = require('express');
|
||
|
const router = express.Router();
|
||
|
const FileHound = require('filehound');
|
||
6 years ago
|
const fs = require('fs-extra');
|
||
6 years ago
|
var settings = [];
|
||
|
//--------------------------
|
||
|
// SETTINGS
|
||
|
//--------------------------
|
||
6 years ago
|
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');
|
||
|
}
|
||
|
});
|
||
6 years ago
|
});
|
||
6 years ago
|
module.exports = router;
|