From dfe85d772266cf0f8c51a62f9af72af4b304828e Mon Sep 17 00:00:00 2001 From: samunohito <46447427+samunohito@users.noreply.github.com> Date: Sun, 4 Feb 2024 18:42:03 +0900 Subject: [PATCH] support remote import --- .../api/endpoints/admin/emoji/list-remote.ts | 34 +-- .../pages/admin/custom-emojis-grid.impl.ts | 17 +- ....vue => custom-emojis-grid.local.list.vue} | 130 ++++++++-- ...ustom-emojis-grid.local.register.logs.vue} | 2 +- ... => custom-emojis-grid.local.register.vue} | 2 +- .../pages/admin/custom-emojis-grid.local.vue | 84 ++++++ .../pages/admin/custom-emojis-grid.remote.vue | 245 ++++++++++++++++++ .../src/pages/admin/custom-emojis-grid.vue | 91 +------ .../misskey-js/src/autogen/apiClientJSDoc.ts | 4 +- packages/misskey-js/src/autogen/endpoint.ts | 4 +- packages/misskey-js/src/autogen/entities.ts | 4 +- packages/misskey-js/src/autogen/models.ts | 4 +- packages/misskey-js/src/autogen/types.ts | 15 +- 13 files changed, 463 insertions(+), 173 deletions(-) rename packages/frontend/src/pages/admin/{custom-emojis-grid.list.vue => custom-emojis-grid.local.list.vue} (67%) rename packages/frontend/src/pages/admin/{custom-emojis-grid.register.logs.vue => custom-emojis-grid.local.register.logs.vue} (97%) rename packages/frontend/src/pages/admin/{custom-emojis-grid.register.vue => custom-emojis-grid.local.register.vue} (99%) create mode 100644 packages/frontend/src/pages/admin/custom-emojis-grid.local.vue create mode 100644 packages/frontend/src/pages/admin/custom-emojis-grid.remote.vue diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts index f3e0c1ef1f..35460a2e16 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -24,39 +24,7 @@ export const meta = { optional: false, nullable: false, items: { type: 'object', - optional: false, nullable: false, - properties: { - id: { - type: 'string', - optional: false, nullable: false, - format: 'id', - }, - aliases: { - type: 'array', - optional: false, nullable: false, - items: { - type: 'string', - optional: false, nullable: false, - }, - }, - name: { - type: 'string', - optional: false, nullable: false, - }, - category: { - type: 'string', - optional: false, nullable: true, - }, - host: { - type: 'string', - optional: false, nullable: true, - description: 'The local host is represented with `null`.', - }, - url: { - type: 'string', - optional: false, nullable: false, - }, - }, + ref: 'EmojiDetailed', }, }, } as const; diff --git a/packages/frontend/src/pages/admin/custom-emojis-grid.impl.ts b/packages/frontend/src/pages/admin/custom-emojis-grid.impl.ts index 24bbdb3f62..89e2dee93c 100644 --- a/packages/frontend/src/pages/admin/custom-emojis-grid.impl.ts +++ b/packages/frontend/src/pages/admin/custom-emojis-grid.impl.ts @@ -8,13 +8,12 @@ export type RegisterLogItem = { }; export type GridItem = { - readonly id?: string; - readonly fileId?: string; - readonly url: string; - - deleteCheck: boolean; - + checked: boolean; + id?: string; + fileId?: string; + url: string; name: string; + host: string; category: string; aliases: string; license: string; @@ -25,11 +24,12 @@ export type GridItem = { export function fromEmojiDetailed(it: Misskey.entities.EmojiDetailed): GridItem { return { + checked: false, id: it.id, fileId: undefined, url: it.url, - deleteCheck: false, name: it.name, + host: it.host ?? '', category: it.category ?? '', aliases: it.aliases.join(', '), license: it.license ?? '', @@ -41,11 +41,12 @@ export function fromEmojiDetailed(it: Misskey.entities.EmojiDetailed): GridItem export function fromDriveFile(it: Misskey.entities.DriveFile): GridItem { return { + checked: false, id: undefined, fileId: it.id, url: it.url, - deleteCheck: false, name: it.name.replace(/(\.[a-zA-Z0-9]+)+$/, ''), + host: '', category: '', aliases: '', license: '', diff --git a/packages/frontend/src/pages/admin/custom-emojis-grid.list.vue b/packages/frontend/src/pages/admin/custom-emojis-grid.local.list.vue similarity index 67% rename from packages/frontend/src/pages/admin/custom-emojis-grid.list.vue rename to packages/frontend/src/pages/admin/custom-emojis-grid.local.list.vue index 051c5822ed..0edd313ba4 100644 --- a/packages/frontend/src/pages/admin/custom-emojis-grid.list.vue +++ b/packages/frontend/src/pages/admin/custom-emojis-grid.local.list.vue @@ -1,27 +1,33 @@ + + + + + + diff --git a/packages/frontend/src/pages/admin/custom-emojis-grid.remote.vue b/packages/frontend/src/pages/admin/custom-emojis-grid.remote.vue new file mode 100644 index 0000000000..6d8ca316ea --- /dev/null +++ b/packages/frontend/src/pages/admin/custom-emojis-grid.remote.vue @@ -0,0 +1,245 @@ + + + + + + + diff --git a/packages/frontend/src/pages/admin/custom-emojis-grid.vue b/packages/frontend/src/pages/admin/custom-emojis-grid.vue index b0e6e46ddc..84087b9be9 100644 --- a/packages/frontend/src/pages/admin/custom-emojis-grid.vue +++ b/packages/frontend/src/pages/admin/custom-emojis-grid.vue @@ -4,74 +4,22 @@ -
- - - - - -
- - -
-
+ +