New server type: S3 (MinIO, AWS, any S3-compatible storage) - core/s3_client.py: boto3 client with auto-reconnect, 10 retries, exponential backoff, multipart upload/download, tcp_keepalive - gui/tabs/s3_tab.py: object browser (Treeview), bucket selector, folder navigation, drag-and-drop upload from Explorer (windnd), progress bar with %, multi-file upload - CLI: --s3-buckets, --s3-ls, --s3-upload, --s3-download, --s3-delete with retry - ServerDialog: access_key, secret_key, bucket fields - Registration: server_store, connection_factory, status_checker, icons, app, i18n (EN/RU/ZH) - Fix: build.py cleanup_old_releases now sorts by semver (was lexicographic, broke v1.8.100+) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
"""
|
|
Connection factory — creates connection wrappers based on server type.
|
|
Uses lazy imports so missing optional dependencies don't crash the app.
|
|
"""
|
|
|
|
from core.ssh_client import SSHClientWrapper
|
|
|
|
|
|
def create_connection(server: dict, key_path: str = ""):
|
|
"""Create a connection wrapper based on server type."""
|
|
server_type = server.get("type", "ssh")
|
|
|
|
if server_type == "ssh":
|
|
return SSHClientWrapper(server, key_path)
|
|
|
|
if server_type == "telnet":
|
|
from core.telnet_client import TelnetSession
|
|
return TelnetSession(server)
|
|
|
|
if server_type in ("mariadb", "mssql", "postgresql"):
|
|
from core.sql_client import SQLClient
|
|
return SQLClient(server)
|
|
|
|
if server_type == "redis":
|
|
from core.redis_client import RedisClient
|
|
return RedisClient(server)
|
|
|
|
if server_type == "grafana":
|
|
from core.grafana_client import GrafanaClient
|
|
return GrafanaClient(server)
|
|
|
|
if server_type == "prometheus":
|
|
from core.prometheus_client import PrometheusClient
|
|
return PrometheusClient(server)
|
|
|
|
if server_type == "winrm":
|
|
from core.winrm_client import WinRMClient
|
|
return WinRMClient(server)
|
|
|
|
if server_type == "s3":
|
|
from core.s3_client import S3Client
|
|
return S3Client(server)
|
|
|
|
if server_type in ("rdp", "vnc"):
|
|
from core.remote_desktop import RemoteDesktopLauncher
|
|
return RemoteDesktopLauncher()
|
|
|
|
raise ValueError(f"Unknown server type: {server_type}")
|