|
|
|
@@ -64,21 +64,21 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
|
|
|
|
this.followingsRepository.createQueryBuilder('following')
|
|
|
|
|
.select('COUNT(DISTINCT following.followeeHost)')
|
|
|
|
|
.where('following.followeeHost IS NOT NULL')
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: this.meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : '(\'.\' || following.followeeHost) NOT ILIKE ALL(select \'%.\' || x from (select unnest("blockedHosts") as x from "meta") t)')
|
|
|
|
|
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
|
|
|
|
.getRawOne()
|
|
|
|
|
.then(x => parseInt(x.count, 10)),
|
|
|
|
|
this.followingsRepository.createQueryBuilder('following')
|
|
|
|
|
.select('COUNT(DISTINCT following.followerHost)')
|
|
|
|
|
.where('following.followerHost IS NOT NULL')
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : 'following.followerHost NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: this.meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : '(\'.\' || following.followerHost) NOT ILIKE ALL(select \'%.\' || x from (select unnest("blockedHosts") as x from "meta") t)')
|
|
|
|
|
.andWhere(`following.followerHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
|
|
|
|
.getRawOne()
|
|
|
|
|
.then(x => parseInt(x.count, 10)),
|
|
|
|
|
this.followingsRepository.createQueryBuilder('following')
|
|
|
|
|
.select('COUNT(DISTINCT following.followeeHost)')
|
|
|
|
|
.where('following.followeeHost IS NOT NULL')
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: this.meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : '(\'.\' || following.followeeHost) NOT ILIKE ALL(select \'%.\' || x from (select unnest("blockedHosts") as x from "meta") t)')
|
|
|
|
|
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
|
|
|
|
.andWhere(`following.followeeHost IN (${ pubsubSubQuery.getQuery() })`)
|
|
|
|
|
.setParameters(pubsubSubQuery.getParameters())
|
|
|
|
@@ -87,7 +87,7 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
|
|
|
|
this.instancesRepository.createQueryBuilder('instance')
|
|
|
|
|
.select('COUNT(instance.id)')
|
|
|
|
|
.where(`instance.host IN (${ subInstancesQuery.getQuery() })`)
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: this.meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : '(\'.\' || instance.host) NOT ILIKE ALL(select \'%.\' || x from (select unnest("blockedHosts") as x from "meta") t)')
|
|
|
|
|
.andWhere('instance.suspensionState = \'none\'')
|
|
|
|
|
.andWhere('instance.isNotResponding = false')
|
|
|
|
|
.getRawOne()
|
|
|
|
@@ -95,7 +95,7 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
|
|
|
|
this.instancesRepository.createQueryBuilder('instance')
|
|
|
|
|
.select('COUNT(instance.id)')
|
|
|
|
|
.where(`instance.host IN (${ pubInstancesQuery.getQuery() })`)
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: this.meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
|
|
|
|
.andWhere(this.meta.blockedHosts.length === 0 ? '1=1' : '(\'.\' || instance.host) NOT ILIKE ALL(select \'%.\' || x from (select unnest("blockedHosts") as x from "meta") t)')
|
|
|
|
|
.andWhere('instance.suspensionState = \'none\'')
|
|
|
|
|
.andWhere('instance.isNotResponding = false')
|
|
|
|
|
.getRawOne()
|
|
|
|
|