start on creating dns records
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user