From 5eb276b6fcc77ca2eb05230fc5cd31ace0d42d16 Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 4 Jun 2024 09:16:57 -0600 Subject: [PATCH] fix wow connection --- .../add_edit_node_view.dart | 15 +++++++++--- .../test_monero_node_connection.dart | 5 ++-- lib/wallets/wallet/impl/monero_wallet.dart | 2 ++ lib/wallets/wallet/impl/wownero_wallet.dart | 2 ++ pubspec.lock | 24 +++++++++---------- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart index 4ccaa47bf..478440c99 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart @@ -29,6 +29,7 @@ import '../../../../utilities/text_styles.dart'; import '../../../../utilities/util.dart'; import '../../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart'; +import '../../../../wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart'; import '../../../../widgets/background.dart'; import '../../../../widgets/conditional_parent.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; @@ -221,7 +222,7 @@ class _AddEditNodeViewState extends ConsumerState { // strip unused path String address = formData.host!; - if (coin is Monero || coin is Wownero) { + if (coin is CwBasedInterface) { if (address.startsWith("http")) { final uri = Uri.parse(address); address = "${uri.scheme}://${uri.host}"; @@ -332,7 +333,7 @@ class _AddEditNodeViewState extends ConsumerState { FocusScope.of(context).unfocus(); await Future.delayed(const Duration(milliseconds: 75)); } - if (mounted) { + if (context.mounted) { Navigator.of(context).pop(); } }, @@ -836,6 +837,14 @@ class _NodeFormState extends ConsumerState { } else { enableSSLCheckbox = true; } + } else if (widget.coin is CwBasedInterface) { + if (newValue.startsWith("https://")) { + _useSSL = true; + } else if (newValue.startsWith("http://")) { + _useSSL = false; + } else { + _useSSL = true; + } } _updateState(); setState(() {}); @@ -1043,7 +1052,7 @@ class _NodeFormState extends ConsumerState { ), ], ), - if (widget.coin is Monero || widget.coin is Wownero) + if (widget.coin is CwBasedInterface) Row( children: [ GestureDetector( diff --git a/lib/utilities/test_monero_node_connection.dart b/lib/utilities/test_monero_node_connection.dart index d6fe05cd5..bc9c95a69 100644 --- a/lib/utilities/test_monero_node_connection.dart +++ b/lib/utilities/test_monero_node_connection.dart @@ -12,11 +12,12 @@ import 'dart:convert'; import 'dart:io'; import 'package:flutter/material.dart'; -import 'format.dart'; -import 'logger.dart'; + import '../widgets/desktop/primary_button.dart'; import '../widgets/desktop/secondary_button.dart'; import '../widgets/stack_dialog.dart'; +import 'format.dart'; +import 'logger.dart'; class MoneroNodeConnectionResponse { final X509Certificate? cert; diff --git a/lib/wallets/wallet/impl/monero_wallet.dart b/lib/wallets/wallet/impl/monero_wallet.dart index 757c553f1..71dc2e238 100644 --- a/lib/wallets/wallet/impl/monero_wallet.dart +++ b/lib/wallets/wallet/impl/monero_wallet.dart @@ -201,6 +201,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { uri: "$host:${node.port}", type: WalletType.monero, trusted: node.trusted ?? false, + useSSL: node.useSSL, ), socksProxyAddress: proxy == null ? null : "${proxy.host.address}:${proxy.port}", @@ -212,6 +213,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { uri: "$host:${node.port}", type: WalletType.monero, trusted: node.trusted ?? false, + useSSL: node.useSSL, ), socksProxyAddress: proxy == null ? null : "${proxy.host.address}:${proxy.port}", diff --git a/lib/wallets/wallet/impl/wownero_wallet.dart b/lib/wallets/wallet/impl/wownero_wallet.dart index 847b8b811..e8d8c3646 100644 --- a/lib/wallets/wallet/impl/wownero_wallet.dart +++ b/lib/wallets/wallet/impl/wownero_wallet.dart @@ -190,6 +190,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { uri: "$host:${node.port}", type: WalletType.wownero, trusted: node.trusted ?? false, + useSSL: node.useSSL, ), socksProxyAddress: proxy == null ? null : "${proxy.host.address}:${proxy.port}", @@ -201,6 +202,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { uri: "$host:${node.port}", type: WalletType.wownero, trusted: node.trusted ?? false, + useSSL: node.useSSL, ), socksProxyAddress: proxy == null ? null : "${proxy.host.address}:${proxy.port}", diff --git a/pubspec.lock b/pubspec.lock index e8c94e9a2..aac36a767 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -346,10 +346,10 @@ packages: dependency: transitive description: name: cross_file - sha256: fd832b5384d0d6da4f6df60b854d33accaaeb63aa9e10e736a87381f08dee2cb + sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32" url: "https://pub.dev" source: hosted - version: "0.3.3+5" + version: "0.3.4+1" crypto: dependency: "direct main" description: @@ -616,11 +616,11 @@ packages: dependency: "direct main" description: path: "." - ref: f0930d9fa79d347b2a0e25a7de4f5a4a88a9a907 - resolved-ref: f0930d9fa79d347b2a0e25a7de4f5a4a88a9a907 - url: "https://github.com/muttsu-623/flutter_file_picker.git" + ref: "9abc0930081c9859884e073bd25ab88b2114d9e7" + resolved-ref: "9abc0930081c9859884e073bd25ab88b2114d9e7" + url: "https://github.com/cypherstack/flutter_file_picker.git" source: git - version: "5.3.3" + version: "8.0.3" fixnum: dependency: transitive description: @@ -746,10 +746,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: f185ac890306b5779ecbd611f52502d8d4d63d27703ef73161ca0407e815f02c + sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f" url: "https://pub.dev" source: hosted - version: "2.0.16" + version: "2.0.19" flutter_riverpod: dependency: "direct main" description: @@ -1390,10 +1390,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.1.8" pointycastle: dependency: "direct main" description: @@ -2049,10 +2049,10 @@ packages: dependency: transitive description: name: win32 - sha256: c97defd418eef4ec88c0d1652cdce84b9f7b63dd7198e266d06ac1710d527067 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" url: "https://pub.dev" source: hosted - version: "5.0.8" + version: "5.2.0" win32_registry: dependency: transitive description: