summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/resolver.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/remote/activitypub/resolver.ts')
-rw-r--r--src/remote/activitypub/resolver.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/remote/activitypub/resolver.ts b/src/remote/activitypub/resolver.ts
index f4bf8f94f9..2871c1cb41 100644
--- a/src/remote/activitypub/resolver.ts
+++ b/src/remote/activitypub/resolver.ts
@@ -1,8 +1,13 @@
+import config from '../../config';
import { getJson } from '../../misc/fetch';
+import { ILocalUser } from '../../models/entities/user';
+import { getInstanceActor } from '../../services/instance-actor';
+import { signedGet } from './request';
import { IObject, isCollectionOrOrderedCollection, ICollection, IOrderedCollection } from './type';
export default class Resolver {
private history: Set<string>;
+ private user?: ILocalUser;
constructor() {
this.history = new Set();
@@ -39,7 +44,13 @@ export default class Resolver {
this.history.add(value);
- const object = await getJson(value, 'application/activity+json, application/ld+json');
+ if (config.signToActivityPubGet && !this.user) {
+ this.user = await getInstanceActor();
+ }
+
+ const object = this.user
+ ? await signedGet(value, this.user)
+ : await getJson(value, 'application/activity+json, application/ld+json');
if (object == null || (
Array.isArray(object['@context']) ?