This commit is contained in:
atsuchan 2025-05-04 12:57:44 +00:00 committed by GitHub
commit f007182feb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 6 deletions

View File

@ -101,9 +101,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (typeof ps.blocked === 'boolean') { if (typeof ps.blocked === 'boolean') {
const meta = await this.metaService.fetch(true); const meta = await this.metaService.fetch(true);
if (ps.blocked) { if (ps.blocked) {
query.andWhere(meta.blockedHosts.length === 0 ? '1=0' : 'instance.host IN (:...blocks)', { blocks: meta.blockedHosts }); query.andWhere(meta.blockedHosts.length === 0 ? '1=0' : 'instance.host ILIKE ANY(ARRAY[:...blocks])', { blocks: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) });
} else { } else {
query.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT IN (:...blocks)', { blocks: meta.blockedHosts }); query.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ALL(ARRAY[:...blocks])', { blocks: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) });
} }
} }
@ -130,12 +130,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (meta.silencedHosts.length === 0) { if (meta.silencedHosts.length === 0) {
return []; return [];
} }
query.andWhere('instance.host IN (:...silences)', { query.andWhere('instance.host ILIKE ANY(ARRAY[:...silences])', {
silences: meta.silencedHosts, silences: meta.silencedHosts.flatMap(x => [x, `%.${x}`]),
}); });
} else if (meta.silencedHosts.length > 0) { } else if (meta.silencedHosts.length > 0) {
query.andWhere('instance.host NOT IN (:...silences)', { query.andWhere('instance.host NOT ILIKE ALL(ARRAY[:...silences])', {
silences: meta.silencedHosts, silences: meta.silencedHosts.flatMap(x => [x, `%.${x}`]),
}); });
} }
} }