mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-25 14:05:14 +00:00
add resolver check for blocked instance (#7777)
* add resolver check for blocked instance * lint * Update note.ts
This commit is contained in:
parent
5141afe476
commit
d5702f9d51
1 changed files with 8 additions and 0 deletions
|
@ -4,6 +4,8 @@ import { ILocalUser } from '@/models/entities/user';
|
||||||
import { getInstanceActor } from '@/services/instance-actor';
|
import { getInstanceActor } from '@/services/instance-actor';
|
||||||
import { signedGet } from './request';
|
import { signedGet } from './request';
|
||||||
import { IObject, isCollectionOrOrderedCollection, ICollection, IOrderedCollection } from './type';
|
import { IObject, isCollectionOrOrderedCollection, ICollection, IOrderedCollection } from './type';
|
||||||
|
import { fetchMeta } from '@/misc/fetch-meta';
|
||||||
|
import { extractDbHost } from '@/misc/convert-host';
|
||||||
|
|
||||||
export default class Resolver {
|
export default class Resolver {
|
||||||
private history: Set<string>;
|
private history: Set<string>;
|
||||||
|
@ -44,6 +46,12 @@ export default class Resolver {
|
||||||
|
|
||||||
this.history.add(value);
|
this.history.add(value);
|
||||||
|
|
||||||
|
const meta = await fetchMeta();
|
||||||
|
const host = extractDbHost(value);
|
||||||
|
if (meta.blockedHosts.includes(host)) {
|
||||||
|
throw new Error('Instance is blocked');
|
||||||
|
}
|
||||||
|
|
||||||
if (config.signToActivityPubGet && !this.user) {
|
if (config.signToActivityPubGet && !this.user) {
|
||||||
this.user = await getInstanceActor();
|
this.user = await getInstanceActor();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue