From 33306c9170ea9b3bf8b5ce3c3467bb27e9f2e58b Mon Sep 17 00:00:00 2001 From: mai <74494945+chan-mai@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:10:20 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=99=BB=E9=8C=B2=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=8C=E3=82=A2=E3=82=AB?= =?UTF-8?q?=E3=82=A6=E3=83=B3=E3=83=88=E3=82=92=E5=89=8A=E9=99=A4=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=82=82=E7=B5=B5=E6=96=87=E5=AD=97=E3=81=8C=E6=B6=88?= =?UTF-8?q?=E3=81=88=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/core/CustomEmojiService.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/backend/src/core/CustomEmojiService.ts b/packages/backend/src/core/CustomEmojiService.ts index cd906a72af..a909204af2 100755 --- a/packages/backend/src/core/CustomEmojiService.ts +++ b/packages/backend/src/core/CustomEmojiService.ts @@ -22,6 +22,7 @@ import { ModerationLogService } from '@/core/ModerationLogService.js'; import type { Config } from '@/config.js'; import { DriveService } from './DriveService.js'; + const parseEmojiStrRegexp = /^([-\w]+)(?:@([\w.-]+))?$/; @Injectable() @@ -77,6 +78,14 @@ export class CustomEmojiService implements OnApplicationShutdown { localOnly: boolean; roleIdsThatCanBeUsedThisEmojiAsReaction: MiRole['id'][]; }, moderator?: MiUser): Promise { + // システムユーザーとして再アップロード + if (!data.driveFile.user?.isRoot) { + data.driveFile = await this.driveService.uploadFromUrl({ + url: data.driveFile.url, + user: null, + force: true, + }); + } const emoji = await this.emojisRepository.insertOne({ id: this.idService.gen(), updatedAt: new Date(),