Skip to content

Build your personal knowledge base with Trilium Notes

sync fix and more logging

azivnere1251222cc5e
diff --git a/app.js b/app.js
index 5584ba3dec..e4802b9745 100644
--- a/app.js
+++ b/app.js
@@ -1,3 +1,5 @@
+const log = require('./services/log');
+log.info("App starting up");
const express = require('express');
const path = require('path');
const favicon = require('serve-favicon');
@@ -8,13 +10,12 @@ const session = require('express-session');
const FileStore = require('session-file-store')(session);
const os = require('os');
const options = require('./services/options');
-const log = require('./services/log');
const utils = require('./services/utils');
const sql = require('./services/sql');
-
const dataDir = require('./services/data_dir');
const sessionSecret = require('./services/session_secret');
+
const db = require('sqlite');
db.open(dataDir.DOCUMENT_PATH, { Promise }).then(async () => {
diff --git a/routes/api/notes_move.js b/routes/api/notes_move.js
index e9557e60a0..75796b26d7 100644
--- a/routes/api/notes_move.js
+++ b/routes/api/notes_move.js
@@ -87,8 +87,7 @@ router.put('/:noteId/expanded/:expanded', async (req, res, next) => {
const now = utils.nowTimestamp();
await sql.doInTransaction(async () => {
- // we don't change date_modified so other changes are prioritized in case of conflict
- await sql.execute("update notes_tree set is_expanded = ? where note_id = ?", [expanded, noteId]);
+ await sql.execute("update notes_tree set is_expanded = ?, date_modified = ? where note_id = ?", [expanded, now, noteId]);
await sql.addNoteTreeSync(noteId);
await sql.addAudit(audit_category.CHANGE_EXPANDED, utils.browserId(req), noteId, null, expanded);
diff --git a/services/source_id.js b/services/source_id.js
index 9721d99fb9..78efc684c8 100644
--- a/services/source_id.js
+++ b/services/source_id.js
@@ -1,3 +1,8 @@
const utils = require('./utils');
+const log = require('./log');
-module.exports = utils.randomString(16);
\ No newline at end of file
+const sourceId = utils.randomString(16);
+
+log.info("Using sourceId=" + sourceId);
+
+module.exports = sourceId;
\ No newline at end of file