Prokbun API fix
This commit is contained in:
@@ -182,17 +182,21 @@ if(require.main === module){(async function(){try{
|
|||||||
|
|
||||||
// console.log(await DnsProvider.findall());
|
// console.log(await DnsProvider.findall());
|
||||||
|
|
||||||
let provider = await DnsProvider.get('e8443e03ac503c7b');
|
let provider = await DnsProvider.get('84c6613b9464fbe1');
|
||||||
|
|
||||||
console.log(await provider.listDomains())
|
// console.log(await provider.listDomains())
|
||||||
|
|
||||||
let domain = await Domain.get('holycore.quest') // pork
|
let domain = await Domain.get('holycore.quest') // pork
|
||||||
// let domain = await Domain.get('rm-rf.stream') // DO
|
// let domain = await Domain.get('rm-rf.stream') // DO
|
||||||
// let domain = await Domain.get('test.wtf') // CF
|
// let domain = await Domain.get('test.wtf') // CF
|
||||||
|
|
||||||
// console.log(await domain.createRecord({type: 'TXT', name: 'apitewefweefwsewft222', data:'hiiiiiii'}))
|
console.log(await domain.createRecord({
|
||||||
|
type: 'TXT',
|
||||||
|
name: 'apitewefweefwsewft222',
|
||||||
|
data: 'sdddddddad'
|
||||||
|
}));
|
||||||
|
|
||||||
let txtRecords = await domain.getRecords({type: 'TXT'});
|
let txtRecords = await domain.getRecords();
|
||||||
console.log(txtRecords.map(i=>`${i.name}: ${i.data}`))
|
console.log(txtRecords.map(i=>`${i.name}: ${i.data}`))
|
||||||
// console.log(await domain.deleteRecords({type: 'TXT'}))
|
// console.log(await domain.deleteRecords({type: 'TXT'}))
|
||||||
|
|
||||||
|
|||||||
@@ -93,13 +93,19 @@ class PorkBun extends DnsApi{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async createRecord(domain, options, force){
|
async createRecord(domain, options, force = true){
|
||||||
if(force){
|
|
||||||
await this.deleteRecords(domain, options)
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
// Throw errors for missing keys, do this first.
|
||||||
options = this.__parseOptions(options, ['type', 'name', 'data']);
|
options = this.__parseOptions(options, ['type', 'name', 'data']);
|
||||||
|
|
||||||
|
// Delete the current records
|
||||||
|
if(force){
|
||||||
|
let forceOptions = new Map(Object.entries(options));
|
||||||
|
forceOptions.delete('data');
|
||||||
|
forceOptions.delete('content');
|
||||||
|
await this.deleteRecords(domain, Object.fromEntries(forceOptions));
|
||||||
|
}
|
||||||
|
|
||||||
let res = await this.post(`/dns/create/${domain}`, options);
|
let res = await this.post(`/dns/create/${domain}`, options);
|
||||||
|
|
||||||
return res.data.result;
|
return res.data.result;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const {Host} = require('../models/host');
|
|||||||
|
|
||||||
// Initial wildcard cert check 30 seconds after app starts
|
// Initial wildcard cert check 30 seconds after app starts
|
||||||
// Delay allows the system to fully initialize before checking certs
|
// Delay allows the system to fully initialize before checking certs
|
||||||
setTimeout(Host.checkWildcardForRenew.bind(Host), 30000);
|
// setTimeout(Host.checkWildcardForRenew.bind(Host), 30000);
|
||||||
|
|
||||||
// Check wildcard certs once every 24 hours
|
// Check wildcard certs once every 24 hours
|
||||||
// Ensures certificates are renewed well before expiration
|
// Ensures certificates are renewed well before expiration
|
||||||
|
|||||||
Reference in New Issue
Block a user