feat: use better embedded Tor (#2453)

* feat: use better embedded Tor

* update docs [skip ci]

* fix: update torch properly add minimum os version for iOS

* fix: use of invalid thread api on iOS

* fix: disable use of lzma and zstd system libraries

* fix: update torch_dart to work on linux
This commit is contained in:
cyan
2025-09-05 23:07:26 +03:00
committed by GitHub
parent f0ca065a48
commit 2dc95b2bf0
42 changed files with 294 additions and 192 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ class FeatureFlag {
static const bool isCakePayRedemptionFlowEnabled = false;
static const bool isExolixEnabled = true;
static const bool isBackgroundSyncEnabled = true;
static final bool isInAppTorEnabled = CakeTor.instance is! CakeTorDisabled;
static bool get isInAppTorEnabled => CakeTor.instance is! CakeTorDisabled;
static const int verificationWordsCount = kDebugMode ? 0 : 2;
static const bool hasDevOptions = bool.fromEnvironment('hasDevOptions', defaultValue: kDebugMode);
static const bool hasBitcoinViewOnly = true;
+1 -1
View File
@@ -13,7 +13,7 @@ class ImageUtil {
}) {
bool isNetworkImage = imagePath.startsWith('http') || imagePath.startsWith('https');
if (CakeTor.instance.enabled && isNetworkImage) {
if (CakeTor.instance!.enabled && isNetworkImage) {
imagePath = "assets/images/tor_logo.svg";
isNetworkImage = false;
}
+6 -6
View File
@@ -15,7 +15,7 @@ Future<void> ensureTorStopped({required BuildContext? context}) async {
if (context != null) dialogContext = await showFullscreenDialog(context);
didTorStart = false;
printV("Stopping tor");
await CakeTor.instance.stop();
await CakeTor.instance!.stop();
printV("Tor stopped");
if (context != null) dismissFullscreenDialog(dialogContext!);
}
@@ -32,20 +32,20 @@ Future<void> ensureTorStarted({required BuildContext? context}) async {
// var rootToken = RootIsolateToken.instance!;
// await Isolate.run(() async {
// BackgroundIsolateBinaryMessenger.ensureInitialized(rootToken);
// await CakeTor.instance.start();
// await CakeTor.instance!.start();
// });
// second start is fast but populates the values on current thread
await CakeTor.instance.start();
await CakeTor.instance!.start();
printV("Tor started");
while (!CakeTor.instance.started) {
while (!CakeTor.instance!.started) {
printV("Waiting for tor to start (part 1)");
await Future.delayed(const Duration(seconds: 1));
}
while (CakeTor.instance.port == -1) {
while (CakeTor.instance!.port == -1) {
printV("Waiting for tor to start (listening on port)");
await Future.delayed(const Duration(seconds: 1));
}
printV("Tor started on port ${CakeTor.instance.port}");
printV("Tor started on port ${CakeTor.instance!.port}");
if (context != null) dismissFullscreenDialog(dialogContext!);
}