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 -->"
GLOBAL_CLAUDE_MD_BLOCK = f"""{_BLOCK_START}
## Server Manager — управление серверами
## Серверы — ТОЛЬКО через /ssh
**ВСЕГДА** используй server manager для подключения к серверам. Никогда не используй `ssh`, `sshpass` или прямые подключения.
**НИКОГДА не используй raw `ssh` команды.** НИКОГДА не читай `~/.ssh/config` для поиска серверов.
Все операции с серверами — **ТОЛЬКО через скилл `/ssh`** или напрямую через `ssh.py`:
- Скилл: `/ssh ALIAS "command"` — выполнить команду на сервере
- Список серверов: `python3 ~/.server-connections/ssh.py --list`
- Документация: `~/.claude/commands/ssh.md`
- Memory bank: проект `global-infrastructure` → `techContext.md`
- Инфраструктура: https://git.sensey24.ru/aibot777/infrastructure-docs
```bash
python ~/.server-connections/ssh.py --list # список серверов (alias, тип, заметки)
python ~/.server-connections/ssh.py --info ALIAS # инфо (без creds)
python ~/.server-connections/ssh.py --status # online/offline
```
**Запрещено:** использовать `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}
"""

View File

@@ -15,12 +15,10 @@ class AboutDialog(ctk.CTkToplevel):
self.geometry("500x480")
self.resizable(False, False)
self.transient(master)
self.grab_set()
self.focus_force()
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 ──
ctk.CTkLabel(
self, text=t("about_title"),
@@ -80,20 +78,9 @@ class AboutDialog(ctk.CTkToplevel):
self, text=t("close"), width=120, command=self._on_close
).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):
try:
self._master_ref.unbind("<Map>", self._map_bind_id)
self.grab_release()
except Exception:
pass
self.destroy()

View File

@@ -2,8 +2,8 @@
Main application window — sidebar + tabview layout.
"""
import tkinter
import sys
import tkinter
import customtkinter as ctk
from tkinter import messagebox
@@ -92,7 +92,7 @@ class App(ctk.CTk):
# Restore saved window geometry or use default
saved_geo = self.store._window_geometry
if saved_geo:
if saved_geo and self._is_valid_geometry(saved_geo):
self.geometry(saved_geo)
else:
self.geometry("1100x700")
@@ -119,28 +119,23 @@ class App(ctk.CTk):
# Cleanup on close
self.protocol("WM_DELETE_WINDOW", self._on_close)
# Fix: restore window after Win+D (Show Desktop)
self.bind("<Map>", self._on_map, add="+")
# Win32: restore window when stuck minimized after Win+D
self._restore_check_id = None
if sys.platform == "win32":
self._setup_win32_restore()
self.after(3000, self._start_restore_watchdog)
def _on_map(self, event=None):
"""Ensure window is fully visible when restored from taskbar."""
def _start_restore_watchdog(self):
"""Start periodic check for stuck minimized state (Windows only)."""
try:
self.deiconify()
self.lift()
import ctypes
self._user32 = ctypes.windll.user32
self._hwnd = int(self.wm_frame(), 16)
self._check_restore()
except Exception:
pass
def _setup_win32_restore(self):
"""Win32 fallback: periodic check for stuck minimized state."""
import ctypes
self._user32 = ctypes.windll.user32
self._hwnd = int(self.wm_frame(), 16)
self._check_minimized()
def _check_minimized(self):
"""If window is iconic but should be visible, force restore."""
def _check_restore(self):
"""If window is iconic but user clicked taskbar, force restore."""
try:
if self._user32.IsIconic(self._hwnd):
fg = self._user32.GetForegroundWindow()
@@ -148,7 +143,7 @@ class App(ctk.CTk):
self._user32.ShowWindow(self._hwnd, 9) # SW_RESTORE
except Exception:
pass
self.after(500, self._check_minimized)
self._restore_check_id = self.after(500, self._check_restore)
def _build_layout(self):
# PanedWindow — resizable sidebar | main area
@@ -699,10 +694,31 @@ class App(ctk.CTk):
except Exception:
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):
# 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
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
try:
sash_pos = self._paned.sash_coord(0)

View File

@@ -32,11 +32,7 @@ class GroupDialog(ctk.CTkToplevel):
self.geometry("340x200")
self.resizable(False, False)
self.transient(master)
self.focus_force()
self.protocol("WM_DELETE_WINDOW", self._on_close)
self._master_ref = master
self._map_bind_id = master.bind("<Map>", self._on_parent_map, add="+")
self.grab_set()
# ── Name ──
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))
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,
command=self._save).pack(side="right")
@@ -94,23 +90,6 @@ class GroupDialog(ctk.CTkToplevel):
else:
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):
name = self._name_var.get().strip()
if not name:
@@ -128,4 +107,4 @@ class GroupDialog(ctk.CTkToplevel):
group = self.store.add_group(name, self._selected_color)
self.result = group
self._on_close()
self.destroy()

View File

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

View File

@@ -83,11 +83,7 @@ class UpdateDialog(ctk.CTkToplevel):
self.geometry("500x420")
self.resizable(False, False)
self.transient(parent)
self.focus_force()
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.grab_set()
self._info = info
self._downloaded_path = downloaded_path
@@ -103,23 +99,6 @@ class UpdateDialog(ctk.CTkToplevel):
py = parent.winfo_y() + (parent.winfo_height() - 420) // 2
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):
from version import __version__
@@ -215,7 +194,7 @@ class UpdateDialog(ctk.CTkToplevel):
width=80, height=34, corner_radius=8,
fg_color="#4b5563", hover_color="#374151",
font=ctk.CTkFont(size=13),
command=self._on_close,
command=self.destroy,
).pack(side="right", padx=(8, 0))
ctk.CTkButton(
@@ -289,4 +268,4 @@ class UpdateDialog(ctk.CTkToplevel):
def _on_skip_click(self):
if self._on_skip:
self._on_skip(self._info["version"])
self._on_close()
self.destroy()

View File

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