hippofish/src/server/api/endpoints/federation/show-instance.ts
syuilo ce340aba7a
Refactor (#7394)
* 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
2021-03-24 11:05:37 +09:00

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;
});