#98, sync to server now works as well + a lot of related changes

This commit is contained in:
azivner
2018-07-24 20:35:03 +02:00
parent 013714cb5c
commit 37ab7b4641
19 changed files with 153 additions and 65 deletions

View File

@@ -38,6 +38,15 @@ async function checkApiAuth(req, res, next) {
}
}
async function checkAppInitialized(req, res, next) {
if (!await sqlInit.isDbInitialized()) {
res.redirect("setup");
}
else {
next();
}
}
async function checkAppNotInitialized(req, res, next) {
if (await sqlInit.isDbInitialized()) {
res.status(400).send("App already initialized.");
@@ -77,6 +86,7 @@ async function checkBasicAuth(req, res, next) {
module.exports = {
checkAuth,
checkApiAuth,
checkAppInitialized,
checkAppNotInitialized,
checkApiAuthOrElectron,
checkSenderToken,