refactor: renderers + auth providers + fixes

This commit is contained in:
NGPixel
2018-01-14 22:05:08 -05:00
parent 24fc806b0e
commit 74bd722168
41 changed files with 475 additions and 770 deletions

View File

@@ -247,6 +247,9 @@ module.exports = () => {
confRaw = yaml.safeDump(conf)
await fs.writeFileAsync(path.join(wiki.ROOTPATH, 'config.yml'), confRaw)
_.set(wiki.config, 'port', req.body.port)
_.set(wiki.config, 'paths.repo', req.body.pathRepo)
// Populate config namespaces
wiki.config.auth = wiki.config.auth || {}
wiki.config.features = wiki.config.features || {}
@@ -313,29 +316,24 @@ module.exports = () => {
})
wiki.logger.info('Setup is complete!')
res.json({ ok: true })
res.json({
ok: true,
redirectPath: wiki.config.site.path,
redirectPort: wiki.config.port
}).end()
wiki.logger.info('Stopping Setup...')
server.destroy(() => {
wiki.logger.info('Setup stopped. Starting Wiki.js...')
_.delay(() => {
wiki.kernel.bootMaster()
}, 1000)
})
} catch (err) {
res.json({ ok: false, error: err.message })
}
})
/**
* Restart in normal mode
*/
app.post('/restart', (req, res) => {
res.status(204).end()
/* server.destroy(() => {
spinner.text = 'Setup wizard terminated. Restarting in normal mode...'
_.delay(() => {
const exec = require('execa')
exec.stdout('node', ['wiki', 'start']).then(result => {
spinner.succeed('Wiki.js is now running in normal mode!')
process.exit(0)
})
}, 1000)
}) */
})
// ----------------------------------------
// Error handling
// ----------------------------------------