mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-15 06:59:50 +00:00
read URI scheme
This commit is contained in:
parent
36b9144d60
commit
775bbcc316
2 changed files with 27 additions and 4 deletions
|
@ -151,7 +151,11 @@ def int_to_hex(i, length=1):
|
||||||
return s.decode('hex')[::-1].encode('hex')
|
return s.decode('hex')[::-1].encode('hex')
|
||||||
|
|
||||||
|
|
||||||
|
# URL decode
|
||||||
|
_ud = re.compile('%([0-9a-hA-H]{2})', re.MULTILINE)
|
||||||
|
urldecode = lambda x: _ud.sub(lambda m: chr(int(m.group(1), 16)), x)
|
||||||
|
|
||||||
|
# AES
|
||||||
EncodeAES = lambda secret, s: base64.b64encode(aes.encryptData(secret,s))
|
EncodeAES = lambda secret, s: base64.b64encode(aes.encryptData(secret,s))
|
||||||
DecodeAES = lambda secret, e: aes.decryptData(secret, base64.b64decode(e))
|
DecodeAES = lambda secret, e: aes.decryptData(secret, base64.b64decode(e))
|
||||||
|
|
||||||
|
@ -762,21 +766,34 @@ if __name__ == '__main__':
|
||||||
except:
|
except:
|
||||||
firstarg = ''
|
firstarg = ''
|
||||||
|
|
||||||
if cmd not in known_commands:
|
|
||||||
cmd = 'help'
|
|
||||||
|
|
||||||
interface = Interface()
|
interface = Interface()
|
||||||
wallet = Wallet(interface)
|
wallet = Wallet(interface)
|
||||||
wallet.set_path(options.wallet_path)
|
wallet.set_path(options.wallet_path)
|
||||||
|
|
||||||
if cmd == 'gui':
|
if cmd == 'gui' or re.match('^bitcoin:', cmd):
|
||||||
import gui
|
import gui
|
||||||
gui.init_wallet(wallet)
|
gui.init_wallet(wallet)
|
||||||
gui = gui.BitcoinGUI(wallet)
|
gui = gui.BitcoinGUI(wallet)
|
||||||
|
if re.match('^bitcoin:', cmd):
|
||||||
|
address, params = cmd[8:].split('?')
|
||||||
|
params = params.split('&')
|
||||||
|
cmd = 'gui'
|
||||||
|
amount = ''
|
||||||
|
label = ''
|
||||||
|
for p in params:
|
||||||
|
k,v = p.split('=')
|
||||||
|
if k=='amount': amount = v
|
||||||
|
if k=='label': label = urldecode(v)
|
||||||
|
|
||||||
|
gui.set_send_tab(address, amount, label)
|
||||||
|
|
||||||
gui.main()
|
gui.main()
|
||||||
wallet.save()
|
wallet.save()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
if cmd not in known_commands:
|
||||||
|
cmd = 'help'
|
||||||
|
|
||||||
if not wallet.read() and cmd not in ['help','create']:
|
if not wallet.read() and cmd not in ['help','create']:
|
||||||
print "Wallet file not found."
|
print "Wallet file not found."
|
||||||
print "Type 'electrum.py create' to create a new wallet, or provide a path to a wallet with the -d option"
|
print "Type 'electrum.py create' to create a new wallet, or provide a path to a wallet with the -d option"
|
||||||
|
|
|
@ -720,6 +720,12 @@ class BitcoinGUI:
|
||||||
self.payto_label_entry = label_entry
|
self.payto_label_entry = label_entry
|
||||||
self.add_tab(page, 'Send')
|
self.add_tab(page, 'Send')
|
||||||
|
|
||||||
|
def set_send_tab(self, address, amount, label):
|
||||||
|
self.notebook.set_current_page(1)
|
||||||
|
self.payto_entry.set_text(address)
|
||||||
|
self.payto_label_entry.set_text(label)
|
||||||
|
self.payto_amount_entry.set_text(amount)
|
||||||
|
|
||||||
def create_about_tab(self):
|
def create_about_tab(self):
|
||||||
page = gtk.VBox()
|
page = gtk.VBox()
|
||||||
page.show()
|
page.show()
|
||||||
|
|
Loading…
Add table
Reference in a new issue