Skip to content

Build your personal knowledge base with Trilium Notes

Merge branch 'master' into next61

zadamb7f0fd2db38d
diff --cc src/becca/similarity.js
index 61bd02f450,253a250497..b0ed39e138
--- a/src/becca/similarity.js
+++ b/src/becca/similarity.js
@@@ -364,10 -364,10 +364,10 @@@ async function findSimilarNotes(noteId
}
/**
- * We want to improve standing of notes which have been created in similar time to each other since
+ * We want to improve the standing of notes which have been created in similar time to each other since
* there's a good chance they are related.
*
- * But there's an exception - if they were created really close to each other (withing few seconds) then
+ * But there's an exception - if they were created really close to each other (within few seconds) then
* they are probably part of the import and not created by hand - these OTOH should not benefit.
*/
const {utcDateCreated} = candidateNote;
diff --cc src/public/app/widgets/highlights_list.js
index deecd01a3c,8d32e7b362..a4962bf3d4
--- a/src/public/app/widgets/highlights_list.js
+++ b/src/public/app/widgets/highlights_list.js
@@@ -36,10 -36,10 +36,10 @@@ const TPL = `<div class="highlights-lis
font-weight: bold;
}
- .close-highlists-list {
+ .close-highlights-list {
position: absolute;
top: 2px;
- right: 2px;
+ right: 0px;
}
</style>
diff --cc src/public/app/widgets/note_tree.js
index dac3abae5a,a1c2fadb6c..4e1b40f45d
--- a/src/public/app/widgets/note_tree.js
+++ b/src/public/app/widgets/note_tree.js
@@@ -1116,8 -1139,8 +1116,8 @@@ export default class NoteTreeWidget ext
const note = froca.getNoteFromCache(ecAttr.noteId);
if (note && note.getChildNoteIds().includes(ecAttr.value)) {
- // there's a new /deleted imageLink betwen note and its image child - which can show/hide
- // there's new/deleted imageLink between note and its image child - which can show/hide
- // the image (if there is a imageLink relation between parent and child
++ // there's a new /deleted imageLink between note and its image child - which can show/hide
+ // the image (if there is an imageLink relation between parent and child,
// then it is assumed to be "contained" in the note and thus does not have to be displayed in the tree)
noteIdsToReload.add(ecAttr.noteId);
}
diff --cc src/routes/api/options.js
index 999bcb993f,ba8bc7943e..708b89ac1f
--- a/src/routes/api/options.js
+++ b/src/routes/api/options.js
@@@ -49,13 -60,11 +49,13 @@@ const ALLOWED_OPTIONS = new Set(
'compressImages',
'downloadImagesAutomatically',
'minTocHeadings',
- 'highlightedText',
+ 'highlightsList',
'checkForUpdates',
'disableTray',
+ 'eraseUnusedAttachmentsAfterSeconds',
+ 'disableTray',
'customSearchEngineName',
- 'customSearchEngineUrl',
+ 'customSearchEngineUrl'
]);
function getOptions() {
diff --cc src/routes/routes.js
index 120c23dbd9,764b2746ce..9d70ff6374
--- a/src/routes/routes.js
+++ b/src/routes/routes.js
@@@ -266,49 -283,12 +266,50 @@@ function register(app)
const clipperMiddleware = utils.isElectron() ? [] : [auth.checkEtapiToken];
route(GET, '/api/clipper/handshake', clipperMiddleware, clipperRoute.handshake, apiResultHandler);
- route(POST, '/api/clipper/clippings', clipperMiddleware, clipperRoute.addClipping, apiResultHandler);
- route(POST, '/api/clipper/notes', clipperMiddleware, clipperRoute.createNote, apiResultHandler);
- route(POST, '/api/clipper/open/:noteId', clipperMiddleware, clipperRoute.openNote, apiResultHandler);
+ route(PST, '/api/clipper/clippings', clipperMiddleware, clipperRoute.addClipping, apiResultHandler);
+ route(PST, '/api/clipper/notes', clipperMiddleware, clipperRoute.createNote, apiResultHandler);
+ route(PST, '/api/clipper/open/:noteId', clipperMiddleware, clipperRoute.openNote, apiResultHandler);
+ route(GET, '/api/clipper/notes-by-url/:noteUrl', clipperMiddleware, clipperRoute.findNotesByUrl, apiResultHandler);
- apiRoute(GET, '/api/similar-notes/:noteId', similarNotesRoute.getSimilarNotes);
+ apiRoute(GET, '/api/special-notes/inbox/:date', specialNotesRoute.getInboxNote);
+ apiRoute(GET, '/api/special-notes/days/:date', specialNotesRoute.getDayNote);
+ apiRoute(GET, '/api/special-notes/weeks/:date', specialNotesRoute.getWeekNote);
+ apiRoute(GET, '/api/special-notes/months/:month', specialNotesRoute.getMonthNote);
+ apiRoute(GET, '/api/special-notes/years/:year', specialNotesRoute.getYearNote);
+ apiRoute(GET, '/api/special-notes/notes-for-month/:month', specialNotesRoute.getDayNotesForMonth);
+ apiRoute(PST, '/api/special-notes/sql-console', specialNotesRoute.createSqlConsole);
+ apiRoute(PST, '/api/special-notes/save-sql-console', specialNotesRoute.saveSqlConsole);
+ apiRoute(PST, '/api/special-notes/search-note', specialNotesRoute.createSearchNote);
+ apiRoute(PST, '/api/special-notes/save-search-note', specialNotesRoute.saveSearchNote);
+ apiRoute(PST, '/api/special-notes/launchers/:noteId/reset', specialNotesRoute.resetLauncher);
+ apiRoute(PST, '/api/special-notes/launchers/:parentNoteId/:launcherType', specialNotesRoute.createLauncher);
+ apiRoute(PUT, '/api/special-notes/api-script-launcher', specialNotesRoute.createOrUpdateScriptLauncherFromApi);
+
+ apiRoute(GET, '/api/sql/schema', sqlRoute.getSchema);
+ apiRoute(PST, '/api/sql/execute/:noteId', sqlRoute.execute);
+ route(PST, '/api/database/anonymize/:type', [auth.checkApiAuthOrElectron, csrfMiddleware], databaseRoute.anonymize, apiResultHandler, false);
+
+ // backup requires execution outside of transaction
+ route(PST, '/api/database/backup-database', [auth.checkApiAuthOrElectron, csrfMiddleware], databaseRoute.backupDatabase, apiResultHandler, false);
+
+ // VACUUM requires execution outside of transaction
+ route(PST, '/api/database/vacuum-database', [auth.checkApiAuthOrElectron, csrfMiddleware], databaseRoute.vacuumDatabase, apiResultHandler, false);
+
+ route(PST, '/api/database/find-and-fix-consistency-issues', [auth.checkApiAuthOrElectron, csrfMiddleware], databaseRoute.findAndFixConsistencyIssues, apiResultHandler, false);
+
+ apiRoute(GET, '/api/database/check-integrity', databaseRoute.checkIntegrity);
+
+ apiRoute(PST, '/api/script/exec', scriptRoute.exec);
+ apiRoute(PST, '/api/script/run/:noteId', scriptRoute.run);
+ apiRoute(GET, '/api/script/startup', scriptRoute.getStartupBundles);
+ apiRoute(GET, '/api/script/widgets', scriptRoute.getWidgetBundles);
+ apiRoute(GET, '/api/script/bundle/:noteId', scriptRoute.getBundle);
+ apiRoute(GET, '/api/script/relation/:noteId/:relationName', scriptRoute.getRelationBundles);
+
+ // no CSRF since this is called from android app
+ route(PST, '/api/sender/login', [loginRateLimiter], loginApiRoute.token, apiResultHandler);
+ route(PST, '/api/sender/image', [auth.checkEtapiToken, uploadMiddlewareWithErrorHandling], senderRoute.uploadImage, apiResultHandler);
+ route(PST, '/api/sender/note', [auth.checkEtapiToken], senderRoute.saveNote, apiResultHandler);
apiRoute(GET, '/api/keyboard-actions', keysRoute.getKeyboardActions);
apiRoute(GET, '/api/keyboard-shortcuts-for-notes', keysRoute.getShortcutsForNotes);
diff --cc src/services/consistency_checks.js
index a085bb9156,a29a67c7d4..49cec40522
--- a/src/services/consistency_checks.js
+++ b/src/services/consistency_checks.js
@@@ -389,13 -347,12 +389,13 @@@ class ConsistencyChecks
this.findAndFixIssues(`
SELECT notes.noteId, notes.isProtected, notes.type, notes.mime
FROM notes
- LEFT JOIN note_contents USING (noteId)
- WHERE note_contents.noteId IS NULL`,
+ LEFT JOIN blobs USING (blobId)
+ WHERE blobs.blobId IS NULL
+ AND notes.isDeleted = 0`,
({noteId, isProtected, type, mime}) => {
if (this.autoFix) {
- // it might be possible that the note_content is not available only because of the interrupted
+ // it might be possible that the blob is not available only because of the interrupted
- // sync, and it will come later. It's therefore important to guarantee that this artifical
+ // sync, and it will come later. It's therefore important to guarantee that this artificial
// record won't overwrite the real one coming from the sync.
const fakeDate = "2000-01-01 00:00:00Z";
diff --cc src/services/options_init.js
index 547b4f9568,b8026d371e..714f912d90
--- a/src/services/options_init.js
+++ b/src/services/options_init.js
@@@ -83,12 -87,11 +83,12 @@@ const defaultOptions =
{ name: 'compressImages', value: 'true', isSynced: true },
{ name: 'downloadImagesAutomatically', value: 'true', isSynced: true },
{ name: 'minTocHeadings', value: '5', isSynced: true },
- { name: 'highlightedText', value: '["bold","italic","underline","color","bgColor"]', isSynced: true },
+ { name: 'highlightsList', value: '["bold","italic","underline","color","bgColor"]', isSynced: true },
{ name: 'checkForUpdates', value: 'true', isSynced: true },
{ name: 'disableTray', value: 'false', isSynced: false },
- { name: 'customSearchEngineName', value: 'Duckduckgo', isSynced: false },
- { name: 'customSearchEngineUrl', value: 'https://duckduckgo.com/?q={keyword}', isSynced: false },
+ { name: 'eraseUnusedAttachmentsAfterSeconds', value: '2592000', isSynced: true },
+ { name: 'customSearchEngineName', value: 'DuckDuckGo', isSynced: true },
+ { name: 'customSearchEngineUrl', value: 'https://duckduckgo.com/?q={keyword}', isSynced: true }
];
function initStartupOptions() {
diff --cc src/services/task_context.js
index 13fc22b04e,1d46e053ee..be031ddacf
--- a/src/services/task_context.js
+++ b/src/services/task_context.js
@@@ -13,11 -13,11 +13,11 @@@ class TaskContext
this.noteDeletionHandlerTriggered = false;
// progressCount is meant to represent just some progress - to indicate the task is not stuck
- this.progressCount = -1; // we're incrementing immediatelly
+ this.progressCount = -1; // we're incrementing immediately
- this.lastSentCountTs = 0; // 0 will guarantee first message will be sent
+ this.lastSentCountTs = 0; // 0 will guarantee the first message will be sent
// just the fact this has been initialized is a progress which should be sent to clients
- // this is esp. important when importing big files/images which take long time to upload/process
+ // this is esp. important when importing big files/images which take a long time to upload/process
// which means that first "real" increaseProgressCount() will be called quite late and user is without
// feedback until then
this.increaseProgressCount();