From 35ebb8bcf24a42c42df563b985d17c25ee6ded48 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 12 Dec 2022 15:07:38 -0800 Subject: [PATCH] feat: customizable max note length --- .config/example.yml | 3 +++ CALCKEY.md | 1 + packages/backend/src/config/types.ts | 1 + packages/backend/src/const.ts | 4 +++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.config/example.yml b/.config/example.yml index 5cf984e9e0..29f4a62290 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -93,6 +93,9 @@ id: 'aid' # ┌─────────────────────┐ #───┘ Other configuration └───────────────────────────────────── +# Max note length, should be < 8000. +#maxNoteLength: 3000 + # Whether disable HSTS #disableHsts: true diff --git a/CALCKEY.md b/CALCKEY.md index b164e5f311..f1a62548b2 100644 --- a/CALCKEY.md +++ b/CALCKEY.md @@ -29,6 +29,7 @@ ## Work in progress - Weblate project +- Customizable max note length - Link verification - Better Messaging UI - Better API Documentation diff --git a/packages/backend/src/config/types.ts b/packages/backend/src/config/types.ts index aff67ffa67..9872b0eeb3 100644 --- a/packages/backend/src/config/types.ts +++ b/packages/backend/src/config/types.ts @@ -67,6 +67,7 @@ export type Source = { // Managed hosting stuff maxUserSignups?: number; isManagedHosting?: boolean; + maxNoteLength?: number; deepl: { managed?: boolean; authKey?: string; diff --git a/packages/backend/src/const.ts b/packages/backend/src/const.ts index 17fdb45ec0..172edca0df 100644 --- a/packages/backend/src/const.ts +++ b/packages/backend/src/const.ts @@ -1,4 +1,6 @@ -export const MAX_NOTE_TEXT_LENGTH = 3000; +import config from '@/config/index.js'; + +export const MAX_NOTE_TEXT_LENGTH = config.maxNoteLength != null ? config.maxNoteLength : 3000; export const SECOND = 1000; export const SEC = 1000;