mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-03-11 17:25:32 +00:00
Start Cloudflare resolution after app starts
- Defer the Cloudflare resolution webserver until after runApp(). - await said function
This commit is contained in:
parent
e0ecc94869
commit
5c34dcab9a
2 changed files with 4 additions and 2 deletions
|
|
@ -50,7 +50,6 @@ DiscordRPC? discordRpc;
|
|||
WebViewEnvironment? webViewEnvironment;
|
||||
String? customDns;
|
||||
void main(List<String> args) async {
|
||||
cfResolutionWebviewServer();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
if (Platform.isLinux && runWebViewTitleBarWidget(args)) return;
|
||||
MediaKit.ensureInitialized();
|
||||
|
|
@ -93,6 +92,7 @@ Future<void> _postLaunchInit(StorageProvider storage) async {
|
|||
await discordRpc?.initialize();
|
||||
}
|
||||
await storage.deleteBtDirectory();
|
||||
await cfResolutionWebviewServer();
|
||||
}
|
||||
|
||||
class MyApp extends ConsumerStatefulWidget {
|
||||
|
|
|
|||
|
|
@ -292,7 +292,9 @@ class ResolveCloudFlareChallenge extends RetryPolicy {
|
|||
}
|
||||
|
||||
int cfPort = 0;
|
||||
void cfResolutionWebviewServer() async {
|
||||
|
||||
/// Cloudflare Resolution Webview Server
|
||||
Future<void> cfResolutionWebviewServer() async {
|
||||
final server = await HttpServer.bind(InternetAddress.loopbackIPv4, cfPort);
|
||||
cfPort = server.port;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue