diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-07-19 00:24:07 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-07-19 00:24:07 +0900 |
| commit | 3f71b1463719bee476d39b7ceca5a2eea4b5cb67 (patch) | |
| tree | 70003fc0a220785526289fd5b46d8c708a59c21d /src/models | |
| parent | fix(client): プラグインの動作を修正 (diff) | |
| download | sharkey-3f71b1463719bee476d39b7ceca5a2eea4b5cb67.tar.gz sharkey-3f71b1463719bee476d39b7ceca5a2eea4b5cb67.tar.bz2 sharkey-3f71b1463719bee476d39b7ceca5a2eea4b5cb67.zip | |
feat: Blurhash integration
Resolve #6559
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/entities/drive-file.ts | 6 | ||||
| -rw-r--r-- | src/models/entities/user.ts | 8 | ||||
| -rw-r--r-- | src/models/repositories/drive-file.ts | 1 | ||||
| -rw-r--r-- | src/models/repositories/user.ts | 10 |
4 files changed, 17 insertions, 8 deletions
diff --git a/src/models/entities/drive-file.ts b/src/models/entities/drive-file.ts index 067dc1181c..c02b9f3636 100644 --- a/src/models/entities/drive-file.ts +++ b/src/models/entities/drive-file.ts @@ -67,6 +67,12 @@ export class DriveFile { }) public comment: string | null; + @Column('varchar', { + length: 128, nullable: true, + comment: 'The BlurHash string.' + }) + public blurhash: string | null; + @Column('jsonb', { default: {}, comment: 'The any properties of the DriveFile. For example, it includes image width/height.' diff --git a/src/models/entities/user.ts b/src/models/entities/user.ts index d3086f43f2..fee5906a3d 100644 --- a/src/models/entities/user.ts +++ b/src/models/entities/user.ts @@ -106,14 +106,14 @@ export class User { public bannerUrl: string | null; @Column('varchar', { - length: 32, nullable: true, + length: 128, nullable: true, }) - public avatarColor: string | null; + public avatarBlurhash: string | null; @Column('varchar', { - length: 32, nullable: true, + length: 128, nullable: true, }) - public bannerColor: string | null; + public bannerBlurhash: string | null; @Column('boolean', { default: false, diff --git a/src/models/repositories/drive-file.ts b/src/models/repositories/drive-file.ts index 28a393cfb4..6bdf62be8b 100644 --- a/src/models/repositories/drive-file.ts +++ b/src/models/repositories/drive-file.ts @@ -115,6 +115,7 @@ export class DriveFileRepository extends Repository<DriveFile> { md5: file.md5, size: file.size, isSensitive: file.isSensitive, + blurhash: file.blurhash, properties: file.properties, url: opts.self ? file.url : this.getPublicUrl(file, false, meta), thumbnailUrl: this.getPublicUrl(file, true, meta), diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index c4c9503e06..bbaafc9050 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -165,7 +165,8 @@ export class UserRepository extends Repository<User> { username: user.username, host: user.host, avatarUrl: user.avatarUrl ? user.avatarUrl : config.url + '/avatar/' + user.id, - avatarColor: user.avatarColor, + avatarBlurhash: user.avatarBlurhash, + avatarColor: null, // 後方互換性のため isAdmin: user.isAdmin || falsy, isModerator: user.isModerator || falsy, isBot: user.isBot || falsy, @@ -196,7 +197,8 @@ export class UserRepository extends Repository<User> { createdAt: user.createdAt.toISOString(), updatedAt: user.updatedAt ? user.updatedAt.toISOString() : null, bannerUrl: user.bannerUrl, - bannerColor: user.bannerColor, + bannerBlurhash: user.bannerBlurhash, + bannerColor: null, // 後方互換性のため isLocked: user.isLocked, isModerator: user.isModerator || falsy, isSilenced: user.isSilenced || falsy, @@ -331,7 +333,7 @@ export const packedUserSchema = { format: 'url', nullable: true as const, optional: false as const, }, - avatarColor: { + avatarBlurhash: { type: 'any' as const, nullable: true as const, optional: false as const, }, @@ -340,7 +342,7 @@ export const packedUserSchema = { format: 'url', nullable: true as const, optional: true as const, }, - bannerColor: { + bannerBlurhash: { type: 'any' as const, nullable: true as const, optional: true as const, }, |