Merge remote-tracking branch 'origin/stable' into redesign

# Conflicts:
#	package-lock.json
#	package.json
This commit is contained in:
zadam 2021-05-26 21:27:06 +02:00
commit 205f9953f9
7 changed files with 26 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.47.2",
"version": "0.47.3",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {
@ -80,7 +80,7 @@
},
"devDependencies": {
"cross-env": "7.0.3",
"electron": "13.0.0-beta.28",
"electron": "13.0.1",
"electron-builder": "22.11.3",
"electron-packager": "15.2.0",
"electron-rebuild": "2.3.5",

View File

@ -7,7 +7,13 @@ const {LOG_DIR} = require('../../services/data_dir.js');
function getBackendLog() {
const file = `${LOG_DIR}/trilium-${dateUtils.localNowDate()}.log`;
return fs.readFileSync(file, 'utf8');
try {
return fs.readFileSync(file, 'utf8');
}
catch (e) {
// most probably the log file does not exist yet - https://github.com/zadam/trilium/issues/1977
return "";
}
}
module.exports = {

View File

@ -11,7 +11,7 @@ function sanitize(dirtyHtml) {
'figure', 'span', 'label', 'input'
],
allowedAttributes: {
'a': [ 'href', 'class' ],
'a': [ 'href', 'class', 'data-note-path' ],
'img': [ 'src' ],
'section': [ 'class', 'data-note-id' ],
'figure': [ 'class' ],

View File

@ -307,6 +307,14 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
return `href="#root/${targetNoteId}"`;
});
content = content.replace(/data-note-path="([^"]*)"/g, (match, notePath) => {
const noteId = notePath.split("/").pop();
const targetNoteId = noteIdMap[noteId];
return `data-note-path="root/${targetNoteId}"`;
});
if (noteMeta) {
const includeNoteLinks = (noteMeta.attributes || [])
.filter(attr => attr.type === 'relation' && attr.name === 'includeNoteLink');

View File

@ -41,13 +41,17 @@ function initLogFile() {
function checkDate(millisSinceMidnight) {
if (millisSinceMidnight >= DAY) {
initLogFile();
millisSinceMidnight =- DAY;
}
return millisSinceMidnight;
}
function log(str) {
const millisSinceMidnight = Date.now() - todaysMidnight.getTime();
let millisSinceMidnight = Date.now() - todaysMidnight.getTime();
checkDate(millisSinceMidnight);
millisSinceMidnight = checkDate(millisSinceMidnight);
logFile.write(formatTime(millisSinceMidnight) + ' ' + str + NEW_LINE);