mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 13:27:31 -07:00
Fix bug
This commit is contained in:
parent
110240c76b
commit
ff1bd37bd7
1 changed files with 10 additions and 4 deletions
|
@ -34,7 +34,7 @@ export default define(meta, async (ps) => {
|
||||||
|
|
||||||
if (ps.domain) {
|
if (ps.domain) {
|
||||||
const whiteDomains = ps.domain.split(' ').filter(x => !x.startsWith('-'));
|
const whiteDomains = ps.domain.split(' ').filter(x => !x.startsWith('-'));
|
||||||
const blackDomains = ps.domain.split(' ').filter(x => x.startsWith('-'));
|
const blackDomains = ps.domain.split(' ').filter(x => x.startsWith('-')).map(x => x.substr(1));
|
||||||
|
|
||||||
if (whiteDomains.length > 0) {
|
if (whiteDomains.length > 0) {
|
||||||
query.andWhere(new Brackets(qb => {
|
query.andWhere(new Brackets(qb => {
|
||||||
|
@ -53,11 +53,17 @@ export default define(meta, async (ps) => {
|
||||||
if (blackDomains.length > 0) {
|
if (blackDomains.length > 0) {
|
||||||
query.andWhere(new Brackets(qb => {
|
query.andWhere(new Brackets(qb => {
|
||||||
for (const blackDomain of blackDomains) {
|
for (const blackDomain of blackDomains) {
|
||||||
|
const subDomains = blackDomain.split('.');
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (const subDomain of blackDomain.split('.')) {
|
for (const subDomain of subDomains) {
|
||||||
const p = `blackSubDomain_${subDomain}_${i}`;
|
const p = `blackSubDomain_${subDomain}_${i}`;
|
||||||
|
if (i === subDomains.length - 1) {
|
||||||
// SQL is 1 based, so we need '+ 1'
|
// SQL is 1 based, so we need '+ 1'
|
||||||
qb.andWhere(`log.domain[${i + 1}] != :${p}`, { [p]: subDomain });
|
qb.andWhere(`log.domain[${i + 1}] != :${p}`, { [p]: subDomain });
|
||||||
|
} else {
|
||||||
|
// SQL is 1 based, so we need '+ 1'
|
||||||
|
qb.andWhere(`log.domain[${i + 1}] == :${p}`, { [p]: subDomain });
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue