feat: Implement proper DKIM creation for deSEC

This commit is contained in:
NaiJi 2023-05-16 12:49:55 -03:00 committed by Inex Code
parent 32ef162f9b
commit 6bee028188
3 changed files with 20 additions and 7 deletions

View file

@ -286,11 +286,13 @@
"select_provider_countries_text_hetzner": "Germany, Finland, USA",
"select_provider_countries_text_do": "USA, Netherlands, Singapore, UK, Germany, Canada, India, Australia",
"select_provider_price_title": "Average price",
"select_provider_price_free": "Free",
"select_provider_price_text_hetzner": "€8 per month for a relatively small server and 50GB of disk storage",
"select_provider_price_text_do": "$17 per month for a relatively small server and 50GB of disk storage",
"select_provider_payment_title": "Payment methods",
"select_provider_payment_text_hetzner": "Credit cards, SWIFT, SEPA, PayPal",
"select_provider_payment_text_do": "Credit cards, Google Pay, PayPal",
"select_provider_payment_text_cloudflare": "Credit cards",
"select_provider_email_notice": "E-mail hosting won't be available for new clients. Nevertheless it will be unlocked as soon as you complete your first payment.",
"select_provider_site_button": "Visit site",
"connect_to_server_provider": "Now log in ",

View file

@ -280,10 +280,12 @@
"select_provider_countries_text_hetzner": "Германия, Финляндия, США",
"select_provider_countries_text_do": "США, Нидерланды, Сингапур, Великобритания, Германия, Канада, Индия, Австралия",
"select_provider_price_title": "Средняя цена",
"select_provider_price_free": "Бесплатно",
"select_provider_price_text_hetzner": "€8 в месяц за небольшой сервер и 50GB места на диске",
"select_provider_price_text_do": "$17 в месяц за небольшой сервер и 50GB места на диске",
"select_provider_payment_title": "Методы оплаты",
"select_provider_payment_text_hetzner": "Банковские карты, SWIFT, SEPA, PayPal",
"select_provider_payment_text_cloudflare": "Банковские карты",
"select_provider_payment_text_do": "Банковские карты, Google Pay, PayPal",
"select_provider_email_notice": "Хостинг электронной почты недоступен для новых клиентов. Разблокировать можно будет после первой оплаты.",
"select_provider_site_button": "Посетить сайт",

View file

@ -196,13 +196,13 @@ class DesecApi extends DnsProviderApi {
? {
'type': record.type,
'ttl': record.ttl,
'records': [record.content],
'records': [extractContent(record)],
}
: {
'subname': record.name,
'type': record.type,
'ttl': record.ttl,
'records': [record.content],
'records': [extractContent(record)],
},
);
}
@ -275,6 +275,15 @@ class DesecApi extends DnsProviderApi {
];
}
String? extractContent(final DnsRecord record) {
String? content = record.content;
if (record.type == 'TXT' && content != null && !content.startsWith('"')) {
content = '"$content"';
}
return content;
}
@override
Future<void> setDnsRecord(
final DnsRecord record,
@ -290,13 +299,13 @@ class DesecApi extends DnsProviderApi {
? {
'type': record.type,
'ttl': record.ttl,
'records': [record.content],
'records': [extractContent(record)],
}
: {
'subname': record.name,
'type': record.type,
'ttl': record.ttl,
'records': [record.content],
'records': [extractContent(record)],
},
);
await Future.delayed(const Duration(seconds: 1));
@ -465,7 +474,7 @@ class DesecApi extends DnsProviderApi {
if (dkimPublicKey != null)
DesiredDnsRecord(
name: 'selector._domainkey.$domainName',
content: dkimPublicKey,
content: '"$dkimPublicKey"',
description: 'record.dkim',
type: 'TXT',
category: DnsRecordsCategory.email,