diff --git a/src/core/runtime/dns-browser.js b/src/core/runtime/dns-browser.js index 9ca358d95b..26cf106ee0 100644 --- a/src/core/runtime/dns-browser.js +++ b/src/core/runtime/dns-browser.js @@ -1,16 +1,14 @@ 'use strict' -const dns = require('dns') - module.exports = (domain, opts, callback) => { domain = encodeURIComponent(domain) - const url = `https://ipfs.io/api/v0/dns?arg=${domain}` + let url = `https://ipfs.io/api/v0/dns?arg=${domain}` for (const prop in opts) { url += `&${prop}=${opts[prop]}` } - fetch(url, {mode: 'cors'}) + window.fetch(url, {mode: 'cors'}) .then((response) => { const resp = response.json() if (resp.Path) { diff --git a/src/core/runtime/dns-nodejs.js b/src/core/runtime/dns-nodejs.js index 01eb00609f..8f6bb132bd 100644 --- a/src/core/runtime/dns-nodejs.js +++ b/src/core/runtime/dns-nodejs.js @@ -13,7 +13,7 @@ module.exports = (domain, opts, callback) => { for (const record of records) { if (record[0].startsWith('dnslink=')) { return callback(null, record[0].substr(8, record[0].length - 1)) - } + } } callback(new Error('domain does not have a txt dnslink entry'))