mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-03-11 17:24:09 +00:00
fix: Implement correct DNS entries creation and deletion
This commit is contained in:
parent
9184a9db5d
commit
07de11c75a
1 changed files with 7 additions and 4 deletions
|
@ -105,12 +105,15 @@ class DigitalOceanDnsApi extends DnsProviderApi {
|
||||||
|
|
||||||
final Dio client = await getClient();
|
final Dio client = await getClient();
|
||||||
try {
|
try {
|
||||||
|
const String ignoreType = 'SOA';
|
||||||
final List<Future> allDeleteFutures = [];
|
final List<Future> allDeleteFutures = [];
|
||||||
final List<DnsRecord> records = await getDnsRecords(domain: domain);
|
final List<DnsRecord> records = await getDnsRecords(domain: domain);
|
||||||
for (final record in records) {
|
for (final record in records) {
|
||||||
allDeleteFutures.add(
|
if (record.type != ignoreType) {
|
||||||
client.delete('/domains/$domainName/records/${record.id}'),
|
allDeleteFutures.add(
|
||||||
);
|
client.delete('/domains/$domainName/records/${record.id}'),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await Future.wait(allDeleteFutures);
|
await Future.wait(allDeleteFutures);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -186,7 +189,7 @@ class DigitalOceanDnsApi extends DnsProviderApi {
|
||||||
data: {
|
data: {
|
||||||
'type': record.type,
|
'type': record.type,
|
||||||
'name': record.name,
|
'name': record.name,
|
||||||
'data': record.content,
|
'data': record.type == 'MX' ? '@' : record.content,
|
||||||
'ttl': record.ttl,
|
'ttl': record.ttl,
|
||||||
'priority': record.priority,
|
'priority': record.priority,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue