activitypub: perform resolver block check on objects as well
This commit is contained in:
parent
85419326f8
commit
6c4a80ac24
1 changed files with 6 additions and 6 deletions
|
@ -45,11 +45,16 @@ export class Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
public async resolve(value: string | IObject, allowRedirect = false): Promise<IObject> {
|
||||
public async resolve(value?: string | IObject | null, allowRedirect = false): Promise<IObject> {
|
||||
if (value == null) {
|
||||
throw new Error('resolvee is null (or undefined)');
|
||||
}
|
||||
|
||||
const host = extractDbHost(typeof value === 'string' ? value : getApId(value));
|
||||
if (await shouldBlockInstance(host)) {
|
||||
throw new Error('instance is blocked');
|
||||
}
|
||||
|
||||
if (typeof value !== 'string') {
|
||||
return value;
|
||||
}
|
||||
|
@ -69,15 +74,10 @@ export class Resolver {
|
|||
}
|
||||
this.history.add(value);
|
||||
|
||||
const host = extractDbHost(value);
|
||||
if (isSelfHost(host)) {
|
||||
return await this.resolveLocal(value);
|
||||
}
|
||||
|
||||
if (await shouldBlockInstance(host)) {
|
||||
throw new Error('Instance is blocked');
|
||||
}
|
||||
|
||||
if (!this.user) {
|
||||
this.user = await getInstanceActor();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue