2022-09-17 13:27:08 -05:00
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
|
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
2022-12-03 19:16:03 -06:00
|
|
|
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
|
2022-09-23 17:15:16 -05:00
|
|
|
import { GetterService } from '@/server/api/GetterService.js';
|
2019-01-26 02:53:35 -06:00
|
|
|
|
|
|
|
export const meta = {
|
2021-04-22 22:05:15 -05:00
|
|
|
tags: ['federation'],
|
2019-02-22 20:20:58 -06:00
|
|
|
|
2022-01-18 07:27:10 -06:00
|
|
|
requireCredential: true,
|
2022-02-18 23:05:32 -06:00
|
|
|
} as const;
|
2019-01-26 02:53:35 -06:00
|
|
|
|
2022-02-19 22:15:40 -06:00
|
|
|
export const paramDef = {
|
2022-02-18 23:05:32 -06:00
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
userId: { type: 'string', format: 'misskey:id' },
|
2021-12-09 08:58:30 -06:00
|
|
|
},
|
2022-02-18 23:05:32 -06:00
|
|
|
required: ['userId'],
|
2022-01-18 07:27:10 -06:00
|
|
|
} as const;
|
2019-01-26 02:53:35 -06:00
|
|
|
|
2022-01-02 11:12:50 -06:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2022-09-17 13:27:08 -05:00
|
|
|
@Injectable()
|
|
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|
|
|
constructor(
|
|
|
|
private getterService: GetterService,
|
|
|
|
private apPersonService: ApPersonService,
|
|
|
|
) {
|
|
|
|
super(meta, paramDef, async (ps) => {
|
|
|
|
const user = await this.getterService.getRemoteUser(ps.userId);
|
|
|
|
await this.apPersonService.updatePerson(user.uri!);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|