summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/QueryService.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2025-05-02 15:26:15 +0100
committerdakkar <dakkar@thenautilus.net>2025-05-02 15:57:56 +0100
commit31d93c80525ef450f528287c50ed22270892c432 (patch)
tree60b68311047061999dc2eeba77583b302e1005d8 /packages/backend/src/core/QueryService.ts
parentenforce maxFileSize for remote users (diff)
downloadsharkey-31d93c80525ef450f528287c50ed22270892c432.tar.gz
sharkey-31d93c80525ef450f528287c50ed22270892c432.tar.bz2
sharkey-31d93c80525ef450f528287c50ed22270892c432.zip
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
Diffstat (limited to 'packages/backend/src/core/QueryService.ts')
-rw-r--r--packages/backend/src/core/QueryService.ts3
1 files changed, 1 insertions, 2 deletions
diff --git a/packages/backend/src/core/QueryService.ts b/packages/backend/src/core/QueryService.ts
index fb4335b55d..50a72e8aa6 100644
--- a/packages/backend/src/core/QueryService.ts
+++ b/packages/backend/src/core/QueryService.ts
@@ -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) {