From 6467265cfda617520437ff5a5df8e7c3cb2ee921 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Sat, 3 May 2025 08:47:43 +0200 Subject: [PATCH] Misc docs --- _regroup/bin/generate-openapi.ts | 5 +++- apps/server/src/routes/login.ts | 30 +++++++++++++++++++ .../Database/attachments.md | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/_regroup/bin/generate-openapi.ts b/_regroup/bin/generate-openapi.ts index e1c54dca7..c422f93ab 100644 --- a/_regroup/bin/generate-openapi.ts +++ b/_regroup/bin/generate-openapi.ts @@ -34,6 +34,7 @@ const options = { "./src/routes/api/setup.ts", // all other files "./src/routes/api/*.ts", + "./src/routes/*.ts", "./bin/generate-openapi.ts" ] }; @@ -68,7 +69,7 @@ console.log("Saved to ", outputPath); * $ref: "#/components/schemas/NoteId" * type: * type: string - * enum: ["attribute", "relation"] + * enum: ["label", "relation"] * name: * type: string * example: "internalLink" @@ -100,6 +101,7 @@ console.log("Saved to ", outputPath); * $ref: "#/components/schemas/UtcDateTime" * Branch: * type: object + * required: ["branchId", "noteId", "parentNoteId", "notePosition"] * properties: * branchId: * $ref: "#/components/schemas/BranchId" @@ -142,6 +144,7 @@ console.log("Saved to ", outputPath); * description: Encoded entity data. Object has one property for each database column. * Note: * type: object + * required: ["noteId", "title", "isProtected", "type", "mime", "blobId"] * properties: * noteId: * $ref: "#/components/schemas/NoteId" diff --git a/apps/server/src/routes/login.ts b/apps/server/src/routes/login.ts index 1b2d42b25..877d65577 100644 --- a/apps/server/src/routes/login.ts +++ b/apps/server/src/routes/login.ts @@ -62,6 +62,36 @@ function setPassword(req: Request, res: Response) { res.redirect("login"); } +/** + * @swagger + * /login: + * post: + * tags: + * - auth + * summary: Log in using password + * description: This will give you a Trilium session, which is required for some other API endpoints. `totpToken` is only required if the user configured TOTP authentication. + * operationId: login-normal + * externalDocs: + * description: HMAC calculation + * url: https://github.com/TriliumNext/Notes/blob/v0.91.6/src/services/utils.ts#L62-L66 + * requestBody: + * content: + * application/x-www-form-urlencoded: + * schema: + * type: object + * required: + * - password + * properties: + * password: + * type: string + * totpToken: + * type: string + * responses: + * '200': + * description: Successful operation + * '401': + * description: Password / TOTP mismatch + */ function login(req: Request, res: Response) { if (openID.isOpenIDEnabled()) { res.oidc.login({ diff --git a/docs/Developer Guide/Developer Guide/Old documentation/Development and architecture/Database/attachments.md b/docs/Developer Guide/Developer Guide/Old documentation/Development and architecture/Database/attachments.md index 3645b15c7..274233e4f 100644 --- a/docs/Developer Guide/Developer Guide/Old documentation/Development and architecture/Database/attachments.md +++ b/docs/Developer Guide/Developer Guide/Old documentation/Development and architecture/Database/attachments.md @@ -1,2 +1,2 @@ # attachments -
Column NameData TypeNullityDefault valueDescription
attachmentIdTextNon-null Unique ID (e.g. qhC1vzU4nwSE)
ownerIdTextNon-null The unique ID of a row in notes.
roleTextNon-null The role of the attachment: image for images that are attached to a note.
mimeTextNon-null The MIME type of the attachment (e.g. image/png)
titleTextNon-null The title of the attachment.
isProtectedIntegerNon-null01 if the entity is protected, 0 otherwise.
positionIntegerNon-null0Not sure where the position is relevant for attachments (saw it with values of 10 and 0).
blobIdTextNullablenullThe corresponding blobId from the blobs table.
dateModifiedTextNon-null Localized modification date (e.g. 2023-11-08 18:43:44.204+0200)
utcDateModifiedTextNon-null Modification date in UTC format (e.g. 2023-11-08 16:43:44.204Z)
utcDateScheduledForErasureTextNullablenull 
isDeletedIntegerNon-null 1 if the entity is deleted, 0 otherwise.
deleteIdTextNullablenull 
\ No newline at end of file +
Column NameData TypeNullityDefault valueDescription
attachmentIdTextNon-null Unique ID (e.g. qhC1vzU4nwSE)
ownerIdTextNon-null The unique ID of a row in notes.
roleTextNon-null The role of the attachment: image for images that are attached to a note, file for uploaded files.
mimeTextNon-null The MIME type of the attachment (e.g. image/png)
titleTextNon-null The title of the attachment.
isProtectedIntegerNon-null01 if the entity is protected, 0 otherwise.
positionIntegerNon-null0Not sure where the position is relevant for attachments (saw it with values of 10 and 0).
blobIdTextNullablenullThe corresponding blobId from the blobs table.
dateModifiedTextNon-null Localized modification date (e.g. 2023-11-08 18:43:44.204+0200)
utcDateModifiedTextNon-null Modification date in UTC format (e.g. 2023-11-08 16:43:44.204Z)
utcDateScheduledForErasureTextNullablenull 
isDeletedIntegerNon-null 1 if the entity is deleted, 0 otherwise.
deleteIdTextNullablenull 
\ No newline at end of file