Skip to content

Commit

Permalink
Fix: Judge instance block subdomain maching
Browse files Browse the repository at this point in the history
  • Loading branch information
atsu1125 committed Aug 19, 2024
1 parent 4ff88d7 commit 73316f7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (ps.blocked) {
query.andWhere(meta.blockedHosts.length === 0 ? '1=0' : 'instance.host ILIKE ANY(ARRAY[:...blocks])', { blocks: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) });
} else {
query.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ANY(ARRAY[:...blocks])', { blocks: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) });
query.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ALL(ARRAY[:...blocks])', { blocks: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) });
}
}

Expand Down Expand Up @@ -114,7 +114,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
silences: meta.silencedHosts.flatMap(x => [x, `%.${x}`]),
});
} else if (meta.silencedHosts.length > 0) {
query.andWhere("instance.host NOT ILIKE ANY(ARRAY[:...silences])", {
query.andWhere("instance.host NOT ILIKE ALL(ARRAY[:...silences])", {
silences: meta.silencedHosts.flatMap(x => [x, `%.${x}`]),
});
}
Expand Down

0 comments on commit 73316f7

Please sign in to comment.