ce340aba7a
* wip * wip * wip * wip * wip * Update define.ts * Update update.ts * Update user.ts * wip * wip * Update request.ts * URL * wip * wip * wip * wip * Update invite.ts * Update create.ts
29 lines
553 B
TypeScript
29 lines
553 B
TypeScript
import $ from 'cafy';
|
|
import define from '../../define';
|
|
import { Instances } from '../../../../models';
|
|
import { toPuny } from '@/misc/convert-host';
|
|
|
|
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;
|
|
});
|