From 8f7730575e19cd56ae5be5d88e71d5f28cca7edc Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 5 Sep 2023 08:34:01 -0300 Subject: [PATCH 1/2] fix: Wrap DNS check in catch to avoid runtime crash --- .../server_installation_repository.dart | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index c3fd6811..7f33d4f7 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -218,19 +218,23 @@ class ServerInstallationRepository { final Map skippedMatches, ) async { final Map matches = {}; - await InternetAddress.lookup(domainName!).then( - (final records) { - for (final record in records) { - if (skippedMatches[record.host] ?? false) { - matches[record.host] = true; - continue; + try { + await InternetAddress.lookup(domainName!).then( + (final records) { + for (final record in records) { + if (skippedMatches[record.host] ?? false) { + matches[record.host] = true; + continue; + } + if (record.address == ip4!) { + matches[record.host] = true; + } } - if (record.address == ip4!) { - matches[record.host] = true; - } - } - }, - ); + }, + ); + } catch (e) { + print(e); + } return matches; } From 85abd8f0fca2cc134809ea364940ab1bd93d6674 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 5 Sep 2023 08:45:09 -0300 Subject: [PATCH 2/2] refactor: Remove mentions of cloudflare from general variables --- .../server_installation/server_installation_repository.dart | 6 +++--- lib/ui/pages/setup/initializing/initializing.dart | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index c3fd6811..37e0cb95 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -155,7 +155,7 @@ class ServerInstallationRepository { RecoveryStep _getCurrentRecoveryStep( final String? serverProviderToken, - final String? cloudflareToken, + final String? dnsProviderToken, final ServerDomain serverDomain, final ServerHostingDetails? serverDetails, ) { @@ -235,7 +235,7 @@ class ServerInstallationRepository { return matches; } - Future createDkimRecord(final ServerDomain cloudFlareDomain) async { + Future createDkimRecord(final ServerDomain domain) async { final ServerApi api = ServerApi(); late DnsRecord record; @@ -248,7 +248,7 @@ class ServerInstallationRepository { await ProvidersController.currentDnsProvider!.setDnsRecord( record, - cloudFlareDomain, + domain, ); } diff --git a/lib/ui/pages/setup/initializing/initializing.dart b/lib/ui/pages/setup/initializing/initializing.dart index 5d54935a..4e9b1a78 100644 --- a/lib/ui/pages/setup/initializing/initializing.dart +++ b/lib/ui/pages/setup/initializing/initializing.dart @@ -99,7 +99,7 @@ class InitializingPage extends StatelessWidget { steps: const [ 'Hosting', 'Server Type', - 'CloudFlare', + 'DNS Provider', 'Backblaze', 'Domain', 'User',