nicer SQL checks for blocked hosts
instead of passing a (possibly gigantic) array from JS, we get PostgreSQL to look at the value in the `meta` table directly tested the `federation/instances` endpoint, and the `QueryService` methods; I have not tested the charts
This commit is contained in:
parent
54b5c930cb
commit
31d93c8052
3 changed files with 8 additions and 9 deletions
|
|
@ -261,8 +261,7 @@ export class QueryService {
|
|||
if (this.meta.blockedHosts.length === 0) {
|
||||
nonBlockedHostQuery = () => '1=1';
|
||||
} else {
|
||||
nonBlockedHostQuery = (match: string) => `${match} NOT ILIKE ALL(ARRAY[:...blocked])`;
|
||||
q.setParameters({ blocked: this.meta.blockedHosts.flatMap(x => [x, `%.${x}`]) });
|
||||
nonBlockedHostQuery = (match: string) => `('.' || ${match}) NOT ILIKE ALL(select '%.' || x from (select unnest("blockedHosts") as x from "meta") t)`;
|
||||
}
|
||||
|
||||
if (excludeAuthor) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue