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;
|
||||
@@ -31,6 +31,6 @@
|
||||
<div style="width: 200px;"></div>
|
||||
<p class="TitleText">Options</p>
|
||||
<ul>
|
||||
<li><a href="/dns/new">Add New Record</a></li>
|
||||
<li><a href="/dns/new/{{domain.id}}">Add New Record</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,16 @@
|
||||
<form action="/dns/new/{{domain.id}}">
|
||||
<label for="dns_record_type">Type</label>
|
||||
<select name="dns_record_type" id="dns_record_type">
|
||||
{{#each supportedRecordTypes}}
|
||||
{{/each}}
|
||||
</select>
|
||||
|
||||
<label for="dns_record_name">Name</label>
|
||||
<input type="text" name="dns_record_name" id="dns_record_name">
|
||||
|
||||
<label for="dns_record_host">Host</label>
|
||||
<input type="text" name="dns_record_host" id="dns_record_host">
|
||||
|
||||
<label for="dns_record_ttl">TTL</label>
|
||||
<input type="text" name="dns_record_ttl" id="dns_record_ttl">
|
||||
</form>
|
||||
Reference in New Issue
Block a user