From 217e35a482d1ca9d206fe15d819590e9df9bd708 Mon Sep 17 00:00:00 2001
From: mai <74494945+chan-mai@users.noreply.github.com>
Date: Fri, 14 Jun 2024 15:19:53 +0000
Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E3=82=A2=E3=83=90=E3=82=BF?=
=?UTF-8?q?=E3=83=BC=E3=83=87=E3=82=B3=E3=83=AC=E3=83=BC=E3=82=B7=E3=83=A7?=
=?UTF-8?q?=E3=83=B3=E3=82=92=E3=83=95=E3=83=AD=E3=83=B3=E3=83=88=E3=81=8B?=
=?UTF-8?q?=E3=82=89=E3=82=A2=E3=83=83=E3=83=97=E3=83=AD=E3=83=BC=E3=83=89?=
=?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=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/frontend/src/pages/avatar-decorations.vue | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/packages/frontend/src/pages/avatar-decorations.vue b/packages/frontend/src/pages/avatar-decorations.vue
index ad9ec3c4eece..fd87793d022b 100644
--- a/packages/frontend/src/pages/avatar-decorations.vue
+++ b/packages/frontend/src/pages/avatar-decorations.vue
@@ -13,6 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ avatarDecoration.description }}
+ {{ i18n.ts.selectFile }}
{{ i18n.ts.name }}
@@ -44,9 +45,17 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkFolder from '@/components/MkFolder.vue';
+import { selectFile } from '@/scripts/select-file.js';
const avatarDecorations = ref([]);
+// ファイル選択
+async function selectImage(decoration, ev) {
+ let file = await selectFile(ev.currentTarget ?? ev.target, null);
+ decoration.name = file.name.replace(/\.(.+)$/, '');
+ decoration.url = file.url;
+}
+
function add() {
avatarDecorations.value.unshift({
_id: Math.random().toString(36),
From 6daa8ccc31a4d0924ce56a68c4a84d67f1af2892 Mon Sep 17 00:00:00 2001
From: mai <74494945+chan-mai@users.noreply.github.com>
Date: Fri, 14 Jun 2024 15:20:10 +0000
Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E3=82=A2=E3=83=90=E3=82=BF?=
=?UTF-8?q?=E3=83=BC=E3=83=87=E3=82=B3=E3=83=AC=E3=83=BC=E3=82=B7=E3=83=A7?=
=?UTF-8?q?=E3=83=B3=E3=81=AE=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92?=
=?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E4=BE=9D=E5=AD=98=E3=81=AB?=
=?UTF-8?q?=E3=81=97=E3=81=AA=E3=81=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../endpoints/admin/avatar-decorations/create.ts | 10 +++++++++-
.../endpoints/admin/avatar-decorations/update.ts | 15 ++++++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts
index fd213098188d..5e52d8e2b52a 100644
--- a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts
+++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts
@@ -6,6 +6,7 @@
import { Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
+import { DriveService } from '@/core/DriveService.js';
export const meta = {
tags: ['admin'],
@@ -32,12 +33,19 @@ export const paramDef = {
export default class extends Endpoint { // eslint-disable-line import/no-default-export
constructor(
private avatarDecorationService: AvatarDecorationService,
+ private driveService: DriveService,
) {
super(meta, paramDef, async (ps, me) => {
+ // システムユーザーとして再アップロード
+ const sysFileData = await this.driveService.uploadFromUrl({
+ url: ps.url,
+ user: null,
+ force: true,
+ });
await this.avatarDecorationService.create({
name: ps.name,
description: ps.description,
- url: ps.url,
+ url: sysFileData.url,
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
}, me);
});
diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts
index 34b3b5a11f50..9f12901d948a 100644
--- a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts
+++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/update.ts
@@ -7,6 +7,7 @@ import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { DI } from '@/di-symbols.js';
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
+import { DriveService } from '@/core/DriveService.js';
import { ApiError } from '../../../error.js';
export const meta = {
@@ -38,12 +39,24 @@ export const paramDef = {
export default class extends Endpoint { // eslint-disable-line import/no-default-export
constructor(
private avatarDecorationService: AvatarDecorationService,
+ private driveService: DriveService,
) {
super(meta, paramDef, async (ps, me) => {
+ let fileUrl = ps.url;
+ // URLに変更があるか
+ if (typeof ps.url !== 'undefined' || typeof ps.url === 'string' ) {
+ // システムユーザーとして再アップロード
+ const sysFileData = await this.driveService.uploadFromUrl({
+ url: ps.url,
+ user: null,
+ force: true,
+ });
+ fileUrl = sysFileData.url;
+ }
await this.avatarDecorationService.update(ps.id, {
name: ps.name,
description: ps.description,
- url: ps.url,
+ url: fileUrl,
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
}, me);
});
From 98ec2e40ee3441358f4ae691f911e65649861781 Mon Sep 17 00:00:00 2001
From: mai <74494945+chan-mai@users.noreply.github.com>
Date: Fri, 14 Jun 2024 15:23:48 +0000
Subject: [PATCH 3/3] docs: update
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 59b2779179e3..596fdbd6b79f 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,8 @@
- 二要素認証のバックアップコードを保存するように促すダイアログを表示するように
- カスタムフォント機能
- 絵文字を登録したユーザーがアカウントを消去しても継続して絵文字の使用ができるように
+- アバターデコレーションを登録したユーザーがアカウントを消去しても継続して使用ができるように
+- アバターデコレーションをmisskeyUI上から登録できるように
## Special Thanks
- [Misskey](https://github.com/misskey-dev/misskey)