activitypub: perform resolver block check on objects as well

This commit is contained in:
Norm 2022-12-24 11:58:49 -05:00
parent 8e12b9a33e
commit a8f82050c8
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE

View file

@ -45,12 +45,18 @@ 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)');
}
if (typeof value !== 'string') {
if (typeof value.id !== 'undefined') {
const host = extractDbHost(getApId(value));
if (await shouldBlockInstance(host)) {
throw new Error('instance is blocked');
}
}
return value;
}
@ -75,7 +81,7 @@ export class Resolver {
}
if (await shouldBlockInstance(host)) {
throw new Error('Instance is blocked');
throw new Error('instance is blocked');
}
if (!this.user) {