diff --git a/coredns_bridge.js b/coredns_bridge.js index 8e1f239..cb2c77b 100644 --- a/coredns_bridge.js +++ b/coredns_bridge.js @@ -13,7 +13,6 @@ function DomainToCoreDNS(domain) { async function GetAllRecords(domain) { const prefix = DomainToCoreDNS(domain) + "/"; - console.log(prefix); if (!prefix) throw new Error("Invalid domain"); const kvs = await client.getAll().prefix(prefix).strings(); diff --git a/index.html b/index.html new file mode 100644 index 0000000..dccc6b5 --- /dev/null +++ b/index.html @@ -0,0 +1,11 @@ + + +
+ + +This is the default web page. Please configure your DNS.
+ + \ No newline at end of file diff --git a/routes/dns.js b/routes/dns.js index 20dc9bd..ccaf96e 100644 --- a/routes/dns.js +++ b/routes/dns.js @@ -6,7 +6,7 @@ const database = require('../database.js'); const dbConnection = database.db; const Sequelize = require('sequelize'); const pageTitle = 'Domain Manager | Edit DNS'; - +const { GetAllRecords } = require('../coredns_bridge.js'); // Manage domains router.get('/dns/edit/:domainId', authMw.AllowIfAuthenticated, async (req, res, next) => { @@ -24,7 +24,10 @@ router.get('/dns/edit/:domainId', authMw.AllowIfAuthenticated, async (req, res, if(!result) return next(); - res.render('dns', {title: pageTitle, domain: result}); + const fullDomain = result.domain + "." + result.tld; + let records = GetAllRecords(fullDomain); + + res.render('dns', {title: pageTitle, domain: result, dnsRecords: records}); }); module.exports = router; \ No newline at end of file diff --git a/views/dns.handlebars b/views/dns.handlebars index 942dffd..54fee46 100644 --- a/views/dns.handlebars +++ b/views/dns.handlebars @@ -1 +1,5 @@ -Configuring DNS records for {{domain.domain}}.{{domain.tld}}
\ No newline at end of file +Configuring DNS records for {{domain.domain}}.{{domain.tld}}
+ +{{#each dnsRecords}} + {{this}} +{{/each}} \ No newline at end of file