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:
@@ -7,6 +7,7 @@ import threading
|
||||
import customtkinter as ctk
|
||||
from tkinter import filedialog
|
||||
from core.ssh_client import SSHClientWrapper
|
||||
from core.i18n import t
|
||||
|
||||
|
||||
class FilesTab(ctk.CTkFrame):
|
||||
@@ -16,48 +17,54 @@ class FilesTab(ctk.CTkFrame):
|
||||
self._current_alias: str | None = None
|
||||
|
||||
# Upload section
|
||||
upload_label = ctk.CTkLabel(self, text="Upload", font=ctk.CTkFont(size=14, weight="bold"), anchor="w")
|
||||
upload_label.pack(fill="x", padx=15, pady=(15, 5))
|
||||
self.upload_label = ctk.CTkLabel(self, text=t("upload"), font=ctk.CTkFont(size=14, weight="bold"), anchor="w")
|
||||
self.upload_label.pack(fill="x", padx=15, pady=(15, 5))
|
||||
|
||||
upload_frame = ctk.CTkFrame(self, fg_color="transparent")
|
||||
upload_frame.pack(fill="x", padx=15, pady=(0, 5))
|
||||
|
||||
ctk.CTkLabel(upload_frame, text="Local:", width=60, anchor="w").pack(side="left")
|
||||
self.upload_local = ctk.CTkEntry(upload_frame, placeholder_text="/path/to/local/file")
|
||||
self.upload_local_label = ctk.CTkLabel(upload_frame, text=t("local"), width=60, anchor="w")
|
||||
self.upload_local_label.pack(side="left")
|
||||
self.upload_local = ctk.CTkEntry(upload_frame, placeholder_text=t("placeholder_local_file"))
|
||||
self.upload_local.pack(side="left", fill="x", expand=True, padx=5)
|
||||
ctk.CTkButton(upload_frame, text="Browse", width=70, command=self._browse_upload).pack(side="right")
|
||||
self.browse_upload_btn = ctk.CTkButton(upload_frame, text=t("browse"), width=70, command=self._browse_upload)
|
||||
self.browse_upload_btn.pack(side="right")
|
||||
|
||||
upload_remote_frame = ctk.CTkFrame(self, fg_color="transparent")
|
||||
upload_remote_frame.pack(fill="x", padx=15, pady=(0, 5))
|
||||
|
||||
ctk.CTkLabel(upload_remote_frame, text="Remote:", width=60, anchor="w").pack(side="left")
|
||||
self.upload_remote = ctk.CTkEntry(upload_remote_frame, placeholder_text="/remote/path/file")
|
||||
self.upload_remote_label = ctk.CTkLabel(upload_remote_frame, text=t("remote"), width=60, anchor="w")
|
||||
self.upload_remote_label.pack(side="left")
|
||||
self.upload_remote = ctk.CTkEntry(upload_remote_frame, placeholder_text=t("placeholder_remote_file"))
|
||||
self.upload_remote.pack(side="left", fill="x", expand=True, padx=5)
|
||||
self.upload_btn = ctk.CTkButton(upload_remote_frame, text="Upload", width=70, command=self._upload)
|
||||
self.upload_btn = ctk.CTkButton(upload_remote_frame, text=t("upload"), width=70, command=self._upload)
|
||||
self.upload_btn.pack(side="right")
|
||||
|
||||
# Separator
|
||||
ctk.CTkFrame(self, height=2, fg_color="gray40").pack(fill="x", padx=15, pady=10)
|
||||
|
||||
# Download section
|
||||
download_label = ctk.CTkLabel(self, text="Download", font=ctk.CTkFont(size=14, weight="bold"), anchor="w")
|
||||
download_label.pack(fill="x", padx=15, pady=(5, 5))
|
||||
self.download_label = ctk.CTkLabel(self, text=t("download"), font=ctk.CTkFont(size=14, weight="bold"), anchor="w")
|
||||
self.download_label.pack(fill="x", padx=15, pady=(5, 5))
|
||||
|
||||
download_remote_frame = ctk.CTkFrame(self, fg_color="transparent")
|
||||
download_remote_frame.pack(fill="x", padx=15, pady=(0, 5))
|
||||
|
||||
ctk.CTkLabel(download_remote_frame, text="Remote:", width=60, anchor="w").pack(side="left")
|
||||
self.download_remote = ctk.CTkEntry(download_remote_frame, placeholder_text="/remote/path/file")
|
||||
self.download_remote_label = ctk.CTkLabel(download_remote_frame, text=t("remote"), width=60, anchor="w")
|
||||
self.download_remote_label.pack(side="left")
|
||||
self.download_remote = ctk.CTkEntry(download_remote_frame, placeholder_text=t("placeholder_remote_file"))
|
||||
self.download_remote.pack(side="left", fill="x", expand=True, padx=5)
|
||||
|
||||
download_local_frame = ctk.CTkFrame(self, fg_color="transparent")
|
||||
download_local_frame.pack(fill="x", padx=15, pady=(0, 5))
|
||||
|
||||
ctk.CTkLabel(download_local_frame, text="Local:", width=60, anchor="w").pack(side="left")
|
||||
self.download_local = ctk.CTkEntry(download_local_frame, placeholder_text="/path/to/save")
|
||||
self.download_local_label = ctk.CTkLabel(download_local_frame, text=t("local"), width=60, anchor="w")
|
||||
self.download_local_label.pack(side="left")
|
||||
self.download_local = ctk.CTkEntry(download_local_frame, placeholder_text=t("placeholder_save_path"))
|
||||
self.download_local.pack(side="left", fill="x", expand=True, padx=5)
|
||||
ctk.CTkButton(download_local_frame, text="Browse", width=70, command=self._browse_download).pack(side="left", padx=(5, 0))
|
||||
self.download_btn = ctk.CTkButton(download_local_frame, text="Download", width=80, command=self._download)
|
||||
self.browse_download_btn = ctk.CTkButton(download_local_frame, text=t("browse"), width=70, command=self._browse_download)
|
||||
self.browse_download_btn.pack(side="left", padx=(5, 0))
|
||||
self.download_btn = ctk.CTkButton(download_local_frame, text=t("download"), width=80, command=self._download)
|
||||
self.download_btn.pack(side="right")
|
||||
|
||||
# Progress
|
||||
@@ -94,15 +101,15 @@ class FilesTab(ctk.CTkFrame):
|
||||
|
||||
def _upload(self):
|
||||
if not self._current_alias:
|
||||
self._log_msg("[!] No server selected")
|
||||
self._log_msg(t("no_server_selected"))
|
||||
return
|
||||
local = self.upload_local.get().strip()
|
||||
remote = self.upload_remote.get().strip()
|
||||
if not local or not remote:
|
||||
self._log_msg("[!] Both paths required")
|
||||
self._log_msg(t("both_paths_required"))
|
||||
return
|
||||
if not os.path.exists(local):
|
||||
self._log_msg(f"[!] File not found: {local}")
|
||||
self._log_msg(t("file_not_found").format(path=local))
|
||||
return
|
||||
|
||||
server = self.store.get_server(self._current_alias)
|
||||
@@ -121,7 +128,7 @@ class FilesTab(ctk.CTkFrame):
|
||||
try:
|
||||
wrapper = SSHClientWrapper(server, self.store.get_ssh_key_path())
|
||||
wrapper.upload(local, remote, progress_cb=_progress)
|
||||
self.after(0, lambda: self._log_msg(f"OK: {local} -> {self._current_alias}:{remote}"))
|
||||
self.after(0, lambda: self._log_msg(t("upload_ok").format(local=local, alias=self._current_alias, remote=remote)))
|
||||
except Exception as e:
|
||||
self.after(0, lambda: self._log_msg(f"[ERROR] {e}"))
|
||||
finally:
|
||||
@@ -131,12 +138,12 @@ class FilesTab(ctk.CTkFrame):
|
||||
|
||||
def _download(self):
|
||||
if not self._current_alias:
|
||||
self._log_msg("[!] No server selected")
|
||||
self._log_msg(t("no_server_selected"))
|
||||
return
|
||||
remote = self.download_remote.get().strip()
|
||||
local = self.download_local.get().strip()
|
||||
if not remote or not local:
|
||||
self._log_msg("[!] Both paths required")
|
||||
self._log_msg(t("both_paths_required"))
|
||||
return
|
||||
|
||||
server = self.store.get_server(self._current_alias)
|
||||
@@ -154,7 +161,7 @@ class FilesTab(ctk.CTkFrame):
|
||||
try:
|
||||
wrapper = SSHClientWrapper(server, self.store.get_ssh_key_path())
|
||||
wrapper.download(remote, local, progress_cb=_progress)
|
||||
self.after(0, lambda: self._log_msg(f"OK: {self._current_alias}:{remote} -> {local}"))
|
||||
self.after(0, lambda: self._log_msg(t("download_ok").format(alias=self._current_alias, remote=remote, local=local)))
|
||||
except Exception as e:
|
||||
self.after(0, lambda: self._log_msg(f"[ERROR] {e}"))
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user