rudeshark.net/src/remote/activitypub/act/index.ts

31 lines
728 B
TypeScript
Raw Normal View History

2018-03-31 12:55:00 +02:00
import create from './create';
2018-04-03 10:50:52 +02:00
import performDeleteActivity from './delete';
2018-04-02 12:50:40 +02:00
import follow from './follow';
2018-04-03 09:33:16 +02:00
import undo from './undo';
2018-04-03 13:09:26 +02:00
import Resolver from '../resolver';
2018-04-04 16:12:35 +02: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 14:17:46 +02:00
};