diff --git a/Dockerfile b/Dockerfile index 620c13789..365e4d07f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build stage -FROM node:22.13.1-bullseye-slim AS builder +FROM node:22.14.0-bullseye-slim AS builder # Configure build dependencies in a single layer RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -36,7 +36,7 @@ RUN cp -R build/src/* src/. && \ rm -r build # Runtime stage -FROM node:22.13.1-bullseye-slim +FROM node:22.14.0-bullseye-slim # Install only runtime dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ diff --git a/Dockerfile.alpine b/Dockerfile.alpine index cac6d1871..36d6f0b7b 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,5 +1,5 @@ # Build stage -FROM node:22.13.1-alpine AS builder +FROM node:22.14.0-alpine AS builder # Configure build dependencies RUN apk add --no-cache --virtual .build-dependencies \ @@ -35,7 +35,7 @@ RUN cp -R build/src/* src/. && \ rm -r build # Runtime stage -FROM node:22.13.1-alpine +FROM node:22.14.0-alpine # Install runtime dependencies RUN apk add --no-cache su-exec shadow diff --git a/bin/copy-dist.ts b/bin/copy-dist.ts index 85013e992..83a31bbf7 100644 --- a/bin/copy-dist.ts +++ b/bin/copy-dist.ts @@ -29,7 +29,12 @@ const copy = async () => { fs.copySync(path.join("build", srcFile), destFile, { recursive: true }); } - const filesToCopy = ["config-sample.ini", "tsconfig.webpack.json", "./src/etapi/etapi.openapi.yaml"]; + const filesToCopy = [ + "config-sample.ini", + "tsconfig.webpack.json", + "./src/etapi/etapi.openapi.yaml", + "./src/routes/api/openapi.json" + ]; for (const file of filesToCopy) { log(`Copying ${file}`); await fs.copy(file, path.join(DEST_DIR, file)); diff --git a/bin/generate-openapi.js b/bin/generate-openapi.js deleted file mode 100644 index ae6818482..000000000 --- a/bin/generate-openapi.js +++ /dev/null @@ -1,51 +0,0 @@ -import swaggerJsdoc from 'swagger-jsdoc'; - -/* - * Usage: npm run generate-openapi | tail -n1 > x.json - * - * Inspect generated file by opening it in https://editor-next.swagger.io/ - * - */ - -const options = { - definition: { - openapi: '3.1.1', - info: { - title: 'Trilium Notes - Sync server API', - version: '0.96.6', - description: "This is the internal sync server API used by Trilium Notes / TriliumNext Notes.\n\n_If you're looking for the officially supported External Trilium API, see [here](https://triliumnext.github.io/Docs/Wiki/etapi.html)._\n\nThis page does not yet list all routes. For a full list, see the [route controller](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/routes.ts).", - contact: { - name: "TriliumNext issue tracker", - url: "https://github.com/TriliumNext/Notes/issues", - }, - license: { - name: "GNU Free Documentation License 1.3 (or later)", - url: "https://www.gnu.org/licenses/fdl-1.3", - }, - }, - }, - apis: ['./src/routes/api/*.ts', './bin/generate-openapi.js'], -}; - -const openapiSpecification = swaggerJsdoc(options); - -console.log(JSON.stringify(openapiSpecification)); - -/** - * @swagger - * components: - * schemas: - * UtcDateTime: - * type: string - * example: "2025-02-13T07:42:47.698Z" - * securitySchemes: - * user-password: - * type: apiKey - * name: trilium-cred - * in: header - * description: "Username and password, formatted as `user:password`" - * session: - * type: apiKey - * in: cookie - * name: trilium.sid - */ diff --git a/bin/generate-openapi.ts b/bin/generate-openapi.ts new file mode 100644 index 000000000..4bd97a76f --- /dev/null +++ b/bin/generate-openapi.ts @@ -0,0 +1,189 @@ +import { fileURLToPath } from "url"; +import { dirname, join } from "path"; +import swaggerJsdoc from 'swagger-jsdoc'; +import fs from "fs"; + +/* + * Usage: npm run generate-openapi | tail -n1 > x.json + * + * Inspect generated file by opening it in https://editor-next.swagger.io/ + * + */ + +const options = { + definition: { + openapi: '3.1.1', + info: { + title: 'Trilium Notes - Sync server API', + version: '0.96.6', + description: "This is the internal sync server API used by Trilium Notes / TriliumNext Notes.\n\n_If you're looking for the officially supported External Trilium API, see [here](https://triliumnext.github.io/Docs/Wiki/etapi.html)._\n\nThis page does not yet list all routes. For a full list, see the [route controller](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/routes.ts).", + contact: { + name: "TriliumNext issue tracker", + url: "https://github.com/TriliumNext/Notes/issues", + }, + license: { + name: "GNU Free Documentation License 1.3 (or later)", + url: "https://www.gnu.org/licenses/fdl-1.3", + }, + }, + }, + apis: [ + // Put individual files here to have them ordered first. + './src/routes/api/setup.ts', + // all other files + './src/routes/api/*.ts', './bin/generate-openapi.js' + ], +}; + +const openapiSpecification = swaggerJsdoc(options); +const scriptDir = dirname(fileURLToPath(import.meta.url)); +const outputPath = join(scriptDir, "..", "src", "routes", "api", "openapi.json"); +fs.writeFileSync(outputPath, JSON.stringify(openapiSpecification)); +console.log("Saved to ", outputPath); + +/** + * @swagger + * tags: + * - name: auth + * description: Authentication + * - name: sync + * description: Synchronization + * - name: data + */ + +/** + * @swagger + * components: + * schemas: + * Attribute: + * type: object + * properties: + * attributeId: + * type: string + * example: "4G1DPrI58PAb" + * noteId: + * $ref: "#/components/schemas/NoteId" + * type: + * type: string + * enum: ["attribute", "relation"] + * name: + * type: string + * example: "internalLink" + * value: + * type: string + * example: "hA8aHSpTRdZ6" + * description: "If type = \"relation\", a note ID. Otherwise, the attribute content." + * position: + * type: integer + * example: 20 + * isInheritable: + * type: boolean + * Blob: + * type: object + * properties: + * blobId: + * type: string + * example: "8iqMIB8eiY1tPYmElfjm" + * content: + * type: + * - string + * - 'null' + * description: "`null` if not text." + * contentLength: + * type: integer + * dateModified: + * $ref: "#/components/schemas/DateTime" + * utcDateModified: + * $ref: "#/components/schemas/UtcDateTime" + * Branch: + * type: object + * properties: + * branchId: + * $ref: "#/components/schemas/BranchId" + * noteId: + * $ref: "#/components/schemas/NoteId" + * parentNoteId: + * $ref: "#/components/schemas/NoteId" + * notePosition: + * type: integer + * example: 20 + * prefix: + * type: + * - string + * - 'null' + * isExpanded: + * type: boolean + * BranchId: + * type: string + * example: "WUjhaGp4EKah_ur11rSfHkzeV" + * description: Equal to `{parentNoteId}_{noteId}` + * DateTime: + * type: string + * example: "2025-02-14 08:19:59.203+0100" + * EntityChange: + * type: object + * properties: + * entityChange: + * type: object + * properties: + * entityName: + * type: string + * example: "notes" + * description: Database table for this entity. + * changeId: + * type: string + * example: "changeId9630" + * description: ID, referenced in `entity_changes` table. + * entity: + * type: object + * description: Encoded entity data. Object has one property for each database column. + * Note: + * type: object + * properties: + * noteId: + * $ref: "#/components/schemas/NoteId" + * title: + * type: string + * isProtected: + * type: boolean + * type: + * type: string + * example: "text" + * enum: ["text", "code", "render", "file", "image", "search", "relationMap", "book", "noteMap", "mermaid", "canvas", "webView", "launcher", "doc", "contentWidget", "mindMap", "geoMap"] + * description: "[Reference list](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/note_types.ts)" + * mime: + * type: string + * example: "text/html" + * blobId: + * type: string + * example: "z4PhNX7vuL3xVChQ1m2A" + * NoteId: + * type: string + * example: "ur11rSfHkzeV" + * description: "12-character note ID. Special values: \"none\"`, `\"root\"." + * Timestamps: + * type: object + * properties: + * dateCreated: + * $ref: "#/components/schemas/DateTime" + * dateModified: + * $ref: "#/components/schemas/DateTime" + * utcDateCreated: + * $ref: "#/components/schemas/UtcDateTime" + * utcDateModified: + * $ref: "#/components/schemas/UtcDateTime" + * UtcDateTime: + * type: string + * example: "2025-02-13T07:42:47.698Z" + * description: "Result of `new Date().toISOString().replace('T', ' ')`" + * securitySchemes: + * user-password: + * type: apiKey + * name: trilium-cred + * in: header + * description: "Username and password, formatted as `user:password`" + * session: + * type: apiKey + * in: cookie + * name: trilium.sid + */ diff --git a/package-lock.json b/package-lock.json index 5fdf64248..a32cc9615 100644 --- a/package-lock.json +++ b/package-lock.json @@ -135,13 +135,12 @@ "@types/fs-extra": "11.0.4", "@types/html": "1.0.4", "@types/ini": "4.1.1", - "@types/jasmine": "5.1.5", "@types/jquery": "3.5.32", "@types/jsdom": "21.1.7", "@types/leaflet-gpx": "1.3.7", "@types/mime-types": "2.1.4", "@types/multer": "1.4.12", - "@types/node": "22.13.1", + "@types/node": "22.13.4", "@types/react": "18.3.18", "@types/safe-compare": "1.1.2", "@types/sanitize-html": "2.13.0", @@ -157,12 +156,12 @@ "@types/yargs": "17.0.33", "@vitest/coverage-v8": "3.0.5", "cross-env": "7.0.3", - "electron": "34.1.1", + "electron": "34.2.0", "esm": "3.2.25", "jsdoc": "4.0.4", "lorem-ipsum": "2.0.8", "nodemon": "3.1.9", - "prettier": "3.5.0", + "prettier": "3.5.1", "rcedit": "4.0.1", "rimraf": "6.0.1", "swagger-jsdoc": "6.2.8", @@ -171,7 +170,7 @@ "typedoc": "0.27.7", "typescript": "5.7.3", "vitest": "3.0.5", - "webpack": "5.97.1", + "webpack": "5.98.0", "webpack-cli": "6.0.1", "webpack-dev-middleware": "7.4.2" } @@ -4104,13 +4103,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/jasmine": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-5.1.5.tgz", - "integrity": "sha512-SaCZ3kM5NjOiJqMRYwHpLbTfUC2Dyk1KS3QanNFsUYPGTk70CWVK/J9ueun6zNhw/UkgV7xl8V4ZLQZNRbfnNw==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/jquery": { "version": "3.5.32", "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.32.tgz", @@ -4239,9 +4231,9 @@ } }, "node_modules/@types/node": { - "version": "22.13.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.1.tgz", - "integrity": "sha512-jK8uzQlrvXqEU91UxiK5J7pKHyzgnI1Qnl0QDHIgVGuolJhRb9EEl28Cj9b3rGR8B2lhFCtvIm5os8lFnO/1Ew==", + "version": "22.13.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.4.tgz", + "integrity": "sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg==", "license": "MIT", "dependencies": { "undici-types": "~6.20.0" @@ -4970,15 +4962,15 @@ } }, "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -5002,35 +4994,16 @@ } } }, - "node_modules/ajv-formats/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "fast-deep-equal": "^3.1.3" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-formats/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "license": "MIT" - }, - "node_modules/ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "license": "MIT", "peerDependencies": { - "ajv": "^6.9.1" + "ajv": "^8.8.2" } }, "node_modules/amator": { @@ -8004,9 +7977,9 @@ } }, "node_modules/electron": { - "version": "34.1.1", - "resolved": "https://registry.npmjs.org/electron/-/electron-34.1.1.tgz", - "integrity": "sha512-1aDYk9Gsv1/fFeClMrxWGoVMl7uCUgl1pe26BiTnLXmAoqEXCa3f3sCKFWV+cuDzUjQGAZcpkWhGYTgWUSQrLA==", + "version": "34.2.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-34.2.0.tgz", + "integrity": "sha512-SYwBJNeXBTm1q/ErybQMUBZAYqEreBUqBwTrNkw1rV4YatDZk5Aittpcus3PPeC4UoI/tqmJ946uG8AKHTd6CA==", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -8725,9 +8698,9 @@ } }, "node_modules/electron/node_modules/@types/node": { - "version": "20.17.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.17.tgz", - "integrity": "sha512-/WndGO4kIfMicEQLTi/mDANUu/iVUhT7KboZPdEqqHQ4aTS+3qT3U5gIqWDFV+XouorjfgGqvKILJeHhuQgFYg==", + "version": "20.17.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.19.tgz", + "integrity": "sha512-LEwC7o1ifqg/6r2gn9Dns0f1rhK+fPFDoMiceTJ6kWmVk6bgXBI/9IOWfVan4WiAavK9pIVWdX0/e3J+eEUh5A==", "license": "MIT", "dependencies": { "undici-types": "~6.19.2" @@ -9027,6 +9000,28 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-scope/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, "node_modules/esm": { "version": "3.2.25", "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", @@ -9547,12 +9542,6 @@ "node": ">= 6" } }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "license": "MIT" - }, "node_modules/fast-uri": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.3.tgz", @@ -11707,9 +11696,9 @@ "license": "MIT" }, "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "license": "MIT" }, "node_modules/json-stringify-safe": { @@ -14000,9 +13989,9 @@ } }, "node_modules/prettier": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.0.tgz", - "integrity": "sha512-quyMrVt6svPS7CjQ9gKb3GLEX/rl3BCL2oa/QkNcXv4YNVBC9olt3s+H7ukto06q7B1Qz46PbrKLO34PR6vXcA==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.1.tgz", + "integrity": "sha512-hPpFQvHwL3Qv5AdRvBFMhnKo4tYxp0ReXiPn2bxkiohEX6mBeBwEpBSQTkD458RaaDKQMYSp4hX4UtfUTA5wDw==", "dev": true, "license": "MIT", "bin": { @@ -15215,14 +15204,15 @@ } }, "node_modules/schema-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", - "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.0.tgz", + "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" }, "engines": { "node": ">= 10.13.0" @@ -16502,59 +16492,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/terser-webpack-plugin/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/terser-webpack-plugin/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/terser-webpack-plugin/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "license": "MIT" - }, - "node_modules/terser-webpack-plugin/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/terser/node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -17295,15 +17232,6 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/username": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/username/-/username-5.1.0.tgz", @@ -18149,9 +18077,9 @@ } }, "node_modules/webpack": { - "version": "5.97.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.97.1.tgz", - "integrity": "sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==", + "version": "5.98.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.98.0.tgz", + "integrity": "sha512-UFynvx+gM44Gv9qFgj0acCQK2VE1CtdfwFdimkapco3hlPCJ/zeq73n2yVKimVbtm+TnApIugGhLJnkU6gjYXA==", "license": "MIT", "dependencies": { "@types/eslint-scope": "^3.7.7", @@ -18172,9 +18100,9 @@ "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", - "schema-utils": "^3.2.0", + "schema-utils": "^4.3.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.10", + "terser-webpack-plugin": "^5.3.11", "watchpack": "^2.4.1", "webpack-sources": "^3.2.3" }, @@ -18277,63 +18205,6 @@ } } }, - "node_modules/webpack-dev-middleware/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/webpack-dev-middleware/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" - } - }, - "node_modules/webpack-dev-middleware/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, - "node_modules/webpack-dev-middleware/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/webpack-merge": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-6.0.1.tgz", @@ -18358,28 +18229,6 @@ "node": ">=10.13.0" } }, - "node_modules/webpack/node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/webpack/node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, "node_modules/whatwg-encoding": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", diff --git a/package.json b/package.json index 53070e6ed..bd65afbd8 100644 --- a/package.json +++ b/package.json @@ -49,8 +49,8 @@ "build:webpack": "tsx node_modules/webpack/bin/webpack.js -c webpack.config.ts", "build:prepare-dist": "rimraf ./dist && tsc && tsx ./bin/copy-dist.ts", - "test": "cross-env TRILIUM_DATA_DIR=./data-test vitest", - "test:coverage": "cross-env TRILIUM_DATA_DIR=./data-test vitest --coverage", + "test": "cross-env TRILIUM_DATA_DIR=./integration-tests/db vitest", + "test:coverage": "cross-env TRILIUM_DATA_DIR=./integration-tests/db vitest --coverage", "test:playwright": "playwright test", "test:integration-edit-db": "cross-env TRILIUM_INTEGRATION_TEST=edit TRILIUM_PORT=8081 TRILIUM_ENV=dev TRILIUM_DATA_DIR=./integration-tests/db nodemon src/main.ts", @@ -64,7 +64,7 @@ "chore:update-build-info": "tsx bin/update-build-info.ts", "chore:ci-update-nightly-version": "tsx ./bin/update-nightly-version.ts", "chore:generate-document": "cross-env nodemon ./bin/generate_document.ts 1000", - "chore:generate-openapi": "node bin/generate-openapi.js" + "chore:generate-openapi": "tsx bin/generate-openapi.js" }, "dependencies": { "@braintree/sanitize-url": "7.1.1", @@ -190,13 +190,12 @@ "@types/fs-extra": "11.0.4", "@types/html": "1.0.4", "@types/ini": "4.1.1", - "@types/jasmine": "5.1.5", "@types/jquery": "3.5.32", "@types/jsdom": "21.1.7", "@types/leaflet-gpx": "1.3.7", "@types/mime-types": "2.1.4", "@types/multer": "1.4.12", - "@types/node": "22.13.1", + "@types/node": "22.13.4", "@types/react": "18.3.18", "@types/safe-compare": "1.1.2", "@types/sanitize-html": "2.13.0", @@ -212,12 +211,12 @@ "@types/yargs": "17.0.33", "@vitest/coverage-v8": "3.0.5", "cross-env": "7.0.3", - "electron": "34.1.1", + "electron": "34.2.0", "esm": "3.2.25", "jsdoc": "4.0.4", "lorem-ipsum": "2.0.8", "nodemon": "3.1.9", - "prettier": "3.5.0", + "prettier": "3.5.1", "rcedit": "4.0.1", "rimraf": "6.0.1", "swagger-jsdoc": "6.2.8", @@ -226,7 +225,7 @@ "typedoc": "0.27.7", "typescript": "5.7.3", "vitest": "3.0.5", - "webpack": "5.97.1", + "webpack": "5.98.0", "webpack-cli": "6.0.1", "webpack-dev-middleware": "7.4.2" } diff --git a/spec/etapi/app_info.ts b/spec/etapi/app_info.ts index 4bb8c4064..08aade29b 100644 --- a/spec/etapi/app_info.ts +++ b/spec/etapi/app_info.ts @@ -1,8 +1,9 @@ import etapi from "../support/etapi.js"; - +/* TriliumNextTODO: port to Vitest etapi.describeEtapi("app_info", () => { it("get", async () => { const appInfo = await etapi.getEtapi("app-info"); expect(appInfo.clipperProtocolVersion).toEqual("1.0"); }); }); +*/ \ No newline at end of file diff --git a/spec/etapi/backup.ts b/spec/etapi/backup.ts index 78aa01d7f..88e487f9e 100644 --- a/spec/etapi/backup.ts +++ b/spec/etapi/backup.ts @@ -1,8 +1,10 @@ import etapi from "../support/etapi.js"; +/* TriliumNextTODO: port to Vitest etapi.describeEtapi("backup", () => { it("create", async () => { const response = await etapi.putEtapiContent("backup/etapi_test"); expect(response.status).toEqual(204); }); }); +*/ \ No newline at end of file diff --git a/spec/etapi/import.ts b/spec/etapi/import.ts index d36a01c58..fc88a9ef5 100644 --- a/spec/etapi/import.ts +++ b/spec/etapi/import.ts @@ -3,6 +3,7 @@ import fs from "fs"; import path from "path"; import { fileURLToPath } from "url"; +/* TriliumNextTODO: port to Vitest etapi.describeEtapi("import", () => { // temporarily skip this test since test-export.zip is missing xit("import", async () => { @@ -22,3 +23,4 @@ etapi.describeEtapi("import", () => { expect(content).toContain("test export content"); }); }); +*/ \ No newline at end of file diff --git a/spec/etapi/notes.ts b/spec/etapi/notes.ts index 6efcd88a1..dccb668df 100644 --- a/spec/etapi/notes.ts +++ b/spec/etapi/notes.ts @@ -1,6 +1,7 @@ import crypto from "crypto"; import etapi from "../support/etapi.js"; +/* TriliumNextTODO: port to Vitest etapi.describeEtapi("notes", () => { it("create", async () => { const { note, branch } = await etapi.postEtapi("create-note", { @@ -99,3 +100,4 @@ etapi.describeEtapi("notes", () => { expect(error.message).toEqual(`Note '${note.noteId}' not found.`); }); }); +*/ \ No newline at end of file diff --git a/spec/support/etapi.ts b/spec/support/etapi.ts index d653707d5..307868d7d 100644 --- a/spec/support/etapi.ts +++ b/spec/support/etapi.ts @@ -1,4 +1,5 @@ import type child_process from "child_process"; +import { describe, beforeAll, afterAll } from "vitest"; let etapiAuthToken: string | undefined; diff --git a/src/public/app/doc_notes/en/User Guide/!!!meta.json b/src/public/app/doc_notes/en/User Guide/!!!meta.json index ffee6a973..f7ee2b545 100644 --- a/src/public/app/doc_notes/en/User Guide/!!!meta.json +++ b/src/public/app/doc_notes/en/User Guide/!!!meta.json @@ -1,6 +1,6 @@ { "formatVersion": 2, - "appVersion": "0.91.5", + "appVersion": "0.91.6-test-250214-024424", "files": [ { "isClone": false, @@ -11,7 +11,7 @@ "title": "User Guide", "notePosition": 20, "prefix": null, - "isExpanded": false, + "isExpanded": true, "type": "text", "mime": "text/html", "attributes": [ @@ -29,22 +29,326 @@ "children": [ { "isClone": false, - "noteId": "wmegHv51MJMd", + "noteId": "jrai60LsOhdk", "notePath": [ "OkOZllzB3fqN", - "wmegHv51MJMd" + "jrai60LsOhdk" ], - "title": "Types of notes", + "title": "Installation", "notePosition": 20, "prefix": null, "isExpanded": false, "type": "text", "mime": "text/html", + "attributes": [ + { + "type": "relation", + "name": "internalLink", + "value": "KPeRqBU7YSAY", + "isInheritable": false, + "position": 10 + }, + { + "type": "label", + "name": "hideChildrenOverview", + "value": "", + "isInheritable": false, + "position": 10 + } + ], + "format": "html", + "dataFileName": "Installation.html", + "attachments": [ + { + "attachmentId": "Mp9RaDeLtETz", + "title": "Fedora_logo.svg", + "role": "image", + "mime": "image/svg+xml", + "position": 10, + "dataFileName": "Installation_Fedora_logo.svg" + } + ], + "dirFileName": "Installation", + "children": [ + { + "isClone": false, + "noteId": "KPeRqBU7YSAY", + "notePath": [ + "OkOZllzB3fqN", + "jrai60LsOhdk", + "KPeRqBU7YSAY" + ], + "title": "On Fedora Linux", + "notePosition": 10, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [ + { + "type": "label", + "name": "iconClass", + "value": "bx bxl-tux", + "isInheritable": false, + "position": 10 + } + ], + "format": "html", + "dataFileName": "On Fedora Linux.html", + "attachments": [ + { + "attachmentId": "YHD8kyEhgkyZ", + "title": "Screenshot From 2025-02-05 19-30-50.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "On Fedora Linux_Screenshot.png" + }, + { + "attachmentId": "0CpZ5v5xUMia", + "title": "Screenshot From 2025-02-05 19-35-45.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "1_On Fedora Linux_Screenshot.png" + }, + { + "attachmentId": "9u7nBYvUbXJW", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "On Fedora Linux_image.png" + }, + { + "attachmentId": "ipGBq0moRvF3", + "title": "Screenshot From 2025-02-05 19-36-27.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "2_On Fedora Linux_Screenshot.png" + }, + { + "attachmentId": "fa83WbDUIB4G", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "1_On Fedora Linux_image.png" + }, + { + "attachmentId": "kcCWr0YXytOU", + "title": "Screenshot From 2025-02-05 19-30-30.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "3_On Fedora Linux_Screenshot.png" + }, + { + "attachmentId": "YF3JZy1qz7Fq", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "2_On Fedora Linux_image.png" + } + ] + } + ] + }, + { + "isClone": false, + "noteId": "yoAe4jV2yzbd", + "notePath": [ + "OkOZllzB3fqN", + "yoAe4jV2yzbd" + ], + "title": "Features", + "notePosition": 40, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", "attributes": [], "format": "html", "attachments": [], - "dirFileName": "Types of notes", + "dirFileName": "Features", "children": [ + { + "isClone": false, + "noteId": "13D1lOc9sqmZ", + "notePath": [ + "OkOZllzB3fqN", + "yoAe4jV2yzbd", + "13D1lOc9sqmZ" + ], + "title": "Export as PDF", + "notePosition": 20, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "dataFileName": "Export as PDF.html", + "attachments": [ + { + "attachmentId": "xsGM34t8ssKV", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "Export as PDF_image.png" + }, + { + "attachmentId": "cvyes4f1Vhmm", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "1_Export as PDF_image.png" + }, + { + "attachmentId": "b3v1pLE6TF1Y", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "2_Export as PDF_image.png" + } + ] + }, + { + "isClone": false, + "noteId": "B3YLYM4erjnW", + "notePath": [ + "OkOZllzB3fqN", + "yoAe4jV2yzbd", + "B3YLYM4erjnW" + ], + "title": "Zen mode", + "notePosition": 30, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "dataFileName": "Zen mode.html", + "attachments": [ + { + "attachmentId": "TS5MS8fQ8Rfr", + "title": "image.png", + "role": "image", + "mime": "image/jpg", + "position": 10, + "dataFileName": "Zen mode_image.png" + }, + { + "attachmentId": "cswryNtIFZHy", + "title": "image.png", + "role": "image", + "mime": "image/jpg", + "position": 10, + "dataFileName": "1_Zen mode_image.png" + }, + { + "attachmentId": "UDk4M7uiTE7w", + "title": "image.png", + "role": "image", + "mime": "image/jpg", + "position": 10, + "dataFileName": "2_Zen mode_image.png" + }, + { + "attachmentId": "sQldbByAmE0k", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "3_Zen mode_image.png" + }, + { + "attachmentId": "DzrJD3hXJwXJ", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "4_Zen mode_image.png" + }, + { + "attachmentId": "HeGfp8wObFO5", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "5_Zen mode_image.png" + }, + { + "attachmentId": "uWsrFwgfypsS", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "6_Zen mode_image.png" + }, + { + "attachmentId": "hX8xmbxgSNFh", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "7_Zen mode_image.png" + } + ] + } + ] + }, + { + "isClone": false, + "noteId": "wmegHv51MJMd", + "notePath": [ + "OkOZllzB3fqN", + "wmegHv51MJMd" + ], + "title": "Note Types", + "notePosition": 70, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "attachments": [], + "dirFileName": "Note Types", + "children": [ + { + "isClone": false, + "noteId": "TTWESa9YFyB4", + "notePath": [ + "OkOZllzB3fqN", + "wmegHv51MJMd", + "TTWESa9YFyB4" + ], + "title": "Mermaid Diagram", + "notePosition": 10, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [ + { + "type": "label", + "name": "iconClass", + "value": "bx bx-shape-square", + "isInheritable": false, + "position": 10 + } + ], + "format": "html", + "dataFileName": "Mermaid Diagram.html", + "attachments": [] + }, { "isClone": false, "noteId": "foPEtsL51pD2", @@ -54,7 +358,7 @@ "foPEtsL51pD2" ], "title": "Geo map", - "notePosition": 10, + "notePosition": 20, "prefix": null, "isExpanded": false, "type": "text", @@ -72,7 +376,7 @@ "dataFileName": "Geo map.html", "attachments": [ { - "attachmentId": "viN50n5G4kB0", + "attachmentId": "J0baLTpafs7C", "title": "image.png", "role": "image", "mime": "image/png", @@ -80,7 +384,7 @@ "dataFileName": "Geo map_image.png" }, { - "attachmentId": "eUrcqc8RRuZG", + "attachmentId": "kcYjOvJDFkbS", "title": "image.png", "role": "image", "mime": "image/png", @@ -88,7 +392,7 @@ "dataFileName": "1_Geo map_image.png" }, { - "attachmentId": "1quk4yxJpeHZ", + "attachmentId": "FDP3JzIVSnuJ", "title": "image.png", "role": "image", "mime": "image/png", @@ -96,7 +400,7 @@ "dataFileName": "2_Geo map_image.png" }, { - "attachmentId": "mgwGrtQZjxxb", + "attachmentId": "eUrcqc8RRuZG", "title": "image.png", "role": "image", "mime": "image/png", @@ -104,7 +408,7 @@ "dataFileName": "3_Geo map_image.png" }, { - "attachmentId": "JULizn130rVI", + "attachmentId": "0AwaQMqt3FVA", "title": "image.png", "role": "image", "mime": "image/png", @@ -112,7 +416,7 @@ "dataFileName": "4_Geo map_image.png" }, { - "attachmentId": "kcYjOvJDFkbS", + "attachmentId": "1quk4yxJpeHZ", "title": "image.png", "role": "image", "mime": "image/png", @@ -120,7 +424,7 @@ "dataFileName": "5_Geo map_image.png" }, { - "attachmentId": "ut6vm2aXVfXI", + "attachmentId": "iSpyhQ5Ya6Nk", "title": "image.png", "role": "image", "mime": "image/png", @@ -128,7 +432,7 @@ "dataFileName": "6_Geo map_image.png" }, { - "attachmentId": "0AwaQMqt3FVA", + "attachmentId": "ut6vm2aXVfXI", "title": "image.png", "role": "image", "mime": "image/png", @@ -136,7 +440,7 @@ "dataFileName": "7_Geo map_image.png" }, { - "attachmentId": "gFR2Izzp18LQ", + "attachmentId": "uYdb9wWf5Nuv", "title": "image.png", "role": "image", "mime": "image/png", @@ -144,7 +448,7 @@ "dataFileName": "8_Geo map_image.png" }, { - "attachmentId": "PMqmCbNLlZOG", + "attachmentId": "GhHYO2LteDmZ", "title": "image.png", "role": "image", "mime": "image/png", @@ -152,7 +456,7 @@ "dataFileName": "9_Geo map_image.png" }, { - "attachmentId": "pKdtiq4r0eFY", + "attachmentId": "viN50n5G4kB0", "title": "image.png", "role": "image", "mime": "image/png", @@ -160,7 +464,7 @@ "dataFileName": "10_Geo map_image.png" }, { - "attachmentId": "FXRVvYpOxWyR", + "attachmentId": "mgwGrtQZjxxb", "title": "image.png", "role": "image", "mime": "image/png", @@ -168,7 +472,7 @@ "dataFileName": "11_Geo map_image.png" }, { - "attachmentId": "42AncDs7SSAf", + "attachmentId": "PMqmCbNLlZOG", "title": "image.png", "role": "image", "mime": "image/png", @@ -184,7 +488,7 @@ "dataFileName": "13_Geo map_image.png" }, { - "attachmentId": "FDP3JzIVSnuJ", + "attachmentId": "JULizn130rVI", "title": "image.png", "role": "image", "mime": "image/png", @@ -192,7 +496,7 @@ "dataFileName": "14_Geo map_image.png" }, { - "attachmentId": "GhHYO2LteDmZ", + "attachmentId": "MdC0DpifJwu4", "title": "image.png", "role": "image", "mime": "image/png", @@ -200,7 +504,7 @@ "dataFileName": "15_Geo map_image.png" }, { - "attachmentId": "J0baLTpafs7C", + "attachmentId": "gFR2Izzp18LQ", "title": "image.png", "role": "image", "mime": "image/png", @@ -208,7 +512,7 @@ "dataFileName": "16_Geo map_image.png" }, { - "attachmentId": "uYdb9wWf5Nuv", + "attachmentId": "42AncDs7SSAf", "title": "image.png", "role": "image", "mime": "image/png", @@ -216,7 +520,7 @@ "dataFileName": "17_Geo map_image.png" }, { - "attachmentId": "iSpyhQ5Ya6Nk", + "attachmentId": "pKdtiq4r0eFY", "title": "image.png", "role": "image", "mime": "image/png", @@ -224,7 +528,7 @@ "dataFileName": "18_Geo map_image.png" }, { - "attachmentId": "MdC0DpifJwu4", + "attachmentId": "FXRVvYpOxWyR", "title": "image.png", "role": "image", "mime": "image/png", @@ -237,13 +541,13 @@ }, { "isClone": false, - "noteId": "BDEpqZHDS51s", + "noteId": "BhLd0mxKn0gY", "notePath": [ "OkOZllzB3fqN", - "BDEpqZHDS51s" + "BhLd0mxKn0gY" ], - "title": "Working with notes", - "notePosition": 30, + "title": "Shared notes", + "notePosition": 100, "prefix": null, "isExpanded": false, "type": "text", @@ -251,17 +555,17 @@ "attributes": [], "format": "html", "attachments": [], - "dirFileName": "Working with notes", + "dirFileName": "Shared notes", "children": [ { "isClone": false, - "noteId": "13D1lOc9sqmZ", + "noteId": "1DtQ2mHreeOI", "notePath": [ "OkOZllzB3fqN", - "BDEpqZHDS51s", - "13D1lOc9sqmZ" + "BhLd0mxKn0gY", + "1DtQ2mHreeOI" ], - "title": "Exporting as PDF", + "title": "Serving directly the content of a note", "notePosition": 10, "prefix": null, "isExpanded": false, @@ -269,31 +573,23 @@ "mime": "text/html", "attributes": [], "format": "html", - "dataFileName": "Exporting as PDF.html", + "dataFileName": "Serving directly the content o.html", "attachments": [ { - "attachmentId": "b3v1pLE6TF1Y", + "attachmentId": "2zgbdi7zMieM", "title": "image.png", "role": "image", - "mime": "image/png", + "mime": "image/jpg", "position": 10, - "dataFileName": "Exporting as PDF_image.png" + "dataFileName": "Serving directly the conte.png" }, { - "attachmentId": "xsGM34t8ssKV", + "attachmentId": "DsKDaFOcumH6", "title": "image.png", "role": "image", - "mime": "image/png", + "mime": "image/jpg", "position": 10, - "dataFileName": "1_Exporting as PDF_image.png" - }, - { - "attachmentId": "cvyes4f1Vhmm", - "title": "image.png", - "role": "image", - "mime": "image/png", - "position": 10, - "dataFileName": "2_Exporting as PDF_image.png" + "dataFileName": "1_Serving directly the conte.png" } ] } @@ -301,28 +597,89 @@ }, { "isClone": false, - "noteId": "XUG1egT28FBk", + "noteId": "LTnkDnYmmZ7s", "notePath": [ "OkOZllzB3fqN", - "XUG1egT28FBk" + "LTnkDnYmmZ7s" ], - "title": "Power users", - "notePosition": 50, + "title": "Scripting", + "notePosition": 110, "prefix": null, - "isExpanded": true, + "isExpanded": false, "type": "text", "mime": "text/html", "attributes": [], "format": "html", "attachments": [], - "dirFileName": "Power users", + "dirFileName": "Scripting", + "children": [ + { + "isClone": false, + "noteId": "cTWlUHkiv1fB", + "notePath": [ + "OkOZllzB3fqN", + "LTnkDnYmmZ7s", + "cTWlUHkiv1fB" + ], + "title": "Examples", + "notePosition": 10, + "prefix": null, + "isExpanded": true, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "attachments": [], + "dirFileName": "Examples", + "children": [ + { + "isClone": false, + "noteId": "g5Vta7jt3aq3", + "notePath": [ + "OkOZllzB3fqN", + "LTnkDnYmmZ7s", + "cTWlUHkiv1fB", + "g5Vta7jt3aq3" + ], + "title": "Downloading responses from Google Forms", + "notePosition": 10, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "dataFileName": "Downloading responses from Goo.html", + "attachments": [] + } + ] + } + ] + }, + { + "isClone": false, + "noteId": "m4Paddd5qnnQ", + "notePath": [ + "OkOZllzB3fqN", + "m4Paddd5qnnQ" + ], + "title": "Advanced usage", + "notePosition": 120, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "attachments": [], + "dirFileName": "Advanced usage", "children": [ { "isClone": false, "noteId": "DtJJ20yEozPA", "notePath": [ "OkOZllzB3fqN", - "XUG1egT28FBk", + "m4Paddd5qnnQ", "DtJJ20yEozPA" ], "title": "Theme development", @@ -349,7 +706,7 @@ "noteId": "5HH79ztN0fZA", "notePath": [ "OkOZllzB3fqN", - "XUG1egT28FBk", + "m4Paddd5qnnQ", "DtJJ20yEozPA", "5HH79ztN0fZA" ], @@ -372,7 +729,7 @@ "dataFileName": "Creating a custom theme.html", "attachments": [ { - "attachmentId": "bn93hwF7C8sR", + "attachmentId": "AJHVfQtIQgJ7", "title": "image.png", "role": "image", "mime": "image/png", @@ -380,7 +737,7 @@ "dataFileName": "Creating a custom theme_im.png" }, { - "attachmentId": "17p6z24yW5eP", + "attachmentId": "gXLyv5KXjfxg", "title": "image.png", "role": "image", "mime": "image/png", @@ -388,7 +745,7 @@ "dataFileName": "1_Creating a custom theme_im.png" }, { - "attachmentId": "gXLyv5KXjfxg", + "attachmentId": "on1gD7BzCWdN", "title": "image.png", "role": "image", "mime": "image/png", @@ -396,7 +753,7 @@ "dataFileName": "2_Creating a custom theme_im.png" }, { - "attachmentId": "AJHVfQtIQgJ7", + "attachmentId": "17p6z24yW5eP", "title": "image.png", "role": "image", "mime": "image/png", @@ -404,7 +761,7 @@ "dataFileName": "3_Creating a custom theme_im.png" }, { - "attachmentId": "on1gD7BzCWdN", + "attachmentId": "K3cdwj8f90m0", "title": "image.png", "role": "image", "mime": "image/png", @@ -412,7 +769,7 @@ "dataFileName": "4_Creating a custom theme_im.png" }, { - "attachmentId": "K3cdwj8f90m0", + "attachmentId": "bn93hwF7C8sR", "title": "image.png", "role": "image", "mime": "image/png", @@ -426,11 +783,11 @@ "noteId": "aH8Dk5aMiq7R", "notePath": [ "OkOZllzB3fqN", - "XUG1egT28FBk", + "m4Paddd5qnnQ", "DtJJ20yEozPA", "aH8Dk5aMiq7R" ], - "title": "Theme base (legacy vs. next)", + "title": "Customize the Next theme", "notePosition": 20, "prefix": null, "isExpanded": false, @@ -438,23 +795,23 @@ "mime": "text/html", "attributes": [], "format": "html", - "dataFileName": "Theme base (legacy vs. next).html", + "dataFileName": "Customize the Next theme.html", "attachments": [ - { - "attachmentId": "u0zkXkD7rGXA", - "title": "image.png", - "role": "image", - "mime": "image/png", - "position": 10, - "dataFileName": "Theme base (legacy vs. nex.png" - }, { "attachmentId": "5z4bC0x0eH0P", "title": "image.png", "role": "image", "mime": "image/png", "position": 10, - "dataFileName": "1_Theme base (legacy vs. nex.png" + "dataFileName": "Customize the Next theme_i.png" + }, + { + "attachmentId": "u0zkXkD7rGXA", + "title": "image.png", + "role": "image", + "mime": "image/png", + "position": 10, + "dataFileName": "1_Customize the Next theme_i.png" } ] }, @@ -463,7 +820,7 @@ "noteId": "pMq6N1oBV9oo", "notePath": [ "OkOZllzB3fqN", - "XUG1egT28FBk", + "m4Paddd5qnnQ", "DtJJ20yEozPA", "pMq6N1oBV9oo" ], @@ -473,12 +830,160 @@ "isExpanded": false, "type": "text", "mime": "text/html", - "attributes": [], + "attributes": [ + { + "type": "relation", + "name": "internalLink", + "value": "po38jIc0LD2H", + "isInheritable": false, + "position": 10 + } + ], "format": "html", "dataFileName": "Reference.html", "attachments": [] } ] + }, + { + "isClone": false, + "noteId": "po38jIc0LD2H", + "notePath": [ + "OkOZllzB3fqN", + "m4Paddd5qnnQ", + "po38jIc0LD2H" + ], + "title": "Custom resource providers", + "notePosition": 20, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "dataFileName": "Custom resource providers.html", + "attachments": [] + }, + { + "isClone": false, + "noteId": "rGq9oI9hWwGf", + "notePath": [ + "OkOZllzB3fqN", + "m4Paddd5qnnQ", + "rGq9oI9hWwGf" + ], + "title": "REST API", + "notePosition": 30, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "attachments": [], + "dirFileName": "REST API", + "children": [ + { + "isClone": false, + "noteId": "sztusxU10ADE", + "notePath": [ + "OkOZllzB3fqN", + "m4Paddd5qnnQ", + "rGq9oI9hWwGf", + "sztusxU10ADE" + ], + "title": "ETAPI", + "notePosition": 10, + "prefix": null, + "isExpanded": true, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "attachments": [], + "dirFileName": "ETAPI", + "children": [ + { + "isClone": false, + "noteId": "f3xpgx6H01PW", + "notePath": [ + "OkOZllzB3fqN", + "m4Paddd5qnnQ", + "rGq9oI9hWwGf", + "sztusxU10ADE", + "f3xpgx6H01PW" + ], + "title": "API Reference", + "notePosition": 10, + "prefix": null, + "isExpanded": false, + "type": "webView", + "mime": "", + "attributes": [ + { + "type": "label", + "name": "webViewSrc", + "value": "/etapi/docs", + "isInheritable": false, + "position": 10 + } + ], + "dataFileName": "API Reference.dat", + "attachments": [] + } + ] + }, + { + "isClone": false, + "noteId": "9OiEC6pf3Wfv", + "notePath": [ + "OkOZllzB3fqN", + "m4Paddd5qnnQ", + "rGq9oI9hWwGf", + "9OiEC6pf3Wfv" + ], + "title": "Internal API", + "notePosition": 20, + "prefix": null, + "isExpanded": true, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "html", + "attachments": [], + "dirFileName": "Internal API", + "children": [ + { + "isClone": false, + "noteId": "7uB5k0iCmOtZ", + "notePath": [ + "OkOZllzB3fqN", + "m4Paddd5qnnQ", + "rGq9oI9hWwGf", + "9OiEC6pf3Wfv", + "7uB5k0iCmOtZ" + ], + "title": "API Reference", + "notePosition": 10, + "prefix": null, + "isExpanded": false, + "type": "webView", + "mime": "", + "attributes": [ + { + "type": "label", + "name": "webViewSrc", + "value": "/api/docs", + "isInheritable": false, + "position": 10 + } + ], + "dataFileName": "API Reference.dat", + "attachments": [] + } + ] + } + ] } ] } diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Custom resource providers.html b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Custom resource providers.html new file mode 100644 index 000000000..e847d0808 --- /dev/null +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Custom resource providers.html @@ -0,0 +1,56 @@ + + + + + + + + Custom resource providers + + + +
+

Custom resource providers

+ +
+

A custom resource provider allows any file imported into Trilium (images, + fonts, stylesheets) to be publicly accessible via a URL.

+

A potential use case for this is to add embed a custom font alongside + a theme.

+

Steps for creating a custom resource provider

+
    +
  1. Import a file such as an image or a font into Trilium by drag & drop.
  2. +
  3. Select the file and go to the Owned Attributes section.
  4. +
  5. Add the label #customResourceProvider=hello.
  6. +
  7. To test if it is working, use a browser to navigate to <protocol>://<host>/custom/hello (where <protocol> is + either http or https based on your setup, and <host> is + the host or IP to your Trilium server instance). If you are running the + TriliumNext application without a server, use http://localhost:37840 as + the base URL.
  8. +
  9. If everything went well, at the previous step the browser should have + downloaded the file uploaded in the first step.
  10. +
+

Instead of hello, the name can be:

+ +

Using it in a theme

+

For example, if you have a custom font to be imported by the theme, first + upload a font file into Trilium and assign it the #customResourceProvider=fonts/myfont.ttf attribute.

+

Then modify the theme CSS to point to:

@font-face {
+	font-family: customFont;
+	src: url("/custom/fonts/myfont.ttf");
+}
+
+div {
+	font-family: customFont;
+}
+
+
+ + + \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/REST API/ETAPI/API Reference.dat b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/REST API/ETAPI/API Reference.dat new file mode 100644 index 000000000..e69de29bb diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/REST API/Internal API/API Reference.dat b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/REST API/Internal API/API Reference.dat new file mode 100644 index 000000000..e69de29bb diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/2_Creating a custom theme_im.png b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/1_Creating a custom theme_im.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/2_Creating a custom theme_im.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/1_Creating a custom theme_im.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Theme base (legacy vs. nex.png b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/1_Customize the Next theme_i.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Theme base (legacy vs. nex.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/1_Customize the Next theme_i.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/4_Creating a custom theme_im.png b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/2_Creating a custom theme_im.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/4_Creating a custom theme_im.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/2_Creating a custom theme_im.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/1_Creating a custom theme_im.png b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/3_Creating a custom theme_im.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/1_Creating a custom theme_im.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/3_Creating a custom theme_im.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/5_Creating a custom theme_im.png b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/4_Creating a custom theme_im.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/5_Creating a custom theme_im.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/4_Creating a custom theme_im.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Creating a custom theme_im.png b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/5_Creating a custom theme_im.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Creating a custom theme_im.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/5_Creating a custom theme_im.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Creating a custom theme.html b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Creating a custom theme.html similarity index 87% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Creating a custom theme.html rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Creating a custom theme.html index e4d1eeda4..d2dc5fea7 100644 --- a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Creating a custom theme.html +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Creating a custom theme.html @@ -19,7 +19,7 @@ keep them into one place.

As such, the first step is to create a new note to gather all the themes.

- +

Step 2. Create the theme

@@ -32,7 +32,7 @@
-
@@ -42,7 +42,7 @@
-
@@ -51,7 +51,7 @@
-
@@ -72,15 +72,15 @@

Refresh the application (Ctrl+Shift+R is a good way to do so) and go to settings. You should see the newly created theme:

- +

Afterwards the application will refresh itself with the new theme:

- +

Do note that the theme will be based off of the legacy theme. To override that and base the theme on the new TriliumNext theme, see: Theme base (legacy vs. next) + href="Customize%20the%20Next%20theme.html">Theme base (legacy vs. next)

Step 5. Making changes

Simply go back to the note and change according to needs. To apply the diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/3_Creating a custom theme_im.png b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Creating a custom theme_im.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/3_Creating a custom theme_im.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Creating a custom theme_im.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Theme base (legacy vs. next).html b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Customize the Next theme.html similarity index 78% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Theme base (legacy vs. next).html rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Customize the Next theme.html index d392deed4..cd0a47f0b 100644 --- a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Theme base (legacy vs. next).html +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Customize the Next theme.html @@ -5,20 +5,20 @@ - Theme base (legacy vs. next) + Customize the Next theme

-

Theme base (legacy vs. next)

+

Customize the Next theme

By default, any custom theme will be based on the legacy light theme. - To change the TriliumNext theme instead, add the #appThemeBase=next attribute + To use the TriliumNext theme instead, add the #appThemeBase=next attribute onto the existing theme. The appTheme attribute must also be present.

- +

When appThemeBase is set to next it will use the “TriliumNext (auto)” theme. Any other value is ignored and will use the diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/1_Theme base (legacy vs. nex.png b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Customize the Next theme_i.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/1_Theme base (legacy vs. nex.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Customize the Next theme_i.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Reference.html b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Reference.html similarity index 93% rename from src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Reference.html rename to src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Reference.html index 13af6494e..e858513c1 100644 --- a/src/public/app/doc_notes/en/User Guide/User Guide/Power users/Theme development/Reference.html +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Advanced usage/Theme development/Reference.html @@ -122,6 +122,11 @@ body.electron:not(.native-titlebar) { height: 3px; background-color: var(--workspace-tab-background-color); } +

Custom fonts

+

Currently the only way to include a custom font is to use Custom resource providers. + Basically import a font into Trilium and assign it #customResourceProvider=fonts/myfont.ttf and + then import the font in CSS via /custom/fonts/myfont.ttf.

diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Working with notes/2_Exporting as PDF_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/1_Export as PDF_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Working with notes/2_Exporting as PDF_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Features/1_Export as PDF_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Features/1_Zen mode_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/1_Zen mode_image.png new file mode 100644 index 000000000..c1a3e8124 Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Features/1_Zen mode_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Working with notes/Exporting as PDF_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/2_Export as PDF_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Working with notes/Exporting as PDF_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Features/2_Export as PDF_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Features/2_Zen mode_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/2_Zen mode_image.png new file mode 100644 index 000000000..0c9f26de0 Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Features/2_Zen mode_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Features/3_Zen mode_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/3_Zen mode_image.png new file mode 100644 index 000000000..530d76afb Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Features/3_Zen mode_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Features/4_Zen mode_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/4_Zen mode_image.png new file mode 100644 index 000000000..d2698b715 Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Features/4_Zen mode_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Features/5_Zen mode_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/5_Zen mode_image.png new file mode 100644 index 000000000..9f693475f Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Features/5_Zen mode_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Features/6_Zen mode_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/6_Zen mode_image.png new file mode 100644 index 000000000..c2543960a Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Features/6_Zen mode_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Features/7_Zen mode_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/7_Zen mode_image.png new file mode 100644 index 000000000..d23b671da Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Features/7_Zen mode_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Working with notes/Exporting as PDF.html b/src/public/app/doc_notes/en/User Guide/User Guide/Features/Export as PDF.html similarity index 78% rename from src/public/app/doc_notes/en/User Guide/User Guide/Working with notes/Exporting as PDF.html rename to src/public/app/doc_notes/en/User Guide/User Guide/Features/Export as PDF.html index 045180d5f..1c4337360 100644 --- a/src/public/app/doc_notes/en/User Guide/User Guide/Working with notes/Exporting as PDF.html +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Features/Export as PDF.html @@ -5,32 +5,35 @@ - Exporting as PDF + Export as PDF
-

Exporting as PDF

+

Export as PDF

-
- +
+ +
Screenshot of the note contextual menu indicating the “Export as PDF” + option.

On the desktop application of Trilium it is possible to export a note as PDF. On the server or PWA (mobile), the option is not available due to technical constraints and it will be hidden.

To print a note, select the - button to the right of the note and select Export as PDF.

Afterwards you will be prompted to select where to save the PDF file. - Upon confirmation, the resulting PDF will be opened automatically.

+ Upon confirmation, the resulting PDF will be opened automatically using + the default/system application configured for PDFs.

Should you encounter any visual issues in the resulting PDF file (e.g. a table does not fit properly, there is cut off text, etc.) feel free to report the issue. In this case, it's best to offer a sample note (click on the - button, select Export note → This note and all of its descendants → HTML + button, select Export note → This note and all of its descendants → HTML in ZIP archive). Make sure not to accidentally leak any personal information.

Landscape mode

When exporting to PDF, there are no customizable settings such as page diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Working with notes/1_Exporting as PDF_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/Export as PDF_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Working with notes/1_Exporting as PDF_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Features/Export as PDF_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Features/Zen mode.html b/src/public/app/doc_notes/en/User Guide/User Guide/Features/Zen mode.html new file mode 100644 index 000000000..9792a7d32 --- /dev/null +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Features/Zen mode.html @@ -0,0 +1,73 @@ + + + + + + + + Zen mode + + + +

+

Zen mode

+ +
+
+ +
Screenshot of Zen Mode activated on a Windows 11 system with native title + bar off and background effects on.
+
+

When Zen Mode is activated (pictured on the side), most of the user interface + of Trilium is hidden away in order to be able to focus on the content, + whether it's for reading or writing.

+
+ +
Screenshot of the Zen Mode option in the global menu.
+
+

Activating & deactivating

+

The Zen Mode can be activated by accessing the global menu and selecting + the “Zen Mode” option:

+

Aside from the global menu, it's also possible to activate this mode by + using a keyboard shortcut which is Alt+Z by default. Look for toggleZenMode in + the shortcut configuration.

+

Once Zen Mode is activated, all the UI elements of the application will + be hidden away, including the global menu. In that case, the Zen Mode can + be deactivated either by pressing the + icon in the top-right corner of the window or by pressing the keyboard + combination again.

+

Do note that, by design, activating or deactivating the Zen Mode applies + only to the current window. Restarting the application will also disable + the Zen Mode.

+

Moving the window around

+

If “Native title bar” is activated, then the operating system's default + title bar can be used to drag the window around. If deactivated, the window + can still be moved by dragging the mouse across the top part of the window + where the note titles are.

+
+ +
Screenshot of two notes side-by-side while Zen Mode is active, on Windows + 11 with background effects off.
+
+

Split windows and tabs

+

Tabs are completely hidden, however it's still possible to use keyboard + shortcuts such as firstTab (Ctrl+1 by default), secondTab (Ctrl+2 + by default). There are also some newer shortcuts such as activateNextTab (Ctrl+Tab) + or activatePreviousTab (Ctrl+Shift+Tab) that allow easy navigation, + however make sure that they are configured properly in the settings.

+

For the split view of notes, there are no keyboard shortcuts at the time + of writing, but it's still possible to have them in Zen Mode by creating + the split while the Zen Mode is off and then reactivating it afterwards.

+

 

+

 

+
+
+ + + \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Features/Zen mode_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Features/Zen mode_image.png new file mode 100644 index 000000000..675a068aa Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Features/Zen mode_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation.html b/src/public/app/doc_notes/en/User Guide/User Guide/Installation.html new file mode 100644 index 000000000..058f84feb --- /dev/null +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Installation.html @@ -0,0 +1,38 @@ + + + + + + + + Installation + + + +
+

Installation

+ +
+

Desktop application

+
+ + + + + + +
+
+ +
+

Fedora +

+
+
+

Self-hosted server

+
+
+ + + \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation/1_On Fedora Linux_Screenshot.png b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/1_On Fedora Linux_Screenshot.png new file mode 100644 index 000000000..d519f9b75 Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/1_On Fedora Linux_Screenshot.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation/1_On Fedora Linux_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/1_On Fedora Linux_image.png new file mode 100644 index 000000000..f3fcbfcb5 Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/1_On Fedora Linux_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation/2_On Fedora Linux_Screenshot.png b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/2_On Fedora Linux_Screenshot.png new file mode 100644 index 000000000..d7370a422 Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/2_On Fedora Linux_Screenshot.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation/2_On Fedora Linux_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/2_On Fedora Linux_image.png new file mode 100644 index 000000000..b69b71d3c Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/2_On Fedora Linux_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation/3_On Fedora Linux_Screenshot.png b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/3_On Fedora Linux_Screenshot.png new file mode 100644 index 000000000..6c3589ca4 Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/3_On Fedora Linux_Screenshot.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation/On Fedora Linux.html b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/On Fedora Linux.html new file mode 100644 index 000000000..88ad36272 --- /dev/null +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/On Fedora Linux.html @@ -0,0 +1,82 @@ + + + + + + + + On Fedora Linux + + + +
+

On Fedora Linux

+ +
+

First, download a release from GitHub.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1 +
+ +
+
In your file explorer, look for the .rpm file of TriliumNext.
2 +
+ +
+
Right click the file and select Open With Software Install.
3 +
+ +
+
+

GNOME Software will appear. Press the + .

+

You will be asked to confirm the action by entering your password.

+

After confirmation the software will start installing.

+

Once it's done the “Install” button will turn into + .

+
4 +
+ +
+
After installation, the application will be available in the GNOME overview + section.
+
+
+
+ + + \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation/On Fedora Linux_Screenshot.png b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/On Fedora Linux_Screenshot.png new file mode 100644 index 000000000..fb0ce66ef Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/On Fedora Linux_Screenshot.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation/On Fedora Linux_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/On Fedora Linux_image.png new file mode 100644 index 000000000..5791f83ef Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Installation/On Fedora Linux_image.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Installation_Fedora_logo.svg b/src/public/app/doc_notes/en/User Guide/User Guide/Installation_Fedora_logo.svg new file mode 100644 index 000000000..1ad9c15c8 --- /dev/null +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Installation_Fedora_logo.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/10_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/10_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/3_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/11_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/3_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/11_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/9_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/12_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/9_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/12_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/13_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/13_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/13_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/13_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/4_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/14_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/4_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/14_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/19_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/15_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/19_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/15_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/8_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/16_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/8_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/16_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/12_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/17_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/12_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/17_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/10_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/18_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/10_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/18_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/11_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/19_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/11_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/19_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/5_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/1_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/5_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/1_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/14_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/2_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/14_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/2_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/1_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/3_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/1_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/3_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/7_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/4_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/7_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/4_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/2_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/5_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/2_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/5_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/18_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/6_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/18_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/6_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/6_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/7_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/6_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/7_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/17_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/8_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/17_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/8_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/15_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/9_Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/15_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/9_Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/Geo map.html b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/Geo map.html similarity index 80% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/Geo map.html rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/Geo map.html index bcaf6d7b7..65d8ee517 100644 --- a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/Geo map.html +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/Geo map.html @@ -26,7 +26,7 @@ 1
-
@@ -36,7 +36,7 @@ 2
-
@@ -51,8 +51,8 @@
  • Use the mouse wheel, two-finger gesture on a touchpad or the +/- buttons on the top-left to adjust the zoom.
  • -

    The position on the map and the zoom are saved inside the map note. When - visting again the note it will restore this position.

    +

    The position on the map and the zoom are saved inside the map note and + restored when visiting again the note.

    Adding a marker using the map

    @@ -69,18 +69,18 @@

    To create a marker, first navigate to the desired point on the map. Then press the button on the top-right of the map.

    + src="5_Geo map_image.png" width="72" height="66">button on the top-right of the map.

    If the button is not visible, make sure the button section is visible by pressing the chevron button ( ) in the top-right of the map.

    + src="11_Geo map_image.png" width="72" height="66">) in the top-right of the map.

    2
    -

     

    @@ -96,7 +96,7 @@
    3
    -

     

    @@ -107,7 +107,7 @@
    4
    -

     

    @@ -118,6 +118,15 @@
    +

    How the location of the markers is stored

    +

    The location of a marker is stored in the #geolocation attribute + of the child notes:

    +
    + +
    +

    This value can be added manually if needed. The value of the attribute + is made up of the latitude and longitude separated by a comma.

    Repositioning markers

    It's possible to reposition existing markers by simply drag and dropping them to the new destination.

    @@ -125,13 +134,30 @@

    If moved by mistake, there is currently no way to undo the change. If the mouse was not yet released, it's possible to force a refresh of the page (Ctrl+R or Meta+R) to cancel it.

    -

    Adding the geolocation manually

    -

    The location of a marker is stored in the #geolocation attribute - of the child notes:

    -
    - -
    +

    Interaction with the markers

    +
      +
    • Hovering over a marker will display the content of the note it belongs + to. +
        +
      • Clicking on the note title in the tooltip will navigate to the note in + the current view.
      • +
      +
    • +
    • Middle-clicking the marker will open the note in a new tab.
    • +
    • Right-clicking the marker will open a contextual menu allowing: +
        +
      • Opening the note in a new tab, split or window.
      • +
      • Opening the location using an external application (if the operating system + supports it).
      • +
      • Removing the marker from the map, which will remove the #geolocation attribute + of the note. To add it back again, the coordinates have to be manually + added back in.
      • +
      +
    • +
    +

    Adding the coordinates manually

    +

    In a nutshell, create a child note and set the #geolocation attribute + to the coordinates.

    The value of the attribute is made up of the latitude and longitude separated by a comma.

    Adding from Google Maps

    @@ -142,7 +168,7 @@ 1
    -
    @@ -159,7 +185,7 @@ 2
    -
    @@ -173,7 +199,7 @@ 3
    -
    @@ -199,7 +225,7 @@ 1
    -
    @@ -224,7 +250,7 @@ 3
    -
    @@ -249,7 +275,7 @@ 1
    -
    @@ -260,7 +286,7 @@ 2
    -
    @@ -271,7 +297,7 @@ 3
    -
    diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/16_Geo map_image.png b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/Geo map_image.png similarity index 100% rename from src/public/app/doc_notes/en/User Guide/User Guide/Types of notes/16_Geo map_image.png rename to src/public/app/doc_notes/en/User Guide/User Guide/Note Types/Geo map_image.png diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/Mermaid Diagram.html b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/Mermaid Diagram.html new file mode 100644 index 000000000..bbe5d76cc --- /dev/null +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Note Types/Mermaid Diagram.html @@ -0,0 +1,19 @@ + + + + + + + + Mermaid Diagram + + + +
    +

    Mermaid Diagram

    + +
    +
    + + + \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Scripting/Examples/Downloading responses from Goo.html b/src/public/app/doc_notes/en/User Guide/User Guide/Scripting/Examples/Downloading responses from Goo.html new file mode 100644 index 000000000..7e4955655 --- /dev/null +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Scripting/Examples/Downloading responses from Goo.html @@ -0,0 +1,19 @@ + + + + + + + + Downloading responses from Google Forms + + + +
    +

    Downloading responses from Google Forms

    + +
    +
    + + + \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Shared notes/1_Serving directly the conte.png b/src/public/app/doc_notes/en/User Guide/User Guide/Shared notes/1_Serving directly the conte.png new file mode 100644 index 000000000..bab0f97f5 Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Shared notes/1_Serving directly the conte.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Shared notes/Serving directly the conte.png b/src/public/app/doc_notes/en/User Guide/User Guide/Shared notes/Serving directly the conte.png new file mode 100644 index 000000000..981a43146 Binary files /dev/null and b/src/public/app/doc_notes/en/User Guide/User Guide/Shared notes/Serving directly the conte.png differ diff --git a/src/public/app/doc_notes/en/User Guide/User Guide/Shared notes/Serving directly the content o.html b/src/public/app/doc_notes/en/User Guide/User Guide/Shared notes/Serving directly the content o.html new file mode 100644 index 000000000..d64d24e2e --- /dev/null +++ b/src/public/app/doc_notes/en/User Guide/User Guide/Shared notes/Serving directly the content o.html @@ -0,0 +1,60 @@ + + + + + + + + Serving directly the content of a note + + + +
    +

    Serving directly the content of a note

    + +
    +

    When accessing a shared note, Trilium will render it as a web page. Sometimes + it's desirable to serve the content directly so that it can be used in + a script or downloaded by the user.

    +
    + + + + + + + + + + + +
    +
    + +
    A note displayed as a web page (HTML)
    +
    +
    +
    + +
    A note displayed as a raw format
    +
    +
    +
    +

    By adding an attribute to the note

    +

    Simply add the #shareRaw attribute and the note will always + be rendered raw when accessed from the share URL.

    +

    By altering the URL

    +

    Append ?raw to the URL to display a note in its raw format + regardless of whether the #shareRaw attribute is added on the + note.

    +

    + +

    +

     

    +
    +
    + + + \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/index.html b/src/public/app/doc_notes/en/User Guide/index.html index bac353ead..fc49dc742 100644 --- a/src/public/app/doc_notes/en/User Guide/index.html +++ b/src/public/app/doc_notes/en/User Guide/index.html @@ -6,6 +6,6 @@ - + \ No newline at end of file diff --git a/src/public/app/doc_notes/en/User Guide/navigation.html b/src/public/app/doc_notes/en/User Guide/navigation.html index ddf57d958..77cf9ca53 100644 --- a/src/public/app/doc_notes/en/User Guide/navigation.html +++ b/src/public/app/doc_notes/en/User Guide/navigation.html @@ -9,34 +9,82 @@
    • User Guide diff --git a/src/public/app/widgets/ribbon_widgets/book_properties.js b/src/public/app/widgets/ribbon_widgets/book_properties.ts similarity index 80% rename from src/public/app/widgets/ribbon_widgets/book_properties.js rename to src/public/app/widgets/ribbon_widgets/book_properties.ts index efc49d142..6bb66dd1f 100644 --- a/src/public/app/widgets/ribbon_widgets/book_properties.js +++ b/src/public/app/widgets/ribbon_widgets/book_properties.ts @@ -1,6 +1,8 @@ import NoteContextAwareWidget from "../note_context_aware_widget.js"; import attributeService from "../../services/attributes.js"; import { t } from "../../services/i18n.js"; +import type FNote from "../../entities/fnote.js"; +import type { EventData } from "../../components/app_context.js"; const TPL = `
      @@ -9,7 +11,7 @@ const TPL = ` padding: 12px 12px 6px 12px; display: flex; } - + .book-properties-widget > * { margin-right: 15px; } @@ -17,19 +19,19 @@ const TPL = `
      ${t("book_properties.view_type")}:    - +
      - + @@ -37,13 +39,18 @@ const TPL = ` class="expand-children-button btn btn-sm" title="${t("book_properties.expand_all_children")}"> - + ${t("book_properties.expand")}
      `; export default class BookPropertiesWidget extends NoteContextAwareWidget { + + private $viewTypeSelect!: JQuery; + private $expandChildrenButton!: JQuery; + private $collapseAllButton!: JQuery; + get name() { return "bookProperties"; } @@ -70,11 +77,15 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget { this.contentSized(); this.$viewTypeSelect = this.$widget.find(".view-type-select"); - this.$viewTypeSelect.on("change", () => this.toggleViewType(this.$viewTypeSelect.val())); + this.$viewTypeSelect.on("change", () => this.toggleViewType(String(this.$viewTypeSelect.val()))); this.$expandChildrenButton = this.$widget.find(".expand-children-button"); this.$expandChildrenButton.on("click", async () => { - if (!this.note.isLabelTruthy("expanded")) { + if (!this.noteId || !this.note) { + return; + } + + if (!this.note?.isLabelTruthy("expanded")) { await attributeService.addLabel(this.noteId, "expanded"); } @@ -83,6 +94,10 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget { this.$collapseAllButton = this.$widget.find(".collapse-all-button"); this.$collapseAllButton.on("click", async () => { + if (!this.noteId || !this.note) { + return; + } + // owned is important - we shouldn't remove inherited expanded labels for (const expandedAttr of this.note.getOwnedLabels("expanded")) { await attributeService.removeAttributeById(this.noteId, expandedAttr.attributeId); @@ -92,7 +107,11 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget { }); } - async refreshWithNote(note) { + async refreshWithNote(note: FNote) { + if (!this.note) { + return; + } + const viewType = this.note.getLabelValue("viewType") || "grid"; this.$viewTypeSelect.val(viewType); @@ -101,7 +120,11 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget { this.$collapseAllButton.toggle(viewType === "list"); } - async toggleViewType(type) { + async toggleViewType(type: string) { + if (!this.noteId) { + return; + } + if (type !== "list" && type !== "grid") { throw new Error(t("book_properties.invalid_view_type", { type })); } @@ -109,7 +132,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget { await attributeService.setLabel(this.noteId, "viewType", type); } - entitiesReloadedEvent({ loadResults }) { + entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { if (loadResults.getAttributeRows().find((attr) => attr.noteId === this.noteId && attr.name === "viewType")) { this.refresh(); } diff --git a/src/public/translations/ro/translation.json b/src/public/translations/ro/translation.json index eabe682d1..a7515c183 100644 --- a/src/public/translations/ro/translation.json +++ b/src/public/translations/ro/translation.json @@ -231,7 +231,7 @@ "workspace_tab_background_color": "Culoare CSS ce va fi folosită în tab-urile ce aparțin spațiului de lucru", "workspace_template": "Această notița va apărea în lista de șabloane când se crează o nouă notiță, dar doar când spațiul de lucru în care se află notița este focalizat", "app_theme_base": "setați valoarea la „next” pentru a folosi drept temă de bază „TriliumNext” în loc de cea clasică.", - "print_landscape": "Schimbă orientarea paginii din portret în peisaj atunci când se exportă în PDF.", + "print_landscape": "Schimbă orientarea paginii din portret în vedere atunci când se exportă în PDF.", "print_page_size": "Schimbă dimensiunea paginii când se exportă în PDF. Valori suportate: A0, A1, A2, A3, A4, A5, A6, Legal, Letter, Tabloid, Ledger." }, "attribute_editor": { diff --git a/src/routes/api/app_info.ts b/src/routes/api/app_info.ts index 560a52d1f..fb2f84aec 100644 --- a/src/routes/api/app_info.ts +++ b/src/routes/api/app_info.ts @@ -13,6 +13,7 @@ import appInfo from "../../services/app_info.js"; * url: https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/app_info.ts * responses: * '200': + * description: Installation info * content: * application/json: * schema: diff --git a/src/routes/api/branches.ts b/src/routes/api/branches.ts index b9c5f751d..b81d0cfc0 100644 --- a/src/routes/api/branches.ts +++ b/src/routes/api/branches.ts @@ -186,6 +186,51 @@ function setExpandedForSubtree(req: Request) { }; } +/** + * @swagger + * /api/branches/{branchId}: + * delete: + * summary: Delete branch (note clone) + * operationId: branches-delete + * parameters: + * - name: branchId + * in: path + * required: true + * schema: + * $ref: "#/components/schemas/BranchId" + * - name: taskId + * in: query + * required: true + * schema: + * type: string + * description: Task group identifier + * - name: eraseNotes + * in: query + * schema: + * type: boolean + * required: false + * description: Whether to erase the note immediately + * - name: last + * in: query + * schema: + * type: boolean + * required: true + * description: Whether this is the last request of this task group + * responses: + * '200': + * description: Branch successfully deleted + * content: + * application/json: + * schema: + * type: object + * properties: + * noteDeleted: + * type: boolean + * description: Whether the last note clone was deleted + * security: + * - session: [] + * tags: ["data"] + */ function deleteBranch(req: Request) { const last = req.query.last === "true"; const eraseNotes = req.query.eraseNotes === "true"; diff --git a/src/routes/api/notes.ts b/src/routes/api/notes.ts index 9f1dc5e41..853032938 100644 --- a/src/routes/api/notes.ts +++ b/src/routes/api/notes.ts @@ -14,14 +14,85 @@ import type { Request } from "express"; import type BBranch from "../../becca/entities/bbranch.js"; import type { AttributeRow } from "../../becca/entities/rows.js"; +/** + * @swagger + * /api/notes/{noteId}: + * get: + * summary: Retrieve note metadata + * operationId: notes-get + * parameters: + * - name: noteId + * in: path + * required: true + * schema: + * $ref: "#/components/schemas/NoteId" + * responses: + * '200': + * description: Note metadata + * content: + * application/json: + * schema: + * allOf: + * - $ref: '#/components/schemas/Note' + * - $ref: "#/components/schemas/Timestamps" + * security: + * - session: [] + * tags: ["data"] + */ function getNote(req: Request) { return becca.getNoteOrThrow(req.params.noteId); } +/** + * @swagger + * /api/notes/{noteId}/blob: + * get: + * summary: Retrieve note content + * operationId: notes-blob + * parameters: + * - name: noteId + * in: path + * required: true + * schema: + * $ref: "#/components/schemas/NoteId" + * responses: + * '304': + * description: Note content + * content: + * application/json: + * schema: + * $ref: '#/components/schemas/Blob' + * security: + * - session: [] + * tags: ["data"] + */ function getNoteBlob(req: Request) { return blobService.getBlobPojo("notes", req.params.noteId); } +/** + * @swagger + * /api/notes/{noteId}/metadata: + * get: + * summary: Retrieve note metadata (limited to timestamps) + * operationId: notes-metadata + * parameters: + * - name: noteId + * in: path + * required: true + * schema: + * $ref: "#/components/schemas/NoteId" + * responses: + * '200': + * description: Note metadata + * content: + * application/json: + * schema: + * $ref: "#/components/schemas/Timestamps" + * security: + * - session: [] + * tags: ["data"] + */ function getNoteMetadata(req: Request) { const note = becca.getNoteOrThrow(req.params.noteId); @@ -62,6 +133,43 @@ function updateNoteData(req: Request) { return noteService.updateNoteData(noteId, content, attachments); } +/** + * @swagger + * /api/notes/{noteId}: + * delete: + * summary: Delete note + * operationId: notes-delete + * parameters: + * - name: noteId + * in: path + * required: true + * schema: + * $ref: "#/components/schemas/NoteId" + * - name: taskId + * in: query + * required: true + * schema: + * type: string + * description: Task group identifier + * - name: eraseNotes + * in: query + * schema: + * type: boolean + * required: false + * description: Whether to erase the note immediately + * - name: last + * in: query + * schema: + * type: boolean + * required: true + * description: Whether this is the last request of this task group + * responses: + * '200': + * description: Note successfully deleted + * security: + * - session: [] + * tags: ["data"] + */ function deleteNote(req: Request) { const noteId = req.params.noteId; const taskId = req.query.taskId; diff --git a/src/routes/api/openapi.json b/src/routes/api/openapi.json new file mode 100644 index 000000000..3034c7e13 --- /dev/null +++ b/src/routes/api/openapi.json @@ -0,0 +1 @@ +{"openapi":"3.1.1","info":{"title":"Trilium Notes - Sync server API","version":"0.96.6","description":"This is the internal sync server API used by Trilium Notes / TriliumNext Notes.\n\n_If you're looking for the officially supported External Trilium API, see [here](https://triliumnext.github.io/Docs/Wiki/etapi.html)._\n\nThis page does not yet list all routes. For a full list, see the [route controller](https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/routes.ts).","contact":{"name":"TriliumNext issue tracker","url":"https://github.com/TriliumNext/Notes/issues"},"license":{"name":"GNU Free Documentation License 1.3 (or later)","url":"https://www.gnu.org/licenses/fdl-1.3"}},"paths":{"/api/setup/sync-seed":{"get":{"tags":["auth"],"summary":"Sync documentSecret value","description":"First step to logging in.","operationId":"setup-sync-seed","responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"type":"object","properties":{"syncVersion":{"type":"integer","example":34},"options":{"type":"object","properties":{"documentSecret":{"type":"string"}}}}}}}}},"security":[{"user-password":[]}]}},"/api/app-info":{"get":{"summary":"Get installation info","operationId":"app-info","externalDocs":{"description":"Server implementation","url":"https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/app_info.ts"},"responses":{"200":{"description":"Installation info","content":{"application/json":{"schema":{"type":"object","properties":{"appVersion":{"type":"string","example":"0.91.6"},"dbVersion":{"type":"integer","example":228},"nodeVersion":{"type":"string","description":"value of process.version"},"syncVersion":{"type":"integer","example":34},"buildDate":{"type":"string","example":"2024-09-07T18:36:34Z"},"buildRevision":{"type":"string","example":"7c0d6930fa8f20d269dcfbcbc8f636a25f6bb9a7"},"dataDirectory":{"type":"string","example":"/var/lib/trilium"},"clipperProtocolVersion":{"type":"string","example":"1.0"},"utcDateTime":{"$ref":"#/components/schemas/UtcDateTime"}}}}}}},"security":[{"session":[]}]}},"/api/branches/{branchId}":{"delete":{"summary":"Delete branch (note clone)","operationId":"branches-delete","parameters":[{"name":"branchId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BranchId"}},{"name":"taskId","in":"query","required":true,"schema":{"type":"string"},"description":"Task group identifier"},{"name":"eraseNotes","in":"query","schema":{"type":"boolean"},"required":false,"description":"Whether to erase the note immediately"},{"name":"last","in":"query","schema":{"type":"boolean"},"required":true,"description":"Whether this is the last request of this task group"}],"responses":{"200":{"description":"Branch successfully deleted","content":{"application/json":{"schema":{"type":"object","properties":{"noteDeleted":{"type":"boolean","description":"Whether the last note clone was deleted"}}}}}}},"security":[{"session":[]}],"tags":["data"]}},"/api/login/sync":{"post":{"tags":["auth"],"summary":"Log in using documentSecret","description":"The `hash` parameter is computed using a HMAC of the `documentSecret` and `timestamp`.","operationId":"login-sync","externalDocs":{"description":"HMAC calculation","url":"https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/utils.ts#L62-L66"},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"timestamp":{"$ref":"#/components/schemas/UtcDateTime"},"hash":{"type":"string"},"syncVersion":{"type":"integer","example":34}}}}}},"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"type":"object","properties":{"syncVersion":{"type":"integer","example":34},"options":{"type":"object","properties":{"documentSecret":{"type":"string"}}}}}}}},"400":{"description":"Sync version / document secret mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Non-matching sync versions, local is version ${server syncVersion}, remote is ${requested syncVersion}. It is recommended to run same version of Trilium on both sides of sync"}}}}}},"401":{"description":"Timestamp mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Auth request time is out of sync, please check that both client and server have correct time. The difference between clocks has to be smaller than 5 minutes"}}}}}}}}},"/api/notes/{noteId}":{"get":{"summary":"Retrieve note metadata","operationId":"notes-get","parameters":[{"name":"noteId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/NoteId"}}],"responses":{"200":{"description":"Note metadata","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Note"},{"$ref":"#/components/schemas/Timestamps"}]}}}}},"security":[{"session":[]}],"tags":["data"]},"delete":{"summary":"Delete note","operationId":"notes-delete","parameters":[{"name":"noteId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/NoteId"}},{"name":"taskId","in":"query","required":true,"schema":{"type":"string"},"description":"Task group identifier"},{"name":"eraseNotes","in":"query","schema":{"type":"boolean"},"required":false,"description":"Whether to erase the note immediately"},{"name":"last","in":"query","schema":{"type":"boolean"},"required":true,"description":"Whether this is the last request of this task group"}],"responses":{"200":{"description":"Note successfully deleted"}},"security":[{"session":[]}],"tags":["data"]}},"/api/notes/{noteId}/blob":{"get":{"summary":"Retrieve note content","operationId":"notes-blob","parameters":[{"name":"noteId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/NoteId"}}],"responses":{"304":{"description":"Note content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Blob"}}}}},"security":[{"session":[]}],"tags":["data"]}},"/api/notes/{noteId}/metadata":{"get":{"summary":"Retrieve note metadata (limited to timestamps)","operationId":"notes-metadata","parameters":[{"name":"noteId","in":"path","required":true,"schema":{"$ref":"#/components/schemas/NoteId"}}],"responses":{"200":{"description":"Note metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Timestamps"}}}}},"security":[{"session":[]}],"tags":["data"]}},"/api/sync/changed":{"get":{"summary":"Pull sync changes","operationId":"sync-changed","externalDocs":{"description":"Server implementation","url":"https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/api/sync.ts"},"parameters":[{"in":"query","name":"instanceId","required":true,"schema":{"type":"string"},"description":"Local instance ID"},{"in":"query","name":"lastEntityChangeId","required":true,"schema":{"type":"integer"},"description":"Last locally present change ID"},{"in":"query","name":"logMarkerId","required":true,"schema":{"type":"string"},"description":"Marker to identify this request in server log"}],"responses":{"200":{"description":"Sync changes, limited to approximately one megabyte.","content":{"application/json":{"schema":{"type":"object","properties":{"entityChanges":{"type":"list","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","example":42,"description":"Number of changes not yet returned by the remote."}}}}}}},"security":[{"session":[]}],"tags":["sync"]}},"/api/sync/update":{"put":{"summary":"Push sync changes","description":"Basic usage: set `pageCount = 1`, `pageIndex = 0`, and omit `requestId`. Supply your entity changes in the request body.","operationId":"sync-update","externalDocs":{"description":"Server implementation","url":"https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/api/sync.ts"},"parameters":[{"in":"header","name":"pageCount","required":true,"schema":{"type":"integer"}},{"in":"header","name":"pageIndex","required":true,"schema":{"type":"integer"}},{"in":"header","name":"requestId","schema":{"type":"string","description":"ID to identify paginated requests"}},{"in":"query","name":"logMarkerId","required":true,"schema":{"type":"string"},"description":"Marker to identify this request in server log"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"instanceId":{"type":"string","description":"Local instance ID"},"entities":{"type":"list","items":{"$ref":"#/components/schemas/EntityChange"}}}}}}},"responses":{"200":{"description":"Changes processed successfully"}},"security":[{"session":[]}],"tags":["sync"]}},"/api/tree":{"get":{"summary":"Retrieve tree data","operationId":"tree","externalDocs":{"description":"Server implementation","url":"https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/api/tree.ts"},"parameters":[{"in":"query","name":"subTreeNoteId","required":false,"schema":{"type":"string"},"description":"Limit tree data to this note and descendants"}],"responses":{"200":{"description":"Notes, branches and attributes","content":{"application/json":{"schema":{"type":"object","properties":{"branches":{"type":"list","items":{"$ref":"#/components/schemas/Branch"}},"notes":{"type":"list","items":{"$ref":"#/components/schemas/Note"}},"attributes":{"type":"list","items":{"$ref":"#/components/schemas/Attribute"}}}}}}}},"security":[{"session":[]}],"tags":["data"]}}},"components":{},"tags":[]} \ No newline at end of file diff --git a/src/routes/api/sync.ts b/src/routes/api/sync.ts index d157fb4ed..736e1e97b 100644 --- a/src/routes/api/sync.ts +++ b/src/routes/api/sync.ts @@ -86,6 +86,58 @@ function forceFullSync() { syncService.sync(); } +/** + * @swagger + * /api/sync/changed: + * get: + * summary: Pull sync changes + * operationId: sync-changed + * externalDocs: + * description: Server implementation + * url: https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/api/sync.ts + * parameters: + * - in: query + * name: instanceId + * required: true + * schema: + * type: string + * description: Local instance ID + * - in: query + * name: lastEntityChangeId + * required: true + * schema: + * type: integer + * description: Last locally present change ID + * - in: query + * name: logMarkerId + * required: true + * schema: + * type: string + * description: Marker to identify this request in server log + * responses: + * '200': + * description: Sync changes, limited to approximately one megabyte. + * content: + * application/json: + * schema: + * type: object + * properties: + * entityChanges: + * type: list + * 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 + * example: 42 + * description: Number of changes not yet returned by the remote. + * security: + * - session: [] + * tags: + * - sync + */ function getChanged(req: Request) { const startTime = Date.now(); @@ -151,6 +203,60 @@ const partialRequests: Record< } > = {}; +/** + * @swagger + * /api/sync/update: + * put: + * summary: Push sync changes + * description: + * "Basic usage: set `pageCount = 1`, `pageIndex = 0`, and omit `requestId`. Supply your entity changes in the request body." + * operationId: sync-update + * externalDocs: + * description: Server implementation + * url: https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/api/sync.ts + * parameters: + * - in: header + * name: pageCount + * required: true + * schema: + * type: integer + * - in: header + * name: pageIndex + * required: true + * schema: + * type: integer + * - in: header + * name: requestId + * schema: + * type: string + * description: ID to identify paginated requests + * - in: query + * name: logMarkerId + * required: true + * schema: + * type: string + * description: Marker to identify this request in server log + * requestBody: + * content: + * application/json: + * schema: + * type: object + * properties: + * instanceId: + * type: string + * description: Local instance ID + * entities: + * type: list + * items: + * $ref: '#/components/schemas/EntityChange' + * responses: + * '200': + * description: Changes processed successfully + * security: + * - session: [] + * tags: + * - sync + */ function update(req: Request) { let { body } = req; diff --git a/src/routes/api/tree.ts b/src/routes/api/tree.ts index d90470993..610c82fde 100644 --- a/src/routes/api/tree.ts +++ b/src/routes/api/tree.ts @@ -127,6 +127,46 @@ function getNotesAndBranchesAndAttributes(_noteIds: string[] | Set) { }; } +/** + * @swagger + * /api/tree: + * get: + * summary: Retrieve tree data + * operationId: tree + * externalDocs: + * description: Server implementation + * url: https://github.com/TriliumNext/Notes/blob/v0.91.6/src/routes/api/tree.ts + * parameters: + * - in: query + * name: subTreeNoteId + * required: false + * schema: + * type: string + * description: Limit tree data to this note and descendants + * responses: + * '200': + * description: Notes, branches and attributes + * content: + * application/json: + * schema: + * type: object + * properties: + * branches: + * type: list + * items: + * $ref: '#/components/schemas/Branch' + * notes: + * type: list + * items: + * $ref: '#/components/schemas/Note' + * attributes: + * type: list + * items: + * $ref: '#/components/schemas/Attribute' + * security: + * - session: [] + * tags: ["data"] + */ function getTree(req: Request) { const subTreeNoteId = typeof req.query.subTreeNoteId === "string" ? req.query.subTreeNoteId : "root"; const collectedNoteIds = new Set([subTreeNoteId]); diff --git a/src/routes/api_docs.ts b/src/routes/api_docs.ts index 1535265c3..3df230feb 100644 --- a/src/routes/api_docs.ts +++ b/src/routes/api_docs.ts @@ -1,4 +1,4 @@ -import type { Router } from "express"; +import type { Application, Router } from "express"; import swaggerUi from "swagger-ui-express"; import { readFile } from "fs/promises"; import { fileURLToPath } from "url"; @@ -7,19 +7,29 @@ import yaml from "js-yaml"; import type { JsonObject } from "swagger-ui-express"; const __dirname = dirname(fileURLToPath(import.meta.url)); -const swaggerDocument = yaml.load( +const etapiDocument = yaml.load( await readFile(join(__dirname, "../etapi/etapi.openapi.yaml"), "utf8") ) as JsonObject; +const apiDocument = JSON.parse(await readFile(join(__dirname, "api", "openapi.json"), "utf-8")); -function register(router: Router) { - router.use( - "/etapi", - swaggerUi.serve, - swaggerUi.setup(swaggerDocument, { +function register(app: Application) { + app.use( + "/etapi/docs/", + swaggerUi.serveFiles(etapiDocument), + swaggerUi.setup(etapiDocument, { explorer: true, customSiteTitle: "TriliumNext ETAPI Documentation" }) ); + + app.use( + "/api/docs/", + swaggerUi.serveFiles(apiDocument), + swaggerUi.setup(apiDocument, { + explorer: true, + customSiteTitle: "TriliumNext Internal API Documentation" + }) + ); } export default { diff --git a/src/services/in_app_help.ts b/src/services/in_app_help.ts index 0af911684..fffbf7812 100644 --- a/src/services/in_app_help.ts +++ b/src/services/in_app_help.ts @@ -44,6 +44,15 @@ function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSubtreeIt for (const attribute of noteMeta.attributes ?? []) { if (attribute.name === "iconClass") { iconClass = attribute.value; + continue; + } + + if (attribute.name === "webViewSrc") { + item.attributes?.push({ + type: "label", + name: attribute.name, + value: attribute.value + }); } } @@ -64,6 +73,11 @@ function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSubtreeIt }); } + // Handle web views + if (noteMeta.type === "webView") { + item.type = "webView"; + } + // Handle children if (noteMeta.children) { const children: HiddenSubtreeItem[] = []; diff --git a/src/services/meta/note_meta.ts b/src/services/meta/note_meta.ts index 0aaafb6b5..681ca4f8c 100644 --- a/src/services/meta/note_meta.ts +++ b/src/services/meta/note_meta.ts @@ -1,3 +1,4 @@ +import type { NoteType } from "../../becca/entities/rows.js"; import type AttachmentMeta from "./attachment_meta.js"; import type AttributeMeta from "./attribute_meta.js"; @@ -15,7 +16,7 @@ export default interface NoteMeta { notePosition?: number; prefix?: string | null; isExpanded?: boolean; - type?: string; + type?: NoteType; mime?: string; /** 'html' or 'markdown', applicable to text notes only */ format?: "html" | "markdown"; diff --git a/src/services/search/services/search.spec.ts b/src/services/search/services/search.spec.ts index e468ffd07..493eff030 100644 --- a/src/services/search/services/search.spec.ts +++ b/src/services/search/services/search.spec.ts @@ -22,7 +22,7 @@ describe("Search", () => { }); }); - it.skip("simple path match", () => { + it("simple path match", () => { rootNote.child(note("Europe").child(note("Austria"))); const searchContext = new SearchContext(); @@ -32,7 +32,7 @@ describe("Search", () => { expect(findNoteByTitle(searchResults, "Austria")).toBeTruthy(); }); - it.skip("normal search looks also at attributes", () => { + it("normal search looks also at attributes", () => { const austria = note("Austria"); const vienna = note("Vienna"); @@ -50,7 +50,7 @@ describe("Search", () => { expect(findNoteByTitle(searchResults, "Vienna")).toBeTruthy(); }); - it.skip("normal search looks also at type and mime", () => { + it("normal search looks also at type and mime", () => { rootNote.child(note("Effective Java", { type: "book", mime: "" })).child(note("Hello World.java", { type: "code", mime: "text/x-java" })); const searchContext = new SearchContext(); @@ -69,7 +69,7 @@ describe("Search", () => { expect(searchResults.length).toEqual(2); }); - it.skip("only end leafs are results", () => { + it("only end leafs are results", () => { rootNote.child(note("Europe").child(note("Austria"))); const searchContext = new SearchContext(); @@ -79,7 +79,7 @@ describe("Search", () => { expect(findNoteByTitle(searchResults, "Europe")).toBeTruthy(); }); - it.skip("only end leafs are results", () => { + it("only end leafs are results", () => { rootNote.child(note("Europe").child(note("Austria").label("capital", "Vienna"))); const searchContext = new SearchContext(); @@ -132,7 +132,7 @@ describe("Search", () => { expect(findNoteByTitle(searchResults, "Czech Republic")).toBeTruthy(); }); - it.skip("inherited label comparison", () => { + it("inherited label comparison", () => { rootNote.child(note("Europe").label("country", "", true).child(note("Austria")).child(note("Czech Republic"))); const searchContext = new SearchContext(); @@ -527,7 +527,7 @@ describe("Search", () => { expect(becca.notes[searchResults[0].noteId].title).toEqual("Europe"); }); - it.skip("test note.text *=* something", () => { + it("test note.text *=* something", () => { const italy = note("Italy").label("capital", "Rome"); const slovakia = note("Slovakia").label("capital", "Bratislava"); @@ -540,7 +540,7 @@ describe("Search", () => { expect(becca.notes[searchResults[0].noteId].title).toEqual("Slovakia"); }); - it.skip("test that fulltext does not match archived notes", () => { + it("test that fulltext does not match archived notes", () => { const italy = note("Italy").label("capital", "Rome"); const slovakia = note("Slovakia").label("capital", "Bratislava");