Merge remote-tracking branch 'origin/develop' into feature/ckeditor_lib

This commit is contained in:
Elian Doran
2025-05-07 13:13:52 +03:00
25 changed files with 1029 additions and 953 deletions

View File

@@ -23,15 +23,15 @@
"@popperjs/core": "2.11.8",
"@triliumnext/ckeditor5": "workspace:*",
"@triliumnext/commons": "workspace:*",
"bootstrap": "5.3.5",
"bootstrap": "5.3.6",
"dayjs": "1.11.13",
"dayjs-plugin-utc": "0.1.2",
"debounce": "2.2.0",
"draggabilly": "3.0.0",
"eslint-linter-browserify": "9.25.1",
"eslint-linter-browserify": "9.26.0",
"force-graph": "1.49.5",
"globals": "16.0.0",
"i18next": "25.0.2",
"i18next": "25.1.1",
"i18next-http-backend": "3.0.2",
"jquery": "3.7.1",
"jquery-hotkeys": "0.2.2",

View File

@@ -5,9 +5,9 @@
"description": "Tool to compare content of Trilium databases. Useful for debugging sync problems.",
"dependencies": {
"colors": "1.4.0",
"diff": "5.0.0",
"diff": "7.0.0",
"sqlite": "5.1.1",
"sqlite3": "5.1.5"
"sqlite3": "5.1.7"
},
"nx": {
"name": "db-compare",
@@ -69,7 +69,6 @@
}
},
"devDependencies": {
"@types/colors": "1.2.4",
"@types/diff": "^7.0.2"
}
}

View File

@@ -0,0 +1 @@
TRILIUM_PORT=37743

View File

@@ -18,8 +18,7 @@
"@types/electron-squirrel-startup": "1.0.2",
"@triliumnext/server": "workspace:*",
"copy-webpack-plugin": "13.0.0",
"electron": "35.2.2",
"@electron/rebuild": "4.0.1",
"electron": "35.2.2",
"@electron-forge/cli": "7.8.0",
"@electron-forge/maker-deb": "7.8.0",
"@electron-forge/maker-dmg": "7.8.0",
@@ -55,12 +54,10 @@
"cache": true,
"configurations": {
"default": {
"command": "cross-env DEBUG=* tsx scripts/rebuild.mts",
"cwd": "{projectRoot}"
"command": "cross-env DEBUG=* tsx scripts/electron-rebuild.mts {projectRoot}/dist"
},
"nixos": {
"command": "electron-rebuild -f -v $(nix-shell -p electron_35 --run \"electron --version\") dist/main.js -m dist",
"cwd": "{projectRoot}"
"command": "cross-env DEBUG=* tsx scripts/electron-rebuild.mts {projectRoot}/dist $(nix-shell -p electron_33 --run \"electron --version\")"
}
}
},
@@ -76,7 +73,25 @@
"cwd": "{projectRoot}/dist"
},
"nixos": {
"command": "nix-shell -p electron_35 --run \"electron {projectRoot}/dist/main.js\"",
"command": "nix-shell -p electron_33 --run \"electron {projectRoot}/dist/main.js\"",
"cwd": ".",
"forwardAllArgs": false
}
}
},
"serve-nodir": {
"executor": "nx:run-commands",
"dependsOn": [
"rebuild-deps"
],
"defaultConfiguration": "default",
"configurations": {
"default": {
"command": "electron .",
"cwd": "{projectRoot}/dist"
},
"nixos": {
"command": "nix-shell -p electron_33 --run \"electron {projectRoot}/dist/main.js\"",
"cwd": ".",
"forwardAllArgs": false
}

View File

@@ -1,35 +0,0 @@
/**
* @module
*
* This script is used internally by the `rebuild-deps` target of the `desktop`. Normally we could use
* `electron-rebuild` CLI directly, but it would rebuild the monorepo-level dependencies and breaks
* the server build (and it doesn't expose a CLI option to override this).
*/
import { fileURLToPath } from "url";
import { dirname, join } from "path";
import { rebuild } from "@electron/rebuild"
import { readFileSync } from "fs";
const scriptDir = dirname(fileURLToPath(import.meta.url));
const rootDir = join(scriptDir, "..");
function getElectronVersion() {
const packageJsonPath = join(rootDir, "package.json");
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
return packageJson.devDependencies.electron;
}
function main() {
const distDir = join(rootDir, "dist");
rebuild({
// We force the project root path to avoid electron-rebuild from rebuilding the monorepo-level dependency and breaking the server.
projectRootPath: distDir,
buildPath: distDir,
force: true,
electronVersion: getElectronVersion(),
});
}
main();

View File

@@ -4,7 +4,6 @@
"private": true,
"description": "Desktop version of Trilium which imports the demo database (presented to new users at start-up) or the user guide and other documentation and saves the modifications for committing.",
"devDependencies": {
"@electron/rebuild": "4.0.1",
"@triliumnext/client": "workspace:*",
"@triliumnext/desktop": "workspace:*",
"@types/fs-extra": "11.0.4",
@@ -17,19 +16,19 @@
"targets": {
"rebuild-deps": {
"executor": "nx:run-commands",
"dependsOn": [ "build" ],
"dependsOn": [
"build"
],
"defaultConfiguration": "default",
"cache": true,
"configurations": {
"default": {
"command": "cross-env DEBUG=* tsx scripts/rebuild.mts",
"cwd": "{projectRoot}"
"command": "cross-env DEBUG=* tsx scripts/electron-rebuild.mts {projectRoot}/dist"
},
"nixos": {
"command": "electron-rebuild -f -v $(nix-shell -p electron_35 --run \"electron --version\") dist/main.js -m dist",
"cwd": "{projectRoot}"
"command": "cross-env DEBUG=* tsx scripts/electron-rebuild.mts {projectRoot}/dist $(nix-shell -p electron_33 --run \"electron --version\")"
}
}
}
},
"serve": {
"executor": "nx:run-commands",

View File

@@ -1,37 +0,0 @@
/**
* @module
*
* This script is used internally by the `rebuild-deps` target of the `desktop`. Normally we could use
* `electron-rebuild` CLI directly, but it would rebuild the monorepo-level dependencies and breaks
* the server build (and it doesn't expose a CLI option to override this).
*/
// TODO: Deduplicate with apps/desktop/scripts/rebuild.ts.
import { fileURLToPath } from "url";
import { dirname, join } from "path";
import { rebuild } from "@electron/rebuild"
import { readFileSync } from "fs";
const scriptDir = dirname(fileURLToPath(import.meta.url));
const rootDir = join(scriptDir, "..");
function getElectronVersion() {
const packageJsonPath = join(rootDir, "package.json");
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
return packageJson.devDependencies.electron;
}
function main() {
const distDir = join(rootDir, "dist");
rebuild({
// We force the project root path to avoid electron-rebuild from rebuilding the monorepo-level dependency and breaking the server.
projectRootPath: distDir,
buildPath: distDir,
force: true,
electronVersion: getElectronVersion(),
});
}
main();

View File

@@ -31,7 +31,7 @@
"@types/mime-types": "2.1.4",
"@types/multer": "1.4.12",
"@types/safe-compare": "1.1.2",
"@types/sanitize-html": "2.15.0",
"@types/sanitize-html": "2.16.0",
"@types/sax": "1.2.7",
"@types/serve-favicon": "2.5.7",
"@types/serve-static": "1.15.7",
@@ -85,7 +85,7 @@
"html2plaintext": "2.1.4",
"http-proxy-agent": "7.0.2",
"https-proxy-agent": "7.0.6",
"i18next": "25.0.2",
"i18next": "25.1.1",
"i18next-fs-backend": "2.6.0",
"image-type": "5.2.0",
"ini": "5.0.0",
@@ -117,8 +117,8 @@
"tmp": "0.2.3",
"turndown": "7.2.0",
"unescape": "1.0.1",
"webpack": "5.99.7",
"ws": "8.18.1",
"webpack": "5.99.8",
"ws": "8.18.2",
"xml2js": "0.6.2",
"yauzl": "3.2.0",
"copy-webpack-plugin": "13.0.0"

File diff suppressed because one or more lines are too long

View File

@@ -124,14 +124,14 @@ function forceFullSync() {
* type: object
* properties:
* entityChanges:
* type: list
* type: array
* items:
* $ref: '#/components/schemas/EntityChange'
* lastEntityChangeId:
* type: integer
* description: If `outstandingPullCount > 0`, pass this as parameter in your next request to continue.
* outstandingPullCount:
* type: int
* type: integer
* example: 42
* description: Number of changes not yet returned by the remote.
* security:
@@ -247,7 +247,7 @@ const partialRequests: Record<
* type: string
* description: Local instance ID
* entities:
* type: list
* type: array
* items:
* $ref: '#/components/schemas/EntityChange'
* responses:

View File

@@ -152,15 +152,15 @@ function getNotesAndBranchesAndAttributes(_noteIds: string[] | Set<string>) {
* type: object
* properties:
* branches:
* type: list
* type: array
* items:
* $ref: '#/components/schemas/Branch'
* notes:
* type: list
* type: array
* items:
* $ref: '#/components/schemas/Note'
* attributes:
* type: list
* type: array
* items:
* $ref: '#/components/schemas/Attribute'
* security:

View File

@@ -62,6 +62,36 @@ function setPassword(req: Request, res: Response) {
res.redirect("login");
}
/**
* @swagger
* /login:
* post:
* tags:
* - auth
* summary: Log in using password
* description: This will give you a Trilium session, which is required for some other API endpoints. `totpToken` is only required if the user configured TOTP authentication.
* operationId: login-normal
* externalDocs:
* description: HMAC calculation
* url: https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/utils.ts#L62-L66
* requestBody:
* content:
* application/x-www-form-urlencoded:
* schema:
* type: object
* required:
* - password
* properties:
* password:
* type: string
* totpToken:
* type: string
* responses:
* '200':
* description: Successful operation
* '401':
* description: Password / TOTP mismatch
*/
function login(req: Request, res: Response) {
if (openID.isOpenIDEnabled()) {
res.oidc.login({

View File

@@ -47,9 +47,11 @@ export function listSyntaxHighlightingThemes() {
export function getStylesDirectory() {
if (isElectron && !isDev) {
return "styles";
} else if (!isDev) {
return "node_modules/@highlightjs/cdn-assets/styles";
} else {
return join(__dirname, "../../node_modules/@highlightjs/cdn-assets/styles");
}
return "node_modules/@highlightjs/cdn-assets/styles";
}
/**