mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-22 08:45:24 +00:00
Catch the domains the right way
This commit is contained in:
@@ -41,7 +41,7 @@ async function query(domainId: string, domain: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let existing: any[] = [];
|
let existing: any[] = [];
|
||||||
if (domainRecord.type == "ns" || domainRecord.type == "wildcard") { // the manual "wildcard" domains can have wildcard certs
|
if (domainRecord.type == "ns" || domainRecord.type == "wildcard") {
|
||||||
const domainLevelDown = domain.split(".").slice(1).join(".");
|
const domainLevelDown = domain.split(".").slice(1).join(".");
|
||||||
const wildcardPrefixed = `*.${domainLevelDown}`;
|
const wildcardPrefixed = `*.${domainLevelDown}`;
|
||||||
|
|
||||||
@@ -64,10 +64,15 @@ async function query(domainId: string, domain: string) {
|
|||||||
eq(certificates.domainId, domainId),
|
eq(certificates.domainId, domainId),
|
||||||
or(
|
or(
|
||||||
eq(certificates.domain, domain),
|
eq(certificates.domain, domain),
|
||||||
|
and(
|
||||||
|
eq(certificates.wildcard, true),
|
||||||
|
or(
|
||||||
eq(certificates.domain, domainLevelDown),
|
eq(certificates.domain, domainLevelDown),
|
||||||
eq(certificates.domain, wildcardPrefixed)
|
eq(certificates.domain, wildcardPrefixed)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// For non-NS domains, we only match exact domain names
|
// For non-NS domains, we only match exact domain names
|
||||||
|
|||||||
Reference in New Issue
Block a user