mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-22 02:34:59 +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');
|
throw Exception('Unexpected scan QR code value: value is empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!code.contains('://')) {
|
if (!code.contains('://')) code = 'tcp://$code';
|
||||||
code = 'tcp://$code';
|
|
||||||
}
|
|
||||||
|
|
||||||
final uri = Uri.tryParse(code);
|
final uri = Uri.tryParse(code);
|
||||||
if (uri == null || uri.host.isEmpty) {
|
if (uri == null || uri.host.isEmpty) {
|
||||||
throw Exception('Invalid QR code: Unable to parse or missing host.');
|
throw Exception('Invalid QR code: Unable to parse or missing host.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final userInfo = uri.userInfo;
|
||||||
final ipAddress = uri.host;
|
final ipAddress = uri.host;
|
||||||
final port = uri.hasPort ? uri.port.toString() : '';
|
final port = uri.hasPort ? uri.port.toString() : '';
|
||||||
final path = uri.path;
|
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);
|
setAddress(ipAddress);
|
||||||
setPath(path);
|
setPath(path);
|
||||||
|
setPassword(rpcPassword);
|
||||||
|
setLogin(rpcUser);
|
||||||
setPort(port);
|
setPort(port);
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
connectionState = FailureState(e.toString());
|
connectionState = FailureState(e.toString());
|
||||||
|
|
Loading…
Reference in a new issue