yumechi-no-kuni/src/server/api/endpoints/federation/show-instance.ts
syuilo b9cb6d1c10 refactor: refactoring imports
将来ESMに移行しやすいように
Related: #7658

なんかmochaが起動しなくなってるけど理由不明
すぐ直したい
2021-08-19 18:33:41 +09:00

29 lines
558 B
TypeScript

import $ from 'cafy';
import define from '../../define.js';
import { Instances } from '@/models/index.js';
import { toPuny } from '@/misc/convert-host.js';
export const meta = {
tags: ['federation'],
requireCredential: false as const,
params: {
host: {
validator: $.str
}
},
res: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'FederationInstance'
}
};
export default define(meta, async (ps, me) => {
const instance = await Instances
.findOne({ host: toPuny(ps.host) });
return instance;
});