Update ApInboxService.ts

This commit is contained in:
syuilo 2025-06-26 13:33:20 +09:00
parent b5f284aae3
commit d287d43c98
1 changed files with 27 additions and 2 deletions

View File

@ -458,8 +458,33 @@ export class ApInboxService {
} }
@bindThis @bindThis
private async chatMessage(actor: MiRemoteUser, activity: IChatMessage): Promise<string> { private async chatMessage(resolver: Resolver, actor: MiRemoteUser, message: IObject): Promise<string> {
const targetUri = getApId(activity.object); const uri = getApId(message);
if (typeof message === 'object') {
if (actor.uri !== message.attributedTo) {
return 'skip: actor.uri !== message.attributedTo';
}
if (typeof message.id === 'string') {
if (this.utilityService.extractDbHost(actor.uri) !== this.utilityService.extractDbHost(message.id)) {
return 'skip: host in actor.uri !== message.id';
}
} else {
return 'skip: message.id is not a string';
}
}
try {
await this.chatService.createMessageViaAp(message, actor, resolver);
return 'ok';
} catch (err) {
if (err instanceof StatusError && !err.isRetryable) {
return `skip ${err.statusCode}`;
} else {
throw err;
}
}
} }
@bindThis @bindThis