From b2caf99345e1ee0c13d3ac8b92b34f499636fc18 Mon Sep 17 00:00:00 2001 From: Modnark Date: Thu, 14 May 2026 18:33:29 -0400 Subject: [PATCH] start on creating dns records --- routes/dns.js | 28 ++++++++++++++++++++++++++++ views/dns.handlebars | 2 +- views/newdns.handlebars | 16 ++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 views/newdns.handlebars diff --git a/routes/dns.js b/routes/dns.js index cfa7c23..05809ed 100644 --- a/routes/dns.js +++ b/routes/dns.js @@ -17,6 +17,13 @@ const recordTypeMap = { "srv": "SRV" } +const supportedRecordTypes = [ + "A", + "CNAME", + "TXT", + "MX" +]; + // Manage domains router.get('/dns/edit/:domainId', authMw.AllowIfAuthenticated, async (req, res, next) => { const result = await dbConnection.transaction(async(t) => { @@ -70,4 +77,25 @@ router.get('/dns/edit/:domainId', authMw.AllowIfAuthenticated, async (req, res, res.render('dns', {title: pageTitle, domain: result, dnsRecords: records, dnsRecordsHeaders: recordHeaders}); }); +// Add new DNS record +router.get('/dns/new/:domainId', authMw.AllowIfAuthenticated, async (req, res, next) => { + const result = await dbConnection.transaction(async(t) => { + const ownedDomain = await database.models.RegisteredDomain.findOne({ + where: { + id: req.params.domainId, + owner: req.session.userId + } + }, {transaction: t}); + + return ownedDomain; + }); + + if(!result) + return next(); + + const fullDomain = result.domain + "." + result.tld; + + res.render('newdns', {title: pageTitle, domain: result, supportedRecordTypes: supportedRecordTypes}); +}); + module.exports = router; \ No newline at end of file diff --git a/views/dns.handlebars b/views/dns.handlebars index e5cf632..63719d4 100644 --- a/views/dns.handlebars +++ b/views/dns.handlebars @@ -31,6 +31,6 @@

Options

\ No newline at end of file diff --git a/views/newdns.handlebars b/views/newdns.handlebars new file mode 100644 index 0000000..2878c09 --- /dev/null +++ b/views/newdns.handlebars @@ -0,0 +1,16 @@ +
+ + + + + + + + + + + +