WIP properly fails dry challenge

This commit is contained in:
AJ ONeal 2019-04-29 02:01:14 -06:00
parent 7f0a5fb28a
commit 0ce04b7466
2 changed files with 10 additions and 11 deletions

1
app.js
View File

@ -163,6 +163,7 @@
}).catch(function (err) { }).catch(function (err) {
console.error("A bad thing happened:"); console.error("A bad thing happened:");
console.error(err); console.error(err);
window.alert(err.message || JSON.stringify(err, null, 2));
}); });
}); });
}); });

View File

@ -823,17 +823,15 @@ ACME.create = function create(me) {
if (!me.dig) { if (!me.dig) {
me.dig = function (query) { me.dig = function (query) {
// TODO use digd.js // TODO use digd.js
return new Promise(function (resolve, reject) { return new me.request({ url: "/api/dns/" + query.name + "?type=" + query.type }).then(function (resp) {
var dns = require('dns'); if (!resp.body || !Array.isArray(resp.body.answer)) {
dns.resolveTxt(query.name, function (err, records) { throw new Error("failed to get DNS response");
if (err) { reject(err); return; } }
return {
resolve({ answer: resp.body.answer.map(function (ans) {
answer: records.map(function (rr) { return { data: ans.data, ttl: ans.ttl };
return { data: rr };
}) })
}); };
});
}); });
}; };
} }