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.
Fipamo/brain/routes/dash/settings.js

50 lines
1000 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;