mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
even though trilium APIs are still exposed in electron, they require login if not called directly from electron
This commit is contained in:
parent
81719f84a0
commit
5f3a11af47
@ -7,6 +7,9 @@ function init(app) {
|
|||||||
req.method = arg.method;
|
req.method = arg.method;
|
||||||
req.body = arg.data;
|
req.body = arg.data;
|
||||||
req.headers = arg.headers;
|
req.headers = arg.headers;
|
||||||
|
req.session = {
|
||||||
|
loggedIn: true
|
||||||
|
};
|
||||||
|
|
||||||
const res = {
|
const res = {
|
||||||
statusCode: 200
|
statusCode: 200
|
||||||
|
@ -25,7 +25,7 @@ async function checkAuthForMigrationPage(req, res, next) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function checkApiAuth(req, res, next) {
|
async function checkApiAuth(req, res, next) {
|
||||||
if (!req.session.loggedIn && !utils.isElectron()) {
|
if (!req.session.loggedIn) {
|
||||||
res.status(401).send("Not authorized");
|
res.status(401).send("Not authorized");
|
||||||
}
|
}
|
||||||
else if (await migration.isDbUpToDate()) {
|
else if (await migration.isDbUpToDate()) {
|
||||||
@ -37,7 +37,7 @@ async function checkApiAuth(req, res, next) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function checkApiAuthForMigrationPage(req, res, next) {
|
async function checkApiAuthForMigrationPage(req, res, next) {
|
||||||
if (!req.session.loggedIn && !utils.isElectron()) {
|
if (!req.session.loggedIn) {
|
||||||
res.status(401).send("Not authorized");
|
res.status(401).send("Not authorized");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user