Compare commits

...

4 Commits

Author SHA1 Message Date
chrome-storm-c442
16e69a2bd6 v1.9.21: update global CLAUDE.md installer — full command table for all server types
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 05:21:21 -05:00
chrome-storm-c442
bc4cf2b7a3 v1.9.20: Win32 restore watchdog — fix stuck minimized after Win+D
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 04:37:32 -05:00
chrome-storm-c442
35bdefba59 v1.9.19: fix offscreen window — validate saved geometry, reject -32000 coords
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 04:13:11 -05:00
chrome-storm-c442
d33f573483 v1.9.18: revert GUI to v1.9.14 state — fix broken window display
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 04:09:47 -05:00
12 changed files with 79 additions and 108 deletions

View File

@@ -30,17 +30,37 @@ _BLOCK_START = "<!-- server-manager:start -->"
_BLOCK_END = "<!-- server-manager:end -->" _BLOCK_END = "<!-- server-manager:end -->"
GLOBAL_CLAUDE_MD_BLOCK = f"""{_BLOCK_START} GLOBAL_CLAUDE_MD_BLOCK = f"""{_BLOCK_START}
## Server Manager — управление серверами ## Серверы — ТОЛЬКО через /ssh
**ВСЕГДА** используй server manager для подключения к серверам. Никогда не используй `ssh`, `sshpass` или прямые подключения. **НИКОГДА не используй raw `ssh` команды.** НИКОГДА не читай `~/.ssh/config` для поиска серверов.
Все операции с серверами — **ТОЛЬКО через скилл `/ssh`** или напрямую через `ssh.py`:
- Скилл: `/ssh ALIAS "command"` — выполнить команду на сервере ```bash
- Список серверов: `python3 ~/.server-connections/ssh.py --list` python ~/.server-connections/ssh.py --list # список серверов (alias, тип, заметки)
- Документация: `~/.claude/commands/ssh.md` python ~/.server-connections/ssh.py --info ALIAS # инфо (без creds)
- Memory bank: проект `global-infrastructure` → `techContext.md` python ~/.server-connections/ssh.py --status # online/offline
- Инфраструктура: https://git.sensey24.ru/aibot777/infrastructure-docs ```
**Запрещено:** использовать `ssh`, `sshpass`, читать `~/.server-connections/` напрямую, раскрывать IP/пароли/порты. При вопросе о сервере — **СНАЧАЛА `--list`**, найди нужный алиас по заметкам и **ПРОВЕРЬ ТИП**.
Скрипт `ssh.py` сам читает credentials из зашифрованного хранилища. Claude НЕ видит IP, логины, пароли.
### КРИТИЧНО — команды зависят от типа сервера
**`ALIAS "command"` (shell) — ТОЛЬКО для типов `ssh` и `telnet`!**
| Тип | Команды |
|-----|---------|
| `ssh`/`telnet` | `ALIAS "cmd"`, `--upload ALIAS local remote`, `--download ALIAS remote local` |
| `s3` (MinIO и др.) | `--s3-buckets ALIAS`, `--s3-ls ALIAS bucket/prefix`, `--s3-upload ALIAS local bucket/key`, `--s3-download ALIAS bucket/key local`, `--s3-delete ALIAS bucket/key`, `--s3-url ALIAS bucket/key [SEC]` |
| `mariadb`/`mssql`/`postgresql` | `--sql ALIAS "SELECT ..."`, `--sql-databases ALIAS`, `--sql-tables ALIAS [db]` |
| `redis` | `--redis ALIAS "GET key"`, `--redis-info ALIAS`, `--redis-keys ALIAS "pattern"` |
| `grafana` | `--grafana-dashboards ALIAS`, `--grafana-alerts ALIAS` |
| `prometheus` | `--prom-query ALIAS "up"`, `--prom-targets ALIAS`, `--prom-alerts ALIAS` |
| `winrm` | `--ps ALIAS "Get-Process"`, `--cmd ALIAS "dir"` |
**Формат: `python ~/.server-connections/ssh.py КОМАНДА АЛИАС АРГУМЕНТЫ`** — алиас ВСЕГДА второй после команды.
**Запрещено:** использовать `ssh`/`sshpass`, читать `~/.server-connections/` напрямую, раскрывать IP/пароли/порты.
{_BLOCK_END} {_BLOCK_END}
""" """

View File

@@ -15,12 +15,10 @@ class AboutDialog(ctk.CTkToplevel):
self.geometry("500x480") self.geometry("500x480")
self.resizable(False, False) self.resizable(False, False)
self.transient(master) self.transient(master)
self.grab_set()
self.focus_force() self.focus_force()
self.protocol("WM_DELETE_WINDOW", self._on_close) self.protocol("WM_DELETE_WINDOW", self._on_close)
self._master_ref = master
self._map_bind_id = master.bind("<Map>", self._on_parent_map, add="+")
# ── Header ── # ── Header ──
ctk.CTkLabel( ctk.CTkLabel(
self, text=t("about_title"), self, text=t("about_title"),
@@ -80,20 +78,9 @@ class AboutDialog(ctk.CTkToplevel):
self, text=t("close"), width=120, command=self._on_close self, text=t("close"), width=120, command=self._on_close
).pack(pady=(10, 20)) ).pack(pady=(10, 20))
def _on_parent_map(self, event=None):
"""Restore dialog when parent is un-minimized."""
try:
if not self.winfo_exists():
return
self.deiconify()
self.lift()
self.focus_force()
except Exception:
pass
def _on_close(self): def _on_close(self):
try: try:
self._master_ref.unbind("<Map>", self._map_bind_id) self.grab_release()
except Exception: except Exception:
pass pass
self.destroy() self.destroy()

View File

@@ -2,8 +2,8 @@
Main application window — sidebar + tabview layout. Main application window — sidebar + tabview layout.
""" """
import tkinter
import sys import sys
import tkinter
import customtkinter as ctk import customtkinter as ctk
from tkinter import messagebox from tkinter import messagebox
@@ -92,7 +92,7 @@ class App(ctk.CTk):
# Restore saved window geometry or use default # Restore saved window geometry or use default
saved_geo = self.store._window_geometry saved_geo = self.store._window_geometry
if saved_geo: if saved_geo and self._is_valid_geometry(saved_geo):
self.geometry(saved_geo) self.geometry(saved_geo)
else: else:
self.geometry("1100x700") self.geometry("1100x700")
@@ -119,28 +119,23 @@ class App(ctk.CTk):
# Cleanup on close # Cleanup on close
self.protocol("WM_DELETE_WINDOW", self._on_close) self.protocol("WM_DELETE_WINDOW", self._on_close)
# Fix: restore window after Win+D (Show Desktop) # Win32: restore window when stuck minimized after Win+D
self.bind("<Map>", self._on_map, add="+") self._restore_check_id = None
if sys.platform == "win32": if sys.platform == "win32":
self._setup_win32_restore() self.after(3000, self._start_restore_watchdog)
def _on_map(self, event=None): def _start_restore_watchdog(self):
"""Ensure window is fully visible when restored from taskbar.""" """Start periodic check for stuck minimized state (Windows only)."""
try: try:
self.deiconify()
self.lift()
except Exception:
pass
def _setup_win32_restore(self):
"""Win32 fallback: periodic check for stuck minimized state."""
import ctypes import ctypes
self._user32 = ctypes.windll.user32 self._user32 = ctypes.windll.user32
self._hwnd = int(self.wm_frame(), 16) self._hwnd = int(self.wm_frame(), 16)
self._check_minimized() self._check_restore()
except Exception:
pass
def _check_minimized(self): def _check_restore(self):
"""If window is iconic but should be visible, force restore.""" """If window is iconic but user clicked taskbar, force restore."""
try: try:
if self._user32.IsIconic(self._hwnd): if self._user32.IsIconic(self._hwnd):
fg = self._user32.GetForegroundWindow() fg = self._user32.GetForegroundWindow()
@@ -148,7 +143,7 @@ class App(ctk.CTk):
self._user32.ShowWindow(self._hwnd, 9) # SW_RESTORE self._user32.ShowWindow(self._hwnd, 9) # SW_RESTORE
except Exception: except Exception:
pass pass
self.after(500, self._check_minimized) self._restore_check_id = self.after(500, self._check_restore)
def _build_layout(self): def _build_layout(self):
# PanedWindow — resizable sidebar | main area # PanedWindow — resizable sidebar | main area
@@ -699,10 +694,31 @@ class App(ctk.CTk):
except Exception: except Exception:
pass pass
@staticmethod
def _is_valid_geometry(geo: str) -> bool:
"""Reject geometry with offscreen coordinates (e.g. minimized -32000)."""
try:
# format: WxH+X+Y or WxH-X-Y
import re
m = re.match(r"(\d+)x(\d+)([+-]\d+)([+-]\d+)", geo)
if not m:
return False
x, y = int(m.group(3)), int(m.group(4))
return -100 < x < 10000 and -100 < y < 10000
except Exception:
return False
def _on_close(self): def _on_close(self):
# Cancel restore watchdog
try:
if self._restore_check_id:
self.after_cancel(self._restore_check_id)
except Exception:
pass
# Save window geometry (size + position) and sidebar width # Save window geometry (size + position) and sidebar width
try: try:
self.store._window_geometry = self.geometry() geo = self.geometry()
self.store._window_geometry = geo if self._is_valid_geometry(geo) else None
# Save sidebar width from PanedWindow sash position # Save sidebar width from PanedWindow sash position
try: try:
sash_pos = self._paned.sash_coord(0) sash_pos = self._paned.sash_coord(0)

View File

@@ -32,11 +32,7 @@ class GroupDialog(ctk.CTkToplevel):
self.geometry("340x200") self.geometry("340x200")
self.resizable(False, False) self.resizable(False, False)
self.transient(master) self.transient(master)
self.focus_force() self.grab_set()
self.protocol("WM_DELETE_WINDOW", self._on_close)
self._master_ref = master
self._map_bind_id = master.bind("<Map>", self._on_parent_map, add="+")
# ── Name ── # ── Name ──
ctk.CTkLabel(self, text=t("group_name"), anchor="w").pack( ctk.CTkLabel(self, text=t("group_name"), anchor="w").pack(
@@ -75,7 +71,7 @@ class GroupDialog(ctk.CTkToplevel):
btn_frame.pack(fill="x", padx=20, pady=(15, 10)) btn_frame.pack(fill="x", padx=20, pady=(15, 10))
ctk.CTkButton(btn_frame, text=t("cancel"), width=80, ctk.CTkButton(btn_frame, text=t("cancel"), width=80,
fg_color="gray", command=self._on_close).pack(side="left") fg_color="gray", command=self.destroy).pack(side="left")
ctk.CTkButton(btn_frame, text=t("save"), width=80, ctk.CTkButton(btn_frame, text=t("save"), width=80,
command=self._save).pack(side="right") command=self._save).pack(side="right")
@@ -94,23 +90,6 @@ class GroupDialog(ctk.CTkToplevel):
else: else:
btn.configure(border_color=fg) btn.configure(border_color=fg)
def _on_parent_map(self, event=None):
try:
if not self.winfo_exists():
return
self.deiconify()
self.lift()
self.focus_force()
except Exception:
pass
def _on_close(self):
try:
self._master_ref.unbind("<Map>", self._map_bind_id)
except Exception:
pass
self.destroy()
def _save(self): def _save(self):
name = self._name_var.get().strip() name = self._name_var.get().strip()
if not name: if not name:
@@ -128,4 +107,4 @@ class GroupDialog(ctk.CTkToplevel):
group = self.store.add_group(name, self._selected_color) group = self.store.add_group(name, self._selected_color)
self.result = group self.result = group
self._on_close() self.destroy()

View File

@@ -54,13 +54,13 @@ class ServerDialog(ctk.CTkToplevel):
self.geometry("450x720") self.geometry("450x720")
self.resizable(False, False) self.resizable(False, False)
# transient BEFORE grab_set — prevents focus lock on minimize
self.transient(master) self.transient(master)
self.grab_set()
self.focus_force() self.focus_force()
self.protocol("WM_DELETE_WINDOW", self._on_close)
# Restore dialog when parent is un-minimized # Release grab on close (prevents stuck app)
self._master_ref = master self.protocol("WM_DELETE_WINDOW", self._on_close)
self._map_bind_id = master.bind("<Map>", self._on_parent_map, add="+")
self._field_frames: dict[str, ctk.CTkFrame] = {} self._field_frames: dict[str, ctk.CTkFrame] = {}
self._build_ui(server) self._build_ui(server)
@@ -485,20 +485,10 @@ class ServerDialog(ctk.CTkToplevel):
except ValueError as e: except ValueError as e:
self._show_error(str(e)) self._show_error(str(e))
def _on_parent_map(self, event=None):
"""Restore dialog when parent window is un-minimized."""
try:
if not self.winfo_exists():
return
self.deiconify()
self.lift()
self.focus_force()
except Exception:
pass
def _on_close(self): def _on_close(self):
"""Release grab and destroy — prevents stuck app on minimize."""
try: try:
self._master_ref.unbind("<Map>", self._map_bind_id) self.grab_release()
except Exception: except Exception:
pass pass
self.destroy() self.destroy()

View File

@@ -83,11 +83,7 @@ class UpdateDialog(ctk.CTkToplevel):
self.geometry("500x420") self.geometry("500x420")
self.resizable(False, False) self.resizable(False, False)
self.transient(parent) self.transient(parent)
self.focus_force() self.grab_set()
self.protocol("WM_DELETE_WINDOW", self._on_close)
self._master_ref = parent
self._map_bind_id = parent.bind("<Map>", self._on_parent_map, add="+")
self._info = info self._info = info
self._downloaded_path = downloaded_path self._downloaded_path = downloaded_path
@@ -103,23 +99,6 @@ class UpdateDialog(ctk.CTkToplevel):
py = parent.winfo_y() + (parent.winfo_height() - 420) // 2 py = parent.winfo_y() + (parent.winfo_height() - 420) // 2
self.geometry(f"+{px}+{py}") self.geometry(f"+{px}+{py}")
def _on_parent_map(self, event=None):
try:
if not self.winfo_exists():
return
self.deiconify()
self.lift()
self.focus_force()
except Exception:
pass
def _on_close(self):
try:
self._master_ref.unbind("<Map>", self._map_bind_id)
except Exception:
pass
self.destroy()
def _build_ui(self): def _build_ui(self):
from version import __version__ from version import __version__
@@ -215,7 +194,7 @@ class UpdateDialog(ctk.CTkToplevel):
width=80, height=34, corner_radius=8, width=80, height=34, corner_radius=8,
fg_color="#4b5563", hover_color="#374151", fg_color="#4b5563", hover_color="#374151",
font=ctk.CTkFont(size=13), font=ctk.CTkFont(size=13),
command=self._on_close, command=self.destroy,
).pack(side="right", padx=(8, 0)) ).pack(side="right", padx=(8, 0))
ctk.CTkButton( ctk.CTkButton(
@@ -289,4 +268,4 @@ class UpdateDialog(ctk.CTkToplevel):
def _on_skip_click(self): def _on_skip_click(self):
if self._on_skip: if self._on_skip:
self._on_skip(self._info["version"]) self._on_skip(self._info["version"])
self._on_close() self.destroy()

View File

@@ -1,6 +1,6 @@
"""Version info for ServerManager.""" """Version info for ServerManager."""
__version__ = "1.9.16" __version__ = "1.9.21"
__app_name__ = "ServerManager" __app_name__ = "ServerManager"
__author__ = "aibot777" __author__ = "aibot777"
__description__ = "Desktop GUI for managing remote servers" __description__ = "Desktop GUI for managing remote servers"