2023-02-16 14:09:41 +00:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2022-09-17 18:27:08 +00:00
|
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
2022-12-04 01:16:03 +00:00
|
|
|
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
|
2022-09-23 22:15:16 +00:00
|
|
|
import { GetterService } from '@/server/api/GetterService.js';
|
2019-01-26 08:53:35 +00:00
|
|
|
|
|
|
|
export const meta = {
|
2021-04-23 03:05:15 +00:00
|
|
|
tags: ['federation'],
|
2019-02-23 02:20:58 +00:00
|
|
|
|
2022-01-18 13:27:10 +00:00
|
|
|
requireCredential: true,
|
2022-02-19 05:05:32 +00:00
|
|
|
} as const;
|
2019-01-26 08:53:35 +00:00
|
|
|
|
2022-02-20 04:15:40 +00:00
|
|
|
export const paramDef = {
|
2022-02-19 05:05:32 +00:00
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
userId: { type: 'string', format: 'misskey:id' },
|
2021-12-09 14:58:30 +00:00
|
|
|
},
|
2022-02-19 05:05:32 +00:00
|
|
|
required: ['userId'],
|
2022-01-18 13:27:10 +00:00
|
|
|
} as const;
|
2019-01-26 08:53:35 +00:00
|
|
|
|
2022-01-02 17:12:50 +00:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2022-09-17 18:27:08 +00: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!);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|