commit
d32147bdf8
|
@ -1,16 +1,22 @@
|
||||||
//go:build freebsd || linux
|
//go:build freebsd || linux || darwin
|
||||||
|
|
||||||
package pinentry
|
package pinentry
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/twpayne/go-pinentry"
|
"github.com/twpayne/go-pinentry"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getPassword(title string, description string) (string, error) {
|
func getPassword(title string, description string) (string, error) {
|
||||||
|
binaryClientOption := pinentry.WithBinaryNameFromGnuPGAgentConf()
|
||||||
|
if runtime.GOOS == "darwin" {
|
||||||
|
binaryClientOption = pinentry.WithBinaryName("pinentry-mac")
|
||||||
|
}
|
||||||
|
|
||||||
client, err := pinentry.NewClient(
|
client, err := pinentry.NewClient(
|
||||||
pinentry.WithBinaryNameFromGnuPGAgentConf(),
|
binaryClientOption,
|
||||||
pinentry.WithGPGTTY(),
|
pinentry.WithGPGTTY(),
|
||||||
pinentry.WithTitle(title),
|
pinentry.WithTitle(title),
|
||||||
pinentry.WithDesc(description),
|
pinentry.WithDesc(description),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//go:build windows || darwin
|
//go:build windows
|
||||||
|
|
||||||
package pinentry
|
package pinentry
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import src.linux.main as linux_main
|
|
||||||
|
|
||||||
|
import platform
|
||||||
|
|
||||||
|
if platform.system() == 'Darwin':
|
||||||
|
import src.macos.main as macos_main
|
||||||
|
macos_main.main()
|
||||||
|
elif platform.system() == 'Linux':
|
||||||
|
import src.linux.main as linux_main
|
||||||
linux_main.main()
|
linux_main.main()
|
||||||
|
else:
|
||||||
|
print("Unsupported OS " + platform.system() + "... exiting...")
|
|
@ -1,10 +1,10 @@
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '4.0')
|
gi.require_version('Gtk', '4.0')
|
||||||
gi.require_version('Adw', '1')
|
gi.require_version('Adw', '1')
|
||||||
gi.require_version('Notify', '0.7')
|
# gi.require_version('Notify', '0.7')
|
||||||
import gc
|
import gc
|
||||||
import time
|
import time
|
||||||
from gi.repository import Gtk, Adw, GLib, Notify, Gdk
|
from gi.repository import Gtk, Adw, GLib, Gdk
|
||||||
from ..services import goldwarden
|
from ..services import goldwarden
|
||||||
from ..services.autotype import autotype
|
from ..services.autotype import autotype
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
@ -12,7 +12,6 @@ from .resource_loader import load_template
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from ..services import totp
|
from ..services import totp
|
||||||
Notify.init("Goldwarden")
|
|
||||||
|
|
||||||
class GoldwardenQuickAccessApp(Adw.Application):
|
class GoldwardenQuickAccessApp(Adw.Application):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
@ -115,8 +114,8 @@ class GoldwardenQuickAccessApp(Adw.Application):
|
||||||
|
|
||||||
def run_autotype(self, text):
|
def run_autotype(self, text):
|
||||||
def perform_autotype(text):
|
def perform_autotype(text):
|
||||||
self.window.hide()
|
GLib.idle_add(self.window.hide)
|
||||||
time.sleep(0.1)
|
time.sleep(2)
|
||||||
autotype.autotype(text)
|
autotype.autotype(text)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
@ -148,7 +147,7 @@ class GoldwardenQuickAccessApp(Adw.Application):
|
||||||
self.filtered_logins = self.filtered_logins[0:7]
|
self.filtered_logins = self.filtered_logins[0:7]
|
||||||
|
|
||||||
def render_list(self):
|
def render_list(self):
|
||||||
if len(self.filtered_logins) > 1:
|
if len(self.filtered_logins) > 0:
|
||||||
self.results_list.set_visible(True)
|
self.results_list.set_visible(True)
|
||||||
while self.results_list.get_first_child() != None:
|
while self.results_list.get_first_child() != None:
|
||||||
self.results_list.remove(self.results_list.get_first_child())
|
self.results_list.remove(self.results_list.get_first_child())
|
||||||
|
|
|
@ -101,8 +101,7 @@ class GoldwardenSettingsApp(Adw.Application):
|
||||||
if status == None:
|
if status == None:
|
||||||
is_daemon_running = goldwarden.is_daemon_running()
|
is_daemon_running = goldwarden.is_daemon_running()
|
||||||
if not is_daemon_running:
|
if not is_daemon_running:
|
||||||
self.status_row.set_subtitle("Daemon not running")
|
print("Daemon not running")
|
||||||
self.vault_status_icon.set_icon("dialog-error", "error")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
logged_in = status["loggedIn"]
|
logged_in = status["loggedIn"]
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
import secrets
|
||||||
|
from src.services import goldwarden
|
||||||
|
from src.services import pinentry
|
||||||
|
import time
|
||||||
|
|
||||||
|
root_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir))
|
||||||
|
|
||||||
|
def main():
|
||||||
|
token = secrets.token_hex(32)
|
||||||
|
if not os.environ.get("GOLDWARDEN_DAEMON_AUTH_TOKEN") == None:
|
||||||
|
token = os.environ["GOLDWARDEN_DAEMON_AUTH_TOKEN"]
|
||||||
|
print("Starting Goldwarden GUI")
|
||||||
|
goldwarden.run_daemon_background(token)
|
||||||
|
time.sleep(1)
|
||||||
|
#pinentry.daemonize()
|
||||||
|
if not "--hidden" in sys.argv:
|
||||||
|
p = subprocess.Popen(["python3", "-m", "src.gui.settings"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=root_path, start_new_session=True)
|
||||||
|
p.stdin.write(f"{token}\n".encode())
|
||||||
|
p.stdin.flush()
|
||||||
|
# print stdout
|
||||||
|
while True:
|
||||||
|
line = p.stderr.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
print(line.decode().strip())
|
||||||
|
while True:
|
||||||
|
time.sleep(60)
|
|
@ -3,3 +3,6 @@ import pyautogui
|
||||||
def autotype_pyautogui(text):
|
def autotype_pyautogui(text):
|
||||||
print("autotypeing with pyautogui")
|
print("autotypeing with pyautogui")
|
||||||
pyautogui.write(text, interval=0.02)
|
pyautogui.write(text, interval=0.02)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
autotype_pyautogui("hello world")
|
Loading…
Reference in New Issue