From c8b35a5c405db428d841a13a7ecd38de9687a7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=AC=B4=EB=9D=BC=EC=BF=A0=EB=AA=A8?= Date: Sun, 11 Aug 2024 13:52:59 +0900 Subject: [PATCH] hotfix: repository DI symbol --- .../refresh-remote-instance-metadata.ts | 3 +++ .../admin/federation/remove-all-following.ts | 23 ++++++++++++++++++- .../endpoints/admin/unset-user-mutual-link.ts | 3 +-- .../misskey-js/src/autogen/apiClientJSDoc.ts | 2 ++ packages/misskey-js/src/autogen/types.ts | 4 ++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts index 406e234e6..3907ee0b7 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -17,6 +17,7 @@ export const meta = { requireCredential: true, requireAdmin: true, + secure: true, kind: 'write:admin:federation', errors: { @@ -41,6 +42,8 @@ export default class extends Endpoint { // eslint- constructor( @Inject(DI.instancesRepository) private instancesRepository: InstancesRepository, + + @Inject(DI.followingsRepository) private followingsRepository: FollowingsRepository, private utilityService: UtilityService, diff --git a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts index 9f44db7d9..e7696c9b1 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -5,16 +5,27 @@ import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; -import type { FollowingsRepository, UsersRepository } from '@/models/_.js'; +import type { FollowingsRepository, InstancesRepository, UsersRepository } from '@/models/_.js'; import { DI } from '@/di-symbols.js'; import { QueueService } from '@/core/QueueService.js'; +import { ApiError } from '@/server/api/error.js'; +import { UtilityService } from '@/core/UtilityService.js'; export const meta = { tags: ['admin'], requireCredential: true, requireAdmin: true, + secure: true, kind: 'write:admin:federation', + + errors: { + instanceNotFound: { + message: 'Instance with that hostname is not found.', + code: 'INSTANCE_NOT_FOUND', + id: '82791415-ae4b-4e82-bffe-e3dbc4322a0a', + }, + }, } as const; export const paramDef = { @@ -34,9 +45,19 @@ export default class extends Endpoint { // eslint- @Inject(DI.notesRepository) private followingsRepository: FollowingsRepository, + @Inject(DI.instancesRepository) + private instancesRepository: InstancesRepository, + private queueService: QueueService, + private utilityService: UtilityService, ) { super(meta, paramDef, async (ps, me) => { + const instance = await this.instancesRepository.findOneBy({ host: this.utilityService.toPuny(ps.host) }); + + if (instance == null) { + throw new ApiError(meta.errors.instanceNotFound); + } + const followings = await this.followingsRepository.findBy({ followerHost: ps.host, }); diff --git a/packages/backend/src/server/api/endpoints/admin/unset-user-mutual-link.ts b/packages/backend/src/server/api/endpoints/admin/unset-user-mutual-link.ts index 735711c0e..faae10b01 100644 --- a/packages/backend/src/server/api/endpoints/admin/unset-user-mutual-link.ts +++ b/packages/backend/src/server/api/endpoints/admin/unset-user-mutual-link.ts @@ -23,9 +23,8 @@ export const paramDef = { required: ['userId'], } as const; -// eslint-disable-next-line import/no-default-export @Injectable() -export default class extends Endpoint { +export default class extends Endpoint { // eslint-disable-line import/no-default-export constructor( @Inject(DI.usersRepository) private usersRepository: UsersRepository, diff --git a/packages/misskey-js/src/autogen/apiClientJSDoc.ts b/packages/misskey-js/src/autogen/apiClientJSDoc.ts index 865e57005..c936d244c 100644 --- a/packages/misskey-js/src/autogen/apiClientJSDoc.ts +++ b/packages/misskey-js/src/autogen/apiClientJSDoc.ts @@ -503,6 +503,7 @@ declare module '../api.js' { /** * No description provided. * + * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. * **Credential required**: *Yes* / **Permission**: *write:admin:federation* */ request( @@ -514,6 +515,7 @@ declare module '../api.js' { /** * No description provided. * + * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. * **Credential required**: *Yes* / **Permission**: *write:admin:federation* */ request( diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 9eb7445ac..7baaa702f 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -424,6 +424,7 @@ export type paths = { * admin/federation/refresh-remote-instance-metadata * @description No description provided. * + * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. * **Credential required**: *Yes* / **Permission**: *write:admin:federation* */ post: operations['admin___federation___refresh-remote-instance-metadata']; @@ -433,6 +434,7 @@ export type paths = { * admin/federation/remove-all-following * @description No description provided. * + * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. * **Credential required**: *Yes* / **Permission**: *write:admin:federation* */ post: operations['admin___federation___remove-all-following']; @@ -8001,6 +8003,7 @@ export type operations = { * admin/federation/refresh-remote-instance-metadata * @description No description provided. * + * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. * **Credential required**: *Yes* / **Permission**: *write:admin:federation* */ 'admin___federation___refresh-remote-instance-metadata': { @@ -8052,6 +8055,7 @@ export type operations = { * admin/federation/remove-all-following * @description No description provided. * + * **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties. * **Credential required**: *Yes* / **Permission**: *write:admin:federation* */ 'admin___federation___remove-all-following': {