From 4638f781f93adade92f580033a5d9bcfeff65ea8 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Mon, 25 Jan 2021 14:11:11 +0100 Subject: [PATCH] Fix JS error --- .../Views/Stores/AddDerivationScheme.cshtml | 11 +++++---- BTCPayServer/Views/Wallets/WalletPSBT.cshtml | 24 +++++++++---------- .../js/wallet/wallet-camera-scanner.js | 10 ++++---- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/BTCPayServer/Views/Stores/AddDerivationScheme.cshtml b/BTCPayServer/Views/Stores/AddDerivationScheme.cshtml index 2c847a420..d08d076c8 100644 --- a/BTCPayServer/Views/Stores/AddDerivationScheme.cshtml +++ b/BTCPayServer/Views/Stores/AddDerivationScheme.cshtml @@ -225,11 +225,12 @@ } diff --git a/BTCPayServer/Views/Wallets/WalletPSBT.cshtml b/BTCPayServer/Views/Wallets/WalletPSBT.cshtml index 733bf2995..a3797a31d 100644 --- a/BTCPayServer/Views/Wallets/WalletPSBT.cshtml +++ b/BTCPayServer/Views/Wallets/WalletPSBT.cshtml @@ -86,17 +86,17 @@ - - + hljs.initHighlightingOnLoad(); + + $(function (){ + initQRShow("Scan PSBT", @Json.Serialize(Model.PSBTHex), "scan-qr-modal"); + if (typeof(initCameraScanningApp) === "function") { + initCameraScanningApp("Scan PSBT", function (data){ + $("textarea[name=PSBT]").val(data); + $("#Decode").click(); + }, "scanModal"); + } + }); + } diff --git a/BTCPayServer/wwwroot/js/wallet/wallet-camera-scanner.js b/BTCPayServer/wwwroot/js/wallet/wallet-camera-scanner.js index 899b64786..06f42be1e 100644 --- a/BTCPayServer/wwwroot/js/wallet/wallet-camera-scanner.js +++ b/BTCPayServer/wwwroot/js/wallet/wallet-camera-scanner.js @@ -1,6 +1,8 @@ $(function () { - initCameraScanningApp("Scan address/ payment link", function(data){ - $("#BIP21").val(data); - $("form").submit(); - },"scanModal"); + if (typeof(initCameraScanningApp) === "function") { + initCameraScanningApp("Scan address/ payment link", function(data) { + $("#BIP21").val(data); + $("form").submit(); + },"scanModal"); + } });