feat: rewrite terminal to use vte_terminal_spawn_sync

Replaced the SSH library + IO thread + intermediate PTY bridge with
vte_terminal_spawn_sync(). This eliminates the broken terminal behavior
(backspace, Ctrl+C, copy/paste, bash completion) caused by the
intermediate PTY with no process on the slave side.

- SshTerminal now spawns 'ssh' as a VTE subprocess
- Removed libssh dependency from terminal (still used for key validation)
- Removed IO thread, manual PTY creation, and thread synchronization
- VTE now handles all terminal I/O, line discipline, resize, etc.
- Password saved: uses sshpass -e with SSHPASS env var if available
- Password not saved: ssh prompts interactively in the terminal
- Removed show_password_dialog (no longer needed)
- Simplified connect flow in ssh_client.cpp
This commit is contained in:
x3
2026-09-07 16:54:21 +00:00
parent 69369aedb8
commit 916a167f67
12 changed files with 142 additions and 576 deletions
+5 -7
View File
@@ -4,7 +4,6 @@
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <libssh/libssh.h>
static std::string trim(const std::string& s) {
size_t a = s.find_first_not_of(" \t\r\n");
@@ -128,15 +127,14 @@ bool KeyStore::generate_keypair(const std::string& name, int bits) {
}
bool KeyStore::import_key(const std::string& name, const std::string& privkey_path) {
ssh_key key = nullptr;
if (ssh_pki_import_privkey_file(privkey_path.c_str(), nullptr, nullptr, nullptr, &key) != SSH_OK) {
return false;
}
ssh_key_free(key);
/* Validate key by running ssh-keygen -l */
std::string check_cmd = "ssh-keygen -l -f \"" + privkey_path + "\" >/dev/null 2>&1";
int rc = system(check_cmd.c_str());
if (rc != 0) return false;
std::string dest = keys_dir_ + "/" + name;
std::string cp_cmd = "cp \"" + privkey_path + "\" \"" + dest + "\" && chmod 600 \"" + dest + "\"";
int rc = system(cp_cmd.c_str());
rc = system(cp_cmd.c_str());
if (rc != 0) return false;
std::string pub_src = privkey_path + ".pub";