mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	Compare commits
	
		
			9 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 6afc299efb | ||
|  | 369274ead7 | ||
|  | 04e6431c09 | ||
|  | e89057a771 | ||
|  | 4f27254e64 | ||
|  | 577dc95ab8 | ||
|  | a266d6a3d5 | ||
|  | 749b6cb57e | ||
|  | b0b2951ff6 | 
| @@ -2,7 +2,7 @@ | |||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "productName": "Trilium Notes", |   "productName": "Trilium Notes", | ||||||
|   "description": "Trilium Notes", |   "description": "Trilium Notes", | ||||||
|   "version": "0.45.7", |   "version": "0.45.8", | ||||||
|   "license": "AGPL-3.0-only", |   "license": "AGPL-3.0-only", | ||||||
|   "main": "electron.js", |   "main": "electron.js", | ||||||
|   "bin": { |   "bin": { | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ const TPL = ` | |||||||
|         cursor: text !important; |         cursor: text !important; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     .note-detail-editable-text *:first-child { |     .note-detail-editable-text *:not(figure):first-child { | ||||||
|         margin-top: 0 !important; |         margin-top: 0 !important; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|   | |||||||
| @@ -23,11 +23,7 @@ function exportBranch(req, res) { | |||||||
|  |  | ||||||
|     try { |     try { | ||||||
|         if (type === 'subtree' && (format === 'html' || format === 'markdown')) { |         if (type === 'subtree' && (format === 'html' || format === 'markdown')) { | ||||||
|             const start = Date.now(); |  | ||||||
|  |  | ||||||
|             zipExportService.exportToZip(taskContext, branch, format, res); |             zipExportService.exportToZip(taskContext, branch, format, res); | ||||||
|  |  | ||||||
|             console.log("Export took", Date.now() - start, "ms"); |  | ||||||
|         } |         } | ||||||
|         else if (type === 'single') { |         else if (type === 'single') { | ||||||
|             singleExportService.exportSingleNote(taskContext, branch, format, res); |             singleExportService.exportSingleNote(taskContext, branch, format, res); | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| module.exports = { buildDate:"2020-12-22T20:21:15+01:00", buildRevision: "bdfd760b9d428dc29c45a0e016d12a25af220043" }; | module.exports = { buildDate:"2021-01-11T22:29:31+01:00", buildRevision: "369274ead75947a68bf7bbb5ab1e784e81521030" }; | ||||||
|   | |||||||
| @@ -143,7 +143,7 @@ function exportToZip(taskContext, branch, format, res) { | |||||||
|         const available = !note.isProtected || protectedSessionService.isProtectedSessionAvailable(); |         const available = !note.isProtected || protectedSessionService.isProtectedSessionAvailable(); | ||||||
|  |  | ||||||
|         // if it's a leaf then we'll export it even if it's empty |         // if it's a leaf then we'll export it even if it's empty | ||||||
|         if (available && ((note.getContent()).length > 0 || childBranches.length === 0)) { |         if (available && (note.getContent().length > 0 || childBranches.length === 0)) { | ||||||
|             meta.dataFileName = getDataFileName(note, baseFileName, existingFileNames); |             meta.dataFileName = getDataFileName(note, baseFileName, existingFileNames); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -234,7 +234,7 @@ function exportToZip(taskContext, branch, format, res) { | |||||||
|     <link rel="stylesheet" href="${cssUrl}"> |     <link rel="stylesheet" href="${cssUrl}"> | ||||||
|     <base target="_parent"> |     <base target="_parent"> | ||||||
| </head> | </head> | ||||||
| <body> | <body class="ck-content"> | ||||||
|   <h1>${utils.escapeHtml(title)}</h1> |   <h1>${utils.escapeHtml(title)}</h1> | ||||||
| ${content} | ${content} | ||||||
| </body> | </body> | ||||||
| @@ -433,14 +433,13 @@ ${content} | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     const note = branch.getNote(); |     const note = branch.getNote(); | ||||||
|     const zipFileName = (branch.prefix ? (branch.prefix + " - ") : "") + note.title + ".zip"; |     const zipFileName = (branch.prefix ? `${branch.prefix} - ` : "") + note.title + ".zip"; | ||||||
|  |  | ||||||
|     res.setHeader('Content-Disposition', utils.getContentDisposition(zipFileName)); |     res.setHeader('Content-Disposition', utils.getContentDisposition(zipFileName)); | ||||||
|     res.setHeader('Content-Type', 'application/zip'); |     res.setHeader('Content-Type', 'application/zip'); | ||||||
|  |  | ||||||
|     zipFile.end(); |  | ||||||
|  |  | ||||||
|     zipFile.outputStream.pipe(res); |     zipFile.outputStream.pipe(res); | ||||||
|  |     zipFile.end(); | ||||||
|  |  | ||||||
|     taskContext.taskSucceeded(); |     taskContext.taskSucceeded(); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -31,10 +31,7 @@ function initNotSyncedOptions(initialized, startNotePath = 'root', opts = {}) { | |||||||
|     optionService.createOption('openTabs', JSON.stringify([ |     optionService.createOption('openTabs', JSON.stringify([ | ||||||
|         { |         { | ||||||
|             notePath: startNotePath, |             notePath: startNotePath, | ||||||
|             active: true, |             active: true | ||||||
|             sidebar: { |  | ||||||
|                 widgets: [] |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     ]), false); |     ]), false); | ||||||
|  |  | ||||||
| @@ -103,6 +100,15 @@ function initStartupOptions() { | |||||||
|             log.info(`Created missing option "${name}" with default value "${value}"`); |             log.info(`Created missing option "${name}" with default value "${value}"`); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (process.env.TRILIUM_START_NOTE_ID) { | ||||||
|  |         optionService.setOption('openTabs', JSON.stringify([ | ||||||
|  |             { | ||||||
|  |                 notePath: process.env.TRILIUM_START_NOTE_ID, | ||||||
|  |                 active: true | ||||||
|  |             } | ||||||
|  |         ])); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| function getKeyboardDefaultOptions() { | function getKeyboardDefaultOptions() { | ||||||
|   | |||||||
| @@ -32,26 +32,29 @@ class NoteContentProtectedFulltextExp extends Expression { | |||||||
|                 FROM notes JOIN note_contents USING (noteId)  |                 FROM notes JOIN note_contents USING (noteId)  | ||||||
|                 WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 1`)) { |                 WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 1`)) { | ||||||
|  |  | ||||||
|  |             if (!inputNoteSet.hasNoteId(noteId) || !(noteId in noteCache.notes)) { | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             try { |             try { | ||||||
|                 content = protectedSessionService.decryptString(content); |                 content = protectedSessionService.decryptString(content); | ||||||
|             } |             } | ||||||
|             catch (e) { |             catch (e) { | ||||||
|                 log.info('Cannot decrypt content of note', noteId); |                 log.info(`Cannot decrypt content of note ${noteId}`); | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             content = content.toLowerCase(); |             content = content.toLowerCase(); | ||||||
|  |  | ||||||
|             if (type === 'text' && mime === 'text/html') { |             if (type === 'text' && mime === 'text/html') { | ||||||
|                 content = striptags(content); |                 if (content.length < 20000) { // striptags is slow for very large notes | ||||||
|  |                     content = striptags(content); | ||||||
|  |                 } | ||||||
|  |  | ||||||
|                 content = content.replace(/ /g, ' '); |                 content = content.replace(/ /g, ' '); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (this.tokens.find(token => !content.includes(token))) { |             if (!this.tokens.find(token => !content.includes(token))) { | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             if (inputNoteSet.hasNoteId(noteId) && noteId in noteCache.notes) { |  | ||||||
|                 resultNoteSet.add(noteCache.notes[noteId]); |                 resultNoteSet.add(noteCache.notes[noteId]); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -26,18 +26,21 @@ class NoteContentUnprotectedFulltextExp extends Expression { | |||||||
|                 FROM notes JOIN note_contents USING (noteId)  |                 FROM notes JOIN note_contents USING (noteId)  | ||||||
|                 WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 0`)) { |                 WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 0`)) { | ||||||
|  |  | ||||||
|             content = content.toString().toLowerCase(); |             if (!inputNoteSet.hasNoteId(noteId) || !(noteId in noteCache.notes)) { | ||||||
|  |  | ||||||
|             if (type === 'text' && mime === 'text/html') { |  | ||||||
|                 content = striptags(content); |  | ||||||
|                 content = content.replace(/ /g, ' '); |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             if (this.tokens.find(token => !content.includes(token))) { |  | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (inputNoteSet.hasNoteId(noteId) && noteId in noteCache.notes) { |             content = content.toString().toLowerCase(); | ||||||
|  |  | ||||||
|  |             if (type === 'text' && mime === 'text/html') { | ||||||
|  |                 if (content.length < 20000) { // striptags is slow for very large notes | ||||||
|  |                     content = striptags(content); | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 content = content.replace(/ /g, ' '); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             if (!this.tokens.find(token => !content.includes(token))) { | ||||||
|                 resultNoteSet.add(noteCache.notes[noteId]); |                 resultNoteSet.add(noteCache.notes[noteId]); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user