Skip to content

Build your personal knowledge base with Trilium Notes

even though trilium APIs are still exposed in electron, they require login if not called directly from electron

azivner5f3a11af477b
diff --git a/routes/electron.js b/routes/electron.js
index 8082c9b6d6..816ed1baba 100644
--- a/routes/electron.js
+++ b/routes/electron.js
@@ -7,6 +7,9 @@ function init(app) {
req.method = arg.method;
req.body = arg.data;
req.headers = arg.headers;
+ req.session = {
+ loggedIn: true
+ };
const res = {
statusCode: 200
diff --git a/services/auth.js b/services/auth.js
index f97f399225..9ccb5da359 100644
--- a/services/auth.js
+++ b/services/auth.js
@@ -25,7 +25,7 @@ async function checkAuthForMigrationPage(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");
}
else if (await migration.isDbUpToDate()) {
@@ -37,7 +37,7 @@ async function checkApiAuth(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");
}
else {