2021-04-16 10:34:06 +02:00
|
|
|
import $ from 'cafy';
|
2021-08-19 14:55:45 +02:00
|
|
|
import define from '../../define';
|
|
|
|
import Resolver from '@/remote/activitypub/resolver';
|
|
|
|
import { ApiError } from '../../error';
|
2021-10-08 14:24:53 +02:00
|
|
|
import * as ms from 'ms';
|
2021-04-16 10:34:06 +02:00
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
tags: ['federation'],
|
|
|
|
|
2021-10-08 07:05:07 +02:00
|
|
|
requireCredential: true as const,
|
|
|
|
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 30
|
|
|
|
},
|
2021-04-16 10:34:06 +02:00
|
|
|
|
|
|
|
params: {
|
|
|
|
uri: {
|
|
|
|
validator: $.str,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
errors: {
|
|
|
|
},
|
|
|
|
|
|
|
|
res: {
|
|
|
|
type: 'object' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default define(meta, async (ps) => {
|
|
|
|
const resolver = new Resolver();
|
|
|
|
const object = await resolver.resolve(ps.uri);
|
|
|
|
return object;
|
|
|
|
});
|