mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 17:26:38 +01:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a15be82f00 | ||
|
|
6c3809e1db | ||
|
|
33a2cd21a3 | ||
|
|
3eebce22e7 | ||
|
|
adae0625b9 | ||
|
|
5063cfb979 | ||
|
|
0835930a8a |
BIN
db/demo.tar
BIN
db/demo.tar
Binary file not shown.
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "trilium",
|
||||
"version": "0.35.0-beta",
|
||||
"version": "0.35.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -3063,9 +3063,9 @@
|
||||
"integrity": "sha512-kS/gEPzZs3Y1rRsbGX4UOSjtP/CeJP0CxSNZHYxGfVM/VgLcv0ZqM7C45YyTj2DI2g7+P9Dd24C+IMIg6D0nYQ=="
|
||||
},
|
||||
"electron": {
|
||||
"version": "6.0.10",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-6.0.10.tgz",
|
||||
"integrity": "sha512-eTFm6uTn7NKZE1OtSZSOxNuOrCXXeUR0U3vdF3R00byB7mrNe5AOaXEDDMwtzRGGY1jMuUX9Z7RvgXaCXRYSmw==",
|
||||
"version": "6.0.12",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-6.0.12.tgz",
|
||||
"integrity": "sha512-70ODZa1RP6K0gE9IV9YLCXPSyhLjXksCuYSSPb3MljbfwfHo5uE6X0CGxzm+54YuPdE2e7EPnWZxOOsJYrS5iQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "^10.12.18",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.35.1",
|
||||
"version": "0.35.2",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
@@ -79,7 +79,7 @@
|
||||
"xml2js": "0.4.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "6.0.10",
|
||||
"electron": "6.0.12",
|
||||
"electron-builder": "21.2.0",
|
||||
"electron-compile": "6.4.4",
|
||||
"electron-installer-debian": "2.0.1",
|
||||
|
||||
@@ -122,7 +122,7 @@ class NoteDetailRelationMap {
|
||||
this.clipboard = null;
|
||||
|
||||
this.$createChildNote.click(async () => {
|
||||
const promptDialog = await import('"../dialogs/prompt.js"');
|
||||
const promptDialog = await import('../dialogs/prompt.js');
|
||||
const title = await promptDialog.ask({ message: "Enter title of new note", defaultValue: "new note" });
|
||||
|
||||
if (!title.trim()) {
|
||||
|
||||
@@ -8,21 +8,13 @@ import server from "../services/server.js";
|
||||
const TPL = `
|
||||
<div class="calendar-widget">
|
||||
<div class="calendar-header">
|
||||
<button class="calendar-btn" data-calendar-toggle="previous">
|
||||
<svg height="24" version="1.1" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<button class="calendar-btn jam jam-arrow-left" data-calendar-toggle="previous"></button>
|
||||
|
||||
<div class="calendar-header__label" data-calendar-label="month">
|
||||
March 2017
|
||||
</div>
|
||||
|
||||
<button class="calendar-btn" data-calendar-toggle="next">
|
||||
<svg height="24" version="1.1" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<button class="calendar-btn jam jam-arrow-right" data-calendar-toggle="next"></button>
|
||||
</div>
|
||||
|
||||
<div class="calendar-week">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
border: 0;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
font-size: x-large;
|
||||
line-height: normal;
|
||||
min-width: 27px;
|
||||
outline: none;
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
.calendar-widget .calendar-date {
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
background-color: var(--main-background-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 0 0 14.28%;
|
||||
|
||||
@@ -209,9 +209,11 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
* @returns {Promise<{note: Note, branch: Branch}>} object contains newly created entities note and branch
|
||||
*/
|
||||
this.createNoteAndRefresh = async function(parentNoteId, title, content, extraOptions) {
|
||||
await noteService.createNote(parentNoteId, title, content, extraOptions);
|
||||
const ret = await noteService.createNote(parentNoteId, title, content, extraOptions);
|
||||
|
||||
ws.refreshTree();
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1 +1 @@
|
||||
module.exports = { buildDate:"2019-09-30T22:18:23+02:00", buildRevision: "f6fc24d11d9c9a15086c0726dde30f6c382c578f" };
|
||||
module.exports = { buildDate:"2019-10-09T23:09:38+02:00", buildRevision: "6c3809e1db71ebca7bf0ca69f664c3c3f1af793a" };
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
|
||||
const Attribute = require('../../entities/attribute');
|
||||
const utils = require('../../services/utils');
|
||||
const log = require('../../services/log');
|
||||
@@ -114,28 +113,18 @@ async function importTar(importContext, fileBuffer, importRootNote) {
|
||||
}
|
||||
|
||||
function getNoteId(noteMeta, filePath) {
|
||||
let noteId;
|
||||
|
||||
const filePathNoExt = getTextFileWithoutExtension(filePath);
|
||||
|
||||
if (noteMeta) {
|
||||
console.log(`Searching for noteId of filePath ${filePath} with meta: ${!!noteMeta}`);
|
||||
|
||||
if (filePathNoExt in createdPaths) {
|
||||
noteId = createdPaths[filePathNoExt];
|
||||
noteIdMap[noteMeta.noteId] = noteId;
|
||||
}
|
||||
else {
|
||||
noteId = getNewNoteId(noteMeta.noteId);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (filePathNoExt in createdPaths) {
|
||||
noteId = createdPaths[filePathNoExt];
|
||||
}
|
||||
else {
|
||||
noteId = utils.newEntityId();
|
||||
}
|
||||
console.log("Found existing path", filePathNoExt, createdPaths[filePathNoExt]);
|
||||
|
||||
return createdPaths[filePathNoExt];
|
||||
}
|
||||
|
||||
const noteId = noteMeta ? getNewNoteId(noteMeta.noteId) : utils.newEntityId();
|
||||
|
||||
createdPaths[filePathNoExt] = noteId;
|
||||
|
||||
return noteId;
|
||||
@@ -161,6 +150,11 @@ async function importTar(importContext, fileBuffer, importRootNote) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (attr.type === 'relation' && ['internal-link', 'image-link', 'relation-map-link'].includes(attr.name)) {
|
||||
// these relations are created automatically and as such don't need to be duplicated in the import
|
||||
continue;
|
||||
}
|
||||
|
||||
if (attr.type === 'relation') {
|
||||
attr.value = getNewNoteId(attr.value);
|
||||
}
|
||||
@@ -234,7 +228,8 @@ async function importTar(importContext, fileBuffer, importRootNote) {
|
||||
|
||||
absUrl += (absUrl.length > 0 ? '/' : '') + url;
|
||||
|
||||
const targetNoteId = getNoteId(null, absUrl);
|
||||
const {noteMeta} = getMeta(absUrl);
|
||||
const targetNoteId = getNoteId(noteMeta, absUrl);
|
||||
return targetNoteId;
|
||||
}
|
||||
|
||||
@@ -340,6 +335,15 @@ async function importTar(importContext, fileBuffer, importRootNote) {
|
||||
|
||||
await saveAttributes(note, noteMeta);
|
||||
|
||||
if (!firstNote) {
|
||||
firstNote = note;
|
||||
}
|
||||
|
||||
if (type === 'text') {
|
||||
filePath = getTextFileWithoutExtension(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
if (!noteMeta && (type === 'file' || type === 'image')) {
|
||||
attributes.push({
|
||||
noteId,
|
||||
@@ -355,15 +359,6 @@ async function importTar(importContext, fileBuffer, importRootNote) {
|
||||
value: content.byteLength
|
||||
});
|
||||
}
|
||||
|
||||
if (!firstNote) {
|
||||
firstNote = note;
|
||||
}
|
||||
|
||||
if (type === 'text') {
|
||||
filePath = getTextFileWithoutExtension(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** @return {string} path without leading or trailing slash and backslashes converted to forward ones*/
|
||||
@@ -426,7 +421,9 @@ async function importTar(importContext, fileBuffer, importRootNote) {
|
||||
const noteId = createdPaths[path];
|
||||
|
||||
createdNoteIds[noteId] = true;
|
||||
}
|
||||
|
||||
for (const noteId in createdNoteIds) { // now the noteIds are unique
|
||||
await noteService.scanForLinks(noteId);
|
||||
|
||||
importContext.increaseProgressCount();
|
||||
|
||||
@@ -248,7 +248,7 @@ function findRelationMapLinks(content, foundLinks) {
|
||||
foundLinks.push({
|
||||
name: 'relation-map-link',
|
||||
value: note.noteId
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,12 +64,14 @@ async function fillSyncRows(entityName, entityKey, condition = '') {
|
||||
const entityIds = await sql.getColumn(`SELECT ${entityKey} FROM ${entityName}`
|
||||
+ (condition ? ` WHERE ${condition}` : ''));
|
||||
|
||||
let createdCount = 0;
|
||||
|
||||
for (const entityId of entityIds) {
|
||||
const existingRows = await sql.getValue("SELECT COUNT(id) FROM sync WHERE entityName = ? AND entityId = ?", [entityName, entityId]);
|
||||
|
||||
// we don't want to replace existing entities (which would effectively cause full resync)
|
||||
if (existingRows === 0) {
|
||||
log.info(`Creating missing sync record for ${entityName} ${entityId}`);
|
||||
createdCount++;
|
||||
|
||||
await sql.insert("sync", {
|
||||
entityName: entityName,
|
||||
@@ -79,6 +81,10 @@ async function fillSyncRows(entityName, entityKey, condition = '') {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (createdCount > 0) {
|
||||
log.info(`Created ${createdCount} missing sync records for ${entityName}.`);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// this is to fix migration from 0.30 to 0.32, can be removed later
|
||||
|
||||
Reference in New Issue
Block a user