From ea1da1e1550d0e75d9823d199bc06fe989726dd9 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 16 Jul 2024 22:29:00 +0300 Subject: [PATCH 1/4] server: Fix rendering of SVG attachments (closes #226) --- src/routes/api/image.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/routes/api/image.ts b/src/routes/api/image.ts index b00c7fd7f..0c6f29124 100644 --- a/src/routes/api/image.ts +++ b/src/routes/api/image.ts @@ -41,22 +41,21 @@ function returnImageInt(image: BNote | BRevision | null, res: Response) { } function renderSvgAttachment(image: BNote | BRevision, res: Response, attachmentName: string) { - let svgString = '' + let svg: string | Buffer = '' const attachment = image.getAttachmentByTitle(attachmentName); const content = attachment.getContent(); - if (attachment && typeof content === "string") { - svgString = content; + if (attachment) { + svg = content; } else { // backwards compatibility, before attachments, the SVG was stored in the main note content as a separate key const contentSvg = image.getJsonContentSafely()?.svg; if (contentSvg) { - svgString = contentSvg; + svg = contentSvg; } } - const svg = svgString res.set('Content-Type', "image/svg+xml"); res.set("Cache-Control", "no-cache, no-store, must-revalidate"); res.send(svg); From d48cdb1c8d850f880ed26da29a410a4f9973388e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 16 Jul 2024 22:43:15 +0300 Subject: [PATCH 2/4] client: Update Excalidraw to 0.17.6 --- package-lock.json | 60 +++++++++++++++++++++++------------------------ package.json | 6 ++--- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index f76d6a643..acdb916c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "dependencies": { "@braintree/sanitize-url": "6.0.4", "@electron/remote": "2.1.2", - "@excalidraw/excalidraw": "0.17.3", + "@excalidraw/excalidraw": "^0.17.6", "archiver": "7.0.0", "async-mutex": "0.4.1", "axios": "1.6.7", @@ -62,8 +62,8 @@ "panzoom": "9.4.3", "print-this": "2.0.0", "rand-token": "1.0.1", - "react": "18.2.0", - "react-dom": "18.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", "request": "2.88.2", "rimraf": "5.0.5", "safe-compare": "1.1.4", @@ -459,9 +459,9 @@ } }, "node_modules/@excalidraw/excalidraw": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@excalidraw/excalidraw/-/excalidraw-0.17.3.tgz", - "integrity": "sha512-t+0sR30AboKcINt0WUJmSAC1cJy6npO37j/zONvuWvSh6XDOGoL1E0L+WYKJMBzp4wnOQhRIghQJmdfktQlO8w==", + "version": "0.17.6", + "resolved": "https://registry.npmjs.org/@excalidraw/excalidraw/-/excalidraw-0.17.6.tgz", + "integrity": "sha512-fyCl+zG/Z5yhHDh5Fq2ZGmphcrALmuOdtITm8gN4d8w4ntnaopTXcTfnAAaU3VleDC6LhTkoLOTG6P5kgREiIg==", "peerDependencies": { "react": "^17.0.2 || ^18.2.0", "react-dom": "^17.0.2 || ^18.2.0" @@ -10695,9 +10695,9 @@ } }, "node_modules/react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "dependencies": { "loose-envify": "^1.1.0" }, @@ -10706,15 +10706,15 @@ } }, "node_modules/react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "dependencies": { "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" + "scheduler": "^0.23.2" }, "peerDependencies": { - "react": "^18.2.0" + "react": "^18.3.1" } }, "node_modules/react-interactive": { @@ -11340,9 +11340,9 @@ } }, "node_modules/scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", "dependencies": { "loose-envify": "^1.1.0" } @@ -13695,9 +13695,9 @@ } }, "@excalidraw/excalidraw": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@excalidraw/excalidraw/-/excalidraw-0.17.3.tgz", - "integrity": "sha512-t+0sR30AboKcINt0WUJmSAC1cJy6npO37j/zONvuWvSh6XDOGoL1E0L+WYKJMBzp4wnOQhRIghQJmdfktQlO8w==", + "version": "0.17.6", + "resolved": "https://registry.npmjs.org/@excalidraw/excalidraw/-/excalidraw-0.17.6.tgz", + "integrity": "sha512-fyCl+zG/Z5yhHDh5Fq2ZGmphcrALmuOdtITm8gN4d8w4ntnaopTXcTfnAAaU3VleDC6LhTkoLOTG6P5kgREiIg==", "requires": {} }, "@gar/promisify": { @@ -21525,20 +21525,20 @@ } }, "react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "requires": { "loose-envify": "^1.1.0" } }, "react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "requires": { "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" + "scheduler": "^0.23.2" } }, "react-interactive": { @@ -22037,9 +22037,9 @@ } }, "scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", "requires": { "loose-envify": "^1.1.0" } diff --git a/package.json b/package.json index 457b5f06b..9f3fde637 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "dependencies": { "@braintree/sanitize-url": "6.0.4", "@electron/remote": "2.1.2", - "@excalidraw/excalidraw": "0.17.3", + "@excalidraw/excalidraw": "^0.17.6", "archiver": "7.0.0", "async-mutex": "0.4.1", "axios": "1.6.7", @@ -86,8 +86,8 @@ "panzoom": "9.4.3", "print-this": "2.0.0", "rand-token": "1.0.1", - "react": "18.2.0", - "react-dom": "18.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", "request": "2.88.2", "rimraf": "5.0.5", "safe-compare": "1.1.4", From 7ad977de63d8eb2bba6b72350d913345fba6446e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 16 Jul 2024 22:49:23 +0300 Subject: [PATCH 3/4] client: Update Mermaid to 10.9.1 --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index acdb916c8..f7b60ee5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,7 +53,7 @@ "jsdom": "24.0.0", "katex": "0.16.9", "marked": "12.0.0", - "mermaid": "10.9.0", + "mermaid": "^10.9.1", "mime-types": "2.1.35", "multer": "1.4.5-lts.1", "node-abi": "3.56.0", @@ -8846,9 +8846,9 @@ "dev": true }, "node_modules/mermaid": { - "version": "10.9.0", - "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-10.9.0.tgz", - "integrity": "sha512-swZju0hFox/B/qoLKK0rOxxgh8Cf7rJSfAUc1u8fezVihYMvrJAS45GzAxTVf4Q+xn9uMgitBcmWk7nWGXOs/g==", + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-10.9.1.tgz", + "integrity": "sha512-Mx45Obds5W1UkW1nv/7dHRsbfMM1aOKA2+Pxs/IGHNonygDHwmng8xTHyS9z4KWVi0rbko8gjiBmuwwXQ7tiNA==", "dependencies": { "@braintree/sanitize-url": "^6.0.1", "@types/d3-scale": "^4.0.3", @@ -20220,9 +20220,9 @@ "dev": true }, "mermaid": { - "version": "10.9.0", - "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-10.9.0.tgz", - "integrity": "sha512-swZju0hFox/B/qoLKK0rOxxgh8Cf7rJSfAUc1u8fezVihYMvrJAS45GzAxTVf4Q+xn9uMgitBcmWk7nWGXOs/g==", + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-10.9.1.tgz", + "integrity": "sha512-Mx45Obds5W1UkW1nv/7dHRsbfMM1aOKA2+Pxs/IGHNonygDHwmng8xTHyS9z4KWVi0rbko8gjiBmuwwXQ7tiNA==", "requires": { "@braintree/sanitize-url": "^6.0.1", "@types/d3-scale": "^4.0.3", diff --git a/package.json b/package.json index 9f3fde637..039e00698 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "jsdom": "24.0.0", "katex": "0.16.9", "marked": "12.0.0", - "mermaid": "10.9.0", + "mermaid": "^10.9.1", "mime-types": "2.1.35", "multer": "1.4.5-lts.1", "node-abi": "3.56.0", From 1eefa654181adc531fdc05b24786fe7f67a2c3f6 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 16 Jul 2024 22:51:44 +0300 Subject: [PATCH 4/4] client: Update KaTeX to 10.9.1 --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index f7b60ee5a..222169254 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,7 +51,7 @@ "jquery": "3.7.1", "jquery-hotkeys": "0.2.2", "jsdom": "24.0.0", - "katex": "0.16.9", + "katex": "^0.16.11", "marked": "12.0.0", "mermaid": "^10.9.1", "mime-types": "2.1.35", @@ -8316,9 +8316,9 @@ } }, "node_modules/katex": { - "version": "0.16.9", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.9.tgz", - "integrity": "sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ==", + "version": "0.16.11", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.11.tgz", + "integrity": "sha512-RQrI8rlHY92OLf3rho/Ts8i/XvjgguEjOkO1BEXcU3N8BqPpSzBNwV/G0Ukr+P/l3ivvJUE/Fa/CwbS6HesGNQ==", "funding": [ "https://opencollective.com/katex", "https://github.com/sponsors/katex" @@ -19791,9 +19791,9 @@ } }, "katex": { - "version": "0.16.9", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.9.tgz", - "integrity": "sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ==", + "version": "0.16.11", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.11.tgz", + "integrity": "sha512-RQrI8rlHY92OLf3rho/Ts8i/XvjgguEjOkO1BEXcU3N8BqPpSzBNwV/G0Ukr+P/l3ivvJUE/Fa/CwbS6HesGNQ==", "requires": { "commander": "^8.3.0" }, diff --git a/package.json b/package.json index 039e00698..f2a0fe82f 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "jquery": "3.7.1", "jquery-hotkeys": "0.2.2", "jsdom": "24.0.0", - "katex": "0.16.9", + "katex": "^0.16.11", "marked": "12.0.0", "mermaid": "^10.9.1", "mime-types": "2.1.35",