From 4be5f3b58ca3b8085a8952a8408e8899a6fd0033 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sat, 15 Jul 2023 00:06:42 -0700 Subject: [PATCH] refactor: :wastebasket: deprecate DB_MAX_NOTE_TEXT_LENGTH --- .config/example.yml | 2 +- packages/backend/src/const.ts | 3 +-- packages/backend/src/misc/hard-limits.ts | 3 ++- packages/backend/src/server/api/endpoints/admin/update-meta.ts | 1 - packages/megalodon/src/misskey/entities/meta.ts | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.config/example.yml b/.config/example.yml index ba74df8a5..9716915b6 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -121,7 +121,7 @@ redis: # ┌─────────────────────┐ #───┘ Other configuration └───────────────────────────────────── -# Maximum length of a post (default 3000, max 8192) +# Maximum length of a post (default 3000, max 250000000) #maxNoteLength: 3000 # Maximum length of an image caption (default 1500, max 8192) diff --git a/packages/backend/src/const.ts b/packages/backend/src/const.ts index 7e8f96444..1f1e63292 100644 --- a/packages/backend/src/const.ts +++ b/packages/backend/src/const.ts @@ -1,8 +1,7 @@ import config from "@/config/index.js"; import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js"; -export const MAX_NOTE_TEXT_LENGTH = - config.maxNoteLength != null ? config.maxNoteLength : 3000; // <- should we increase this? +export const MAX_NOTE_TEXT_LENGTH = config.maxNoteLength ?? 3000; export const MAX_CAPTION_TEXT_LENGTH = Math.min( config.maxCaptionLength ?? 1500, DB_MAX_IMAGE_COMMENT_LENGTH, diff --git a/packages/backend/src/misc/hard-limits.ts b/packages/backend/src/misc/hard-limits.ts index 51d2c0f5d..f1a58a425 100644 --- a/packages/backend/src/misc/hard-limits.ts +++ b/packages/backend/src/misc/hard-limits.ts @@ -3,8 +3,9 @@ /** * Maximum note text length that can be stored in DB. * Surrogate pairs count as one + * DEPRECARTED: use const/MAX_NOTE_TEXT_LENGTH instead */ -export const DB_MAX_NOTE_TEXT_LENGTH = 8192; +// export const DB_MAX_NOTE_TEXT_LENGTH = 8192; /** * Maximum image description length that can be stored in DB. diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index d11e6b964..2142c7df7 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -1,6 +1,5 @@ import { Meta } from "@/models/entities/meta.js"; import { insertModerationLog } from "@/services/insert-moderation-log.js"; -import { DB_MAX_NOTE_TEXT_LENGTH } from "@/misc/hard-limits.js"; import { db } from "@/db/postgre.js"; import define from "../../define.js"; diff --git a/packages/megalodon/src/misskey/entities/meta.ts b/packages/megalodon/src/misskey/entities/meta.ts index 2e99266ab..7dd5f6400 100644 --- a/packages/megalodon/src/misskey/entities/meta.ts +++ b/packages/megalodon/src/misskey/entities/meta.ts @@ -12,7 +12,7 @@ namespace MisskeyEntity { disableRegistration: boolean disableLocalTimeline: boolean bannerUrl: string - maxNoteTextLength: 300 + maxNoteTextLength: 3000 emojis: Array } }