forked from FoundKeyGang/FoundKey
activitypub: perform resolver block check on objects as well
This commit is contained in:
parent
8e12b9a33e
commit
a8f82050c8
1 changed files with 8 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue