server: block subdomains of a blocked host #259

Closed
norm wants to merge 7 commits from wildcard-block into main
Showing only changes of commit 1b6361f289 - Show all commits

View file

@ -29,10 +29,10 @@ export async function shouldBlockInstance(host: Instance['host']): Promise<boole
return true;
}
const result: { exists: boolean } = await db.query('SELECT EXISTS(SELECT "host" FROM instance WHERE ("host" = $1 OR "host" LIKE \'%.\' || $1) AND "isSuspended") AS "exists"', [
const result = await db.query('SELECT "host" FROM instance WHERE ("host" = $1 OR "host" LIKE \'%.\' || $1) AND "isSuspended"', [
host,
]);
return result.exists;
return result.host.length > 0;
}
/**