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