Implement announce

And bug fixes
This commit is contained in:
syuilo
2018-04-08 06:55:26 +09:00
parent 0004944708
commit 6e34e77372
17 changed files with 164 additions and 300 deletions

View File

@@ -1,6 +1,7 @@
import * as request from 'request-promise-native';
import * as debug from 'debug';
import { IObject } from './type';
//import config from '../../config';
const log = debug('misskey:activitypub:resolver');
@@ -47,6 +48,11 @@ export default class Resolver {
this.history.add(value);
//#region resolve local objects
// TODO
//if (value.startsWith(`${config.url}/@`)) {
//#endregion
const object = await request({
url: value,
headers: {
@@ -60,6 +66,7 @@ export default class Resolver {
!object['@context'].includes('https://www.w3.org/ns/activitystreams') :
object['@context'] !== 'https://www.w3.org/ns/activitystreams'
)) {
log(`invalid response: ${JSON.stringify(object, null, 2)}`);
throw new Error('invalid response');
}