wip
This commit is contained in:
parent
08beb45935
commit
536277122d
13 changed files with 7 additions and 0 deletions
51
src/remote/activitypub/kernel/index.ts
Normal file
51
src/remote/activitypub/kernel/index.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import { Object } from '../type';
|
||||
import { IRemoteUser } from '../../../models/user';
|
||||
import create from './create';
|
||||
import performDeleteActivity from './delete';
|
||||
import follow from './follow';
|
||||
import undo from './undo';
|
||||
import like from './like';
|
||||
import announce from './announce';
|
||||
|
||||
const self = async (actor: IRemoteUser, activity: Object): Promise<void> => {
|
||||
switch (activity.type) {
|
||||
case 'Create':
|
||||
await create(actor, activity);
|
||||
break;
|
||||
|
||||
case 'Delete':
|
||||
await performDeleteActivity(actor, activity);
|
||||
break;
|
||||
|
||||
case 'Follow':
|
||||
await follow(actor, activity);
|
||||
break;
|
||||
|
||||
case 'Accept':
|
||||
// noop
|
||||
break;
|
||||
|
||||
case 'Announce':
|
||||
await announce(actor, activity);
|
||||
break;
|
||||
|
||||
case 'Like':
|
||||
await like(actor, activity);
|
||||
break;
|
||||
|
||||
case 'Undo':
|
||||
await undo(actor, activity);
|
||||
break;
|
||||
|
||||
case 'Collection':
|
||||
case 'OrderedCollection':
|
||||
// TODO
|
||||
break;
|
||||
|
||||
default:
|
||||
console.warn(`unknown activity type: ${(activity as any).type}`);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export default self;
|
||||
Loading…
Add table
Add a link
Reference in a new issue