Fix autotype and remove debug logging
This commit is contained in:
parent
6ee67d6569
commit
29bd40384b
|
@ -12,15 +12,13 @@ import os
|
|||
from ..services import totp
|
||||
Notify.init("Goldwarden")
|
||||
|
||||
token = "Test"
|
||||
# read line from stdin
|
||||
token = sys.stdin.readline()
|
||||
goldwarden.create_authenticated_connection(token)
|
||||
|
||||
def autotype(text):
|
||||
time.sleep(2)
|
||||
print("Autotyping")
|
||||
goldwarden.autotype(text)
|
||||
print("Autotyped")
|
||||
time.sleep(5)
|
||||
time.sleep(0.1)
|
||||
os._exit(0)
|
||||
|
||||
def set_clipboard(text):
|
||||
|
@ -137,13 +135,15 @@ class MainWindow(Gtk.ApplicationWindow):
|
|||
set_clipboard(self.results_list.get_selected_row().password)
|
||||
if ctrl_pressed and alt_pressed:
|
||||
self.hide()
|
||||
autotype(self.results_list.get_selected_row().password)
|
||||
autotypeThread = Thread(target=autotype, args=(self.results_list.get_selected_row().password,))
|
||||
autotypeThread.start()
|
||||
elif keyval == 117:
|
||||
if ctrl_pressed and not alt_pressed:
|
||||
set_clipboard(self.results_list.get_selected_row().username)
|
||||
if ctrl_pressed and alt_pressed:
|
||||
self.hide()
|
||||
autotype(self.results_list.get_selected_row().username)
|
||||
autotypeThread = Thread(target=autotype, args=(self.results_list.get_selected_row().username,))
|
||||
autotypeThread.start()
|
||||
elif keyval == 118:
|
||||
if ctrl_pressed and alt_pressed:
|
||||
environment = goldwarden.get_environment()
|
||||
|
@ -160,7 +160,8 @@ class MainWindow(Gtk.ApplicationWindow):
|
|||
set_clipboard(totp_code)
|
||||
if ctrl_pressed and alt_pressed:
|
||||
self.hide()
|
||||
autotype(totp_code)
|
||||
autotypeThread = Thread(target=autotype, args=(totp_code,))
|
||||
autotypeThread.start()
|
||||
elif keyval == 102:
|
||||
# focus search
|
||||
self.text_view.grab_focus()
|
||||
|
|
|
@ -135,12 +135,9 @@ def autotype(text):
|
|||
goldwarden_cmd = f"{BINARY_PATH} autotype"
|
||||
process = subprocess.Popen(goldwarden_cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
text_hex = text.encode("utf-8").hex()
|
||||
print("autotyping", text_hex)
|
||||
process.stdin.write(text_hex + "\n")
|
||||
process.stdin.flush()
|
||||
# wait for process to finish
|
||||
process.wait()
|
||||
print("autotype finished")
|
||||
|
||||
def is_daemon_running():
|
||||
result = send_authenticated_command(f"vault status")
|
||||
|
|
Loading…
Reference in New Issue