mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-21 18:24:41 +00:00
optionally include user data
This commit is contained in:
parent
ef0054b057
commit
8678ec4660
1 changed files with 7 additions and 3 deletions
|
@ -219,21 +219,25 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
|||
throw Exception('Unexpected scan QR code value: value is empty');
|
||||
}
|
||||
|
||||
if (!code.contains('://')) {
|
||||
code = 'tcp://$code';
|
||||
}
|
||||
if (!code.contains('://')) code = 'tcp://$code';
|
||||
|
||||
final uri = Uri.tryParse(code);
|
||||
if (uri == null || uri.host.isEmpty) {
|
||||
throw Exception('Invalid QR code: Unable to parse or missing host.');
|
||||
}
|
||||
|
||||
final userInfo = uri.userInfo;
|
||||
final ipAddress = uri.host;
|
||||
final port = uri.hasPort ? uri.port.toString() : '';
|
||||
final path = uri.path;
|
||||
final queryParams = uri.queryParameters; // Currently not used
|
||||
final rpcUser = userInfo.split(':').first;
|
||||
final rpcPassword = userInfo.split(':').length > 1 ? userInfo.split(':')[1] : '';
|
||||
|
||||
setAddress(ipAddress);
|
||||
setPath(path);
|
||||
setPassword(rpcPassword);
|
||||
setLogin(rpcUser);
|
||||
setPort(port);
|
||||
} on Exception catch (e) {
|
||||
connectionState = FailureState(e.toString());
|
||||
|
|
Loading…
Reference in a new issue