From d8933c135fb1a579c959dcc06c74f5eab12a747d Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 27 Oct 2020 16:45:14 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=83=A2=E3=83=BC=E3=83=88=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=82=B9=E3=82=BF=E3=83=B3=E3=82=B9=E6=83=85=E5=A0=B1?= =?UTF-8?q?=E3=82=92=E5=BC=B7=E5=88=B6=E6=9B=B4=E6=96=B0=E3=81=99=E3=82=8B?= =?UTF-8?q?API=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../refresh-remote-instance-metadata.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts diff --git a/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts b/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts new file mode 100644 index 000000000..923a5f52c --- /dev/null +++ b/src/server/api/endpoints/admin/federation/refresh-remote-instance-metadata.ts @@ -0,0 +1,28 @@ +import $ from 'cafy'; +import define from '../../../define'; +import { Instances } from '../../../../../models'; +import { toPuny } from '../../../../../misc/convert-host'; +import { fetchInstanceMetadata } from '../../../../../services/fetch-instance-metadata'; + +export const meta = { + tags: ['admin'], + + requireCredential: true as const, + requireModerator: true, + + params: { + host: { + validator: $.str + }, + } +}; + +export default define(meta, async (ps, me) => { + const instance = await Instances.findOne({ host: toPuny(ps.host) }); + + if (instance == null) { + throw new Error('instance not found'); + } + + fetchInstanceMetadata(instance, true); +});