mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
Merge branch 'v4.11.0_v1.8.0' of https://github.com/cake-tech/cake_wallet into cw_linux_direct_input_password
This commit is contained in:
commit
869288cbb7
3 changed files with 44 additions and 41 deletions
|
@ -6,7 +6,7 @@ import 'package:hive/hive.dart';
|
|||
import 'package:cw_core/hive_type_ids.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:http/io_client.dart' as ioc;
|
||||
import 'package:tor/tor.dart';
|
||||
// import 'package:tor/tor.dart';
|
||||
|
||||
part 'node.g.dart';
|
||||
|
||||
|
@ -214,14 +214,17 @@ class Node extends HiveObject with Keyable {
|
|||
}
|
||||
|
||||
Future<bool> requestNodeWithProxy() async {
|
||||
if (!isValidProxyAddress && !Tor.instance.enabled) {
|
||||
if (!isValidProxyAddress/* && !Tor.instance.enabled*/) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String? proxy = socksProxyAddress;
|
||||
|
||||
if ((proxy?.isEmpty ?? true) && Tor.instance.enabled) {
|
||||
proxy = "${InternetAddress.loopbackIPv4.address}:${Tor.instance.port}";
|
||||
// if ((proxy?.isEmpty ?? true) && Tor.instance.enabled) {
|
||||
// proxy = "${InternetAddress.loopbackIPv4.address}:${Tor.instance.port}";
|
||||
// }
|
||||
if (proxy == null) {
|
||||
return false;
|
||||
}
|
||||
final proxyAddress = proxy!.split(':')[0];
|
||||
final proxyPort = int.parse(proxy.split(':')[1]);
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'dart:io';
|
|||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tor/tor.dart';
|
||||
// import 'package:tor/tor.dart';
|
||||
|
||||
class TorPage extends BasePage {
|
||||
final AppStore appStore;
|
||||
|
@ -40,44 +40,44 @@ class _TorPageBodyState extends State<TorPageBody> {
|
|||
connecting = true; // Update flag
|
||||
});
|
||||
|
||||
await Tor.init();
|
||||
|
||||
// Start the proxy
|
||||
await Tor.instance.start();
|
||||
|
||||
// Toggle started flag.
|
||||
setState(() {
|
||||
torEnabled = Tor.instance.enabled; // Update flag
|
||||
connecting = false;
|
||||
});
|
||||
|
||||
final node = widget.appStore.settingsStore.getCurrentNode(widget.appStore.wallet!.type);
|
||||
if (node.socksProxyAddress?.isEmpty ?? true) {
|
||||
node.socksProxyAddress = "${InternetAddress.loopbackIPv4.address}:${Tor.instance.port}";
|
||||
}
|
||||
widget.appStore.wallet!.connectToNode(node: node);
|
||||
// await Tor.init();
|
||||
//
|
||||
// // Start the proxy
|
||||
// await Tor.instance.start();
|
||||
//
|
||||
// // Toggle started flag.
|
||||
// setState(() {
|
||||
// torEnabled = Tor.instance.enabled; // Update flag
|
||||
// connecting = false;
|
||||
// });
|
||||
//
|
||||
// final node = widget.appStore.settingsStore.getCurrentNode(widget.appStore.wallet!.type);
|
||||
// if (node.socksProxyAddress?.isEmpty ?? true) {
|
||||
// node.socksProxyAddress = "${InternetAddress.loopbackIPv4.address}:${Tor.instance.port}";
|
||||
// }
|
||||
// widget.appStore.wallet!.connectToNode(node: node);
|
||||
|
||||
print('Done awaiting; tor should be running');
|
||||
}
|
||||
|
||||
Future<void> endTor() async {
|
||||
// Start the proxy
|
||||
Tor.instance.disable();
|
||||
|
||||
// Toggle started flag.
|
||||
setState(() {
|
||||
torEnabled = Tor.instance.enabled; // Update flag
|
||||
});
|
||||
|
||||
print('Done awaiting; tor should be stopped');
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
torEnabled = Tor.instance.enabled;
|
||||
// // Start the proxy
|
||||
// Tor.instance.disable();
|
||||
//
|
||||
// // Toggle started flag.
|
||||
// setState(() {
|
||||
// torEnabled = Tor.instance.enabled; // Update flag
|
||||
// });
|
||||
//
|
||||
// print('Done awaiting; tor should be stopped');
|
||||
}
|
||||
//
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
//
|
||||
// torEnabled = Tor.instance.enabled;
|
||||
// }
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
|
|
@ -91,10 +91,10 @@ dependencies:
|
|||
url: https://github.com/cake-tech/bitcoin_flutter.git
|
||||
ref: cake-update-v3
|
||||
fluttertoast: 8.1.4
|
||||
tor:
|
||||
git:
|
||||
url: https://github.com/cake-tech/tor.git
|
||||
ref: main
|
||||
# tor:
|
||||
# git:
|
||||
# url: https://github.com/cake-tech/tor.git
|
||||
# ref: main
|
||||
socks5_proxy: ^1.0.4
|
||||
flutter_svg: ^2.0.9
|
||||
polyseed:
|
||||
|
|
Loading…
Reference in a new issue