mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
fixes for label plugin
This commit is contained in:
parent
6101abda5d
commit
1e346404dd
3 changed files with 19 additions and 21 deletions
|
@ -2727,6 +2727,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
p.close()
|
p.close()
|
||||||
else:
|
else:
|
||||||
if p.enable():
|
if p.enable():
|
||||||
|
p.load_wallet(self.wallet)
|
||||||
p.init_qt(self.gui_object)
|
p.init_qt(self.gui_object)
|
||||||
r = p.is_enabled()
|
r = p.is_enabled()
|
||||||
cb.setChecked(r)
|
cb.setChecked(r)
|
||||||
|
|
|
@ -88,7 +88,11 @@ class BasePlugin:
|
||||||
self.set_enabled(False)
|
self.set_enabled(False)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def init(self): pass
|
def init_qt(self, gui): pass
|
||||||
|
|
||||||
|
def load_wallet(self, wallet): pass
|
||||||
|
|
||||||
|
#def init(self): pass
|
||||||
|
|
||||||
def close(self): pass
|
def close(self): pass
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ from electrum_gui.qt import HelpButton, EnterButton
|
||||||
|
|
||||||
class Plugin(BasePlugin):
|
class Plugin(BasePlugin):
|
||||||
|
|
||||||
|
target_host = 'labelectrum.herokuapp.com'
|
||||||
|
|
||||||
def fullname(self):
|
def fullname(self):
|
||||||
return _('Label Sync')
|
return _('Label Sync')
|
||||||
|
|
||||||
|
@ -40,21 +42,26 @@ class Plugin(BasePlugin):
|
||||||
|
|
||||||
def decode(self, message):
|
def decode(self, message):
|
||||||
decoded_message = aes.decryptData(self.encode_password, base64.b64decode(unicode(message)) )
|
decoded_message = aes.decryptData(self.encode_password, base64.b64decode(unicode(message)) )
|
||||||
|
|
||||||
return decoded_message
|
return decoded_message
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def init_qt(self, gui):
|
def init_qt(self, gui):
|
||||||
self.target_host = 'labelectrum.herokuapp.com'
|
|
||||||
self.window = gui.main_window
|
self.window = gui.main_window
|
||||||
|
if not self.auth_token(): # First run, throw plugin settings in your face
|
||||||
|
self.load_wallet(self.window.wallet)
|
||||||
|
if self.settings_dialog():
|
||||||
|
self.set_enabled(True)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
self.set_enabled(False)
|
||||||
|
return False
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def load_wallet(self, wallet):
|
def load_wallet(self, wallet):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
if self.wallet.get_master_public_key():
|
mpk = self.wallet.get_master_public_key()
|
||||||
mpk = self.wallet.get_master_public_key()
|
|
||||||
else:
|
|
||||||
mpk = self.wallet.master_public_keys["m/0'/"][1]
|
|
||||||
self.encode_password = hashlib.sha1(mpk).digest().encode('hex')[:32]
|
self.encode_password = hashlib.sha1(mpk).digest().encode('hex')[:32]
|
||||||
self.wallet_id = hashlib.sha256(mpk).digest().encode('hex')
|
self.wallet_id = hashlib.sha256(mpk).digest().encode('hex')
|
||||||
|
|
||||||
|
@ -151,20 +158,6 @@ class Plugin(BasePlugin):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def enable(self):
|
|
||||||
if not self.auth_token(): # First run, throw plugin settings in your face
|
|
||||||
self.init()
|
|
||||||
self.load_wallet(self.window.wallet)
|
|
||||||
if self.settings_dialog():
|
|
||||||
self.set_enabled(True)
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
self.set_enabled(False)
|
|
||||||
return False
|
|
||||||
|
|
||||||
self.set_enabled(True)
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def full_push(self):
|
def full_push(self):
|
||||||
if self.do_full_push():
|
if self.do_full_push():
|
||||||
|
|
Loading…
Add table
Reference in a new issue