wip
This commit is contained in:
parent
bd758a156e
commit
51255bb446
8 changed files with 259 additions and 83 deletions
35
src/remote/activitypub/kernel/accept/index.ts
Normal file
35
src/remote/activitypub/kernel/accept/index.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import * as debug from 'debug';
|
||||
|
||||
import Resolver from '../../resolver';
|
||||
import { IRemoteUser } from '../../../../models/user';
|
||||
import acceptFollow from './follow';
|
||||
import { IAccept } from '../../type';
|
||||
|
||||
const log = debug('misskey:activitypub');
|
||||
|
||||
export default async (actor: IRemoteUser, activity: IAccept): Promise<void> => {
|
||||
const uri = activity.id || activity;
|
||||
|
||||
log(`Accept: ${uri}`);
|
||||
|
||||
const resolver = new Resolver();
|
||||
|
||||
let object;
|
||||
|
||||
try {
|
||||
object = await resolver.resolve(activity.object);
|
||||
} catch (e) {
|
||||
log(`Resolution failed: ${e}`);
|
||||
throw e;
|
||||
}
|
||||
|
||||
switch (object.type) {
|
||||
case 'Follow':
|
||||
acceptFollow(resolver, actor, activity, object);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.warn(`Unknown accept type: ${object.type}`);
|
||||
break;
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue