Merge branch 'develop' into feature/MFA

This commit is contained in:
Jin 2025-03-28 22:04:23 +01:00
commit 797ed2a494
9 changed files with 428 additions and 49 deletions

View File

@ -10,7 +10,7 @@
"license": "ISC",
"dependencies": {
"better-sqlite3": "^11.1.2",
"mime-types": "^2.1.34",
"mime-types": "^3.0.0",
"sanitize-filename": "^1.6.3",
"tsx": "^4.19.3",
"yargs": "^17.3.1"
@ -762,19 +762,19 @@
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz",
"integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
"dependencies": {
"mime-db": "1.52.0"
"mime-db": "^1.54.0"
},
"engines": {
"node": ">= 0.6"
@ -1594,16 +1594,16 @@
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
},
"mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="
},
"mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz",
"integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
"requires": {
"mime-db": "1.52.0"
"mime-db": "^1.54.0"
}
},
"mimic-response": {

View File

@ -18,7 +18,7 @@
"homepage": "https://github.com/TriliumNext/Notes/blob/master/dump-db/README.md",
"dependencies": {
"better-sqlite3": "^11.1.2",
"mime-types": "^2.1.34",
"mime-types": "^3.0.0",
"sanitize-filename": "^1.6.3",
"tsx": "^4.19.3",
"yargs": "^17.3.1"

394
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -70,7 +70,6 @@
"dependencies": {
"@braintree/sanitize-url": "7.1.1",
"@electron/remote": "2.1.2",
"@excalidraw/excalidraw": "0.18.0",
"@highlightjs/cdn-assets": "11.11.1",
"@mermaid-js/layout-elk": "0.1.7",
"@triliumnext/express-partial-content": "1.0.1",
@ -129,14 +128,12 @@
"mark.js": "8.11.1",
"marked": "15.0.7",
"mermaid": "11.6.0",
"mime-types": "2.1.35",
"mime-types": "3.0.1",
"multer": "1.4.5-lts.2",
"normalize-strings": "1.1.1",
"normalize.css": "8.0.1",
"panzoom": "9.4.3",
"rand-token": "1.0.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"safe-compare": "1.1.4",
"sanitize-filename": "1.6.3",
"sanitize-html": "2.15.0",
@ -168,6 +165,7 @@
"@electron-forge/plugin-auto-unpack-natives": "7.8.0",
"@electron/rebuild": "3.7.1",
"@eslint/js": "9.23.0",
"@excalidraw/excalidraw": "0.18.0",
"@fullcalendar/core": "6.1.15",
"@fullcalendar/daygrid": "6.1.15",
"@fullcalendar/interaction": "6.1.15",
@ -200,7 +198,7 @@
"@types/leaflet-gpx": "1.3.7",
"@types/mime-types": "2.1.4",
"@types/multer": "1.4.12",
"@types/node": "22.13.13",
"@types/node": "22.13.14",
"@types/react": "18.3.20",
"@types/react-dom": "18.3.5",
"@types/safe-compare": "1.1.2",
@ -220,10 +218,11 @@
"@vitest/coverage-v8": "3.0.9",
"autoprefixer": "10.4.21",
"bootstrap": "5.3.3",
"copy-webpack-plugin": "13.0.0",
"cross-env": "7.0.3",
"css-loader": "7.1.2",
"dprint": "0.49.1",
"electron": "35.0.3",
"electron": "35.1.2",
"eslint": "9.23.0",
"esm": "3.2.25",
"globals": "16.0.0",
@ -237,6 +236,8 @@
"nodemon": "3.1.9",
"postcss-loader": "8.1.1",
"rcedit": "4.0.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"rimraf": "6.0.1",
"sass": "1.86.0",
"sass-loader": "16.0.5",

View File

@ -6,4 +6,14 @@ describe("Link", () => {
const output = parseNavigationStateFromUrl("http://localhost:8080/#?searchString=hello");
expect(output).toMatchObject({ searchString: "hello" });
});
it("parses searchString with hash", () => {
const output = parseNavigationStateFromUrl("https://github.com/orgs/TriliumNext/discussions/1526#discussioncomment-12656660");
expect(output).toStrictEqual({});
});
it("parses notePath", () => {
const output = parseNavigationStateFromUrl(`#root/WWaBNf3SSA1b/mQ2tIzLVFKHL`);
expect(output).toMatchObject({ notePath: "root/WWaBNf3SSA1b/mQ2tIzLVFKHL", noteId: "mQ2tIzLVFKHL" });
});
});

View File

@ -238,10 +238,14 @@ export function parseNavigationStateFromUrl(url: string | undefined) {
}
}
if (!notePath.match(/^[_a-z0-9]{4,}(\/[_a-z0-9]{4,})*$/i)) {
if (searchString) {
return { searchString }
}
if (!notePath.match(/^[_a-z0-9]{4,}(\/[_a-z0-9]{4,})*$/i)) {
return {};
}
return {
notePath,
noteId: treeService.getNoteIdFromUrl(notePath),

View File

@ -2,6 +2,7 @@ import TypeWidget from "./type_widget.js";
import utils from "../../services/utils.js";
import linkService from "../../services/link.js";
import server from "../../services/server.js";
import asset_path from "../../../../services/asset_path.js";
import type FNote from "../../entities/fnote.js";
import type { ExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types";
import type { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem, SceneData } from "@excalidraw/excalidraw/types";
@ -129,9 +130,9 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
this.SCENE_VERSION_INITIAL = -1; // -1 indicates that it is fresh. excalidraw scene version is always >0
this.SCENE_VERSION_ERROR = -2; // -2 indicates error
// ensure that assets are loaded from trilium
// TODO:
(window as any).EXCALIDRAW_ASSET_PATH = `${window.location.origin}/node_modules/@excalidraw/excalidraw/dist/`;
// currently required by excalidraw, in order to allows self-hosting fonts locally.
// this avoids making excalidraw load the fonts from an external CDN.
(window as any).EXCALIDRAW_ASSET_PATH = `${window.location.origin}/${asset_path}/app-dist/excalidraw/`;
// temporary vars
this.currentNoteId = "";

View File

@ -47,6 +47,11 @@ const TPL = `
height: 100%;
}
/* Workaround for #1327 */
body.desktop.electron .note-detail-editable-text {
letter-spacing: -0.01px;
}
body.mobile .note-detail-editable-text {
padding-left: 4px;
}

View File

@ -4,6 +4,7 @@ import autoprefixer from "autoprefixer";
import assetPath from "./src/services/asset_path.js";
import miniCssExtractPlugin from "mini-css-extract-plugin";
import type { Configuration } from "webpack";
import CopyPlugin from "copy-webpack-plugin";
const rootDir = path.dirname(fileURLToPath(import.meta.url));
const config: Configuration = {
@ -26,6 +27,15 @@ const config: Configuration = {
new miniCssExtractPlugin({
// TriliumNextTODO: enable this, once webpack build outputs into the "build" folder, instead of "src/public/app-dist" folder => @pano9000
//filename: "../stylesheets/[name].css"
}),
new CopyPlugin({
patterns: [
{
context: "node_modules/@excalidraw/excalidraw/dist/prod/fonts/",
from: "**/*",
to: "excalidraw/fonts/"
}
]
})
],
module: {