fix(cloudflare): Convert MX name from @ to root domain

- #265
pull/424/head
NaiJi ✨ 2024-01-15 14:45:36 +04:00 committed by Inex Code
parent 39f92f769b
commit 2836ce4870
3 changed files with 9 additions and 2 deletions

View File

@ -270,6 +270,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
records: getProjectDnsRecords(
state.serverDomain!.domainName,
serverDetails.ip4,
false,
),
domain: state.serverDomain!,
);
@ -277,6 +278,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
records: getProjectDnsRecords(
state.serverDomain!.domainName,
serverDetails.ip4,
true,
),
domain: state.serverDomain!,
);

View File

@ -4,14 +4,18 @@ CloudflareDnsRecord _fromDnsRecord(
final DnsRecord dnsRecord,
final String rootDomain,
) {
final String type = dnsRecord.type;
String name = dnsRecord.name ?? '';
if (name != rootDomain && name != '@') {
name = '$name.$rootDomain';
}
if (type == 'MX' && name == '@') {
name = rootDomain;
}
return CloudflareDnsRecord(
content: dnsRecord.content,
name: name,
type: dnsRecord.type,
type: type,
zoneName: rootDomain,
id: null,
ttl: dnsRecord.ttl,

View File

@ -93,6 +93,7 @@ void launchURL(final url) async {
List<DnsRecord> getProjectDnsRecords(
final String? domainName,
final String? ip4,
final bool isCreating,
) {
final DnsRecord domainA =
DnsRecord(type: 'A', name: domainName, content: ip4);
@ -139,7 +140,7 @@ List<DnsRecord> getProjectDnsRecords(
mx,
txt1,
txt2,
txt3,
if (!isCreating) txt3,
vpn,
];
}