increase character limits and share between text and CW

This commit is contained in:
Hazel K 2024-10-03 19:53:57 -04:00
parent ac1e5a0fb5
commit 063b2ff266
7 changed files with 28 additions and 8 deletions

View File

@ -167,7 +167,7 @@ id: 'aidx'
# IP address family used for outgoing request (ipv4, ipv6 or dual) # IP address family used for outgoing request (ipv4, ipv6 or dual)
#outgoingAddressFamily: ipv4 #outgoingAddressFamily: ipv4
# Amount of characters that can be used when writing notes (maximum: 8192, minimum: 1) # Amount of characters that can be used when writing notes (maximum: 100000, minimum: 1)
maxNoteLength: 3000 maxNoteLength: 3000
# Proxy for HTTP/HTTPS # Proxy for HTTP/HTTPS

View File

@ -242,7 +242,7 @@ id: 'aidx'
# IP address family used for outgoing request (ipv4, ipv6 or dual) # IP address family used for outgoing request (ipv4, ipv6 or dual)
#outgoingAddressFamily: ipv4 #outgoingAddressFamily: ipv4
# Amount of characters that can be used when writing notes (maximum: 8192, minimum: 1) # Amount of characters that can be used when writing notes (maximum: 100000, minimum: 1)
maxNoteLength: 3000 maxNoteLength: 3000
# Proxy for HTTP/HTTPS # Proxy for HTTP/HTTPS

View File

@ -251,7 +251,7 @@ id: 'aidx'
# IP address family used for outgoing request (ipv4, ipv6 or dual) # IP address family used for outgoing request (ipv4, ipv6 or dual)
#outgoingAddressFamily: ipv4 #outgoingAddressFamily: ipv4
# Amount of characters that can be used when writing notes (maximum: 8192, minimum: 1) # Amount of characters that can be used when writing notes (maximum: 100000, minimum: 1)
maxNoteLength: 3000 maxNoteLength: 3000
# Proxy for HTTP/HTTPS # Proxy for HTTP/HTTPS

View File

@ -0,0 +1,18 @@
/*
* SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class IncreaseCharacterLimits1727998351561 {
name = 'IncreaseCharacterLimits1727998351561'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "comment" TYPE varchar(100000)`);
await queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "cw" TYPE text`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "cw" TYPE varchar(512)`);
await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "comment" TYPE varchar(8192)`);
}
}

View File

@ -13,15 +13,16 @@ export const USER_ACTIVE_THRESHOLD = 1000 * 60 * 60 * 24 * 3; // 3days
/** /**
* Maximum note text length that can be stored in DB. * Maximum note text length that can be stored in DB.
* Content Warnings are included in this limit.
* Surrogate pairs count as one * Surrogate pairs count as one
*/ */
export const DB_MAX_NOTE_TEXT_LENGTH = 8192; export const DB_MAX_NOTE_TEXT_LENGTH = 100_000;
/** /**
* Maximum image description length that can be stored in DB. * Maximum image description length that can be stored in DB.
* Surrogate pairs count as one * Surrogate pairs count as one
*/ */
export const DB_MAX_IMAGE_COMMENT_LENGTH = 8192; export const DB_MAX_IMAGE_COMMENT_LENGTH = 100_000;
//#endregion //#endregion
// ブラウザで直接表示することを許可するファイルの種類のリスト // ブラウザで直接表示することを許可するファイルの種類のリスト

View File

@ -7,6 +7,7 @@ import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typ
import { id } from './util/id.js'; import { id } from './util/id.js';
import { MiUser } from './User.js'; import { MiUser } from './User.js';
import { MiDriveFolder } from './DriveFolder.js'; import { MiDriveFolder } from './DriveFolder.js';
import {DB_MAX_IMAGE_COMMENT_LENGTH} from "@/const.js";
@Entity('drive_file') @Entity('drive_file')
@Index(['userId', 'folderId', 'id']) @Index(['userId', 'folderId', 'id'])
@ -61,7 +62,7 @@ export class MiDriveFile {
public size: number; public size: number;
@Column('varchar', { @Column('varchar', {
length: 8192, length: DB_MAX_IMAGE_COMMENT_LENGTH,
nullable: true, nullable: true,
comment: 'The comment of the DriveFile.', comment: 'The comment of the DriveFile.',
}) })

View File

@ -66,8 +66,8 @@ export class MiNote {
}) })
public name: string | null; public name: string | null;
@Column('varchar', { @Column('text', {
length: 512, nullable: true, nullable: true,
}) })
public cw: string | null; public cw: string | null;