From f262416bdb14f18c61c8086d9f92dcf8ea44a52b Mon Sep 17 00:00:00 2001 From: New Future Date: Fri, 20 May 2022 12:31:30 +0800 Subject: [PATCH 1/2] fix subdomain --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 47b9713..414ee3a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,7 +69,7 @@ type IReturnData = (IDomainData) & (IReturnCa) & (IRe export async function certificateFor(requestedDomains: string | string[], options: O = {} as O): Promise> { const domains = Array.isArray(requestedDomains) ? requestedDomains : [requestedDomains]; domains.forEach((domain) => { - if (!isValidDomain(domain, { subdomain: false, wildcard: false, allowUnicode: true, topLevel: false })) { + if (!isValidDomain(domain, { subdomain: true, wildcard: false, allowUnicode: true, topLevel: false })) { throw new Error(`"${domain}" is not a valid domain name.`); } }); From 4f67afbcbf8f1a56dd6a3d7fa6740507c17595b4 Mon Sep 17 00:00:00 2001 From: New Future Date: Thu, 9 Jun 2022 13:38:07 +0800 Subject: [PATCH 2/2] add localhost --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 414ee3a..bee0b4c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,7 +69,7 @@ type IReturnData = (IDomainData) & (IReturnCa) & (IRe export async function certificateFor(requestedDomains: string | string[], options: O = {} as O): Promise> { const domains = Array.isArray(requestedDomains) ? requestedDomains : [requestedDomains]; domains.forEach((domain) => { - if (!isValidDomain(domain, { subdomain: true, wildcard: false, allowUnicode: true, topLevel: false })) { + if (domain !== "localhost" && !isValidDomain(domain, { subdomain: true, wildcard: false, allowUnicode: true, topLevel: false })) { throw new Error(`"${domain}" is not a valid domain name.`); } });