aboutsummaryrefslogtreecommitdiff
path: root/main.qml
diff options
context:
space:
mode:
Diffstat (limited to 'main.qml')
-rw-r--r--main.qml46
1 files changed, 14 insertions, 32 deletions
diff --git a/main.qml b/main.qml
index e2a19ffc..67919574 100644
--- a/main.qml
+++ b/main.qml
@@ -445,41 +445,23 @@ ApplicationWindow {
}
function onUriHandler(uri){
- if(uri.startsWith("monero://")){
- var address = uri.substring("monero://".length);
+ if (uri && (uri.startsWith("monero://") || uri.startsWith("monero:"))) {
+ const normalizedUri = uri.replace("monero://", "monero:");
+ const parsed = walletManager.parse_uri_to_object(normalizedUri);
- var params = {}
- if(address.length === 0) return;
- var spl = address.split("?");
-
- if(spl.length > 2) return;
- if(spl.length >= 1) {
- // parse additional params
- address = spl[0];
-
- if(spl.length === 2){
- spl.shift();
- var item = spl[0];
-
- var _spl = item.split("&");
- for (var param in _spl){
- var _item = _spl[param];
- if(!_item.indexOf("=") > 0) continue;
-
- var __spl = _item.split("=");
- if(__spl.length !== 2) continue;
+ if (parsed.error) {
+ console.log("Invalid Monero URI: " + parsed.error);
+ } else {
+ middlePanel.transferView.sendTo(
+ parsed.address || "",
+ parsed.payment_id || "",
+ parsed.tx_description || "",
+ parsed.amount || ""
+ );
- params[__spl[0]] = __spl[1];
- }
- }
+ appWindow.raise();
+ appWindow.show();
}
-
- // Fill fields
- middlePanel.transferView.sendTo(address, params["tx_payment_id"], params["tx_description"], params["tx_amount"]);
-
- // Raise window
- appWindow.raise();
- appWindow.show();
}
}