From a25729843670469b3584ec9a2df535d9349b7cae Mon Sep 17 00:00:00 2001 From: Modnark Date: Thu, 14 May 2026 14:45:14 -0400 Subject: [PATCH] start DNS configuration --- coredns_bridge.js | 1 - index.html | 11 +++++++++++ routes/dns.js | 7 +++++-- views/dns.handlebars | 6 +++++- 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 index.html 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 @@ + + + + + + Default Page + + +

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