mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
sync WIP
This commit is contained in:
@@ -1,19 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
function checkAuth(req, res, next) {
|
||||
const migration = require('./migration');
|
||||
|
||||
async function checkAuth(req, res, next) {
|
||||
if (!req.session.loggedIn) {
|
||||
res.redirect("login");
|
||||
} else {
|
||||
}
|
||||
|
||||
if (await migration.isDbUpToDate()) {
|
||||
next();
|
||||
}
|
||||
else {
|
||||
res.redirect("migration");
|
||||
}
|
||||
}
|
||||
|
||||
function checkApiAuth(req, res, next) {
|
||||
if (!req.session.loggedIn) {
|
||||
async function checkApiAuth(req, res, next) {
|
||||
if (!req.session.loggedIn && req.header("auth") !== "sync") {
|
||||
res.sendStatus(401);
|
||||
} else {
|
||||
}
|
||||
|
||||
if (await migration.isDbUpToDate()) {
|
||||
next();
|
||||
}
|
||||
else {
|
||||
res.sendStatus(409); // need better response than that
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user