Merge remote-tracking branch 'origin/master' into next54

This commit is contained in:
zadam 2022-07-03 22:38:45 +02:00
commit 19c65e240e
16 changed files with 522 additions and 172 deletions

View File

@ -48,7 +48,7 @@ function decrypt(key, cipherText, ivLength = 13) {
}
catch (e) {
// recovery from https://github.com/zadam/trilium/issues/510
if (e.message && e.message.includes("WRONG_FINAL_BLOCK_LENGTH")) {
if (e.message?.includes("WRONG_FINAL_BLOCK_LENGTH") || e.message?.includes("wrong final block length")) {
log.info("Caught WRONG_FINAL_BLOCK_LENGTH, returning cipherText instead");
return cipherText;

569
package-lock.json generated
View File

@ -75,7 +75,7 @@
"devDependencies": {
"cross-env": "7.0.3",
"electron": "16.2.8",
"electron-builder": "23.0.3",
"electron-builder": "23.1.0",
"electron-packager": "15.5.1",
"electron-rebuild": "3.2.7",
"esm": "3.2.25",
@ -192,9 +192,9 @@
}
},
"node_modules/@electron/universal": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.2.0.tgz",
"integrity": "sha512-eu20BwNsrMPKoe2bZ3/l9c78LclDvxg3PlVXrQf3L50NaUuW5M59gbPytI+V4z7/QMrohUHetQaU0ou+p1UG9Q==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.2.1.tgz",
"integrity": "sha512-7323HyMh7KBAl/nPDppdLsC87G6RwRU02dy5FPeGB1eS7rUePh55+WNWiDPLhFQqqVPHzh77M69uhmoT8XnwMQ==",
"dev": true,
"dependencies": {
"@malept/cross-spawn-promise": "^1.1.0",
@ -950,6 +950,17 @@
"integrity": "sha512-KPYGmfD0/b1eXurQ59fXD1GBzhSQfz6/lKBxkaHX9dKTzjXbK68Zt7yGUxUsCS1jeTy/8aL+d9JEr+S54mpkWQ==",
"devOptional": true
},
"node_modules/@types/plist": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.2.tgz",
"integrity": "sha512-ULqvZNGMv0zRFvqn8/4LSPtnmN4MfhlPNtJCTpKuIIxGVGZ2rYWzFXrvEBoh9CVyqSE7D6YFRJ1hydLHI6kbWw==",
"dev": true,
"optional": true,
"dependencies": {
"@types/node": "*",
"xmlbuilder": ">=11.0.1"
}
},
"node_modules/@types/responselike": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz",
@ -959,6 +970,13 @@
"@types/node": "*"
}
},
"node_modules/@types/verror": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.5.tgz",
"integrity": "sha512-9UjMCHK5GPgQRoNbqdLIAvAy0EInuiqbW0PBMtVP6B5B2HQJlvoJHM+KodPZMEjOa5VkSc+5LH7xy+cUzQdmHw==",
"dev": true,
"optional": true
},
"node_modules/@types/yargs": {
"version": "17.0.7",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.7.tgz",
@ -1416,35 +1434,36 @@
"dev": true
},
"node_modules/app-builder-lib": {
"version": "23.0.3",
"resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-23.0.3.tgz",
"integrity": "sha512-1qrtXYHXJfXhzJnMtVGjIva3067F1qYQubl2oBjI61gCBoCHvhghdYJ57XxXTQQ0VxnUhg1/Iaez87uXp8mD8w==",
"version": "23.1.0",
"resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-23.1.0.tgz",
"integrity": "sha512-aZpKjBBLzyxtr4Cmbyi3dl8uRO8SI2PG2MYEKYRZL6pl7IsKP2hJkCYzlD6NjLJlRIAZcFPFjFbJliO74DFf7w==",
"dev": true,
"dependencies": {
"@develar/schema-utils": "~2.6.5",
"@electron/universal": "1.2.0",
"@electron/universal": "1.2.1",
"@malept/flatpak-bundler": "^0.4.0",
"7zip-bin": "~5.1.1",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.9",
"builder-util": "23.0.2",
"builder-util-runtime": "9.0.0",
"builder-util": "23.0.9",
"builder-util-runtime": "9.0.2",
"chromium-pickle-js": "^0.2.0",
"debug": "^4.3.2",
"ejs": "^3.1.6",
"debug": "^4.3.4",
"ejs": "^3.1.7",
"electron-osx-sign": "^0.6.0",
"electron-publish": "23.0.2",
"electron-publish": "23.0.9",
"form-data": "^4.0.0",
"fs-extra": "^10.0.0",
"hosted-git-info": "^4.0.2",
"fs-extra": "^10.1.0",
"hosted-git-info": "^4.1.0",
"is-ci": "^3.0.0",
"isbinaryfile": "^4.0.8",
"isbinaryfile": "^4.0.10",
"js-yaml": "^4.1.0",
"lazy-val": "^1.0.5",
"minimatch": "^3.0.4",
"minimatch": "^3.1.2",
"read-config-file": "6.2.0",
"sanitize-filename": "^1.6.3",
"semver": "^7.3.5",
"semver": "^7.3.7",
"tar": "^6.1.11",
"temp-file": "^3.4.0"
},
"engines": {
@ -1519,6 +1538,18 @@
"node": ">=10"
}
},
"node_modules/app-builder-lib/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/append-field": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",
@ -1671,6 +1702,16 @@
"node": ">=0.8"
}
},
"node_modules/astral-regex": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
"integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
"dev": true,
"optional": true,
"engines": {
"node": ">=8"
}
},
"node_modules/async": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
@ -2124,9 +2165,9 @@
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
},
"node_modules/builder-util": {
"version": "23.0.2",
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-23.0.2.tgz",
"integrity": "sha512-HaNHL3axNW/Ms8O1mDx3I07G+ZnZ/TKSWWvorOAPau128cdt9S+lNx5ocbx8deSaHHX4WFXSZVHh3mxlaKJNgg==",
"version": "23.0.9",
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-23.0.9.tgz",
"integrity": "sha512-ccPFwI1Sex4yLt8R3LI+H07p2jHICKwEWtxkFkb6jiU/g/VJnF1wazW7I1oMcCFcPTEl30GhqoRv9rfDD9VAiQ==",
"dev": true,
"dependencies": {
"@types/debug": "^4.1.6",
@ -2134,10 +2175,10 @@
"7zip-bin": "~5.1.1",
"app-builder-bin": "4.0.0",
"bluebird-lst": "^1.0.9",
"builder-util-runtime": "9.0.0",
"builder-util-runtime": "9.0.2",
"chalk": "^4.1.1",
"cross-spawn": "^7.0.3",
"debug": "^4.3.2",
"debug": "^4.3.4",
"fs-extra": "^10.0.0",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
@ -2149,12 +2190,12 @@
}
},
"node_modules/builder-util-runtime": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.0.0.tgz",
"integrity": "sha512-SkpEtSmTkREDHRJnxKEv43aAYp8sYWY8fxYBhGLBLOBIRXeaIp6Kv3lBgSD7uR8jQtC7CA659sqJrpSV6zNvSA==",
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz",
"integrity": "sha512-xF55W/8mgfT6+sMbX0TeiJkTusA5GMOzckM4rajN4KirFcUIuLTH8oEaTYmM86YwVCZaTwa/7GyFhauXaEICwA==",
"dev": true,
"dependencies": {
"debug": "^4.3.2",
"debug": "^4.3.4",
"sax": "^1.2.4"
},
"engines": {
@ -2426,9 +2467,9 @@
"devOptional": true
},
"node_modules/ci-info": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz",
"integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==",
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.2.tgz",
"integrity": "sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==",
"dev": true
},
"node_modules/clean-stack": {
@ -2476,6 +2517,71 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cli-truncate": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz",
"integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==",
"dev": true,
"optional": true,
"dependencies": {
"slice-ansi": "^3.0.0",
"string-width": "^4.2.0"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cli-truncate/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"optional": true,
"engines": {
"node": ">=8"
}
},
"node_modules/cli-truncate/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"optional": true,
"engines": {
"node": ">=8"
}
},
"node_modules/cli-truncate/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"optional": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/cli-truncate/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"optional": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
@ -2863,6 +2969,16 @@
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"node_modules/crc": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz",
"integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==",
"dev": true,
"optional": true,
"dependencies": {
"buffer": "^5.1.0"
}
},
"node_modules/crc-32": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz",
@ -3285,20 +3401,20 @@
}
},
"node_modules/dmg-builder": {
"version": "23.0.3",
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-23.0.3.tgz",
"integrity": "sha512-mBYrHHnSM5PC656TDE+xTGmXIuWHAGmmRfyM+dV0kP+AxtwPof4pAXNQ8COd0/exZQ4dqf72FiPS3B9G9aB5IA==",
"version": "23.1.0",
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-23.1.0.tgz",
"integrity": "sha512-CzhPk/k12nJ2KqTbePkIwHOLiaWneQu2cgXCT9Hb5FhwI1vxTPalLsg8OZ57wKCrkL8AEftqqSff8gB5yWY/xw==",
"dev": true,
"dependencies": {
"app-builder-lib": "23.0.3",
"builder-util": "23.0.2",
"builder-util-runtime": "9.0.0",
"app-builder-lib": "23.1.0",
"builder-util": "23.0.9",
"builder-util-runtime": "9.0.2",
"fs-extra": "^10.0.0",
"iconv-lite": "^0.6.2",
"js-yaml": "^4.1.0"
},
"optionalDependencies": {
"dmg-license": "^1.0.9"
"dmg-license": "^1.0.11"
}
},
"node_modules/dmg-builder/node_modules/iconv-lite": {
@ -3313,6 +3429,33 @@
"node": ">=0.10.0"
}
},
"node_modules/dmg-license": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.11.tgz",
"integrity": "sha512-ZdzmqwKmECOWJpqefloC5OJy1+WZBBse5+MR88z9g9Zn4VY+WYUkAyojmhzJckH5YbbZGcYIuGAkY5/Ys5OM2Q==",
"deprecated": "Disk image license agreements are deprecated by Apple and will probably be removed in a future macOS release. Discussion at: https://github.com/argv-minus-one/dmg-license/issues/11",
"dev": true,
"optional": true,
"os": [
"darwin"
],
"dependencies": {
"@types/plist": "^3.0.1",
"@types/verror": "^1.10.3",
"ajv": "^6.10.0",
"crc": "^3.8.0",
"iconv-corefoundation": "^1.1.7",
"plist": "^3.0.4",
"smart-buffer": "^4.0.2",
"verror": "^1.10.0"
},
"bin": {
"dmg-license": "bin/dmg-license.js"
},
"engines": {
"node": ">=8"
}
},
"node_modules/dom-serializer": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz",
@ -3462,17 +3605,17 @@
}
},
"node_modules/electron-builder": {
"version": "23.0.3",
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-23.0.3.tgz",
"integrity": "sha512-0lnTsljAgcOMuIiOjPcoFf+WxOOe/O04hZPgIvvUBXIbz3kolbNu0Xdch1f5WuQ40NdeZI7oqs8Eo395PcuGHQ==",
"version": "23.1.0",
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-23.1.0.tgz",
"integrity": "sha512-UEblaQY8N9m8/HriOwl7jgFJ4olpWDXwdDBqwUkQiRHVNRnCfrA0u8LV03li5ZYhma6zFWzfIZbHd+uk8y//lQ==",
"dev": true,
"dependencies": {
"@types/yargs": "^17.0.1",
"app-builder-lib": "23.0.3",
"builder-util": "23.0.2",
"builder-util-runtime": "9.0.0",
"app-builder-lib": "23.1.0",
"builder-util": "23.0.9",
"builder-util-runtime": "9.0.2",
"chalk": "^4.1.1",
"dmg-builder": "23.0.3",
"dmg-builder": "23.1.0",
"fs-extra": "^10.0.0",
"is-ci": "^3.0.0",
"lazy-val": "^1.0.5",
@ -3879,24 +4022,6 @@
"url": "https://github.com/electron/electron-packager?sponsor=1"
}
},
"node_modules/electron-packager/node_modules/@electron/universal": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.2.1.tgz",
"integrity": "sha512-7323HyMh7KBAl/nPDppdLsC87G6RwRU02dy5FPeGB1eS7rUePh55+WNWiDPLhFQqqVPHzh77M69uhmoT8XnwMQ==",
"dev": true,
"dependencies": {
"@malept/cross-spawn-promise": "^1.1.0",
"asar": "^3.1.0",
"debug": "^4.3.1",
"dir-compare": "^2.4.0",
"fs-extra": "^9.0.1",
"minimatch": "^3.0.4",
"plist": "^3.0.4"
},
"engines": {
"node": ">=8.6"
}
},
"node_modules/electron-packager/node_modules/cross-spawn-windows-exe": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/cross-spawn-windows-exe/-/cross-spawn-windows-exe-1.2.0.tgz",
@ -3993,14 +4118,14 @@
}
},
"node_modules/electron-publish": {
"version": "23.0.2",
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-23.0.2.tgz",
"integrity": "sha512-8gMYgWqv96lc83FCm85wd+tEyxNTJQK7WKyPkNkO8GxModZqt1GO8S+/vAnFGxilS/7vsrVRXFfqiCDUCSuxEg==",
"version": "23.0.9",
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-23.0.9.tgz",
"integrity": "sha512-afr2z6L07/elgDX+6I/G/0vzXOP6xYUd/aXx9tnTPSVZ/3AuvCegHrKiuh8sKYHmzoAcNGXe3ikISYIu961IfA==",
"dev": true,
"dependencies": {
"@types/fs-extra": "^9.0.11",
"builder-util": "23.0.2",
"builder-util-runtime": "9.0.0",
"builder-util": "23.0.9",
"builder-util-runtime": "9.0.2",
"chalk": "^4.1.1",
"fs-extra": "^10.0.0",
"lazy-val": "^1.0.5",
@ -5824,6 +5949,23 @@
"ms": "^2.0.0"
}
},
"node_modules/iconv-corefoundation": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz",
"integrity": "sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==",
"dev": true,
"optional": true,
"os": [
"darwin"
],
"dependencies": {
"cli-truncate": "^2.1.0",
"node-addon-api": "^1.6.3"
},
"engines": {
"node": "^8.11.2 || >=10"
}
},
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@ -7318,6 +7460,13 @@
"node": ">=10"
}
},
"node_modules/node-addon-api": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
"dev": true,
"optional": true
},
"node_modules/node-api-version": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz",
@ -9154,6 +9303,31 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/slice-ansi": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz",
"integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==",
"dev": true,
"optional": true,
"dependencies": {
"ansi-styles": "^4.0.0",
"astral-regex": "^2.0.0",
"is-fullwidth-code-point": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/slice-ansi/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"optional": true,
"engines": {
"node": ">=8"
}
},
"node_modules/smart-buffer": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz",
@ -10806,9 +10980,9 @@
"requires": {}
},
"@electron/universal": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.2.0.tgz",
"integrity": "sha512-eu20BwNsrMPKoe2bZ3/l9c78LclDvxg3PlVXrQf3L50NaUuW5M59gbPytI+V4z7/QMrohUHetQaU0ou+p1UG9Q==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.2.1.tgz",
"integrity": "sha512-7323HyMh7KBAl/nPDppdLsC87G6RwRU02dy5FPeGB1eS7rUePh55+WNWiDPLhFQqqVPHzh77M69uhmoT8XnwMQ==",
"dev": true,
"requires": {
"@malept/cross-spawn-promise": "^1.1.0",
@ -11416,6 +11590,17 @@
"integrity": "sha512-KPYGmfD0/b1eXurQ59fXD1GBzhSQfz6/lKBxkaHX9dKTzjXbK68Zt7yGUxUsCS1jeTy/8aL+d9JEr+S54mpkWQ==",
"devOptional": true
},
"@types/plist": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.2.tgz",
"integrity": "sha512-ULqvZNGMv0zRFvqn8/4LSPtnmN4MfhlPNtJCTpKuIIxGVGZ2rYWzFXrvEBoh9CVyqSE7D6YFRJ1hydLHI6kbWw==",
"dev": true,
"optional": true,
"requires": {
"@types/node": "*",
"xmlbuilder": ">=11.0.1"
}
},
"@types/responselike": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz",
@ -11425,6 +11610,13 @@
"@types/node": "*"
}
},
"@types/verror": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.5.tgz",
"integrity": "sha512-9UjMCHK5GPgQRoNbqdLIAvAy0EInuiqbW0PBMtVP6B5B2HQJlvoJHM+KodPZMEjOa5VkSc+5LH7xy+cUzQdmHw==",
"dev": true,
"optional": true
},
"@types/yargs": {
"version": "17.0.7",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.7.tgz",
@ -11814,35 +12006,36 @@
"dev": true
},
"app-builder-lib": {
"version": "23.0.3",
"resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-23.0.3.tgz",
"integrity": "sha512-1qrtXYHXJfXhzJnMtVGjIva3067F1qYQubl2oBjI61gCBoCHvhghdYJ57XxXTQQ0VxnUhg1/Iaez87uXp8mD8w==",
"version": "23.1.0",
"resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-23.1.0.tgz",
"integrity": "sha512-aZpKjBBLzyxtr4Cmbyi3dl8uRO8SI2PG2MYEKYRZL6pl7IsKP2hJkCYzlD6NjLJlRIAZcFPFjFbJliO74DFf7w==",
"dev": true,
"requires": {
"@develar/schema-utils": "~2.6.5",
"@electron/universal": "1.2.0",
"@electron/universal": "1.2.1",
"@malept/flatpak-bundler": "^0.4.0",
"7zip-bin": "~5.1.1",
"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.9",
"builder-util": "23.0.2",
"builder-util-runtime": "9.0.0",
"builder-util": "23.0.9",
"builder-util-runtime": "9.0.2",
"chromium-pickle-js": "^0.2.0",
"debug": "^4.3.2",
"ejs": "^3.1.6",
"debug": "^4.3.4",
"ejs": "^3.1.7",
"electron-osx-sign": "^0.6.0",
"electron-publish": "23.0.2",
"electron-publish": "23.0.9",
"form-data": "^4.0.0",
"fs-extra": "^10.0.0",
"hosted-git-info": "^4.0.2",
"fs-extra": "^10.1.0",
"hosted-git-info": "^4.1.0",
"is-ci": "^3.0.0",
"isbinaryfile": "^4.0.8",
"isbinaryfile": "^4.0.10",
"js-yaml": "^4.1.0",
"lazy-val": "^1.0.5",
"minimatch": "^3.0.4",
"minimatch": "^3.1.2",
"read-config-file": "6.2.0",
"sanitize-filename": "^1.6.3",
"semver": "^7.3.5",
"semver": "^7.3.7",
"tar": "^6.1.11",
"temp-file": "^3.4.0"
},
"dependencies": {
@ -11899,6 +12092,15 @@
"requires": {
"lru-cache": "^6.0.0"
}
},
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
}
}
},
@ -12033,6 +12235,13 @@
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
},
"astral-regex": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
"integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
"dev": true,
"optional": true
},
"async": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
@ -12399,9 +12608,9 @@
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
},
"builder-util": {
"version": "23.0.2",
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-23.0.2.tgz",
"integrity": "sha512-HaNHL3axNW/Ms8O1mDx3I07G+ZnZ/TKSWWvorOAPau128cdt9S+lNx5ocbx8deSaHHX4WFXSZVHh3mxlaKJNgg==",
"version": "23.0.9",
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-23.0.9.tgz",
"integrity": "sha512-ccPFwI1Sex4yLt8R3LI+H07p2jHICKwEWtxkFkb6jiU/g/VJnF1wazW7I1oMcCFcPTEl30GhqoRv9rfDD9VAiQ==",
"dev": true,
"requires": {
"@types/debug": "^4.1.6",
@ -12409,10 +12618,10 @@
"7zip-bin": "~5.1.1",
"app-builder-bin": "4.0.0",
"bluebird-lst": "^1.0.9",
"builder-util-runtime": "9.0.0",
"builder-util-runtime": "9.0.2",
"chalk": "^4.1.1",
"cross-spawn": "^7.0.3",
"debug": "^4.3.2",
"debug": "^4.3.4",
"fs-extra": "^10.0.0",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
@ -12424,12 +12633,12 @@
}
},
"builder-util-runtime": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.0.0.tgz",
"integrity": "sha512-SkpEtSmTkREDHRJnxKEv43aAYp8sYWY8fxYBhGLBLOBIRXeaIp6Kv3lBgSD7uR8jQtC7CA659sqJrpSV6zNvSA==",
"version": "9.0.2",
"resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz",
"integrity": "sha512-xF55W/8mgfT6+sMbX0TeiJkTusA5GMOzckM4rajN4KirFcUIuLTH8oEaTYmM86YwVCZaTwa/7GyFhauXaEICwA==",
"dev": true,
"requires": {
"debug": "^4.3.2",
"debug": "^4.3.4",
"sax": "^1.2.4"
}
},
@ -12624,9 +12833,9 @@
"devOptional": true
},
"ci-info": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz",
"integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==",
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.2.tgz",
"integrity": "sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==",
"dev": true
},
"clean-stack": {
@ -12656,6 +12865,55 @@
"integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==",
"dev": true
},
"cli-truncate": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz",
"integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==",
"dev": true,
"optional": true,
"requires": {
"slice-ansi": "^3.0.0",
"string-width": "^4.2.0"
},
"dependencies": {
"ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"optional": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"optional": true
},
"string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"optional": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
}
},
"strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^5.0.1"
}
}
}
},
"cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
@ -12962,6 +13220,16 @@
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"crc": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz",
"integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==",
"dev": true,
"optional": true,
"requires": {
"buffer": "^5.1.0"
}
},
"crc-32": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz",
@ -13273,15 +13541,15 @@
}
},
"dmg-builder": {
"version": "23.0.3",
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-23.0.3.tgz",
"integrity": "sha512-mBYrHHnSM5PC656TDE+xTGmXIuWHAGmmRfyM+dV0kP+AxtwPof4pAXNQ8COd0/exZQ4dqf72FiPS3B9G9aB5IA==",
"version": "23.1.0",
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-23.1.0.tgz",
"integrity": "sha512-CzhPk/k12nJ2KqTbePkIwHOLiaWneQu2cgXCT9Hb5FhwI1vxTPalLsg8OZ57wKCrkL8AEftqqSff8gB5yWY/xw==",
"dev": true,
"requires": {
"app-builder-lib": "23.0.3",
"builder-util": "23.0.2",
"builder-util-runtime": "9.0.0",
"dmg-license": "^1.0.9",
"app-builder-lib": "23.1.0",
"builder-util": "23.0.9",
"builder-util-runtime": "9.0.2",
"dmg-license": "^1.0.11",
"fs-extra": "^10.0.0",
"iconv-lite": "^0.6.2",
"js-yaml": "^4.1.0"
@ -13298,6 +13566,23 @@
}
}
},
"dmg-license": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.11.tgz",
"integrity": "sha512-ZdzmqwKmECOWJpqefloC5OJy1+WZBBse5+MR88z9g9Zn4VY+WYUkAyojmhzJckH5YbbZGcYIuGAkY5/Ys5OM2Q==",
"dev": true,
"optional": true,
"requires": {
"@types/plist": "^3.0.1",
"@types/verror": "^1.10.3",
"ajv": "^6.10.0",
"crc": "^3.8.0",
"iconv-corefoundation": "^1.1.7",
"plist": "^3.0.4",
"smart-buffer": "^4.0.2",
"verror": "^1.10.0"
}
},
"dom-serializer": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz",
@ -13520,17 +13805,17 @@
}
},
"electron-builder": {
"version": "23.0.3",
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-23.0.3.tgz",
"integrity": "sha512-0lnTsljAgcOMuIiOjPcoFf+WxOOe/O04hZPgIvvUBXIbz3kolbNu0Xdch1f5WuQ40NdeZI7oqs8Eo395PcuGHQ==",
"version": "23.1.0",
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-23.1.0.tgz",
"integrity": "sha512-UEblaQY8N9m8/HriOwl7jgFJ4olpWDXwdDBqwUkQiRHVNRnCfrA0u8LV03li5ZYhma6zFWzfIZbHd+uk8y//lQ==",
"dev": true,
"requires": {
"@types/yargs": "^17.0.1",
"app-builder-lib": "23.0.3",
"builder-util": "23.0.2",
"builder-util-runtime": "9.0.0",
"app-builder-lib": "23.1.0",
"builder-util": "23.0.9",
"builder-util-runtime": "9.0.2",
"chalk": "^4.1.1",
"dmg-builder": "23.0.3",
"dmg-builder": "23.1.0",
"fs-extra": "^10.0.0",
"is-ci": "^3.0.0",
"lazy-val": "^1.0.5",
@ -13847,21 +14132,6 @@
"yargs-parser": "^20.0.0"
},
"dependencies": {
"@electron/universal": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.2.1.tgz",
"integrity": "sha512-7323HyMh7KBAl/nPDppdLsC87G6RwRU02dy5FPeGB1eS7rUePh55+WNWiDPLhFQqqVPHzh77M69uhmoT8XnwMQ==",
"dev": true,
"requires": {
"@malept/cross-spawn-promise": "^1.1.0",
"asar": "^3.1.0",
"debug": "^4.3.1",
"dir-compare": "^2.4.0",
"fs-extra": "^9.0.1",
"minimatch": "^3.0.4",
"plist": "^3.0.4"
}
},
"cross-spawn-windows-exe": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/cross-spawn-windows-exe/-/cross-spawn-windows-exe-1.2.0.tgz",
@ -13925,14 +14195,14 @@
}
},
"electron-publish": {
"version": "23.0.2",
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-23.0.2.tgz",
"integrity": "sha512-8gMYgWqv96lc83FCm85wd+tEyxNTJQK7WKyPkNkO8GxModZqt1GO8S+/vAnFGxilS/7vsrVRXFfqiCDUCSuxEg==",
"version": "23.0.9",
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-23.0.9.tgz",
"integrity": "sha512-afr2z6L07/elgDX+6I/G/0vzXOP6xYUd/aXx9tnTPSVZ/3AuvCegHrKiuh8sKYHmzoAcNGXe3ikISYIu961IfA==",
"dev": true,
"requires": {
"@types/fs-extra": "^9.0.11",
"builder-util": "23.0.2",
"builder-util-runtime": "9.0.0",
"builder-util": "23.0.9",
"builder-util-runtime": "9.0.2",
"chalk": "^4.1.1",
"fs-extra": "^10.0.0",
"lazy-val": "^1.0.5",
@ -15217,6 +15487,17 @@
"ms": "^2.0.0"
}
},
"iconv-corefoundation": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz",
"integrity": "sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==",
"dev": true,
"optional": true,
"requires": {
"cli-truncate": "^2.1.0",
"node-addon-api": "^1.6.3"
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@ -16364,6 +16645,13 @@
"semver": "^7.3.5"
}
},
"node-addon-api": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
"dev": true,
"optional": true
},
"node-api-version": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz",
@ -17797,6 +18085,27 @@
}
}
},
"slice-ansi": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz",
"integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.0.0",
"astral-regex": "^2.0.0",
"is-fullwidth-code-point": "^3.0.0"
},
"dependencies": {
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"optional": true
}
}
},
"smart-buffer": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz",

View File

@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.53.0-beta",
"version": "0.53.1-beta",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {
@ -87,7 +87,7 @@
"devDependencies": {
"cross-env": "7.0.3",
"electron": "16.2.8",
"electron-builder": "23.0.3",
"electron-builder": "23.1.0",
"electron-packager": "15.5.1",
"electron-rebuild": "3.2.7",
"esm": "3.2.25",

View File

@ -1255,7 +1255,7 @@ class Note extends AbstractEntity {
? this.dateModified
: contentMetadata.dateModified,
dateCreated: dateUtils.localNowDateTime()
}).save();
}, true).save();
noteRevision.setContent(content);

View File

@ -19,7 +19,7 @@ class NoteRevision extends AbstractEntity {
static get primaryKeyName() { return "noteRevisionId"; }
static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; }
constructor(row) {
constructor(row, titleDecrypted = false) {
super();
/** @type {string} */
@ -47,13 +47,10 @@ class NoteRevision extends AbstractEntity {
/** @type {number} */
this.contentLength = row.contentLength;
if (this.isProtected) {
if (protectedSessionService.isProtectedSessionAvailable()) {
this.title = protectedSessionService.decryptString(this.title);
}
else {
this.title = "[protected]";
}
if (this.isProtected && !titleDecrypted) {
this.title = protectedSessionService.isProtectedSessionAvailable()
? protectedSessionService.decryptString(this.title)
: "[protected]";
}
}
@ -68,8 +65,8 @@ class NoteRevision extends AbstractEntity {
/*
* Note revision content has quite special handling - it's not a separate entity, but a lazily loaded
* part of NoteRevision entity with it's own sync. Reason behind this hybrid design is that
* content can be quite large and it's not necessary to load it / fill memory for any note access even
* part of NoteRevision entity with its own sync. Reason behind this hybrid design is that
* content can be quite large, and it's not necessary to load it / fill memory for any note access even
* if we don't need a content, especially for bulk operations like search.
*
* This is the same approach as is used for Note's content.

View File

@ -34,7 +34,7 @@ const TPL = `
<h5>Light anonymization</h5>
<p>This action will create a new copy of the database and do a light anonymization on it - specifically only content of all notes will be removed, but titles and attributes will remaing. Additionally, custom JS frontend/backend script notes and custom widgets will remain. This provides more context to debug the issues.</p>
<p>This action will create a new copy of the database and do a light anonymization on it - specifically only content of all notes will be removed, but titles and attributes will remain. Additionally, custom JS frontend/backend script notes and custom widgets will remain. This provides more context to debug the issues.</p>
<p>You can decide yourself if you want to provide fully or lightly anonymized database. Even fully anonymized DB is very useful, however in some cases lightly anonymized database can speed up the process of bug identification and fixing.</p>

View File

@ -15,7 +15,9 @@ function exportBranch(req, res) {
const message = `Cannot export branch ${branchId} since it does not exist.`;
log.error(message);
res.status(500).send(message);
res.setHeader("Content-Type", "text/plain")
.status(500)
.send(message);
return;
}
@ -41,7 +43,9 @@ function exportBranch(req, res) {
log.error(message + e.stack);
res.status(500).send(message);
res.setHeader("Content-Type", "text/plain")
.status(500)
.send(message);
}
}

View File

@ -45,7 +45,9 @@ function downloadNoteFile(noteId, res, contentDisposition = true) {
const note = becca.getNote(noteId);
if (!note) {
return res.status(404).send(`Note ${noteId} doesn't exist.`);
return res.setHeader("Content-Type", "text/plain")
.status(404)
.send(`Note ${noteId} doesn't exist.`);
}
if (note.isProtected && !protectedSessionService.isProtectedSessionAvailable()) {

View File

@ -33,7 +33,9 @@ function returnImage(req, res) {
res.set("Cache-Control", "no-cache, no-store, must-revalidate");
res.send(svg);
} catch(err) {
res.status(500).send("there was an error parsing excalidraw to svg");
res.setHeader("Content-Type", "text/plain")
.status(500)
.send("there was an error parsing excalidraw to svg");
}
} else {
res.set('Content-Type', image.mime);

View File

@ -65,11 +65,15 @@ function downloadNoteRevision(req, res) {
const noteRevision = becca.getNoteRevision(req.params.noteRevisionId);
if (noteRevision.noteId !== req.params.noteId) {
return res.status(400).send(`Note revision ${req.params.noteRevisionId} does not belong to note ${req.params.noteId}`);
return res.setHeader("Content-Type", "text/plain")
.status(400)
.send(`Note revision ${req.params.noteRevisionId} does not belong to note ${req.params.noteId}`);
}
if (noteRevision.isProtected && !protectedSessionService.isProtectedSessionAvailable()) {
return res.status(401).send("Protected session not available");
return res.setHeader("Content-Type", "text/plain")
.status(401)
.send("Protected session not available");
}
const filename = getRevisionFilename(noteRevision);

View File

@ -49,7 +49,9 @@ function handleRequest(req, res) {
catch (e) {
log.error(`Custom handler ${note.noteId} failed with ${e.message}`);
res.status(500).send(e.message);
res.setHeader("Content-Type", "text/plain")
.status(500)
.send(e.message);
}
}
else if (attr.name === 'customResourceProvider') {
@ -65,7 +67,9 @@ function handleRequest(req, res) {
const message = `No handler matched for custom ${path} request.`;
log.info(message);
res.status(404).send(message);
res.setHeader("Content-Type", "text/plain")
.status(404)
.send(message);
}
function register(router) {

View File

@ -121,6 +121,10 @@ function apiResultHandler(req, res, result) {
function send(res, statusCode, response) {
if (typeof response === 'string') {
if (statusCode >= 400) {
res.setHeader("Content-Type", "text/plain");
}
res.status(statusCode).send(response);
return response.length;
@ -168,7 +172,9 @@ function route(method, path, middleware, routeHandler, resultHandler, transactio
.catch(e => {
log.error(`${method} ${path} threw exception: ` + e.stack);
res.status(500).send(e.message);
res.setHeader("Content-Type", "text/plain")
.status(500)
.send(e.message);
});
}
else {
@ -181,7 +187,9 @@ function route(method, path, middleware, routeHandler, resultHandler, transactio
catch (e) {
log.error(`${method} ${path} threw exception: ` + e.stack);
res.status(500).send(e.message);
res.setHeader("Content-Type", "text/plain")
.status(500)
.send(e.message);
}
});
}

View File

@ -88,17 +88,23 @@ function checkEtapiToken(req, res, next) {
function reject(req, res, message) {
log.info(`${req.method} ${req.path} rejected with 401 ${message}`);
res.status(401).send(message);
res.setHeader("Content-Type", "text/plain")
.status(401)
.send(message);
}
function checkCredentials(req, res, next) {
if (!sqlInit.isDbInitialized()) {
res.status(400).send('Database is not initialized yet.');
res.setHeader("Content-Type", "text/plain")
.status(400)
.send('Database is not initialized yet.');
return;
}
if (!passwordService.isPasswordSet()) {
res.status(400).send('Password has not been set yet. Please set a password and repeat the action');
res.setHeader("Content-Type", "text/plain")
.status(400)
.send('Password has not been set yet. Please set a password and repeat the action');
return;
}
@ -109,7 +115,9 @@ function checkCredentials(req, res, next) {
// username is ignored
if (!passwordEncryptionService.verifyPassword(password)) {
res.status(401).send('Incorrect password');
res.setHeader("Content-Type", "text/plain")
.status(401)
.send('Incorrect password');
}
else {
next();

View File

@ -1 +1 @@
module.exports = { buildDate:"2022-06-19T14:49:48+02:00", buildRevision: "046db503d3e659ea06e5731a4ab67778fed71ef8" };
module.exports = { buildDate:"2022-07-01T22:50:19+02:00", buildRevision: "0d4275a2605caecafbf6f5b301c6d19632f400be" };

View File

@ -83,7 +83,7 @@ function decrypt(key, cipherText, ivLength = 13) {
}
catch (e) {
// recovery from https://github.com/zadam/trilium/issues/510
if (e.message && e.message.includes("WRONG_FINAL_BLOCK_LENGTH")) {
if (e.message?.includes("WRONG_FINAL_BLOCK_LENGTH") || e.message?.includes("wrong final block length")) {
log.info("Caught WRONG_FINAL_BLOCK_LENGTH, returning cipherText instead");
return cipherText;

View File

@ -39,9 +39,9 @@ function register(router) {
addNoIndexHeader(note, res);
if (note.hasLabel('shareRaw') || ['image', 'file'].includes(note.type)) {
res.setHeader('Content-Type', note.mime);
res.setHeader('Content-Type', note.mime)
.send(note.getContent());
res.send(note.getContent());
return;
}
@ -83,7 +83,9 @@ function register(router) {
const note = shaca.getNote(noteId);
if (!note) {
return res.status(404).send(`Note '${noteId}' not found`);
return res.setHeader("Content-Type", "text/plain")
.status(404)
.send(`Note '${noteId}' not found`);
}
addNoIndexHeader(note, res);
@ -98,7 +100,9 @@ function register(router) {
const note = shaca.getNote(noteId);
if (!note) {
return res.status(404).send(`Note '${noteId}' not found`);
return res.setHeader("Content-Type", "text/plain")
.status(404)
.send(`Note '${noteId}' not found`);
}
addNoIndexHeader(note, res);
@ -122,10 +126,14 @@ function register(router) {
const image = shaca.getNote(req.params.noteId);
if (!image) {
return res.status(404).send(`Note '${req.params.noteId}' not found`);
return res.setHeader('Content-Type', 'text/plain')
.status(404)
.send(`Note '${req.params.noteId}' not found`);
}
else if (!["image", "canvas"].includes(image.type)) {
return res.status(400).send("Requested note is not a shareable image");
return res.setHeader('Content-Type', 'text/plain')
.status(400)
.send("Requested note is not a shareable image");
} else if (image.type === "canvas") {
/**
* special "image" type. the canvas is actually type application/json
@ -141,7 +149,9 @@ function register(router) {
res.set("Cache-Control", "no-cache, no-store, must-revalidate");
res.send(svg);
} catch(err) {
res.status(500).send("there was an error parsing excalidraw to svg");
res.setHeader('Content-Type', 'text/plain')
.status(500)
.send("there was an error parsing excalidraw to svg");
}
} else {
// normal image
@ -159,7 +169,9 @@ function register(router) {
const note = shaca.getNote(noteId);
if (!note) {
return res.status(404).send(`Note '${noteId}' not found`);
return res.setHeader('Content-Type', 'text/plain')
.status(404)
.send(`Note '${noteId}' not found`);
}
addNoIndexHeader(note, res);