mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	Compare commits
	
		
			9 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | d04d356429 | ||
|  | be59f248e8 | ||
|  | 1995b54770 | ||
|  | f2732bcab7 | ||
|  | 0e9d76890b | ||
|  | 9df521109b | ||
|  | 75b65c396e | ||
|  | d4d48f3834 | ||
|  | b90ba3d1a9 | 
| @@ -44,7 +44,7 @@ find $DIR/node_modules -name demo -exec rm -rf {} \; | |||||||
|  |  | ||||||
| find $DIR/libraries -name "*.map" -type f -delete | find $DIR/libraries -name "*.map" -type f -delete | ||||||
|  |  | ||||||
| rm -r $DIR/src/public/app | rm -rf $DIR/src/public/app | ||||||
|  |  | ||||||
| sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' $DIR/src/views/desktop.ejs | sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' $DIR/src/views/desktop.ejs | ||||||
| sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' $DIR/src/views/mobile.ejs | sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' $DIR/src/views/mobile.ejs | ||||||
|   | |||||||
| @@ -1,3 +1,13 @@ | |||||||
|  | -- delete duplicates https://github.com/zadam/trilium/issues/2534 | ||||||
|  | DELETE FROM entity_changes WHERE isErased = 0 AND id IN ( | ||||||
|  |     SELECT id FROM entity_changes ec | ||||||
|  |     WHERE ( | ||||||
|  |               SELECT COUNT(*) FROM entity_changes | ||||||
|  |               WHERE ec.entityName = entity_changes.entityName | ||||||
|  |                 AND ec.entityId = entity_changes.entityId | ||||||
|  |           ) > 1 | ||||||
|  | ); | ||||||
|  |  | ||||||
| CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( | CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( | ||||||
|                                                 `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |                                                 `id`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||||||
|                                                 `entityName`	TEXT NOT NULL, |                                                 `entityName`	TEXT NOT NULL, | ||||||
| @@ -10,8 +20,8 @@ CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( | |||||||
|                                                 `utcDateChanged` TEXT NOT NULL |                                                 `utcDateChanged` TEXT NOT NULL | ||||||
| ); | ); | ||||||
|  |  | ||||||
| INSERT INTO mig_entity_changes (entityName, entityId, hash, isErased, changeId, sourceId, isSynced, utcDateChanged) | INSERT INTO mig_entity_changes (id, entityName, entityId, hash, isErased, changeId, sourceId, isSynced, utcDateChanged) | ||||||
|     SELECT entityName, entityId, hash, isErased, '', sourceId, isSynced, utcDateChanged FROM entity_changes; |     SELECT id, entityName, entityId, hash, isErased, '', sourceId, isSynced, utcDateChanged FROM entity_changes; | ||||||
|  |  | ||||||
| DROP TABLE  entity_changes; | DROP TABLE  entity_changes; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "productName": "Trilium Notes", |   "productName": "Trilium Notes", | ||||||
|   "description": "Trilium Notes", |   "description": "Trilium Notes", | ||||||
|   "version": "0.49.3", |   "version": "0.49.4", | ||||||
|   "license": "AGPL-3.0-only", |   "license": "AGPL-3.0-only", | ||||||
|   "main": "electron.js", |   "main": "electron.js", | ||||||
|   "bin": { |   "bin": { | ||||||
|   | |||||||
| @@ -71,14 +71,7 @@ function getNoteTitle(childNoteId, parentNoteId) { | |||||||
|         return "[error fetching title]"; |         return "[error fetching title]"; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     let title; |     const title = childNote.getTitleOrProtected(); | ||||||
|  |  | ||||||
|     if (childNote.isProtected) { |  | ||||||
|         title = protectedSessionService.isProtectedSessionAvailable() ? childNote.title : '[protected]'; |  | ||||||
|     } |  | ||||||
|     else { |  | ||||||
|         title = childNote.title; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     const branch = parentNote ? becca.getBranchFromChildAndParent(childNote.noteId, parentNote.noteId) : null; |     const branch = parentNote ? becca.getBranchFromChildAndParent(childNote.noteId, parentNote.noteId) : null; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -131,6 +131,10 @@ class Note extends AbstractEntity { | |||||||
|             || protectedSessionService.isProtectedSessionAvailable() |             || protectedSessionService.isProtectedSessionAvailable() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     getTitleOrProtected() { | ||||||
|  |         return this.isContentAvailable() ? this.title : '[protected]'; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** @returns {Branch[]} */ |     /** @returns {Branch[]} */ | ||||||
|     getParentBranches() { |     getParentBranches() { | ||||||
|         return this.parentBranches; |         return this.parentBranches; | ||||||
|   | |||||||
| @@ -98,7 +98,7 @@ function getLinkMap(req) { | |||||||
|  |  | ||||||
|         return [ |         return [ | ||||||
|             note.noteId, |             note.noteId, | ||||||
|             note.isContentAvailable() ? note.title : '[protected]', |             note.getTitleOrProtected(), | ||||||
|             note.type |             note.type | ||||||
|         ]; |         ]; | ||||||
|     }); |     }); | ||||||
| @@ -158,7 +158,7 @@ function getTreeMap(req) { | |||||||
|         .concat(...mapRootNote.getParentNotes()) |         .concat(...mapRootNote.getParentNotes()) | ||||||
|         .map(note => [ |         .map(note => [ | ||||||
|             note.noteId, |             note.noteId, | ||||||
|             note.isContentAvailable() ? note.title : '[protected]', |             note.getTitleOrProtected(), | ||||||
|             note.type |             note.type | ||||||
|         ]); |         ]); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -54,7 +54,7 @@ function getNotesAndBranchesAndAttributes(noteIds) { | |||||||
|  |  | ||||||
|         notes.push({ |         notes.push({ | ||||||
|             noteId: note.noteId, |             noteId: note.noteId, | ||||||
|             title: note.isDecrypted ? note.title : '[protected]', |             title: note.getTitleOrProtected(), | ||||||
|             isProtected: note.isProtected, |             isProtected: note.isProtected, | ||||||
|             type: note.type, |             type: note.type, | ||||||
|             mime: note.mime |             mime: note.mime | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| module.exports = { buildDate:"2022-01-06T23:09:17+01:00", buildRevision: "590eea11830531699643b381d06a6a59dd7704bb" }; | module.exports = { buildDate:"2022-01-09T22:32:13+01:00", buildRevision: "be59f248e8387c268471946da99979939c8d2c1d" }; | ||||||
|   | |||||||
| @@ -97,7 +97,8 @@ function exportToZip(taskContext, branch, format, res) { | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         const completeTitle = branch.prefix ? (branch.prefix + ' - ' + note.title) : note.title; |         const title = note.getTitleOrProtected(); | ||||||
|  |         const completeTitle = branch.prefix ? (branch.prefix + ' - ' + title) : title; | ||||||
|         let baseFileName = sanitize(completeTitle); |         let baseFileName = sanitize(completeTitle); | ||||||
|  |  | ||||||
|         if (baseFileName.length > 200) { // actual limit is 256 bytes(!) but let's be conservative |         if (baseFileName.length > 200) { // actual limit is 256 bytes(!) but let's be conservative | ||||||
| @@ -113,7 +114,7 @@ function exportToZip(taskContext, branch, format, res) { | |||||||
|                 isClone: true, |                 isClone: true, | ||||||
|                 noteId: note.noteId, |                 noteId: note.noteId, | ||||||
|                 notePath: notePath, |                 notePath: notePath, | ||||||
|                 title: note.title, |                 title: note.getTitleOrProtected(), | ||||||
|                 prefix: branch.prefix, |                 prefix: branch.prefix, | ||||||
|                 dataFileName: fileName, |                 dataFileName: fileName, | ||||||
|                 type: 'text', // export will have text description, |                 type: 'text', // export will have text description, | ||||||
| @@ -125,7 +126,7 @@ function exportToZip(taskContext, branch, format, res) { | |||||||
|             isClone: false, |             isClone: false, | ||||||
|             noteId: note.noteId, |             noteId: note.noteId, | ||||||
|             notePath: notePath, |             notePath: notePath, | ||||||
|             title: note.title, |             title: note.getTitleOrProtected(), | ||||||
|             notePosition: branch.notePosition, |             notePosition: branch.notePosition, | ||||||
|             prefix: branch.prefix, |             prefix: branch.prefix, | ||||||
|             isExpanded: branch.isExpanded, |             isExpanded: branch.isExpanded, | ||||||
| @@ -445,7 +446,7 @@ ${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.getTitleOrProtected() + ".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'); | ||||||
|   | |||||||
| @@ -102,8 +102,9 @@ function createNewNote(params) { | |||||||
|         throw new Error(`Parent note "${params.parentNoteId}" not found.`); |         throw new Error(`Parent note "${params.parentNoteId}" not found.`); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (!params.title || params.title.trim().length === 0) { |     if (params.title === null || params.title === undefined) { | ||||||
|         throw new Error(`Note title must not be empty`); |         // empty title is allowed since it's possible to create such in the UI | ||||||
|  |         throw new Error(`Note title must be set`); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return sql.transactional(() => { |     return sql.transactional(() => { | ||||||
|   | |||||||
| @@ -149,8 +149,8 @@ async function pullChanges(syncContext) { | |||||||
|  |  | ||||||
|         sql.transactional(() => { |         sql.transactional(() => { | ||||||
|             for (const {entityChange, entity} of entityChanges) { |             for (const {entityChange, entity} of entityChanges) { | ||||||
|                 const changeAppliedAlready = !entityChange.changeId |                 const changeAppliedAlready = entityChange.changeId | ||||||
|                     || !!sql.getValue("SELECT id FROM entity_changes WHERE changeId = ?", [entityChange.changeId]); |                     && !!sql.getValue("SELECT id FROM entity_changes WHERE changeId = ?", [entityChange.changeId]); | ||||||
|  |  | ||||||
|                 if (!changeAppliedAlready && !sourceIdService.isLocalSourceId(entityChange.sourceId)) { |                 if (!changeAppliedAlready && !sourceIdService.isLocalSourceId(entityChange.sourceId)) { | ||||||
|                     if (!atLeastOnePullApplied) { // send only for first |                     if (!atLeastOnePullApplied) { // send only for first | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ | |||||||
|     <div id="main"> |     <div id="main"> | ||||||
|         <% if (note.parents[0].noteId !== 'share' && note.parents.length !== 0) { %> |         <% if (note.parents[0].noteId !== 'share' && note.parents.length !== 0) { %> | ||||||
|             <nav id="parentLink"> |             <nav id="parentLink"> | ||||||
|                 parent: <a href="<%= note.parents[0].noteId %>" |                 parent: <a href="<%= note.parents[0].shareId %>" | ||||||
|                            class="type-<%= note.parents[0].type %>"><%= note.parents[0].title %></a> |                            class="type-<%= note.parents[0].type %>"><%= note.parents[0].title %></a> | ||||||
|             </nav> |             </nav> | ||||||
|         <% } %> |         <% } %> | ||||||
| @@ -40,10 +40,7 @@ | |||||||
|             <div id="noteClippedFrom">This note was originally clipped from <a href="<%= note.getLabelValue("pageUrl") %>"><%= note.getLabelValue("pageUrl") %></a></div> |             <div id="noteClippedFrom">This note was originally clipped from <a href="<%= note.getLabelValue("pageUrl") %>"><%= note.getLabelValue("pageUrl") %></a></div> | ||||||
|         <% } %> |         <% } %> | ||||||
|  |  | ||||||
|         <% if (note.type === 'book') { %> |         <% if (!isEmpty) { %> | ||||||
|         <% } else if (isEmpty) { %> |  | ||||||
|             <p>This note has no content.</p> |  | ||||||
|         <% } else { %> |  | ||||||
|             <div id="content" class="type-<%= note.type %><% if (note.type === 'text') { %> ck-content<% } %>"> |             <div id="content" class="type-<%= note.type %><% if (note.type === 'text') { %> ck-content<% } %>"> | ||||||
|                 <%- content %> |                 <%- content %> | ||||||
|             </div> |             </div> | ||||||
| @@ -52,20 +49,21 @@ | |||||||
|         <% if (note.hasChildren()) { %> |         <% if (note.hasChildren()) { %> | ||||||
|             <nav id="childLinks" class="<% if (isEmpty) { %>grid<% } else { %>list<% } %>"> |             <nav id="childLinks" class="<% if (isEmpty) { %>grid<% } else { %>list<% } %>"> | ||||||
|                 <% if (!isEmpty) { %> |                 <% if (!isEmpty) { %> | ||||||
|                     <div id="noteClippedFrom"> |                     <hr> | ||||||
|                     <span>Child notes: </span> |                     <span>Child notes: </span> | ||||||
|                     <ul> |  | ||||||
|                         <% for (const childNote of note.getChildNotes()) { %> |  | ||||||
|                             <li> |  | ||||||
|                                 <a href="<%= childNote.shareId %>" |  | ||||||
|                                    class="type-<%= childNote.type %>"><%= childNote.title %></a> |  | ||||||
|                             </li> |  | ||||||
|                         <% } %> |  | ||||||
|                     </ul> |  | ||||||
|                 </div> |  | ||||||
|                 <% } %> |                 <% } %> | ||||||
|  |  | ||||||
|  |                 <ul> | ||||||
|  |                     <% for (const childNote of note.getChildNotes()) { %> | ||||||
|  |                         <li> | ||||||
|  |                             <a href="<%= childNote.shareId %>" | ||||||
|  |                                class="type-<%= childNote.type %>"><%= childNote.title %></a> | ||||||
|  |                         </li> | ||||||
|  |                     <% } %> | ||||||
|  |                 </ul> | ||||||
|             </nav> |             </nav> | ||||||
|  |         <% } else if (isEmpty) { %> | ||||||
|  |             <p>This note has no content.</p> | ||||||
|         <% } %> |         <% } %> | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user