diff --git a/lib/main.dart b/lib/main.dart index eba2e17c..d343066f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -50,7 +50,6 @@ DiscordRPC? discordRpc; WebViewEnvironment? webViewEnvironment; String? customDns; void main(List args) async { - cfResolutionWebviewServer(); WidgetsFlutterBinding.ensureInitialized(); if (Platform.isLinux && runWebViewTitleBarWidget(args)) return; MediaKit.ensureInitialized(); @@ -93,6 +92,7 @@ Future _postLaunchInit(StorageProvider storage) async { await discordRpc?.initialize(); } await storage.deleteBtDirectory(); + await cfResolutionWebviewServer(); } class MyApp extends ConsumerStatefulWidget { diff --git a/lib/services/http/m_client.dart b/lib/services/http/m_client.dart index dd68ca1d..5f95c732 100644 --- a/lib/services/http/m_client.dart +++ b/lib/services/http/m_client.dart @@ -292,7 +292,9 @@ class ResolveCloudFlareChallenge extends RetryPolicy { } int cfPort = 0; -void cfResolutionWebviewServer() async { + +/// Cloudflare Resolution Webview Server +Future cfResolutionWebviewServer() async { final server = await HttpServer.bind(InternetAddress.loopbackIPv4, cfPort); cfPort = server.port;