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,13 +105,16 @@ class DigitalOceanDnsApi extends DnsProviderApi {
|
|||
|
||||
final Dio client = await getClient();
|
||||
try {
|
||||
const String ignoreType = 'SOA';
|
||||
final List<Future> allDeleteFutures = [];
|
||||
final List<DnsRecord> records = await getDnsRecords(domain: domain);
|
||||
for (final record in records) {
|
||||
if (record.type != ignoreType) {
|
||||
allDeleteFutures.add(
|
||||
client.delete('/domains/$domainName/records/${record.id}'),
|
||||
);
|
||||
}
|
||||
}
|
||||
await Future.wait(allDeleteFutures);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
|
@ -186,7 +189,7 @@ class DigitalOceanDnsApi extends DnsProviderApi {
|
|||
data: {
|
||||
'type': record.type,
|
||||
'name': record.name,
|
||||
'data': record.content,
|
||||
'data': record.type == 'MX' ? '@' : record.content,
|
||||
'ttl': record.ttl,
|
||||
'priority': record.priority,
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue