FIx freeze and remove some logging

This commit is contained in:
Bernd Schoolmann 2024-02-08 17:12:13 +01:00
parent cf6221c080
commit ca17380758
No known key found for this signature in database
4 changed files with 6 additions and 24 deletions

View File

@ -335,7 +335,6 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
if err != nil { if err != nil {
fmt.Println("accept error", err.Error()) fmt.Println("accept error", err.Error())
} }
fmt.Println("Accepted connection")
go serveAgentSession(fd, vault, &cfg) go serveAgentSession(fd, vault, &cfg)
} }

View File

@ -72,8 +72,8 @@ var listLoginsCmd = &cobra.Command{
return return
} }
fmt.Println("[") var toPrintLogins []map[string]string
for index, login := range logins { for _, login := range logins {
data := map[string]string{ data := map[string]string{
"name": stringsx.Clean(login.Name), "name": stringsx.Clean(login.Name),
"uuid": stringsx.Clean(login.UUID), "uuid": stringsx.Clean(login.UUID),
@ -82,19 +82,10 @@ var listLoginsCmd = &cobra.Command{
"totp": stringsx.Clean(login.TOTPSeed), "totp": stringsx.Clean(login.TOTPSeed),
"uri": stringsx.Clean(login.URI), "uri": stringsx.Clean(login.URI),
} }
jsonString, err := json.Marshal(data) toPrintLogins = append(toPrintLogins, data)
if err != nil {
handleSendToAgentError(err)
return
} }
fmt.Print(string(jsonString)) toPrintJSON, _ := json.Marshal(toPrintLogins)
if index != len(logins)-1 { fmt.Println(string(toPrintJSON))
fmt.Println(",")
} else {
fmt.Println()
}
}
fmt.Println("]")
}, },
} }

View File

@ -34,11 +34,9 @@ def send_authenticated_command(cmd):
print("No daemon connection running, please restart the application completely.") print("No daemon connection running, please restart the application completely.")
return "" return ""
print("sending command", cmd)
authenticated_connection.stdin.write(cmd + "\n") authenticated_connection.stdin.write(cmd + "\n")
authenticated_connection.stdin.flush() authenticated_connection.stdin.flush()
result = authenticated_connection.stdout.readline() result = authenticated_connection.stdout.readline()
print("result", result)
return result return result
def set_api_url(url): def set_api_url(url):
@ -61,7 +59,6 @@ def get_environment():
try: try:
return json.loads(result) return json.loads(result)
except Exception as e: except Exception as e:
print(e)
return None return None
def set_client_id(client_id): def set_client_id(client_id):
@ -110,13 +107,10 @@ def get_vault_status():
try: try:
return json.loads(result) return json.loads(result)
except Exception as e: except Exception as e:
print(e)
return None return None
def get_vault_logins(): def get_vault_logins():
result = send_authenticated_command(f"logins list") result = send_authenticated_command(f"logins list")
if result.returncode != 0:
raise Exception("Failed to initialize repository, err", result.stderr)
try: try:
return json.loads(result) return json.loads(result)
except Exception as e: except Exception as e:
@ -124,7 +118,6 @@ def get_vault_logins():
def get_runtime_config(): def get_runtime_config():
result = send_authenticated_command(f"config get-runtime-config") result = send_authenticated_command(f"config get-runtime-config")
print(result)
try: try:
return json.loads(result) return json.loads(result)
except Exception as e: except Exception as e:

View File

@ -136,8 +136,7 @@ class MainWindow(Gtk.ApplicationWindow):
self.history_list.get_style_context().add_class("boxed-list") self.history_list.get_style_context().add_class("boxed-list")
self.box.append(self.history_list) self.box.append(self.history_list)
self.set_default_size(700, 700) self.set_default_size(700, 700)
# self.set_title("Goldwarden") self.set_title("Goldwarden Quick Access")
self.set_title(token)
app = MyApp(application_id="com.quexten.Goldwarden.autofill-menu") app = MyApp(application_id="com.quexten.Goldwarden.autofill-menu")
app.run(sys.argv) app.run(sys.argv)