Scanning or pasting ordinary URL gives the option to open it in a browser.

This commit is contained in:
Brendon Duncan 2018-08-30 19:56:18 +12:00
commit 918451f3da
5 changed files with 71 additions and 18 deletions

View file

@ -93,6 +93,7 @@
returns:
{
amount: '',
bareUrl: '',
coin: '',
copayInvitation: '',
isValid: false,
@ -163,6 +164,9 @@
addressAndParams = colonSplit[1];
console.log('No prefix.');
} else if (/^https?$/.test(colonSplit[1])) {
addressAndParams = trimmed;
} else {
// Something with a colon in the middle that we don't recognise
return parsed;
@ -253,6 +257,7 @@
var privateKeyForUncompressedPublicKeyTestnetRe = /^9[1-9A-HJ-NP-Za-km-z]{50}$/;
var privateKeyForCompressedPublicKeyRe = /^[KL][1-9A-HJ-NP-Za-km-z]{51}$/;
var privateKeyForCompressedPublicKeyTestnetRe = /^[c][1-9A-HJ-NP-Za-km-z]{51}$/;
var urlRe = /^https?:\/\/.+/;
var bitpayAddrMainnet = bitpayAddrOnMainnet(address);
var cashAddrTestnet = cashAddrOnTestnet(addressLowerCase);
@ -322,6 +327,10 @@
} else if (privateKeyEncryptedRe.test(address)) {
parsed.privateKey = { encrypted: address };
parsed.isValid = true;
} else if (urlRe.test(address)) {
parsed.bareUrl = trimmed;
parsed.isValid = true;
}
} else {