v1.2.0 + v1.3.0: Localization, About dialog, TOTP/2FA, stability improvements
v1.2.0: - GUI localization (EN/RU/ZH) with language switcher and persistent selection - About dialog (ⓘ) with app info, features, quick start guide - core/i18n.py — internationalization module with t() function - All GUI components translated via t() keys v1.3.0: - TOTP/2FA tab — Google Authenticator compatible codes with live 30s countdown, one-click copy, per-server secret management - core/totp.py — TOTP module (pyotp, RFC 6238) - core/logger.py — rotating file logger (5MB, 3 backups) - Stronger Fernet encryption key with automatic migration from old key - Thread-safe server store with locks, atomic writes, auto-restore on corruption - Parallel status checks via ThreadPoolExecutor (up to 10 concurrent) - SSH client: explicit channel cleanup, Unix key permissions - Server dialog: port validation (1-65535), TOTP secret field - Language change preserves active tab and server selection - pyotp dependency added Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import os
|
||||
import threading
|
||||
import customtkinter as ctk
|
||||
from core.ssh_client import SSHClientWrapper
|
||||
from core.i18n import t
|
||||
|
||||
|
||||
class KeysTab(ctk.CTkFrame):
|
||||
@@ -15,7 +16,8 @@ class KeysTab(ctk.CTkFrame):
|
||||
self._current_alias: str | None = None
|
||||
|
||||
# Key info
|
||||
ctk.CTkLabel(self, text="SSH Key", font=ctk.CTkFont(size=16, weight="bold"), anchor="w").pack(fill="x", padx=15, pady=(15, 5))
|
||||
self.key_title = ctk.CTkLabel(self, text=t("ssh_key"), font=ctk.CTkFont(size=16, weight="bold"), anchor="w")
|
||||
self.key_title.pack(fill="x", padx=15, pady=(15, 5))
|
||||
|
||||
self.key_path_label = ctk.CTkLabel(self, text="", anchor="w", text_color="#9ca3af")
|
||||
self.key_path_label.pack(fill="x", padx=15)
|
||||
@@ -27,13 +29,13 @@ class KeysTab(ctk.CTkFrame):
|
||||
btn_frame = ctk.CTkFrame(self, fg_color="transparent")
|
||||
btn_frame.pack(fill="x", padx=15, pady=5)
|
||||
|
||||
self.gen_btn = ctk.CTkButton(btn_frame, text="Generate Key", command=self._generate)
|
||||
self.gen_btn = ctk.CTkButton(btn_frame, text=t("generate_key"), command=self._generate)
|
||||
self.gen_btn.pack(side="left", padx=(0, 10))
|
||||
|
||||
self.install_btn = ctk.CTkButton(btn_frame, text="Install on Server", fg_color="#22c55e", hover_color="#16a34a", command=self._install)
|
||||
self.install_btn = ctk.CTkButton(btn_frame, text=t("install_on_server"), fg_color="#22c55e", hover_color="#16a34a", command=self._install)
|
||||
self.install_btn.pack(side="left")
|
||||
|
||||
self.copy_btn = ctk.CTkButton(btn_frame, text="Copy Public Key", fg_color="#6b7280", command=self._copy_key)
|
||||
self.copy_btn = ctk.CTkButton(btn_frame, text=t("copy_public_key"), fg_color="#6b7280", command=self._copy_key)
|
||||
self.copy_btn.pack(side="right")
|
||||
|
||||
# Status log
|
||||
@@ -48,7 +50,7 @@ class KeysTab(ctk.CTkFrame):
|
||||
def _refresh_key_info(self):
|
||||
key_path = self.store.get_ssh_key_path()
|
||||
pub_path = key_path + ".pub"
|
||||
self.key_path_label.configure(text=f"Path: {key_path}")
|
||||
self.key_path_label.configure(text=t("key_path").format(path=key_path))
|
||||
|
||||
self.pub_key_box.configure(state="normal")
|
||||
self.pub_key_box.delete("1.0", "end")
|
||||
@@ -57,10 +59,10 @@ class KeysTab(ctk.CTkFrame):
|
||||
with open(pub_path, "r") as f:
|
||||
pub_key = f.read().strip()
|
||||
self.pub_key_box.insert("1.0", pub_key)
|
||||
self.gen_btn.configure(state="disabled", text="Key exists")
|
||||
self.gen_btn.configure(state="disabled", text=t("key_exists"))
|
||||
else:
|
||||
self.pub_key_box.insert("1.0", "No key found. Click 'Generate Key' to create one.")
|
||||
self.gen_btn.configure(state="normal", text="Generate Key")
|
||||
self.pub_key_box.insert("1.0", t("no_key_found"))
|
||||
self.gen_btn.configure(state="normal", text=t("generate_key"))
|
||||
|
||||
self.pub_key_box.configure(state="disabled")
|
||||
|
||||
@@ -82,14 +84,14 @@ class KeysTab(ctk.CTkFrame):
|
||||
|
||||
def _install(self):
|
||||
if not self._current_alias:
|
||||
self._log("[!] No server selected")
|
||||
self._log(t("no_server_selected"))
|
||||
return
|
||||
|
||||
server = self.store.get_server(self._current_alias)
|
||||
if not server:
|
||||
return
|
||||
|
||||
self.install_btn.configure(state="disabled", text="Installing...")
|
||||
self.install_btn.configure(state="disabled", text=t("installing"))
|
||||
|
||||
def _do():
|
||||
try:
|
||||
@@ -99,7 +101,7 @@ class KeysTab(ctk.CTkFrame):
|
||||
except Exception as e:
|
||||
self.after(0, lambda: self._log(f"[ERROR] {e}"))
|
||||
finally:
|
||||
self.after(0, lambda: self.install_btn.configure(state="normal", text="Install on Server"))
|
||||
self.after(0, lambda: self.install_btn.configure(state="normal", text=t("install_on_server")))
|
||||
|
||||
threading.Thread(target=_do, daemon=True).start()
|
||||
|
||||
@@ -111,6 +113,6 @@ class KeysTab(ctk.CTkFrame):
|
||||
pub_key = f.read().strip()
|
||||
self.clipboard_clear()
|
||||
self.clipboard_append(pub_key)
|
||||
self._log("Public key copied to clipboard")
|
||||
self._log(t("key_copied"))
|
||||
else:
|
||||
self._log("[!] No public key to copy")
|
||||
self._log(t("no_public_key"))
|
||||
|
||||
Reference in New Issue
Block a user