Fix redirect

This commit is contained in:
Wildan M 2021-08-22 08:09:30 +07:00
commit 00feecd9ff
2 changed files with 21 additions and 16 deletions

6
app.js
View file

@ -29,8 +29,10 @@ function getCertCachePath(host) {
}
async function findMaintainerEmail(host) {
const resolve = await axios(`https://dns.google/resolve?name=${encodeURIComponent(host)}&type=TXT`);
for (const head of resolve.data.Answer) {
return head.data.slice(record_email_prefix.length);
if (resolve.data.Answer) {
for (const head of resolve.data.Answer) {
return head.data.slice(record_email_prefix.length);
}
}
throw new Error(record_email_prefix + ' TXT is missing');
}