misskey-awawa/src/remote/activitypub/act/index.ts

31 lines
728 B
TypeScript
Raw Normal View History

2018-03-31 10:55:00 +00:00
import create from './create';
2018-04-03 08:50:52 +00:00
import performDeleteActivity from './delete';
2018-04-02 10:50:40 +00:00
import follow from './follow';
2018-04-03 07:33:16 +00:00
import undo from './undo';
2018-04-03 11:09:26 +00:00
import Resolver from '../resolver';
2018-04-04 14:12:35 +00:00
import { IObject } from '../type';
export default async (parentResolver: Resolver, actor, activity: IObject): Promise<void> => {
switch (activity.type) {
case 'Create':
await create(parentResolver, actor, activity);
break;
case 'Delete':
await performDeleteActivity(parentResolver, actor, activity);
break;
case 'Follow':
await follow(parentResolver, actor, activity);
break;
case 'Undo':
await undo(parentResolver, actor, activity);
break;
default:
console.warn(`unknown activity type: ${activity.type}`);
return null;
}
2018-04-01 12:17:46 +00:00
};