mirror of
https://github.com/db9979/sshtermy.git
synced 2026-12-05 12:24:08 +01:00
Code-Review: Offline-KI nur mit Prüfsumme, Pfadschutz F5, Geheimnisfilter, KI-Zeitplan bestätigen, Maus überall (#182)
* Code-Review 2026-11-21: Offline-KI nur mit Prüfsumme, Pfadschutz F5, Geheimnisfilter, KI-Zeitplan bestätigen, Maus überall Sicherheit und Fehler: - Offline-KI: llama-server und Modell nur mit SHA-256 (GitHub-Digest bzw. SHA256SUMS), sonst Abbruch; Server mit Zugangsschlüssel je Start (LLAMA_API_KEY) und Prüfung, dass der eigene Prozess antwortet; ausgepackte Dateien nicht mehr pauschal ausführbar - F5: Server-Dateinamen mit Pfadteilen (..\..\x.bat) werden nie lokal geschrieben (Windows-Pfadausbruch) - „Mit Standardprogramm öffnen“ fragt bei Programmen und Skripten nach - Geheimnisfilter: Umgebungsvariablen (MYSQL_ROOT_PASSWORD, DB_PASS, AWS_SECRET_ACCESS_KEY), mysql -p, curl -u, Switch-Passwörter/-Secrets, SNMP-Community, Passwort-Hashes - KI-Zeitplan-Prüfung: Befehle beim Speichern einmal vorschlagen und bestätigen, dann fest; Befehle, die Geheimnisse lesen, fallen weg - Syslog: Hostnamen parallel auflösen; ntfy.sh: zufälliges Thema, kurze Themen beim Einrichten abgelehnt Maus: - Esc bleibt in der Fußzeile, auch im schmalen Fenster - Mausrad in Textfenstern und allen Listen-Ansichten - Seitentaste „Zurück“ überall wie Esc, Rechtsklick ins Leere: Palette eine Ebene zurück - Klick daneben schließt Ergebnisfenster und Schnellbefehle - Manager: Rechtsklick auf freie Fläche (Neue Verbindung, Neuer Ordner, Import, Scan, Tag-Filter, alle zu/auf), „Aufgaben …“ und „Neuer Ordner hier …“ in den Rechtsklick-Menüs Doku: README.md, README.de.md, site/, Kurzreferenz (make handout). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUhGTMSBsq7CWSQCGKk * Hilfe (F1) mit der Maus: Reiter anklicken, Zeile wählen, Doppelklick führt aus, Rad blättert Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUhGTMSBsq7CWSQCGKk --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
01aeec5933
commit
ae2ed30e25
40 files changed
+891
-108
No files matched your search
+4
-3
@@ -44,6 +44,7 @@ sshTermy ist eine schlanke Terminal-Anwendung (TUI, eine einzige Datei, ~9 MB, k
|
||||
- **Befehle als Blöcke**: Alt+Bild↑ / Alt+Bild↓ springt im Verlauf von Befehl zu Befehl, Alt+O listet die Befehle des Tabs (mit Uhrzeit, Dauer, ✓/×): ⏎ springt hin, Strg+C kopiert genau diese Ausgabe, Strg+K gibt Befehl und Ausgabe an „KI fragen“, Strg+L zeigt sie groß.
|
||||
- **Neuer Tab über den Manager**: `+` in der Tab-Leiste, Alt+N oder ein Klick aufs Logo `>_ sshTermy` öffnet den Verbindungs-Manager mit Ordnern, Suche und Tags; die gewählte Verbindung (⏎ oder Doppelklick) öffnet sich in einem zusätzlichen Tab, die bisherigen Tabs bleiben offen. Esc führt ohne neuen Tab zurück.
|
||||
- **Tabs mit der Maus ziehen**: Ein Tab lässt sich in der Tab-Leiste an eine andere Stelle ziehen.
|
||||
- **Alles mit der Maus**: Jedes Menü und Fenster lässt sich per Klick öffnen und wieder verlassen. „Esc zurück“ bleibt auch im schmalen Fenster in der Fußzeile klickbar, das Mausrad blättert in allen Listen und Ergebnisfenstern (Config-Diff, Sicherheitscheck, Protokolle, Log-Blick …), die Seitentaste „Zurück“ der Maus wirkt überall wie Esc, ein Rechtsklick ins Leere führt im Befehlsmenü eine Ebene zurück, ein Klick daneben schließt Ergebnisfenster. In der Hilfe (F1) wechselt ein Klick den Reiter, ein Klick wählt eine Zeile, ein Doppelklick führt sie aus. Im Manager zeigt ein Rechtsklick auf die freie Fläche Neue Verbindung, Neuer Ordner, Importieren, Netz scannen, Tag-Filter und alle Ordner zu/auf; Ordner und Verbindungen haben im Rechtsklick-Menü auch „Aufgaben …“ und „Neuer Ordner hier …“
|
||||
- **Fertig im Hintergrund**: Ein Befehl, der 10 s oder länger in einem verdeckten Tab lief, markiert den Tab (✓ / ×) und meldet sich mit einer Einblendung; ist das sshTermy-Fenster im Hintergrund, kommt zusätzlich eine Desktop-Benachrichtigung (Windows, macOS, Linux). Die Terminal-Glocke markiert den Tab ebenso. Beides ist in der Palette abschaltbar
|
||||
- **Handy-Meldungen** (Palette *Handy-Meldungen*: ntfy, Gotify oder Webhook): Was als Desktop-Meldung kommt (langer Befehl fertig, Zeitplan gelaufen, Logwache, Farbregel mit `!`, Programm oder KI-Agent wartet auf dich, Gegenprüfung mit Zweifel), geht zusätzlich aufs Handy, wenn du nicht am Rechner bist: Fenster im Hintergrund, gesperrt oder 5 Minuten keine Taste. Der Text läuft durch den Geheimnisfilter, gesperrt steht kein Befehl darin; Fehler und Wartendes kommen mit hoher Priorität. Nach dem Einrichten kommt eine Probemeldung. Gilt je Rechner, geht nicht mit dem Sync.
|
||||
- **Agent-Weiterleitung** pro Verbindung (wie `ssh -A`): `git pull`, `ssh` und `scp` auf dem Server nutzen deine lokalen Keys aus ssh-agent, Pageant oder dem Windows-OpenSSH-Agent, die Keys verlassen deinen Rechner nie
|
||||
@@ -67,7 +68,7 @@ sshTermy ist eine schlanke Terminal-Anwendung (TUI, eine einzige Datei, ~9 MB, k
|
||||
- **Eine Kopfzeile**: links Logo und Tabs, rechts der Zustand der aktiven Sitzung (wer@wo, Verbindungsdauer, Latenz, Zeichensatz, Ziel, Tunnel, KI) und Warnungen wie root; Produktiv-Hosts (Gruppe/Tag „Produktion“, „prod“, „live“) tragen eine rote Marke **▲ PRODUKTIV** (auch über jedem Bereich der geteilten Ansicht). Wird es eng, fallen rechts erst Details weg, dann kürzen sich die Tabnamen. Version und „Idee: Dominik Bornhäußer“ stehen im Über-Fenster (F12) und im Startbild
|
||||
- **F-Tasten-Leiste** unten wie in klassischen Werkzeugen: `1Hilfe 2Ziel 3KI 4Tunnel 5Dateien 6Host …`, die Ziffer zum Anklicken oder Drücken
|
||||
- **Dateien (F5)**: SFTP über dieselbe Verbindung, links lokal, rechts Server (öffnet im Ordner, in dem du im Terminal gerade bist: per OSC 7 der Shell oder aus dem Prompt `user@host:/pfad$`, sonst im Home-Ordner), Dateien und Ordner hoch- und herunterladen, mit der Maus auf die andere Seite ziehen, mehrere mit der Leertaste markieren. Dateien aus Explorer/Finder ins Fenster ziehen lädt sie hoch, auch direkt im Terminal. Beim Kopieren zeigt ein Balken Prozent, MB/s, Restzeit und „Datei 2 von 5“, dazu eine kleine Tempo-Kurve. **Keine Berechtigung** (z. B. Hochladen nach `/opt/…`): sshTermy fragt, ob es mit sudo wiederholen soll (j zweimal, jede Verbindung gilt als produktiv), und kopiert dann über einen eigenen Zwischenordner und `sudo cp`; genauso bei Herunterladen, Löschen, Umbenennen, Rechten, neuem Ordner und Speichern aus dem eigenen Editor. sudo-Passwort: Anmeldepasswort, Schlüsselbund oder Abfrage; es steht nie in der Befehlszeile
|
||||
- **Dateien mit der Maus**: Doppelklick auf eine Datei zeigt sie direkt in sshTermy (Zeilennummern, Farben, Rad blättert, Ziehen markiert und kopiert, `/` sucht, `f` liest mit wie `tail -f`, `w` bricht um; große Dateien lädt er am Anfang und am Ende). Bilder, PDFs und Office-Dateien öffnen sich mit dem Standardprogramm deines Rechners (Server-Dateien werden vorher heruntergeladen). Ein Einfachklick zeigt den Anfang einer Textdatei unter der Liste (`v` schaltet das aus). Rechtsklick öffnet ein Menü: ansehen, bearbeiten, mit Standardprogramm öffnen, kopieren, herunter-/hochladen nach …, umbenennen (`F2`), Rechte ändern, Pfad kopieren (`y`), im Terminal hierhin `cd`, löschen. Ein Klick auf einen Teil des Pfads (/ › etc › nginx) springt dorthin, Knöpfe für ↑ ~ neu laden, neuer Ordner und versteckte Dateien, ein Klick auf einen Spaltenkopf sortiert (`s`), Strg+Klick markiert einzeln, Umschalt+Klick einen Bereich, die Zurück-Taste der Maus geht eine Ebene hoch
|
||||
- **Dateien mit der Maus**: Doppelklick auf eine Datei zeigt sie direkt in sshTermy (Zeilennummern, Farben, Rad blättert, Ziehen markiert und kopiert, `/` sucht, `f` liest mit wie `tail -f`, `w` bricht um; große Dateien lädt er am Anfang und am Ende). Bilder, PDFs und Office-Dateien öffnen sich mit dem Standardprogramm deines Rechners (Server-Dateien werden vorher heruntergeladen). Programme und Skripte (`.exe`, `.bat`, `.ps1`, `.lnk`, `.sh` …) fragen vorher nach, und ein Dateiname vom Server mit Pfadteilen (`..\`) wird nie heruntergeladen. Ein Einfachklick zeigt den Anfang einer Textdatei unter der Liste (`v` schaltet das aus). Rechtsklick öffnet ein Menü: ansehen, bearbeiten, mit Standardprogramm öffnen, kopieren, herunter-/hochladen nach …, umbenennen (`F2`), Rechte ändern, Pfad kopieren (`y`), im Terminal hierhin `cd`, löschen. Ein Klick auf einen Teil des Pfads (/ › etc › nginx) springt dorthin, Knöpfe für ↑ ~ neu laden, neuer Ordner und versteckte Dateien, ein Klick auf einen Spaltenkopf sortiert (`s`), Strg+Klick markiert einzeln, Umschalt+Klick einen Bereich, die Zurück-Taste der Maus geht eine Ebene hoch
|
||||
- **Dateien wie im Dateimanager (F5)**: `d`/Entf legt in den **Papierkorb** (Server und Linux: `~/.local/share/Trash` wie Dateimanager und trash-cli, Mac: `~/.Trash`), `Strg+Z` holt zurück, `⇧D` löscht endgültig. **Packen und Entpacken** direkt auf dem Server ohne Herunterladen: `z` packt als `.tar.gz`/`.zip`/`.tar`, `u` entpackt in einen neuen Ordner daneben (lokal macht es sshTermy selbst, Archive mit `../` werden abgewiesen). **Datei finden** `/`: unscharf im ganzen Ordnerbaum ab hier („ngcf“ findet `nginx.conf`), ⏎ springt hin. **Platzfresser**: `i` rechnet die Ordnergrößen aus und sortiert die größten nach oben, `⇧I` findet doppelte Dateien (gleiche Prüfsumme) und zeigt, wie viel Platz frei würde. **Orte** `g` (oder ♦ in der Pfadleiste): gemerkte Ordner (`m`), Home, `/`, `/var/log`, `/etc` …, eingehängte Laufwerke, Papierkorb und zuletzt besuchte Ordner; im breiten Fenster als Leiste links; `Alt+←/→` springt zum vorigen/nächsten Ordner. **Viele umbenennen** mit `⇧F2`: die Namen kommen als Liste in den eigenen Editor, nach dem Speichern zeigt sshTermy die Änderungen oder pro Zeile, was nicht geht; Tauschen geht, bei Fehlern wird alles zurückgedreht. **Ausschneiden/Einfügen** `x`/`p`: auf derselben Seite verschieben, auf die andere Seite kopieren und danach das Original löschen. **Vorschau** zeigt jetzt auch Ordnerinhalt, Archivinhalt, Bildgröße, Markdown farbig, CSV als Tabelle (`t` im Betrachter schaltet um) und Schlüsselwörter je Programmiersprache
|
||||
- **Server-Datei im eigenen Editor**: `e` in F5 (Server-Seite) oder Palette „Server-Datei im eigenen Editor öffnen“ mit Pfad öffnet die Datei in VS Code, Notepad++, TextEdit … auf deinem Rechner; jedes Speichern lädt sie über dieselbe Verbindung zurück (Besitzer und Rechte bleiben). Editor einstellen: Palette → Einstellungen › „Editor für Server-Dateien“ (z. B. `code --new-window`)
|
||||
- **Farbregeln für die Ausgabe**: Text ohne eigene Farbe wird eingefärbt, Fehler rot, Warnungen gelb, ok/up grün, IP-Adressen blau, MAC-Adressen lila, Switch-Syslog (`%LINK-3-UPDOWN`) nach Schwere; nie in vim/htop. Eigene Regeln „farbe muster“ (Farben deutsch oder englisch; Palette → „Farbregeln für die Ausgabe“); mit `!` davor meldet sich sshTermy, wenn das Muster in einem verdeckten Tab auftaucht (Tab bekommt ein `!`, Einblendung, auf Wunsch Desktop-Meldung)
|
||||
@@ -112,7 +113,7 @@ nicht als Beweis. Die Liste: Palette *Logwache: Meldungen* oder `w` im Log-Blick
|
||||
Gefährliches und Runbooks mit Variablen lassen sich gar nicht einplanen. Das Ergebnis je Host steht in der Liste
|
||||
(⏎), dazu eine Einblendung bzw. Desktop-Meldung. Zeitpläne gehen mit dem Sync, laufen aber nur auf einem Rechner
|
||||
(„Läuft auf“ im Formular, Standard: der Rechner, der ihn angelegt hat), damit nicht zwei Rechner denselben Lauf starten
|
||||
- **KI-Prüfung als Zeitplan** (Art *KI-Prüfung (nur lesend)*): ein Prüfauftrag in eigenen Worten, z. B. „läuft nginx, ist eine Platte über 90 %, gibt es neue Fehler im Journal?“, für alle Linux-/Unix-Server eines Ordners. Die KI wählt einmal bis zu fünf Befehle, die nur lesen (was nicht sicher nur liest, fällt weg), sie laufen auf jedem Server, dann urteilt die KI je Host: in Ordnung oder Befund. Das Ergebnis mit den Befehlen steht im Zeitplan, Befunde kommen als Meldung (und aufs Handy, wenn eingerichtet).
|
||||
- **KI-Prüfung als Zeitplan** (Art *KI-Prüfung (nur lesend)*): ein Prüfauftrag in eigenen Worten, z. B. „läuft nginx, ist eine Platte über 90 %, gibt es neue Fehler im Journal?“, für alle Linux-/Unix-Server eines Ordners. Beim Speichern schlägt die KI einmal bis zu fünf Befehle vor, die nur lesen (was nicht sicher nur liest oder Geheimnisse wie `/etc/shadow` ausgibt, fällt weg); erst wenn du sie bestätigst, laufen genau diese bei jedem Lauf auf jedem Server, dann urteilt die KI je Host: in Ordnung oder Befund. Das Ergebnis mit den Befehlen steht im Zeitplan, Befunde kommen als Meldung (und aufs Handy, wenn eingerichtet).
|
||||
- **Runbooks mit Variablen:** `{{vlan}}` oder `{{vlan=20}}` in einem Schritt wird vor dem Start abgefragt, `{{host}}`,
|
||||
`{{alias}}`, `{{user}}`, `{{port}}` setzt sshTermy pro Host ein. Im Broadcast lädt `e` ein Runbook zum Bearbeiten,
|
||||
`Strg+R` speichert, `Strg+D` löscht. Vor dem Start prüft die KI mit `k` gegen das Systemprofil jedes Hosts, ob die
|
||||
@@ -204,7 +205,7 @@ nicht als Beweis. Die Liste: Palette *Logwache: Meldungen* oder `w` im Log-Blick
|
||||
- **KI-Befehle vorab auf dem Host geprüft** (Idee aus [lxask](https://github.com/arxhr007/lxask), MIT): bevor ein Befehl aus einer Karte eingefügt oder ausgeführt wird, fragt sshTermy unsichtbar über die offene Sitzung beim echten Host nach, ob es das Programm gibt (`command -v`) und ob jede Option und jeder Unterbefehl in dessen man-Seite oder `--help` steht. Erkannt werden auch macOS/BSD-Formen unter Linux (`top -l`, `pbcopy`, `sed -i ''`), der Paketmanager der falschen Distribution, offene Anführungszeichen und alles, was die Frage ausschließt („ohne lsof“, „kein sudo“); Pfade, Dateiendungen, Ports und Zeiträume aus der Frage müssen im Befehl stehen, und ein Löschen fällt auf, wenn du nur ansehen wolltest. Bekannte Ausrutscher werden gleich repariert (`grep` auf einen Ordner bekommt `-r`, `ps … | head -n 1` behält die Datenzeile, `rpm -qa` wird unter Debian zu `dpkg -l`). Was offen bleibt, steht auf der Karte als *unbestätigt* mit Grund, und die KI bekommt mit diesen Hinweisen einen zweiten Versuch. Netzwerkgeräte und Windows werden übersprungen; abschaltbar unter Einstellungen › KI › *KI-Befehle vorab prüfen*
|
||||
- **Satz → Befehl** (Strg+G): am Prompt in eigenen Worten tippen, was du willst („zeig die 5 größten Dateien hier“), Strg+G ersetzt die Zeile durch einen geprüften Befehl, ausgeführt wird nichts
|
||||
- **Befehl erklären ohne KI** (Alt+H, `e` auf einer Karte): erklärt die getippte Zeile (oder den letzten Befehl) Teil für Teil aus der man-Seite oder `--help` des Hosts, geht offline und ganz ohne KI
|
||||
- **Passend zur vorhandenen KI**: ist keine KI eingerichtet, sind alle KI-Funktionen ausgeblendet, Prüfen, Reparieren und Erklären oben gehen trotzdem. Eine **kleine Offline-KI** lädt ein Knopf herunter (Einstellungen › KI › *Kleine Offline-KI herunterladen*, etwa 1 GB: das lxask-Modell, 1,5B, betrieben von [llama.cpp](https://github.com/ggml-org/llama.cpp) `llama-server` unter Windows, macOS und Linux, geprüft gegen SHA256SUMS). Sie startet nur, wenn keine andere KI antwortet, lauscht nur auf 127.0.0.1 und beendet sich nach 30 Minuten ohne Nutzung. Sie reicht für einzelne Befehle (KI fragen, Strg+G); Ziel-, Agent- und Plan-Modus, Begleiter, Ghost-Text von der KI und andere anspruchsvolle Funktionen bleiben ausgeblendet, bis eine größere KI angebunden ist. Die Marke in der Kopfzeile zeigt *◆ keine KI* oder *◆ Offline-KI*
|
||||
- **Passend zur vorhandenen KI**: ist keine KI eingerichtet, sind alle KI-Funktionen ausgeblendet, Prüfen, Reparieren und Erklären oben gehen trotzdem. Eine **kleine Offline-KI** lädt ein Knopf herunter (Einstellungen › KI › *Kleine Offline-KI herunterladen*, etwa 1 GB: das lxask-Modell, 1,5B, betrieben von [llama.cpp](https://github.com/ggml-org/llama.cpp) `llama-server` unter Windows, macOS und Linux, jede Datei wird gegen ihre SHA-256 geprüft, ohne Prüfsumme lädt nichts). Sie startet nur, wenn keine andere KI antwortet, lauscht nur auf 127.0.0.1 mit einem Zugangsschlüssel je Start und beendet sich nach 30 Minuten ohne Nutzung. Sie reicht für einzelne Befehle (KI fragen, Strg+G); Ziel-, Agent- und Plan-Modus, Begleiter, Ghost-Text von der KI und andere anspruchsvolle Funktionen bleiben ausgeblendet, bis eine größere KI angebunden ist. Die Marke in der Kopfzeile zeigt *◆ keine KI* oder *◆ Offline-KI*
|
||||
- **Systemprofil pro Verbindung**: sshTermy erkennt System, Version und Befehlssatz (Linux mit Paketmanager und
|
||||
Init-System, macOS, Windows, ArubaOS-Switch/ProCurve, ArubaOS-CX, Cisco IOS, Junos, RouterOS, Comware, UniFi-Switches …) aus
|
||||
SSH-Kennung, unsichtbarer Abfrage (nur Server) und dem mitgelesenen Terminal (Netzwerkgeräte, ohne Exec).
|
||||
|
||||
@@ -44,6 +44,7 @@ sshTermy is a lean terminal application (TUI, a single file, ~9 MB, no installer
|
||||
- **Commands as blocks**: Alt+PgUp / Alt+PgDn jumps from command to command in the scrollback, Alt+O lists the commands of the tab (with time, duration, ✓/×): ⏎ jumps there, Ctrl+C copies just that output, Ctrl+K hands command and output to “Ask AI”, Ctrl+L shows it in full.
|
||||
- **New tab via the manager**: `+` in the tab bar, Alt+N or a click on the `>_ sshTermy` logo opens the connection manager with folders, search and tags; the connection you pick (⏎ or double-click) opens in an additional tab, the current tabs stay open. Esc goes back without a new tab.
|
||||
- **Drag tabs with the mouse**: a tab can be dragged to another position in the tab bar.
|
||||
- **Everything with the mouse**: every menu and window can be opened and left again by clicking. “Esc back” stays clickable in the footer even in a narrow window, the mouse wheel scrolls in all lists and result windows (config diff, security check, session logs, log view …), the mouse back button works like Esc everywhere, a right-click on empty space goes up one level in the command menu, a click outside closes result windows. In the help (F1) a click switches the tab, a click selects a row, a double-click runs it. In the manager a right-click on empty space shows new connection, new folder, import, scan network, tag filter and fold/unfold all folders; folders and connections also have “Tasks …” and “New folder here …” in their right-click menu
|
||||
- **Finished in the background**: a command that ran 10 s or longer in a hidden tab marks the tab (✓ / ×) and shows a toast; if the sshTermy window is in the background you also get a desktop notification (Windows, macOS, Linux). The terminal bell marks the tab too. Both can be switched off in the palette
|
||||
- **Phone notifications** (palette *Phone notifications*: ntfy, Gotify or webhook): whatever comes as a desktop notification (long command done, schedule ran, log watch, color rule with `!`, a program or AI agent waiting for you, cross-check with doubt) also goes to your phone when you are away: window in the background, locked or no key for 5 minutes. The text passes the secret filter, when locked no command is in it; failures and waiting come with high priority. A test notification follows the setup. Per computer, not synced.
|
||||
- **Agent forwarding** per connection (like `ssh -A`): `git pull`, `ssh` and `scp` on the server use your local keys from ssh-agent, Pageant or the Windows OpenSSH agent, the keys never leave your computer
|
||||
@@ -67,7 +68,7 @@ sshTermy is a lean terminal application (TUI, a single file, ~9 MB, no installer
|
||||
- **One header line**: logo and tabs on the left, the state of the active session on the right (who@where, connection time, latency, character set, goal, tunnels, AI) plus warnings such as root; production hosts (group/tag “Produktion”, “prod”, “live”) carry a red **▲ PRODUCTION** badge (also above each pane of the split view). When space runs short, details on the right go first, then tab names get shorter. The version and “Idea: Dominik Bornhäußer” live in the About window (F12) and the start screen
|
||||
- **Function key bar** at the bottom like in classic tools: `1Help 2Goal 3AI 4Tunnel 5Files 6Host …`, click the digit or press the key
|
||||
- **Files (F5)**: SFTP over the same connection, local on the left, server on the right (opens in the folder you are in on the terminal: via the shell's OSC 7 or from a `user@host:/path$` prompt, otherwise in the home folder), upload and download files and folders, drag with the mouse to the other side, mark several with Space. Dragging files from Explorer/Finder into the window uploads them, even straight from the terminal. While copying, a bar shows percent, MB/s, time left and “file 2 of 5”, with a small speed curve. **No permission** (e.g. upload to `/opt/…`): sshTermy asks whether to repeat it with sudo (press j twice, every connection counts as production) and then copies via a private temp folder and `sudo cp`; the same works for download, delete, rename, permissions, new folder and saving from your own editor. sudo password: login password, OS keychain or prompt; it never appears on the command line
|
||||
- **Files with the mouse**: double-click a file to view it right in sshTermy (line numbers, colors, wheel scrolls, drag selects and copies, `/` searches, `f` follows like `tail -f`, `w` wraps; big files load beginning and end). Images, PDFs and Office files open with the default app of your computer (server files are downloaded first). A single click shows the start of a text file below the list (`v` turns that off). Right-click opens a menu: view, edit, open with default app, copy, download/upload to …, rename (`F2`), change permissions, copy path (`y`), `cd` here in the terminal, delete. Click a part of the path (/ › etc › nginx) to jump there, buttons for ↑ ~ reload, new folder and hidden files, click a column header to sort (`s`), Ctrl+click marks one by one, Shift+click a range, the mouse back button goes up a level
|
||||
- **Files with the mouse**: double-click a file to view it right in sshTermy (line numbers, colors, wheel scrolls, drag selects and copies, `/` searches, `f` follows like `tail -f`, `w` wraps; big files load beginning and end). Images, PDFs and Office files open with the default app of your computer (server files are downloaded first). Programs and scripts (`.exe`, `.bat`, `.ps1`, `.lnk`, `.sh` …) ask first, and a server file name containing path parts (`..\`) is never downloaded. A single click shows the start of a text file below the list (`v` turns that off). Right-click opens a menu: view, edit, open with default app, copy, download/upload to …, rename (`F2`), change permissions, copy path (`y`), `cd` here in the terminal, delete. Click a part of the path (/ › etc › nginx) to jump there, buttons for ↑ ~ reload, new folder and hidden files, click a column header to sort (`s`), Ctrl+click marks one by one, Shift+click a range, the mouse back button goes up a level
|
||||
- **Files like a file manager (F5)**: `d`/Del moves to the **trash** (server and Linux: `~/.local/share/Trash` like file managers and trash-cli, Mac: `~/.Trash`), `Ctrl+Z` restores, `⇧D` deletes permanently. **Pack and extract** right on the server without downloading: `z` packs as `.tar.gz`/`.zip`/`.tar`, `u` extracts into a new folder next to it (locally sshTermy does it itself, archives with `../` are refused). **Find file** `/`: fuzzy across the whole folder tree from here (“ngcf” finds `nginx.conf`), ⏎ jumps there. **Space hogs**: `i` computes folder sizes and sorts the largest to the top, `⇧I` finds duplicate files (same checksum) and shows how much space would be freed. **Places** `g` (or ♦ in the path bar): bookmarked folders (`m`), home, `/`, `/var/log`, `/etc` …, mounted drives, trash and recently visited folders; as a sidebar on the left in a wide window; `Alt+←/→` goes to the previous/next folder. **Rename many** with `⇧F2`: the names come as a list in your own editor, after saving sshTermy shows the changes or, per line, what doesn't work; swapping works, on errors everything is rolled back. **Cut/paste** `x`/`p`: moves on the same side, copies to the other side and then deletes the original. **Preview** now also shows folder contents, archive contents, image size, colored Markdown, CSV as a table (`t` in the viewer toggles) and keywords per programming language
|
||||
- **Server file in your own editor**: `e` in F5 (server side) or the palette entry “Open server file in your own editor” with a path opens the file in VS Code, Notepad++, TextEdit … on your computer; every save uploads it back over the same connection (owner and permissions stay). Choose the editor: palette → Settings › “Editor for server files” (e.g. `code --new-window`)
|
||||
- **Color rules for output**: text without its own color gets colored, errors red, warnings yellow, ok/up green, IP addresses blue, MAC addresses purple, switch syslog (`%LINK-3-UPDOWN`) by severity; never in vim/htop. Own rules “color pattern” (colors in English or German; palette → “Color rules for output”); with `!` in front sshTermy notifies you when the pattern shows up in a hidden tab (the tab gets a `!`, a toast, a desktop notification if you like)
|
||||
@@ -111,7 +112,7 @@ lets them in. The AI status report treats syslog lines as hints, not as proof. T
|
||||
dangerous steps and runbooks with variables cannot be scheduled at all. The result per host is in the list
|
||||
(⏎), plus a toast or desktop notification. Schedules travel with the sync but run only on one computer
|
||||
(“Runs on” in the form, default: the computer that created it), so two computers never start the same run
|
||||
- **AI check as a schedule** (kind *AI check (read-only)*): a check task in your own words, e.g. “is nginx running, is a disk above 90 %, are there new errors in the journal?”, for all Linux/Unix servers of a folder. The AI picks up to five commands once that only read (anything not surely read-only is dropped), they run on every server, then the AI judges per host: fine or finding. The result with the commands is in the schedule, findings come as a notification (and to the phone, if set up).
|
||||
- **AI check as a schedule** (kind *AI check (read-only)*): a check task in your own words, e.g. “is nginx running, is a disk above 90 %, are there new errors in the journal?”, for all Linux/Unix servers of a folder. When you save, the AI suggests up to five commands once that only read (anything not surely read-only or that prints secrets like `/etc/shadow` is dropped); only after you confirm them do exactly these run on every server on each run, then the AI judges per host: fine or finding. The result with the commands is in the schedule, findings come as a notification (and to the phone, if set up).
|
||||
- **Runbooks with variables:** `{{vlan}}` or `{{vlan=20}}` in a step is asked before the run, `{{host}}`, `{{alias}}`,
|
||||
`{{user}}`, `{{port}}` are filled in per host. In the broadcast `e` loads a runbook for editing, `Ctrl+R` saves,
|
||||
`Ctrl+D` deletes. Before the run `k` lets the AI check the steps against each host's system profile and suggest
|
||||
@@ -199,7 +200,7 @@ lets them in. The AI status report treats syslog lines as hints, not as proof. T
|
||||
- **AI commands checked on the host first** (idea from [lxask](https://github.com/arxhr007/lxask), MIT): before a card command is inserted or run, sshTermy asks the real host, invisibly over the open session, whether the program exists (`command -v`) and whether every option and subcommand is in its man page or `--help`. It also catches macOS/BSD forms on Linux (`top -l`, `pbcopy`, `sed -i ''`), the wrong distro's package manager, unclosed quotes and anything the question rules out (“without lsof”, “ohne sudo”); paths, file extensions, ports and durations named in the question must appear in the command, and a delete is flagged when you only asked to look. Known slips are repaired right away (`grep` on a folder gets `-r`, `ps … | head -n 1` keeps the data line, `rpm -qa` becomes `dpkg -l` on Debian). What is still open shows on the card as *unconfirmed* with the reason, and the AI gets one more try with those notes. Network devices and Windows are skipped; turn it off in Settings › AI › *Check AI commands beforehand*
|
||||
- **Sentence → command** (Ctrl+G): type what you want at the prompt in plain words (“show the 5 largest files here”) and press Ctrl+G; the line is replaced by a checked command, nothing runs
|
||||
- **Explain a command without AI** (Alt+H, `e` on a card): explains the typed line (or the last command) part by part from the host's own man page or `--help`, works offline and with no AI at all
|
||||
- **Fits the AI you have**: with no AI set up, every AI feature is hidden and the checks, repairs and explanations above still work. A **small offline AI** can be downloaded with one button (Settings › AI › *Download small offline AI*, about 1 GB: the lxask model, 1.5B, run by [llama.cpp](https://github.com/ggml-org/llama.cpp) `llama-server` on Windows, macOS and Linux, checked against SHA256SUMS). It only starts when no other AI answers, listens on 127.0.0.1 only and stops after 30 idle minutes. It is good for single commands (Ask AI, Ctrl+G); goal, agent and plan mode, the companion, ghost text from the AI and other demanding features stay hidden until a larger AI is connected. The badge in the header shows *◆ no AI* or *◆ offline AI*
|
||||
- **Fits the AI you have**: with no AI set up, every AI feature is hidden and the checks, repairs and explanations above still work. A **small offline AI** can be downloaded with one button (Settings › AI › *Download small offline AI*, about 1 GB: the lxask model, 1.5B, run by [llama.cpp](https://github.com/ggml-org/llama.cpp) `llama-server` on Windows, macOS and Linux, every file is checked against its SHA-256, nothing downloads without a checksum). It only starts when no other AI answers, listens on 127.0.0.1 only with an access key per start and stops after 30 idle minutes. It is good for single commands (Ask AI, Ctrl+G); goal, agent and plan mode, the companion, ghost text from the AI and other demanding features stay hidden until a larger AI is connected. The badge in the header shows *◆ no AI* or *◆ offline AI*
|
||||
- **System profile per connection**: sshTermy detects system, version and command set (Linux with package manager and
|
||||
init system, macOS, Windows, ArubaOS-Switch/ProCurve, ArubaOS-CX, Cisco IOS, Junos, RouterOS, Comware, UniFi switches …) from the
|
||||
SSH banner, an invisible query (servers only) and the terminal it reads along (network devices, no exec).
|
||||
|
||||
@@ -15,12 +15,30 @@ var redactions = []*regexp.Regexp{
|
||||
regexp.MustCompile(`(?i)\b(bearer)\s+[A-Za-z0-9._\-]{16,}`),
|
||||
regexp.MustCompile(`(?i)\b(password|passwd|pwd|secret|token|api[_-]?key)\s*[=:]\s*\S+`),
|
||||
regexp.MustCompile(`(?i)(--?(password|passwd|pass)[= ]|sshpass -p ?)\S+`), // mysql --password x, sshpass -p x
|
||||
// Umgebungsvariablen: MYSQL_ROOT_PASSWORD=…, DB_PASS=…, AWS_SECRET_ACCESS_KEY=…
|
||||
regexp.MustCompile(`(?i)\b[a-z0-9_]*(password|passwd|secret|token|api_?key|access_?key|private_?key|credentials?|_pass)\s*[=:]\s*\S+`),
|
||||
// Passwort-Hashes (/etc/shadow, enable secret 5 …)
|
||||
regexp.MustCompile(`\$(1|2[aby]|5|6|y|gy|7|md5|sha1)\$[^\s:]{8,}`),
|
||||
}
|
||||
|
||||
// keepPrefix: nur der Wert hinter dem Schlüsselwort geht weg.
|
||||
var keepPrefix = []*regexp.Regexp{
|
||||
regexp.MustCompile(`(\s(?:-u|--user)\s+[^:\s]+:)\S+`), // curl -u admin:pw
|
||||
regexp.MustCompile(`(?i)(\bmysql(?:dump|admin)?\b[^\n]*?\s-p)[^\s-]\S*`), // mysql -pGeheim
|
||||
regexp.MustCompile(`(?i)(\bsnmp-server\s+community\s+)\S+`), // Cisco/HP/Aruba
|
||||
regexp.MustCompile(`(?i)(\bplaintext\s+)\S+`), // Aruba: … plaintext geheim
|
||||
regexp.MustCompile(`(?im)^(\s*(?:username\s+\S+\s+(?:privilege\s+\d+\s+)?|enable\s+)(?:password|secret)\s+(?:(?:\d|manager|operator|sha1|sha256)\s+)*)\S+`),
|
||||
regexp.MustCompile(`(?im)^(\s*(?:password|secret|key)\s+(?:\d|manager|operator)\s+(?:\S+\s+)??)\S+`), // password 7 …, password manager …
|
||||
regexp.MustCompile(`(?im)^(\s+password\s+)\S+`), // eingerückt (line vty)
|
||||
}
|
||||
|
||||
var urlCreds = regexp.MustCompile(`(?i)(://[^:/\s]+:)[^@/\s]+@`) // user:pass@ in URLs
|
||||
|
||||
func Redact(s string) string {
|
||||
s = urlCreds.ReplaceAllString(s, "${1}[ENTFERNT]@")
|
||||
for _, rx := range keepPrefix {
|
||||
s = rx.ReplaceAllString(s, "${1}[ENTFERNT]")
|
||||
}
|
||||
for _, rx := range redactions {
|
||||
s = rx.ReplaceAllString(s, "[ENTFERNT]")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Geheimnisse, die der Filter früher durchließ (Code-Review 2026-11-21).
|
||||
func TestRedactMore(t *testing.T) {
|
||||
for _, s := range []string{
|
||||
"MYSQL_ROOT_PASSWORD=hunter2", "DB_PASS=hunter2", "AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG",
|
||||
"mysql -u root -phunter2 db", "mysqldump -phunter2 db", "curl -u admin:hunter2 http://x",
|
||||
"username admin password 0 hunter2", "enable secret 5 $1$abcd$efghijklmnop", "snmp-server community hunter2 RO",
|
||||
"password manager user-name admin plaintext hunter2", " password 7 hunter2",
|
||||
"root:$6$abc$Xyzhashhashhash/hash.:19000:0:99999:7:::", "u:$y$j9T$abcdefghijkl$mnopqrstuvwxyz0123:1::",
|
||||
"Authorization: Bearer abcdefghijklmnopqrstuvwxyz",
|
||||
} {
|
||||
if got := Redact(s); strings.Contains(got, "hunter2") || strings.Contains(got, "Xyzhash") || strings.Contains(got, "mnopq") ||
|
||||
strings.Contains(got, "efghij") || strings.Contains(got, "wJalr") || strings.Contains(got, "abcdefghijklmnop") {
|
||||
t.Errorf("%q → %q", s, got)
|
||||
}
|
||||
}
|
||||
// Alltagstext bleibt
|
||||
for _, s := range []string{"Tests PASSED: 5", "ls -la /etc", "echo $1 $2", "tokens: 12", "mysql -u root -p", "password changed for root", "show running-config"} {
|
||||
if got := Redact(s); got != s {
|
||||
t.Errorf("%q verändert: %q", s, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,11 +64,18 @@ func (a *Agent) SchedChecks(ctx context.Context, task string, hosts []string, c
|
||||
if !strictJSON(out, &v) {
|
||||
return nil, ErrUnreadable
|
||||
}
|
||||
return SafeChecks(v.B, c), nil
|
||||
}
|
||||
|
||||
// SafeChecks: nur Befehle, die sicher nur lesen und keine Geheimnisse
|
||||
// ausgeben (höchstens MaxSchedChecks). Auch bestätigte Befehle laufen vor
|
||||
// jedem Lauf noch einmal hier durch.
|
||||
func SafeChecks(in []string, c Context) []string {
|
||||
kind := c.kind()
|
||||
var cmds []string
|
||||
for _, x := range v.B {
|
||||
for _, x := range in {
|
||||
line, ok := oneLine(x, maxCmd)
|
||||
if !ok || line == "" || !safety.ReadOnly(line, kind) {
|
||||
if !ok || line == "" || !safety.ReadOnly(line, kind) || safety.Sensitive(line) != "" {
|
||||
continue
|
||||
}
|
||||
cmds = append(cmds, line)
|
||||
@@ -76,7 +83,7 @@ func (a *Agent) SchedChecks(ctx context.Context, task string, hosts []string, c
|
||||
break
|
||||
}
|
||||
}
|
||||
return cmds, nil
|
||||
return cmds
|
||||
}
|
||||
|
||||
// SchedJudge: Urteil je Host und eine Zusammenfassung.
|
||||
|
||||
@@ -35,3 +35,11 @@ func TestSchedJudge(t *testing.T) {
|
||||
t.Fatalf("%+v %q %v", vs, sum, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Geheimnisse lesen fällt weg, auch wenn es nur liest.
|
||||
func TestSafeChecksSensitive(t *testing.T) {
|
||||
got := SafeChecks([]string{"sudo cat /etc/shadow", "kubectl get secret -A -o yaml", "df -h /", "uptime"}, Context{OS: "Debian 12"})
|
||||
if strings.Join(got, "|") != "df -h /|uptime" {
|
||||
t.Fatalf("%v", got)
|
||||
}
|
||||
}
|
||||
+19
-10
@@ -1126,16 +1126,20 @@ func (r Runbook) Rev() time.Time {
|
||||
// verpasst, holt sshTermy ihn innerhalb von ScheduleCatchUp nach. Bleibt auf
|
||||
// dem Rechner (nie im Sync), damit nicht zwei Rechner denselben Lauf starten.
|
||||
type Schedule struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
At string `json:"at"` // "HH:MM" Ortszeit
|
||||
Days []int `json:"days,omitempty"` // 0 = Sonntag … 6; leer = täglich
|
||||
Folder string `json:"folder,omitempty"`
|
||||
Conns []string `json:"conns,omitempty"`
|
||||
Kind string `json:"kind,omitempty"` // "" = Befehle/Runbook, "backup" = Switch-Configs sichern, "logs" = Ordner-Scan
|
||||
RunbookID string `json:"runbook_id,omitempty"`
|
||||
Steps []string `json:"steps,omitempty"` // ohne Runbook
|
||||
Prompt string `json:"prompt,omitempty"` // KI-Prüfung: Prüfauftrag in eigenen Worten
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
At string `json:"at"` // "HH:MM" Ortszeit
|
||||
Days []int `json:"days,omitempty"` // 0 = Sonntag … 6; leer = täglich
|
||||
Folder string `json:"folder,omitempty"`
|
||||
Conns []string `json:"conns,omitempty"`
|
||||
Kind string `json:"kind,omitempty"` // "" = Befehle/Runbook, "backup" = Switch-Configs sichern, "logs" = Ordner-Scan
|
||||
RunbookID string `json:"runbook_id,omitempty"`
|
||||
Steps []string `json:"steps,omitempty"` // ohne Runbook
|
||||
Prompt string `json:"prompt,omitempty"` // KI-Prüfung: Prüfauftrag in eigenen Worten
|
||||
// Checks: die Prüfbefehle, die du für Prompt bestätigt hast (ChecksFor).
|
||||
// Jeder Lauf nimmt genau diese; die KI wählt nicht bei jedem Lauf neu.
|
||||
Checks []string `json:"checks,omitempty"`
|
||||
ChecksFor string `json:"checks_for,omitempty"`
|
||||
Off bool `json:"off,omitempty"`
|
||||
LastRun time.Time `json:"last_run,omitempty"`
|
||||
LastOK int `json:"last_ok,omitempty"`
|
||||
@@ -1153,6 +1157,11 @@ type Schedule struct {
|
||||
Known []string `json:"known,omitempty"`
|
||||
}
|
||||
|
||||
// ChecksPinned: KI-Prüfung mit bestätigten Befehlen für den aktuellen Auftrag?
|
||||
func (s Schedule) ChecksPinned() bool {
|
||||
return len(s.Checks) > 0 && s.ChecksFor == strings.TrimSpace(s.Prompt)
|
||||
}
|
||||
|
||||
// RunsOn: läuft der Zeitplan auf dem Rechner mit diesem Namen?
|
||||
func (s Schedule) RunsOn(device string) bool {
|
||||
return s.Machine == "" || strings.EqualFold(s.Machine, device)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package i18n
|
||||
|
||||
// Code-Review 2026-11-21: Prüfsummen, Pfadschutz, Maus.
|
||||
func init() {
|
||||
for de, e := range map[string]string{
|
||||
"%s: keine Prüfsumme, Herunterladen abgebrochen": "%s: no checksum, download stopped",
|
||||
"für %s gibt es keine Prüfsumme; installiere llama.cpp selbst (llama-server im PATH)": "there is no checksum for %s; install llama.cpp yourself (llama-server in PATH)",
|
||||
"Port %d ist von einem anderen Programm belegt": "port %d is used by another program",
|
||||
"ungültiger Name: %q": "invalid name: %q",
|
||||
"Auf ntfy.sh kann jeder ein kurzes Thema erraten und mitlesen: mindestens %d Zeichen, am besten zufällig": "On ntfy.sh anyone can guess a short topic and read along: at least %d characters, ideally random",
|
||||
"Aufgaben …": "Tasks …",
|
||||
"Diese Befehle laufen bei jedem Lauf auf allen Servern im Ziel, ohne Aufsicht:": "These commands run on every server in the target on each run, unattended:",
|
||||
"Ein bestätigter Prüfbefehl gilt nicht mehr als sicher: Zeitplan öffnen und speichern": "A confirmed check command is no longer considered safe: open and save the schedule",
|
||||
"KI wählt die Prüfbefehle …": "AI is choosing the check commands …",
|
||||
"Nach Tag filtern …": "Filter by tag …",
|
||||
"Netz scannen …": "Scan network …",
|
||||
"Neue Verbindung …": "New connection …",
|
||||
"Neuer Ordner hier …": "New folder here …",
|
||||
"Neuer Ordner …": "New folder …",
|
||||
"Programm starten?": "Run program?",
|
||||
"Prüfbefehle bestätigen": "Confirm check commands",
|
||||
"Prüfbefehle bestätigt": "Check commands confirmed",
|
||||
"Prüfbefehle noch nicht bestätigt: Zeitplan öffnen und speichern": "Check commands not confirmed yet: open and save the schedule",
|
||||
"Verbindungen importieren …": "Import connections …",
|
||||
"auf diesem Rechner": "on this computer",
|
||||
"vom Server": "from the server",
|
||||
"Übernehmen? Ohne Bestätigung läuft die KI-Prüfung nicht.": "Accept? Without confirmation the AI check does not run.",
|
||||
"„%s“ %s ist ein Programm oder Skript. Mit dem Standardprogramm öffnen heißt hier: es läuft auf diesem Rechner, mit deinen Rechten.\n\nNur starten, wenn du der Datei vertraust.": "“%s” %s is a program or script. Opening it with the default app means: it runs on this computer, with your permissions.\n\nOnly run it if you trust the file.",
|
||||
} {
|
||||
en[de] = e
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,22 @@ type Progress struct {
|
||||
}
|
||||
|
||||
type asset struct {
|
||||
Name string `json:"name"`
|
||||
URL string `json:"browser_download_url"`
|
||||
Size int64 `json:"size"`
|
||||
Name string `json:"name"`
|
||||
URL string `json:"browser_download_url"`
|
||||
Size int64 `json:"size"`
|
||||
Digest string `json:"digest"` // "sha256:<hex>", von GitHub zu jeder Datei berechnet
|
||||
}
|
||||
|
||||
// Sum: SHA-256 der Datei laut GitHub ("" = keine Angabe).
|
||||
func (a asset) Sum() string {
|
||||
d, ok := strings.CutPrefix(strings.ToLower(strings.TrimSpace(a.Digest)), "sha256:")
|
||||
if !ok || len(d) != 64 {
|
||||
return ""
|
||||
}
|
||||
if _, err := hex.DecodeString(d); err != nil {
|
||||
return ""
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
type release struct {
|
||||
@@ -158,7 +171,11 @@ func ParseSums(r io.Reader) map[string]string {
|
||||
}
|
||||
|
||||
// download lädt url nach dest (über dest.part) und prüft die Prüfsumme.
|
||||
// Ohne Prüfsumme lädt es nicht.
|
||||
func download(ctx context.Context, url, dest, sum, step string, total int64, progress func(Progress)) error {
|
||||
if len(sum) != 64 {
|
||||
return fmt.Errorf(i18n.T("%s: keine Prüfsumme, Herunterladen abgebrochen"), filepath.Base(dest))
|
||||
}
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -209,7 +226,7 @@ func download(ctx context.Context, url, dest, sum, step string, total int64, pro
|
||||
if err := f.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
if sum != "" && hex.EncodeToString(h.Sum(nil)) != sum {
|
||||
if hex.EncodeToString(h.Sum(nil)) != sum {
|
||||
os.Remove(part)
|
||||
return fmt.Errorf(i18n.T("Prüfsumme von %s stimmt nicht"), filepath.Base(dest))
|
||||
}
|
||||
@@ -235,11 +252,21 @@ func (e *Engine) Download(ctx context.Context, progress func(Progress)) error {
|
||||
if !ok {
|
||||
return errors.New(i18n.T("im lxask-Release fehlt die Modelldatei"))
|
||||
}
|
||||
sum := ""
|
||||
sum := model.Sum()
|
||||
if sums.URL != "" {
|
||||
if m, err := fetchSums(ctx, sums.URL); err == nil {
|
||||
sum = m[model.Name]
|
||||
m, err := fetchSums(ctx, sums.URL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if s := m[model.Name]; s != "" {
|
||||
if sum != "" && s != sum {
|
||||
return fmt.Errorf(i18n.T("Prüfsumme von %s stimmt nicht"), model.Name)
|
||||
}
|
||||
sum = s
|
||||
}
|
||||
}
|
||||
if sum == "" {
|
||||
return fmt.Errorf(i18n.T("%s: keine Prüfsumme, Herunterladen abgebrochen"), model.Name)
|
||||
}
|
||||
if err := download(ctx, model.URL, e.ModelPath(), sum, i18n.T("Modell (lxask)"), model.Size, progress); err != nil {
|
||||
return err
|
||||
@@ -259,6 +286,9 @@ func fetchSums(ctx context.Context, url string) (map[string]string, error) {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("%s: HTTP %d", url, resp.StatusCode)
|
||||
}
|
||||
return ParseSums(io.LimitReader(resp.Body, 1<<20)), nil
|
||||
}
|
||||
|
||||
@@ -268,12 +298,13 @@ func (e *Engine) downloadServer(ctx context.Context, progress func(Progress)) er
|
||||
return fmt.Errorf(i18n.T("llama.cpp-Veröffentlichung nicht erreichbar: %w"), err)
|
||||
}
|
||||
a, ok := PickServer(runtime.GOOS, runtime.GOARCH, rel.Assets)
|
||||
ok = ok && a.Sum() != ""
|
||||
if !ok {
|
||||
// Der neueste Build hat manchmal (noch) nicht alle Pakete: die letzten zehn durchsehen.
|
||||
var rels []release
|
||||
if err := getJSON(ctx, ServerReleases, &rels); err == nil {
|
||||
for _, r := range rels {
|
||||
if a, ok = PickServer(runtime.GOOS, runtime.GOARCH, r.Assets); ok {
|
||||
if a, ok = PickServer(runtime.GOOS, runtime.GOARCH, r.Assets); ok && a.Sum() != "" {
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -285,8 +316,11 @@ func (e *Engine) downloadServer(ctx context.Context, progress func(Progress)) er
|
||||
if !ok {
|
||||
return fmt.Errorf(i18n.T("für %s/%s gibt es keinen fertigen llama-server; installiere llama.cpp selbst (llama-server im PATH)"), runtime.GOOS, runtime.GOARCH)
|
||||
}
|
||||
arch := filepath.Join(e.dir, a.Name)
|
||||
if err := download(ctx, a.URL, arch, "", i18n.T("llama-server (llama.cpp)"), a.Size, progress); err != nil {
|
||||
if a.Sum() == "" {
|
||||
return fmt.Errorf(i18n.T("für %s gibt es keine Prüfsumme; installiere llama.cpp selbst (llama-server im PATH)"), a.Name)
|
||||
}
|
||||
arch := filepath.Join(e.dir, filepath.Base(a.Name))
|
||||
if err := download(ctx, a.URL, arch, a.Sum(), i18n.T("llama-server (llama.cpp)"), a.Size, progress); err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.Remove(arch)
|
||||
@@ -299,6 +333,10 @@ func (e *Engine) downloadServer(ctx context.Context, progress func(Progress)) er
|
||||
if srv == "" {
|
||||
return errors.New(i18n.T("llama-server fehlt im heruntergeladenen Paket"))
|
||||
}
|
||||
// Ausführbar nur, was das Archiv so markiert, und der Server selbst
|
||||
if err := os.Chmod(srv, 0o755); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(filepath.Join(e.dir, "server.path"), []byte(srv), 0o644)
|
||||
}
|
||||
|
||||
@@ -352,7 +390,7 @@ func Extract(archive, dst string) error {
|
||||
}
|
||||
continue
|
||||
}
|
||||
if err := writeFrom(p, f.Mode()|0o755, func() (io.ReadCloser, error) { return f.Open() }); err != nil {
|
||||
if err := writeFrom(p, f.Mode()|0o644, func() (io.ReadCloser, error) { return f.Open() }); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -388,7 +426,7 @@ func Extract(archive, dst string) error {
|
||||
return err
|
||||
}
|
||||
case tar.TypeReg:
|
||||
if err := writeFrom(p, os.FileMode(h.Mode)|0o755, func() (io.ReadCloser, error) { return io.NopCloser(tr), nil }); err != nil {
|
||||
if err := writeFrom(p, os.FileMode(h.Mode)|0o644, func() (io.ReadCloser, error) { return io.NopCloser(tr), nil }); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ package offlineai
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
@@ -41,6 +43,7 @@ type Engine struct {
|
||||
mu sync.Mutex
|
||||
cmd *exec.Cmd
|
||||
port int
|
||||
key string // Zugangsschlüssel dieses Laufs (--api-key)
|
||||
lastUse time.Time
|
||||
starting chan struct{} // offen, solange ein Start läuft
|
||||
startErr error
|
||||
@@ -138,6 +141,20 @@ func (e *Engine) Port() int {
|
||||
return e.port
|
||||
}
|
||||
|
||||
// Key: Zugangsschlüssel des Servers für diesen Lauf. Ohne ihn beantwortet
|
||||
// llama-server keine Anfragen, andere Programme oder Benutzer auf dem Rechner
|
||||
// können die Offline-KI also nicht mitbenutzen.
|
||||
func (e *Engine) Key() string {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
if e.key == "" {
|
||||
b := make([]byte, 24)
|
||||
_, _ = rand.Read(b)
|
||||
e.key = hex.EncodeToString(b)
|
||||
}
|
||||
return e.key
|
||||
}
|
||||
|
||||
func freePort() int {
|
||||
l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
@@ -154,6 +171,7 @@ func (e *Engine) Ensure(ctx context.Context) error {
|
||||
return errors.New(i18n.T("Offline-KI ist nicht heruntergeladen"))
|
||||
}
|
||||
port := e.Port()
|
||||
key := e.Key()
|
||||
e.mu.Lock()
|
||||
e.lastUse = time.Now()
|
||||
if e.cmd != nil {
|
||||
@@ -176,7 +194,7 @@ func (e *Engine) Ensure(ctx context.Context) error {
|
||||
e.starting = ch
|
||||
e.mu.Unlock()
|
||||
|
||||
err := e.start(ctx, port)
|
||||
err := e.start(ctx, port, key)
|
||||
e.mu.Lock()
|
||||
e.startErr, e.starting = err, nil
|
||||
e.mu.Unlock()
|
||||
@@ -184,9 +202,10 @@ func (e *Engine) Ensure(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (e *Engine) start(ctx context.Context, port int) error {
|
||||
func (e *Engine) start(ctx context.Context, port int, key string) error {
|
||||
srv := e.ServerPath()
|
||||
cmd := exec.Command(srv, "-m", e.ModelPath(), "--host", "127.0.0.1", "--port", strconv.Itoa(port), "-c", "4096")
|
||||
cmd.Env = append(os.Environ(), "LLAMA_API_KEY="+key) // nicht in der Befehlszeile (ps)
|
||||
cmd.Dir = filepath.Dir(srv)
|
||||
hideWindow(cmd)
|
||||
logf, _ := os.Create(filepath.Join(e.dir, "server.log"))
|
||||
@@ -226,6 +245,10 @@ func (e *Engine) start(ctx context.Context, port int) error {
|
||||
if err == nil {
|
||||
resp.Body.Close()
|
||||
if resp.StatusCode == http.StatusOK {
|
||||
if !e.ours(port, key) {
|
||||
_ = cmd.Process.Kill()
|
||||
return fmt.Errorf(i18n.T("Port %d ist von einem anderen Programm belegt"), port)
|
||||
}
|
||||
e.mu.Lock()
|
||||
e.cmd = cmd
|
||||
e.mu.Unlock()
|
||||
@@ -237,6 +260,30 @@ func (e *Engine) start(ctx context.Context, port int) error {
|
||||
return errors.New(i18n.T("llama-server antwortet nicht (Zeitüberschreitung beim Laden des Modells)"))
|
||||
}
|
||||
|
||||
// ours: Antwortet auf dem Port unser Server? Nur er kennt den Schlüssel:
|
||||
// ohne Schlüssel lehnt er ab, mit Schlüssel nimmt er an.
|
||||
func (e *Engine) ours(port int, key string) bool {
|
||||
get := func(withKey bool) int {
|
||||
// /tokenize: billig, und anders als /health und /v1/models nicht öffentlich
|
||||
req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("http://127.0.0.1:%d/tokenize", port), strings.NewReader(`{"content":"x"}`))
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
if withKey {
|
||||
req.Header.Set("Authorization", "Bearer "+key)
|
||||
}
|
||||
c := &http.Client{Timeout: 5 * time.Second}
|
||||
resp, err := c.Do(req)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
resp.Body.Close()
|
||||
return resp.StatusCode
|
||||
}
|
||||
return get(false) == http.StatusUnauthorized && get(true) == http.StatusOK
|
||||
}
|
||||
|
||||
// Touch: eine Anfrage lief (verschiebt das Ende im Leerlauf).
|
||||
func (e *Engine) Touch() {
|
||||
e.mu.Lock()
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package offlineai
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAssetSum(t *testing.T) {
|
||||
h := strings.Repeat("ab", 32)
|
||||
for d, want := range map[string]string{"sha256:" + h: h, "SHA256:" + strings.ToUpper(h): h, "": "", "sha1:" + h: "", "sha256:xyz": "", "sha256:" + strings.Repeat("zz", 32): ""} {
|
||||
if got := (asset{Digest: d}).Sum(); got != want {
|
||||
t.Errorf("%q → %q, want %q", d, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ohne passende Prüfsumme bleibt nichts liegen.
|
||||
func TestDownloadNeedsSum(t *testing.T) {
|
||||
body := "llama-server"
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte(body)) }))
|
||||
defer srv.Close()
|
||||
dir := t.TempDir()
|
||||
dest := filepath.Join(dir, "f")
|
||||
if err := download(context.Background(), srv.URL, dest, "", "x", 0, nil); err == nil {
|
||||
t.Fatal("ohne Prüfsumme geladen")
|
||||
}
|
||||
if err := download(context.Background(), srv.URL, dest, strings.Repeat("0", 64), "x", 0, nil); err == nil {
|
||||
t.Fatal("falsche Prüfsumme angenommen")
|
||||
}
|
||||
if _, err := os.Stat(dest); err == nil {
|
||||
t.Fatal("Datei trotz Fehler da")
|
||||
}
|
||||
s := sha256.Sum256([]byte(body))
|
||||
if err := download(context.Background(), srv.URL, dest, hex.EncodeToString(s[:]), "x", 0, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
+23
-4
@@ -8,6 +8,8 @@ package push
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -43,20 +45,37 @@ type Message struct {
|
||||
Category string // z. B. "befehl", "zeitplan", "freigabe" (Webhook)
|
||||
}
|
||||
|
||||
// MinPublicTopic: so lang muss ein Thema auf ntfy.sh ohne Token sein.
|
||||
const MinPublicTopic = 16
|
||||
|
||||
// RandomNtfyURL: ntfy.sh mit zufälligem, nicht erratbarem Thema.
|
||||
func RandomNtfyURL() string {
|
||||
b := make([]byte, 12)
|
||||
_, _ = rand.Read(b)
|
||||
return "https://ntfy.sh/sshtermy-" + hex.EncodeToString(b)
|
||||
}
|
||||
|
||||
// Client: in Tests austauschbar.
|
||||
var Client = &http.Client{Timeout: 15 * time.Second}
|
||||
|
||||
// Check: Einstellungen plausibel?
|
||||
func (c Config) Check() error {
|
||||
// Check: Einstellungen plausibel? (beim Einrichten, mit Themenlänge)
|
||||
func (c Config) Check() error { return c.check(true) }
|
||||
|
||||
func (c Config) check(setup bool) error {
|
||||
u, err := url.Parse(strings.TrimSpace(c.URL))
|
||||
if err != nil || u.Host == "" || (u.Scheme != "https" && u.Scheme != "http") {
|
||||
return errors.New(i18n.T("Adresse mit http:// oder https:// angeben"))
|
||||
}
|
||||
switch c.Kind {
|
||||
case Ntfy:
|
||||
if strings.Trim(u.Path, "/") == "" {
|
||||
topic := strings.Trim(u.Path, "/")
|
||||
if topic == "" {
|
||||
return errors.New(i18n.T("ntfy braucht ein Thema in der Adresse, z. B. https://ntfy.sh/mein-geheimes-thema"))
|
||||
}
|
||||
// Auf dem öffentlichen ntfy.sh liest jeder mit, der das Thema kennt.
|
||||
if setup && strings.EqualFold(u.Hostname(), "ntfy.sh") && c.Token == "" && len(topic) < MinPublicTopic {
|
||||
return fmt.Errorf(i18n.T("Auf ntfy.sh kann jeder ein kurzes Thema erraten und mitlesen: mindestens %d Zeichen, am besten zufällig"), MinPublicTopic)
|
||||
}
|
||||
case Gotify:
|
||||
if c.Token == "" {
|
||||
return errors.New(i18n.T("Gotify braucht ein App-Token"))
|
||||
@@ -70,7 +89,7 @@ func (c Config) Check() error {
|
||||
|
||||
// Send schickt eine Meldung.
|
||||
func Send(ctx context.Context, c Config, m Message) error {
|
||||
if err := c.Check(); err != nil {
|
||||
if err := c.check(false); err != nil { // alte, kurze Themen senden weiter
|
||||
return err
|
||||
}
|
||||
base := strings.TrimRight(strings.TrimSpace(c.URL), "/")
|
||||
|
||||
@@ -57,3 +57,15 @@ func TestSend(t *testing.T) {
|
||||
t.Error("403 nicht gemeldet")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPublicTopicLength(t *testing.T) {
|
||||
if err := (Config{Kind: Ntfy, URL: "https://ntfy.sh/test"}).Check(); err == nil {
|
||||
t.Error("kurzes Thema auf ntfy.sh angenommen")
|
||||
}
|
||||
if err := (Config{Kind: Ntfy, URL: RandomNtfyURL()}).Check(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := (Config{Kind: Ntfy, URL: "https://ntfy.example/test"}).Check(); err != nil {
|
||||
t.Error("eigener Server: kurzes Thema ist erlaubt")
|
||||
}
|
||||
}
|
||||
@@ -149,13 +149,13 @@ func TestEncoding(t *testing.T) {
|
||||
|
||||
func TestPlainName(t *testing.T) {
|
||||
for _, n := range []string{"a.txt", ".bashrc", "x y", "1:2.log"} {
|
||||
if !plainName(n) {
|
||||
t.Errorf("plainName(%q) = false", n)
|
||||
if !PlainName(n) {
|
||||
t.Errorf("PlainName(%q) = false", n)
|
||||
}
|
||||
}
|
||||
for _, n := range []string{"", ".", "..", "../x", "a/b", `..\..\x`, "/etc/passwd"} {
|
||||
if plainName(n) {
|
||||
t.Errorf("plainName(%q) = true", n)
|
||||
if PlainName(n) {
|
||||
t.Errorf("PlainName(%q) = true", n)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package sshx
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
@@ -257,18 +256,21 @@ func Size(ctx context.Context, f FS, p string) (int64, int, error) {
|
||||
|
||||
// Copy kopiert src (Datei oder Ordner) nach dstDir/<name>.
|
||||
func Copy(ctx context.Context, src FS, srcPath string, dst FS, dstDir string, pr *Progress) error {
|
||||
_, local := src.(LocalFS)
|
||||
name := filepath.Base(filepath.FromSlash(srcPath))
|
||||
if src.Label() != "Lokal" {
|
||||
if !local {
|
||||
name = path.Base(srcPath)
|
||||
}
|
||||
if name == "" || name == "." || name == "/" || name == ".." {
|
||||
return errors.New(i18n.T("ungültiger Name"))
|
||||
// Namen vom Server dürfen keinen Pfad enthalten: Unter Windows wäre
|
||||
// „..\..\x.bat“ sonst ein Weg aus dem Zielordner hinaus.
|
||||
if !PlainName(name) && (!local || name == "" || name == "." || name == "/" || name == "..") {
|
||||
return fmt.Errorf(i18n.T("ungültiger Name: %q"), name)
|
||||
}
|
||||
return copyAny(ctx, src, srcPath, dst, dst.Join(dstDir, name), pr)
|
||||
}
|
||||
|
||||
// plainName: ein einzelner Name ohne Pfadanteile.
|
||||
func plainName(n string) bool {
|
||||
// PlainName: ein einzelner Name ohne Pfadanteile.
|
||||
func PlainName(n string) bool {
|
||||
return n != "" && n != "." && n != ".." && !strings.ContainsAny(n, "/\\\x00")
|
||||
}
|
||||
|
||||
@@ -294,7 +296,7 @@ func copyAny(ctx context.Context, src FS, sp string, dst FS, dp string, pr *Prog
|
||||
if c.Link && c.IsDir {
|
||||
continue
|
||||
}
|
||||
if !plainName(c.Name) {
|
||||
if !PlainName(c.Name) {
|
||||
// Ein bösartiger SFTP-Server könnte „../../.bashrc“ melden und
|
||||
// so beim Herunterladen eines Ordners lokal überall schreiben.
|
||||
return fmt.Errorf(i18n.T("ungültiger Dateiname vom Server: %q"), c.Name)
|
||||
|
||||
@@ -45,7 +45,7 @@ const (
|
||||
// beim Bearbeiten weglassen und den Verlust zurück in den Sync schreiben.
|
||||
// Mit der höheren Zahl verweigert es stattdessen den Abgleich (ErrTooNew),
|
||||
// bis es aktualisiert ist. TestPayloadFields erinnert daran.
|
||||
payloadFormat = 8
|
||||
payloadFormat = 9
|
||||
aadWrap = "sshtermy/v1/sync/wrap"
|
||||
aadPayload = "sshtermy/v1/sync/payload"
|
||||
minPassLen = 8
|
||||
|
||||
+3
-1
@@ -1,4 +1,4 @@
|
||||
format 8
|
||||
format 9
|
||||
payload.cmd_stats
|
||||
payload.cmd_stats.at
|
||||
payload.cmd_stats.conns
|
||||
@@ -149,6 +149,8 @@ payload.runbooks.updated_at
|
||||
payload.runbooks.uses
|
||||
payload.schedules
|
||||
payload.schedules.at
|
||||
payload.schedules.checks
|
||||
payload.schedules.checks_for
|
||||
payload.schedules.conns
|
||||
payload.schedules.days
|
||||
payload.schedules.folder
|
||||
|
||||
@@ -129,12 +129,12 @@ func (a *App) curTier() aiTierKind {
|
||||
// offlineLLM: Einstellung für den Endpunkt der Offline-KI.
|
||||
func (a *App) offlineLLM() domain.LLMConfig {
|
||||
e := a.offlineEngine()
|
||||
port := 0
|
||||
port, key := 0, ""
|
||||
if e != nil {
|
||||
port = e.Port()
|
||||
port, key = e.Port(), e.Key()
|
||||
}
|
||||
return domain.LLMConfig{
|
||||
Provider: domain.ProviderCompat, BaseURL: fmt.Sprintf("http://127.0.0.1:%d/v1", port), Model: offlineai.Model,
|
||||
Provider: domain.ProviderCompat, BaseURL: fmt.Sprintf("http://127.0.0.1:%d/v1", port), APIKey: domain.Secret(key), Model: offlineai.Model,
|
||||
MaxTokens: 200, Temperature: 0.1, TimeoutSec: 120, SendScreen: false,
|
||||
}
|
||||
}
|
||||
|
||||
+6
-3
@@ -228,6 +228,7 @@ type App struct {
|
||||
schedRBIDs map[string]string // Runbook-Name → ID im Formular
|
||||
schedMachines map[string]string // Rechner-Auswahl im Zeitplan-Formular → Name
|
||||
schedRun map[string]bool // laufende Zeitpläne
|
||||
schedConfirm string // KI-Prüfung: Befehle nach dem Speichern bestätigen (schedai.go)
|
||||
netData *netCache // letzte Abfrage der Switches (netfind.go)
|
||||
netBusy bool
|
||||
netScope string // zuletzt gewähltes Netz (Ordner) für Gerät finden/Topologie
|
||||
@@ -1259,7 +1260,9 @@ func (a *App) fitFooterAs(keys [][2]string, fbar bool) [][2]string {
|
||||
for i, k := range keys {
|
||||
out[i] = [2]string{strings.ReplaceAll(k[0], "Shift+", "⇧"), k[1]} // kürzer: ⇧F9
|
||||
}
|
||||
keep := func(k [2]string) bool { return k[0] == help || k[0] == explain }
|
||||
// Esc (zurück/schließen) bleibt wie die Hilfe: sonst gibt es bei
|
||||
// schmalem Fenster keinen Mausweg zurück.
|
||||
keep := func(k [2]string) bool { return k[0] == help || k[0] == explain || k[0] == "Esc" }
|
||||
// Breiten einmal messen und die Summe mitführen: lipgloss.Width über
|
||||
// gerenderte Stile ist teuer, und die Schleifen unten fragten früher
|
||||
// bei jedem Schritt die ganze Zeile neu ab (pro Bild Hunderte Mal).
|
||||
@@ -1302,9 +1305,9 @@ func (a *App) fitFooterAs(keys [][2]string, fbar bool) [][2]string {
|
||||
noDesc(i)
|
||||
}
|
||||
}
|
||||
// 3. weitere Tasten von hinten weglassen, nie die Hilfe
|
||||
// 3. weitere Tasten von hinten weglassen, nie Hilfe und Esc
|
||||
for i := len(out) - 1; i >= 0 && total > a.w; i-- {
|
||||
if out[i][0] != help {
|
||||
if out[i][0] != help && out[i][0] != "Esc" {
|
||||
drop(i)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,6 +470,41 @@ func (a *App) loadView(s *session) tea.Cmd {
|
||||
// openWithSystem: mit dem Standardprogramm des Rechners öffnen. Server-
|
||||
// Dateien kommen vorher in einen privaten Ordner (beim Beenden gelöscht).
|
||||
func (a *App) openWithSystem(s *session, side, i int) tea.Cmd {
|
||||
f := &s.files
|
||||
p := f.panes[side]
|
||||
if p == nil || i <= 0 || i >= len(p.entries) {
|
||||
return nil
|
||||
}
|
||||
if name := p.entries[i].Name; runsWhenOpened(name) && !p.entries[i].IsDir {
|
||||
_, local := p.fs.(sshx.LocalFS)
|
||||
where := i18n.T("vom Server")
|
||||
if local {
|
||||
where = i18n.T("auf diesem Rechner")
|
||||
}
|
||||
a.modal = confirmModal(i18n.T("Programm starten?"),
|
||||
fmt.Sprintf(i18n.T("„%s“ %s ist ein Programm oder Skript. Mit dem Standardprogramm öffnen heißt hier: es läuft auf diesem Rechner, mit deinen Rechten.\n\nNur starten, wenn du der Datei vertraust."), name, where),
|
||||
func() tea.Cmd { return a.openWithSystemNow(s, side, i) })
|
||||
return nil
|
||||
}
|
||||
return a.openWithSystemNow(s, side, i)
|
||||
}
|
||||
|
||||
// runExt: Endungen, die das Standardprogramm ausführt statt anzeigt.
|
||||
var runExt = map[string]bool{
|
||||
".exe": true, ".com": true, ".bat": true, ".cmd": true, ".ps1": true, ".psm1": true, ".vbs": true, ".vbe": true,
|
||||
".js": true, ".jse": true, ".wsf": true, ".wsh": true, ".hta": true, ".msi": true, ".msp": true, ".scr": true,
|
||||
".pif": true, ".lnk": true, ".url": true, ".reg": true, ".cpl": true, ".jar": true, ".appref-ms": true,
|
||||
".application": true, ".msc": true, ".inf": true, ".settingcontent-ms": true, ".library-ms": true, ".search-ms": true,
|
||||
".command": true, ".app": true, ".pkg": true, ".dmg": true, ".terminal": true, ".workflow": true, ".scpt": true,
|
||||
".sh": true, ".desktop": true, ".appimage": true, ".run": true, ".py": true, ".pl": true, ".rb": true,
|
||||
}
|
||||
|
||||
// runsWhenOpened: Datei, die beim Öffnen mit dem Standardprogramm läuft.
|
||||
func runsWhenOpened(name string) bool {
|
||||
return runExt[strings.ToLower(filepath.Ext(strings.TrimRight(name, ". ")))]
|
||||
}
|
||||
|
||||
func (a *App) openWithSystemNow(s *session, side, i int) tea.Cmd {
|
||||
f := &s.files
|
||||
p := f.panes[side]
|
||||
if p == nil || i <= 0 || i >= len(p.entries) {
|
||||
@@ -488,6 +523,10 @@ func (a *App) openWithSystem(s *session, side, i int) tea.Cmd {
|
||||
a.flash(i18n.T("Ordner vom Server lassen sich nicht direkt öffnen, erst kopieren (c)"))
|
||||
return nil
|
||||
}
|
||||
if !sshx.PlainName(p.entries[i].Name) {
|
||||
a.flashErr(fmt.Sprintf(i18n.T("ungültiger Name: %q"), p.entries[i].Name))
|
||||
return nil
|
||||
}
|
||||
dir, err := os.MkdirTemp("", "sshtermy-open-")
|
||||
if err != nil {
|
||||
a.flashErr(err.Error())
|
||||
|
||||
+54
-5
@@ -3,10 +3,12 @@ package ui
|
||||
import (
|
||||
"strings"
|
||||
|
||||
tea "charm.land/bubbletea/v2"
|
||||
"charm.land/lipgloss/v2"
|
||||
"github.com/charmbracelet/x/ansi"
|
||||
|
||||
"github.com/db9979/sshtermy/internal/i18n"
|
||||
"github.com/db9979/sshtermy/internal/ui/clickzone"
|
||||
"github.com/db9979/sshtermy/internal/version"
|
||||
)
|
||||
|
||||
@@ -571,6 +573,15 @@ type helpPick struct {
|
||||
block int // Abschnitt mit der Auswahl (-1 = keiner)
|
||||
line int // Zeile der Auswahl im Abschnitt
|
||||
cur int // Abschnitt, der gerade gezeichnet wird
|
||||
mz *helpMouse // Maus: Zeilen anklickbar (nil = ohne Zonen)
|
||||
m *modal
|
||||
}
|
||||
|
||||
// helpMouse: Zonen der Hilfe (Reiter, Zeilen, Rad). press drückt eine Taste
|
||||
// wie die Tastatur (für Doppelklick = ⏎).
|
||||
type helpMouse struct {
|
||||
z *clickzone.Map
|
||||
press func(string) tea.Cmd
|
||||
}
|
||||
|
||||
// helpMatch: passt die Zeile zum Suchtext? Wie die Palette verzeihend
|
||||
@@ -650,13 +661,28 @@ func (s Styles) helpBlock(sec helpSection, ctx helpCtx, cw int, filter string, h
|
||||
plain := ansi.Strip(line)
|
||||
line = bar.Render(plain + strings.Repeat(" ", max(0, cw-lipgloss.Width(plain))))
|
||||
}
|
||||
if hp != nil && hp.mz != nil && hp.m != nil {
|
||||
// Klick wählt die Zeile, Doppelklick führt sie aus (wie ⏎)
|
||||
idx, m, mz := hp.n-1, hp.m, hp.mz
|
||||
line = mz.z.Mark(line, clickzone.Action{Click: func(_ tea.Mouse, double bool) tea.Cmd {
|
||||
m.helpSel, m.helpFollow = idx, true
|
||||
if double {
|
||||
return mz.press("⏎")
|
||||
}
|
||||
return nil
|
||||
}})
|
||||
}
|
||||
lines = append(lines, line)
|
||||
}
|
||||
}
|
||||
return lines
|
||||
}
|
||||
|
||||
func (m *modal) helpView(s Styles, w, h int) string {
|
||||
func (m *modal) helpView(s Styles, w, h int) string { return m.helpViewZ(s, w, h, nil) }
|
||||
|
||||
// helpViewZ: wie helpView, mit Maus-Zonen (Reiter anklicken, Zeile wählen,
|
||||
// Doppelklick führt aus, Rad blättert).
|
||||
func (m *modal) helpViewZ(s Styles, w, h int, mz *helpMouse) string {
|
||||
avail := dialog{maxW: 160}.innerMax(w)
|
||||
if !m.helpTabSet() {
|
||||
m.helpTab = helpTabFor(m.ctx) + 1
|
||||
@@ -667,11 +693,21 @@ func (m *modal) helpView(s Styles, w, h int) string {
|
||||
var tb strings.Builder
|
||||
for i, t := range helpTabs {
|
||||
lbl := " " + i18n.T(t.title) + " "
|
||||
var r string
|
||||
if i == tab && m.filter == "" {
|
||||
tb.WriteString(lipgloss.NewStyle().Background(s.T.Accent).Foreground(s.T.Bg).Bold(true).Render(lbl))
|
||||
r = lipgloss.NewStyle().Background(s.T.Accent).Foreground(s.T.Bg).Bold(true).Render(lbl)
|
||||
} else {
|
||||
tb.WriteString(lipgloss.NewStyle().Background(s.T.Surface2).Foreground(s.T.Muted).Render(lbl))
|
||||
r = lipgloss.NewStyle().Background(s.T.Surface2).Foreground(s.T.Muted).Render(lbl)
|
||||
}
|
||||
if mz != nil {
|
||||
i := i
|
||||
r = mz.z.Click(r, func(tea.Mouse, bool) tea.Cmd {
|
||||
m.helpTab = i + 1
|
||||
m.filter, m.scroll, m.helpSel = "", 0, -1
|
||||
return nil
|
||||
})
|
||||
}
|
||||
tb.WriteString(r)
|
||||
tb.WriteString(" ")
|
||||
}
|
||||
if m.filter != "" {
|
||||
@@ -708,7 +744,7 @@ func (m *modal) helpView(s Styles, w, h int) string {
|
||||
}
|
||||
var blocks [][]string
|
||||
var heights []int
|
||||
hp := &helpPick{sel: m.helpSel, block: -1}
|
||||
hp := &helpPick{sel: m.helpSel, block: -1, mz: mz, m: m}
|
||||
for _, sec := range secs {
|
||||
hp.cur = len(blocks)
|
||||
if b := s.helpBlock(sec, m.ctx, cw, m.filter, hp); b != nil {
|
||||
@@ -788,8 +824,21 @@ func (m *modal) helpView(s Styles, w, h int) string {
|
||||
} else {
|
||||
m.scroll = 0
|
||||
}
|
||||
bodyText := strings.Join(bodyLines, "\n")
|
||||
if mz != nil {
|
||||
// Rad: drei Zeilen je Schritt, unabhängig von der Auswahl
|
||||
bodyText = mz.z.Mark(bodyText, clickzone.Action{Block: true, Wheel: func(up bool) tea.Cmd {
|
||||
if up {
|
||||
m.scroll = max(0, m.scroll-3)
|
||||
} else {
|
||||
m.scroll += 3
|
||||
}
|
||||
m.helpFollow = false
|
||||
return nil
|
||||
}})
|
||||
}
|
||||
return s.dialog(dialog{icon: "?", title: i18n.T("Tastenkürzel"), sub: version.Short(),
|
||||
body: tabRow + "\n\n" + strings.Join(bodyLines, "\n") + foot, info: info, keys: keys, width: cw, maxW: 160}, w)
|
||||
body: tabRow + "\n\n" + bodyText + foot, info: info, keys: keys, width: cw, maxW: 160}, w)
|
||||
}
|
||||
|
||||
// helpTabSet: Reiter schon gewählt? (helpTab zählt ab 1, 0 = noch nicht)
|
||||
|
||||
+46
-21
@@ -359,32 +359,57 @@ func (a *App) startSyslog(port int) context.CancelFunc {
|
||||
return cancel
|
||||
}
|
||||
|
||||
// resolveConnIPs: IP → Verbindungs-ID. Namen werden parallel aufgelöst (16
|
||||
// gleichzeitig, je 2 s), damit viele tote Namen die Runde nicht stundenlang
|
||||
// aufhalten. Bei mehreren Treffern gewinnt die erste Verbindung der Liste.
|
||||
func resolveConnIPs(ctx context.Context, conns []domain.Connection, lookup func(context.Context, string) ([]string, error)) map[string]string {
|
||||
m := map[string]string{}
|
||||
found := make([][]string, len(conns))
|
||||
var wg sync.WaitGroup
|
||||
sem := make(chan struct{}, 16)
|
||||
for i, c := range conns {
|
||||
h := strings.TrimSpace(c.Host)
|
||||
if h == "" || c.Protocol == domain.ProtoSerial || c.Protocol == domain.ProtoLocal {
|
||||
continue
|
||||
}
|
||||
if net.ParseIP(h) != nil {
|
||||
found[i] = []string{h}
|
||||
continue
|
||||
}
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
defer safe.Recover("ui/logwatch.go resolve")
|
||||
select {
|
||||
case sem <- struct{}{}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
defer func() { <-sem }()
|
||||
lctx, cancel := context.WithTimeout(ctx, 2*time.Second)
|
||||
defer cancel()
|
||||
if ips, err := lookup(lctx, h); err == nil {
|
||||
found[i] = ips
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
for i, ips := range found {
|
||||
for _, ip := range ips {
|
||||
if _, ok := m[ip]; !ok {
|
||||
m[ip] = conns[i].ID
|
||||
}
|
||||
}
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// resolveHosts: Hostnamen der Verbindungen zu IPs auflösen, damit Syslog
|
||||
// vom Gerät der richtigen Verbindung zugeordnet wird (alle 10 Minuten neu).
|
||||
func (a *App) resolveHosts(ctx context.Context) {
|
||||
ev := a.events
|
||||
for {
|
||||
m := map[string]string{}
|
||||
for _, c := range a.st.Connections() {
|
||||
h := strings.TrimSpace(c.Host)
|
||||
if h == "" || c.Protocol == domain.ProtoSerial || c.Protocol == domain.ProtoLocal {
|
||||
continue
|
||||
}
|
||||
if net.ParseIP(h) != nil {
|
||||
m[h] = c.ID
|
||||
continue
|
||||
}
|
||||
lctx, cancel := context.WithTimeout(ctx, 2*time.Second)
|
||||
ips, err := net.DefaultResolver.LookupHost(lctx, h)
|
||||
cancel()
|
||||
if err == nil {
|
||||
for _, ip := range ips {
|
||||
if _, ok := m[ip]; !ok {
|
||||
m[ip] = c.ID
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m := resolveConnIPs(ctx, a.st.Connections(), net.DefaultResolver.LookupHost)
|
||||
select {
|
||||
case ev <- watchResolvedMsg{m}:
|
||||
case <-ctx.Done():
|
||||
|
||||
@@ -1121,6 +1121,10 @@ func (a *App) updateForm(msg tea.Msg) tea.Cmd {
|
||||
}
|
||||
a.form = nil
|
||||
a.scr = scrManager
|
||||
if id := a.schedConfirm; id != "" {
|
||||
a.schedConfirm = ""
|
||||
next = tea.Batch(next, a.schedChooseChecks(id))
|
||||
}
|
||||
if a.returnToTerminal {
|
||||
a.scr, a.returnToTerminal = scrTerminal, false
|
||||
}
|
||||
|
||||
+29
-1
@@ -25,7 +25,8 @@ func (a *App) mgrMenu(r mgrRow, x, y int) *modal {
|
||||
menuItem{label: i18n.T("Tunnel …"), hint: "t", sep: true, run: func() tea.Cmd { return a.mgrNewTunnel(c) }},
|
||||
menuItem{label: i18n.T("SSH-Schlüssel erzeugen / übertragen …"), hint: k.label(actSSHKey), run: func() tea.Cmd { return a.openSSHKeyForm(c) }})
|
||||
}
|
||||
items = append(items, menuItem{label: i18n.T("Schnellbefehle …"), hint: k.label(actQuickEdit), run: func() tea.Cmd { return a.openQuickForm(c, "") }})
|
||||
items = append(items, menuItem{label: i18n.T("Schnellbefehle …"), hint: k.label(actQuickEdit), run: func() tea.Cmd { return a.openQuickForm(c, "") }},
|
||||
menuItem{label: i18n.T("Aufgaben …"), hint: k.label(actTasks), run: func() tea.Cmd { return a.openTasks(c.ID, c.Group) }})
|
||||
if !c.Protocol.NoHost() && c.JumpHostID == "" && !a.connected(c.ID) {
|
||||
items = append(items, menuItem{label: i18n.T("Aufwecken (Wake-on-LAN)"), hint: orDefault(c.MAC, i18n.T("MAC fehlt")), run: func() tea.Cmd { return a.wake(c) }})
|
||||
}
|
||||
@@ -53,10 +54,37 @@ func (a *App) mgrFolderMenu(r mgrRow, x, y int) *modal {
|
||||
c.Group = n.Path
|
||||
return a.openConnForm(c)
|
||||
}},
|
||||
{label: i18n.T("Neuer Ordner hier …"), hint: k.label(actFolderNew), run: func() tea.Cmd { return a.newFolderDialog() }},
|
||||
{label: i18n.T("Alle als Raster öffnen"), hint: k.label(actFolderGrid), run: func() tea.Cmd { return a.openFolderGrid(n.Path) }},
|
||||
{label: i18n.T("Aufgaben …"), hint: k.label(actTasks), run: func() tea.Cmd { return a.openTasks("", n.Path) }},
|
||||
{label: i18n.T("Bearbeiten …"), hint: "e", sep: true, run: func() tea.Cmd { return a.openFolderForm(n.Path) }},
|
||||
{label: i18n.T("In Ordner verschieben …"), hint: k.label(actMoveTo), run: func() tea.Cmd { return a.moveToDialog(r) }},
|
||||
{label: i18n.T("Löschen …"), hint: "d", sep: true, run: func() tea.Cmd { a.deleteFolderDialog(n); return nil }},
|
||||
}
|
||||
return &modal{kind: mMenu, title: trunc(r.name(), 30), items: items, at: [2]int{x, y}, anchored: true}
|
||||
}
|
||||
|
||||
// mgrBlankMenu: Rechtsklick auf freie Fläche im Manager. Alles, was sonst
|
||||
// nur eine Taste hat, ist so auch per Maus erreichbar.
|
||||
func (a *App) mgrBlankMenu(x, y int) tea.Cmd {
|
||||
k := a.keys
|
||||
fold := func(collapse bool) func() tea.Cmd {
|
||||
return func() tea.Cmd {
|
||||
if err := a.st.SetCollapsed(collapse); err != nil {
|
||||
a.flashErr(err.Error())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
items := []menuItem{
|
||||
{label: i18n.T("Neue Verbindung …"), hint: "n", run: func() tea.Cmd { return a.openConnForm(newConnDefaults()) }},
|
||||
{label: i18n.T("Neuer Ordner …"), hint: k.label(actFolderNew), run: func() tea.Cmd { return a.newFolderDialog() }},
|
||||
{label: i18n.T("Verbindungen importieren …"), hint: k.label(actImport), sep: true, run: func() tea.Cmd { return a.openImport() }},
|
||||
{label: i18n.T("Netz scannen …"), hint: k.label(actScan), run: func() tea.Cmd { return a.openScan() }},
|
||||
{label: i18n.T("Nach Tag filtern …"), hint: k.label(actTagFilter), sep: true, run: func() tea.Cmd { return a.tagDialog() }},
|
||||
{label: i18n.T("Alle Ordner zuklappen"), hint: k.label(actFoldAll), run: fold(true)},
|
||||
{label: i18n.T("Alle Ordner aufklappen"), hint: k.label(actUnfoldAll), run: fold(false)},
|
||||
}
|
||||
a.modal = &modal{kind: mMenu, title: i18n.T("Verbindungen"), items: items, at: [2]int{x, y}, anchored: true}
|
||||
return nil
|
||||
}
|
||||
@@ -384,6 +384,9 @@ func (a *App) modalView() string {
|
||||
return a.llmStatusView()
|
||||
case mLayout:
|
||||
return a.layoutView()
|
||||
case mHelp:
|
||||
a.modal.hints = a.modalKeys()
|
||||
return a.modal.helpViewZ(a.s, a.w, a.h, &helpMouse{z: &a.z, press: a.pressKey})
|
||||
}
|
||||
a.modal.hints = a.modalKeys()
|
||||
return a.modal.view(a.s, a.w, a.h)
|
||||
|
||||
+61
-3
@@ -159,14 +159,21 @@ func (a *App) mouse(msg tea.MouseMsg) tea.Cmd {
|
||||
if act := a.z.At(m.X, m.Y, true); act != nil {
|
||||
return act.Wheel(up)
|
||||
}
|
||||
if a.modal != nil && (a.modal.kind == mHelp || a.modal.kind == mChangelog) {
|
||||
if a.modal != nil && a.modal.kind == mText {
|
||||
for i := 0; i < 3; i++ { // drei Zeilen je Rasterschritt, wie im Terminal
|
||||
a.pressKey(wheelKey(up))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if a.modal != nil && (a.modal.kind == mHelp || a.modal.kind == mChangelog || a.modal.kind == mQuick) {
|
||||
return a.pressKey(wheelKey(up))
|
||||
}
|
||||
if a.modal != nil || a.pal != nil || a.pick != nil {
|
||||
return nil
|
||||
}
|
||||
switch a.scr {
|
||||
case scrManager, scrThemes:
|
||||
case scrManager, scrThemes, scrLogs, scrLogScan, scrVuln, scrCmdSets, scrKeys, scrImport, scrScan, scrTeam, scrBroadcast:
|
||||
// Listen: das Rad wirkt wie ↑/↓
|
||||
return a.pressKey(wheelKey(up))
|
||||
case scrTerminal:
|
||||
if s != nil && s.panel != panelNone && !s.files.open {
|
||||
@@ -208,6 +215,24 @@ func (a *App) mouse(msg tea.MouseMsg) tea.Cmd {
|
||||
return act.Menu(m)
|
||||
}
|
||||
}
|
||||
// Seitentaste „Zurück“ der Maus: überall wie Esc (Dateien oben eigens)
|
||||
if isClick && m.Button == tea.MouseBackward {
|
||||
return a.mouseBack(s)
|
||||
}
|
||||
// Rechtsklick ins Leere: Untermenü der Palette eine Ebene zurück, sonst
|
||||
// schließen wie ein Klick daneben
|
||||
if isClick && m.Button == tea.MouseRight && a.z.At(m.X, m.Y, false) == nil {
|
||||
if a.pal != nil && a.pal.menu != "" {
|
||||
a.palEnter("")
|
||||
return nil
|
||||
}
|
||||
if a.pick != nil || a.pal != nil || (a.modal != nil && a.modal.closesOnClickAway()) {
|
||||
return a.pressKey("Esc")
|
||||
}
|
||||
if a.scr == scrManager && a.modal == nil {
|
||||
return a.mgrBlankMenu(m.X, m.Y)
|
||||
}
|
||||
}
|
||||
if !isClick || m.Button != tea.MouseLeft {
|
||||
return nil
|
||||
}
|
||||
@@ -223,7 +248,10 @@ func (a *App) mouse(msg tea.MouseMsg) tea.Cmd {
|
||||
case a.pal != nil:
|
||||
a.pal = nil
|
||||
case a.modal != nil:
|
||||
if a.modal.kind == mHelp || a.modal.kind == mAbout || a.modal.kind == mChangelog || a.modal.kind == mMenu || a.modal.kind == mInfo || a.modal.kind == mLLM || a.modal.kind == mCrash || a.modal.kind == mLayout {
|
||||
if a.modal.closesOnClickAway() {
|
||||
if a.modal.kind == mText || a.modal.kind == mQuick {
|
||||
return a.pressKey("Esc") // wie Esc: Panels/Listen räumen dabei auf
|
||||
}
|
||||
a.modal = nil
|
||||
}
|
||||
case a.scr == scrTerminal && s != nil && s.panel != panelNone && !s.files.open && a.inPanel(s, m.X, m.Y):
|
||||
@@ -232,6 +260,36 @@ func (a *App) mouse(msg tea.MouseMsg) tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
// closesOnClickAway: Fenster, die ein Klick daneben schließt. Rückfragen
|
||||
// (Ja/Nein, Passwort, Eingabe, Gefahr) bleiben offen, damit ein verirrter
|
||||
// Klick nichts entscheidet.
|
||||
func (m *modal) closesOnClickAway() bool {
|
||||
switch m.kind {
|
||||
case mHelp, mAbout, mChangelog, mMenu, mInfo, mLLM, mCrash, mLayout, mText, mQuick:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// mouseBack: Seitentaste „Zurück“ der Maus wirkt wie Esc, aber nie im
|
||||
// laufenden Terminal (dort ginge Esc an die Shell).
|
||||
func (a *App) mouseBack(s *session) tea.Cmd {
|
||||
if a.pick != nil || a.pal != nil || a.modal != nil || a.scr != scrTerminal {
|
||||
return a.pressKey("Esc")
|
||||
}
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
if s.search.open {
|
||||
return a.pressKey("Esc")
|
||||
}
|
||||
if s.panel != panelNone {
|
||||
s.panelFocus = true
|
||||
return a.pressKey("Esc")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func wheelKey(up bool) string {
|
||||
if up {
|
||||
return "up"
|
||||
|
||||
@@ -142,6 +142,8 @@ func (a *App) askPushURL(kind string, cur domain.PushConfig) tea.Cmd {
|
||||
val := ""
|
||||
if cur.Kind == kind {
|
||||
val = cur.URL
|
||||
} else if kind == push.Ntfy {
|
||||
val = push.RandomNtfyURL() // zufälliges Thema: errät niemand
|
||||
}
|
||||
body := map[string]string{
|
||||
push.Ntfy: i18n.T("Adresse mit Thema, z. B. https://ntfy.sh/ein-langes-zufälliges-thema (das Thema wirkt wie ein Passwort). In der ntfy-App dasselbe Thema abonnieren."),
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
tea "charm.land/bubbletea/v2"
|
||||
"github.com/charmbracelet/x/ansi"
|
||||
|
||||
"github.com/db9979/sshtermy/internal/domain"
|
||||
)
|
||||
|
||||
// KI-Zeitplan: ohne bestätigte Befehle läuft nichts; geänderter Auftrag
|
||||
// macht die Bestätigung ungültig.
|
||||
func TestScheduleAINeedsConfirmedChecks(t *testing.T) {
|
||||
a := dangerApp(t)
|
||||
c, err := a.st.UpsertConnection(domain.Connection{Alias: "web", Host: "web.lan", Username: "root", Group: "Prod"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sc := domain.Schedule{ID: "s1", Kind: domain.ScheduleAI, Folder: "Prod", Prompt: "läuft nginx?"}
|
||||
cmd := a.startScheduleAI(sc, []domain.Connection{c})
|
||||
if m, ok := cmd().(schedDoneMsg); !ok || m.err == nil || !strings.Contains(m.err.Error(), "bestätigt") {
|
||||
t.Fatalf("ohne Bestätigung gelaufen: %#v", cmd())
|
||||
}
|
||||
sc.Checks, sc.ChecksFor = []string{"systemctl is-active nginx"}, "läuft nginx?"
|
||||
if !sc.ChecksPinned() {
|
||||
t.Fatal("bestätigt erwartet")
|
||||
}
|
||||
sc.Prompt = "läuft apache?"
|
||||
if sc.ChecksPinned() {
|
||||
t.Fatal("neuer Auftrag braucht neue Bestätigung")
|
||||
}
|
||||
sc.Prompt, sc.Checks = "läuft nginx?", []string{"sudo cat /etc/shadow"}
|
||||
if m, ok := a.startScheduleAI(sc, []domain.Connection{c})().(schedDoneMsg); !ok || m.err == nil {
|
||||
t.Fatal("Geheimnis-Befehl trotz Bestätigung gelaufen")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunsWhenOpened(t *testing.T) {
|
||||
for n, want := range map[string]bool{"x.exe": true, "Rechnung.PDF.bat": true, "a.lnk": true, "x.exe.": true, "run.command": true,
|
||||
"bild.png": false, "doc.pdf": false, "notes.txt": false, "README": false} {
|
||||
if runsWhenOpened(n) != want {
|
||||
t.Errorf("%s: %v", n, !want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveConnIPsParallel(t *testing.T) {
|
||||
var conns []domain.Connection
|
||||
for i := 0; i < 40; i++ {
|
||||
conns = append(conns, domain.Connection{ID: fmt.Sprint("c", i), Host: fmt.Sprintf("tot%d.lan", i)})
|
||||
}
|
||||
conns = append(conns, domain.Connection{ID: "ip", Host: "10.0.0.9"}, domain.Connection{ID: "ok", Host: "gut.lan"})
|
||||
start := time.Now()
|
||||
m := resolveConnIPs(context.Background(), conns, func(ctx context.Context, h string) ([]string, error) {
|
||||
if h == "gut.lan" {
|
||||
return []string{"10.0.0.7"}, nil
|
||||
}
|
||||
<-ctx.Done() // hängt bis zum Zeitlimit
|
||||
return nil, ctx.Err()
|
||||
})
|
||||
if m["10.0.0.9"] != "ip" || m["10.0.0.7"] != "ok" {
|
||||
t.Fatalf("%v", m)
|
||||
}
|
||||
if d := time.Since(start); d > 10*time.Second {
|
||||
t.Fatalf("zu langsam: %v", d)
|
||||
}
|
||||
}
|
||||
|
||||
// Esc-Ziel per Maus finden (klickbare Zone über dem Wort).
|
||||
func escZone(a *App, words ...string) (int, int, bool) {
|
||||
lines := strings.Split(ansi.Strip(a.View().Content), "\n")
|
||||
for _, w := range words {
|
||||
for y, l := range lines {
|
||||
if i := strings.Index(l, w); i >= 0 {
|
||||
x := ansi.StringWidth(l[:i])
|
||||
if a.z.At(x, y, false) != nil {
|
||||
return x, y, true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0, 0, false
|
||||
}
|
||||
|
||||
// M1: Bei schmalem Fenster bleibt „Esc“ in der Fußzeile klickbar.
|
||||
func TestFooterKeepsEsc(t *testing.T) {
|
||||
for _, w := range []int{80, 100, 120} {
|
||||
a := newPaletteTestApp(t)
|
||||
a.pal, a.intro, a.w = nil, nil, w
|
||||
a.openLogs()
|
||||
if a.scr != scrLogs {
|
||||
t.Fatal("Protokolle nicht offen")
|
||||
}
|
||||
x, y, ok := escZone(a, "Esc")
|
||||
if !ok {
|
||||
t.Fatalf("Breite %d: kein klickbares Esc", w)
|
||||
}
|
||||
a.mouse(tea.MouseClickMsg{X: x, Y: y, Button: tea.MouseLeft})
|
||||
if a.scr == scrLogs {
|
||||
t.Fatalf("Breite %d: Klick auf Esc führt nicht zurück", w)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// M2 + M4: Textfenster blättert mit dem Rad und schließt per Klick daneben.
|
||||
func TestTextModalWheelAndClickAway(t *testing.T) {
|
||||
a := newPaletteTestApp(t)
|
||||
a.pal, a.intro = nil, nil
|
||||
a.scr = scrManager
|
||||
m := &modal{kind: mText, title: "Diff", lines: strings.Split(strings.Repeat("Zeile\n", 200), "\n")}
|
||||
a.modal = m
|
||||
_ = a.View()
|
||||
a.mouse(tea.MouseWheelMsg{X: a.w / 2, Y: a.h / 2, Button: tea.MouseWheelDown})
|
||||
if m.scroll != 3 {
|
||||
t.Fatalf("Rad: scroll %d", m.scroll)
|
||||
}
|
||||
a.mouse(tea.MouseClickMsg{X: 0, Y: 1, Button: tea.MouseLeft})
|
||||
if a.modal != nil {
|
||||
t.Fatal("Klick daneben schließt das Textfenster nicht")
|
||||
}
|
||||
}
|
||||
|
||||
// M3: Seitentaste „Zurück“ schließt Dialog und führt im Untermenü zurück.
|
||||
func TestMouseBackButton(t *testing.T) {
|
||||
a := newPaletteTestApp(t)
|
||||
a.intro = nil
|
||||
a.scr = scrManager
|
||||
a.palEnter("settings")
|
||||
back := tea.MouseClickMsg{X: 1, Y: 1, Button: tea.MouseBackward}
|
||||
a.mouse(back)
|
||||
if a.pal == nil || a.pal.menu != "" {
|
||||
t.Fatalf("Untermenü: %+v", a.pal)
|
||||
}
|
||||
a.mouse(back)
|
||||
if a.pal != nil {
|
||||
t.Fatal("Palette bleibt offen")
|
||||
}
|
||||
a.modal = &modal{kind: mInfo, title: "x", body: "y"}
|
||||
a.mouse(back)
|
||||
if a.modal != nil {
|
||||
t.Fatal("Dialog bleibt offen")
|
||||
}
|
||||
// Rechtsklick ins Leere im Untermenü: eine Ebene zurück
|
||||
a.openPalette()
|
||||
a.palEnter("help")
|
||||
_ = a.View()
|
||||
a.mouse(tea.MouseClickMsg{X: 0, Y: a.h - 3, Button: tea.MouseRight})
|
||||
if a.pal == nil || a.pal.menu != "" {
|
||||
t.Fatalf("Rechtsklick im Untermenü: %+v", a.pal)
|
||||
}
|
||||
}
|
||||
|
||||
// M5: Rechtsklick auf freie Fläche im Manager zeigt ein Menü mit „Neuer Ordner“.
|
||||
func TestManagerBlankMenu(t *testing.T) {
|
||||
a := newPaletteTestApp(t)
|
||||
a.pal, a.intro = nil, nil
|
||||
a.scr = scrManager
|
||||
_, _ = a.st.UpsertConnection(domain.Connection{Alias: "web", Host: "web.lan", Username: "root"})
|
||||
_ = a.View()
|
||||
a.mouse(tea.MouseClickMsg{X: 3, Y: a.h - 4, Button: tea.MouseRight})
|
||||
if a.modal == nil || a.modal.kind != mMenu {
|
||||
t.Fatal("kein Menü")
|
||||
}
|
||||
found := false
|
||||
for _, it := range a.modal.items {
|
||||
if strings.HasPrefix(it.label, "Neuer Ordner") {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("Neuer Ordner fehlt: %+v", a.modal.items)
|
||||
}
|
||||
}
|
||||
|
||||
// Hilfe (F1) mit der Maus: Reiter anklicken, Zeile wählen, Rad blättert, Esc schließt.
|
||||
func TestHelpMouse(t *testing.T) {
|
||||
a := newPaletteTestApp(t)
|
||||
a.pal, a.intro = nil, nil
|
||||
a.scr = scrManager
|
||||
a.w, a.h = 120, 30
|
||||
a.modal = a.helpModal()
|
||||
m := a.modal
|
||||
x, y, ok := escZone(a, " Logs ")
|
||||
if !ok {
|
||||
t.Fatal("Reiter Logs nicht klickbar")
|
||||
}
|
||||
a.mouse(tea.MouseClickMsg{X: x + 1, Y: y, Button: tea.MouseLeft})
|
||||
if m.helpTab-1 != 3 {
|
||||
t.Fatalf("Reiter %d", m.helpTab-1)
|
||||
}
|
||||
_ = a.View()
|
||||
lines := strings.Split(ansi.Strip(a.View().Content), "\n")
|
||||
for y = range lines {
|
||||
if i := strings.Index(lines[y], "Log-Blick"); i >= 0 {
|
||||
x = ansi.StringWidth(lines[y][:i])
|
||||
break
|
||||
}
|
||||
}
|
||||
if a.z.At(x+2, y+1, false) == nil {
|
||||
t.Fatalf("Zeile nicht klickbar:\n%s", strings.Join(lines, "\n"))
|
||||
}
|
||||
// eine Zeile unter dem Abschnittstitel steht die erste Taste
|
||||
a.click = clickState{}
|
||||
a.mouse(tea.MouseClickMsg{X: x + 2, Y: y + 1, Button: tea.MouseLeft})
|
||||
if m.helpSel < 0 {
|
||||
t.Fatal("Klick wählt keine Zeile")
|
||||
}
|
||||
_ = a.View()
|
||||
before := m.scroll
|
||||
a.mouse(tea.MouseWheelMsg{X: a.w / 2, Y: a.h / 2, Button: tea.MouseWheelDown})
|
||||
_ = a.View()
|
||||
if m.scroll == before && m.helpSel == 0 {
|
||||
t.Fatal("Rad ohne Wirkung")
|
||||
}
|
||||
x, y, ok = escZone(a, "Esc")
|
||||
if !ok {
|
||||
t.Fatal("Esc nicht klickbar")
|
||||
}
|
||||
a.mouse(tea.MouseClickMsg{X: x, Y: y, Button: tea.MouseLeft})
|
||||
if a.modal != nil {
|
||||
t.Fatal("Esc schließt die Hilfe nicht")
|
||||
}
|
||||
}
|
||||
+73
-9
@@ -104,21 +104,25 @@ func (a *App) startScheduleAI(sc domain.Schedule, conns []domain.Connection) tea
|
||||
if err != nil {
|
||||
return func() tea.Msg { return schedDoneMsg{id: id, err: err} }
|
||||
}
|
||||
actx, hosts := schedAIContext(sc, conns)
|
||||
actx, _ := schedAIContext(sc, conns)
|
||||
dial := schedDialer(a)
|
||||
prompt := sc.Prompt
|
||||
if !sc.ChecksPinned() {
|
||||
return func() tea.Msg {
|
||||
return schedDoneMsg{id: id, err: errors.New(i18n.T("Prüfbefehle noch nicht bestätigt: Zeitplan öffnen und speichern"))}
|
||||
}
|
||||
}
|
||||
cmds := agent.SafeChecks(sc.Checks, actx)
|
||||
if len(cmds) != len(sc.Checks) {
|
||||
return func() tea.Msg {
|
||||
return schedDoneMsg{id: id, err: errors.New(i18n.T("Ein bestätigter Prüfbefehl gilt nicht mehr als sicher: Zeitplan öffnen und speichern"))}
|
||||
}
|
||||
}
|
||||
a.flash(i18n.T("Zeitplan startet: ") + sc.Name)
|
||||
return func() tea.Msg {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
|
||||
defer cancel()
|
||||
m := schedAIMsg{id: id}
|
||||
m.cmds, m.err = ag.SchedChecks(ctx, prompt, hosts, actx)
|
||||
if m.err == nil && len(m.cmds) == 0 {
|
||||
m.err = errors.New(i18n.T("Die KI hat keinen Befehl vorgeschlagen, der sicher nur liest"))
|
||||
}
|
||||
if m.err != nil {
|
||||
return m
|
||||
}
|
||||
m := schedAIMsg{id: id, cmds: cmds}
|
||||
job := broadcast.Job{Conns: conns, Steps: []string{schedAILine(m.cmds)}, Timeout: 2 * time.Minute}
|
||||
res := broadcast.Run(ctx, job, dial, func(int, broadcast.Result) {})
|
||||
for _, r := range res {
|
||||
@@ -135,6 +139,63 @@ func (a *App) startScheduleAI(sc domain.Schedule, conns []domain.Connection) tea
|
||||
}
|
||||
}
|
||||
|
||||
type schedChecksMsg struct {
|
||||
id, prompt string
|
||||
cmds []string
|
||||
err error
|
||||
}
|
||||
|
||||
// schedChooseChecks: Die KI schlägt die Prüfbefehle einmal vor; erst wenn
|
||||
// du sie bestätigst, laufen sie (dann bei jedem Lauf dieselben).
|
||||
func (a *App) schedChooseChecks(id string) tea.Cmd {
|
||||
sc, ok := a.scheduleByID(id)
|
||||
if !ok || sc.Kind != domain.ScheduleAI {
|
||||
return nil
|
||||
}
|
||||
conns := a.schedConns(sc)
|
||||
ag, err := a.agentClientFor(conns...)
|
||||
if err != nil {
|
||||
a.flashErr(err.Error())
|
||||
return nil
|
||||
}
|
||||
actx, hosts := schedAIContext(sc, conns)
|
||||
prompt := strings.TrimSpace(sc.Prompt)
|
||||
a.flash(i18n.T("KI wählt die Prüfbefehle …"))
|
||||
return func() tea.Msg {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
defer cancel()
|
||||
m := schedChecksMsg{id: id, prompt: prompt}
|
||||
m.cmds, m.err = ag.SchedChecks(ctx, prompt, hosts, actx)
|
||||
if m.err == nil && len(m.cmds) == 0 {
|
||||
m.err = errors.New(i18n.T("Die KI hat keinen Befehl vorgeschlagen, der sicher nur liest"))
|
||||
}
|
||||
return m
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) onSchedChecks(m schedChecksMsg) tea.Cmd {
|
||||
if m.err != nil {
|
||||
a.flashErr(i18n.T("Zeitplan: ") + m.err.Error())
|
||||
return nil
|
||||
}
|
||||
var b strings.Builder
|
||||
b.WriteString(i18n.T("Diese Befehle laufen bei jedem Lauf auf allen Servern im Ziel, ohne Aufsicht:") + "\n\n")
|
||||
for _, c := range m.cmds {
|
||||
b.WriteString(" $ " + c + "\n")
|
||||
}
|
||||
b.WriteString("\n" + i18n.T("Übernehmen? Ohne Bestätigung läuft die KI-Prüfung nicht."))
|
||||
a.showAsync(confirmModal(i18n.T("Prüfbefehle bestätigen"), b.String(), func() tea.Cmd {
|
||||
a.updateSchedule(m.id, func(x *domain.Schedule) {
|
||||
if strings.TrimSpace(x.Prompt) == m.prompt {
|
||||
x.Checks, x.ChecksFor = m.cmds, m.prompt
|
||||
}
|
||||
})
|
||||
a.flashOK(i18n.T("Prüfbefehle bestätigt"))
|
||||
return nil
|
||||
}))
|
||||
return nil
|
||||
}
|
||||
|
||||
// schedAIReport: Text für die Zeitplanliste, Zahl der Hosts ok / mit Befund.
|
||||
func schedAIReport(m schedAIMsg) (text string, okN, badN int) {
|
||||
var b strings.Builder
|
||||
@@ -173,6 +234,9 @@ func schedAIReport(m schedAIMsg) (text string, okN, badN int) {
|
||||
}
|
||||
|
||||
func (a *App) schedAIMsg(msg tea.Msg) (tea.Cmd, bool) {
|
||||
if c, ok := msg.(schedChecksMsg); ok {
|
||||
return a.onSchedChecks(c), true
|
||||
}
|
||||
m, ok := msg.(schedAIMsg)
|
||||
if !ok {
|
||||
return nil, false
|
||||
|
||||
@@ -413,6 +413,13 @@ func (a *App) saveScheduleForm() error {
|
||||
sc.LastRun = time.Now()
|
||||
}
|
||||
sc.Machine = a.schedMachines[f.sel("machine")]
|
||||
a.schedConfirm = ""
|
||||
if sc.Kind != domain.ScheduleAI {
|
||||
sc.Checks, sc.ChecksFor = nil, ""
|
||||
} else if !sc.ChecksPinned() {
|
||||
sc.Checks, sc.ChecksFor = nil, ""
|
||||
a.schedConfirm = sc.ID // nach dem Speichern: Befehle wählen lassen und bestätigen
|
||||
}
|
||||
return a.st.UpdateSchedules(func(list []domain.Schedule) []domain.Schedule {
|
||||
for i := range list {
|
||||
if list[i].ID == sc.ID {
|
||||
|
||||
+1
-1
@@ -29,4 +29,4 @@
|
||||
|
||||
|
||||
|
||||
Tab Hosts/Quelle/Befehl Space Host wählen g Ordner a alle Strg+R als Runbook Strg+S weiter F1 Hilfe
|
||||
Tab Hosts/Quelle/Befehl Space Host wählen g Ordner a alle Strg+R als Runbook Esc abbrechen F1 Hilfe
|
||||
+1
-1
@@ -27,4 +27,4 @@
|
||||
│
|
||||
│
|
||||
│
|
||||
↑↓ wählen ⏎ auf/zu Tab nach Host f Filter / suchen z KI-Zusammenfassung
|
||||
↑↓ wählen ⏎ auf/zu Tab nach Host f Filter / suchen z KI-Zusammenfassung Esc zurück
|
||||
+1
-1
@@ -27,4 +27,4 @@
|
||||
│
|
||||
│
|
||||
│
|
||||
↑↓ select ⏎ expand Tab by host f Filter / search z AI summary Z summarize all matches
|
||||
↑↓ select ⏎ expand Tab by host f Filter / search z AI summary Esc back
|
||||
+3
-3
@@ -4,9 +4,9 @@
|
||||
▾ Netzwerk │ ──────────────────────────────────────────────────────────────────────── │
|
||||
○ # switc│ ── HIER · NETZWERK ───────────────────────────────────────────────────── │
|
||||
▾ Produktio│ ▶ Neue Verbindung hier … n │
|
||||
▾ Web │ [=] Alle als Raster öffnen g │
|
||||
▌ ○ web│ [=] Bearbeiten … e │ft …
|
||||
▌ ○ web│ [=] In Ordner verschieben … v │
|
||||
▾ Web │ [=] Neuer Ordner hier … o │
|
||||
▌ ○ web│ [=] Alle als Raster öffnen g │ft …
|
||||
▌ ○ web│ [=] Aufgaben … u │
|
||||
▌ ○ db-01│ ── HÄUFIG ────────────────────────────────────────────────────────────── │s Menü ·
|
||||
○ nas │ [+] Neue Verbindung n │
|
||||
○ spark │ [$] Lokale Shell in neuem Tab Alt+L │
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@
|
||||
▾ Netzwerk │ ──────────────────────────────────────────────────────────────────────── │
|
||||
○ # switc│ ── HERE · NETZWERK ───────────────────────────────────────────────────── │
|
||||
▾ Produktio│ ▶ New connection here … n │
|
||||
▾ Web │ [=] Open all as grid g │
|
||||
▌ ○ web│ [=] Edit … e │
|
||||
▌ ○ web│ [=] Move to folder … v │
|
||||
▾ Web │ [=] New folder here … o │
|
||||
▌ ○ web│ [=] Open all as grid g │
|
||||
▌ ○ web│ [=] Tasks … u │
|
||||
▌ ○ db-01│ ── FREQUENT ──────────────────────────────────────────────────────────── │ menu ·
|
||||
○ nas │ [+] New connection n │
|
||||
○ spark │ [$] Local shell in a new tab Alt+L │
|
||||
|
||||
+3
-2
@@ -144,7 +144,7 @@ sudo apt update && sudo apt install sshtermy</pre></div>
|
||||
<div class="card"><h3>Aufgaben, Diff und Gegenprüfung</h3><p>Offene Arbeiten je Verbindung oder Ordner mit Fälligkeit (<kbd>u</kbd> im Manager, <kbd>Alt</kbd>+<kbd>A</kbd>): <kbd>⏎</kbd> startet eine Aufgabe als Ziel, danach steht sie zur Abnahme. Nach jedem Ziel prüft eine zweite KI nur lesend nach, ob es wirklich erreicht ist, und <kbd>d</kbd> zeigt jede geänderte Datei als Diff.</p></div>
|
||||
<div class="card"><h3>KI-Befehle auf dem Host geprüft</h3><p>Bevor ein Befehl aus einer Karte eingefügt oder ausgeführt wird, fragt sshTermy beim echten Host nach, ob es das Programm gibt und jede Option in dessen man-Seite oder <code>--help</code> steht. macOS-Formen unter Linux, der falsche Paketmanager und alles, was die Frage ausschließt („ohne lsof“), fallen auf, bekannte Ausrutscher werden repariert (<code>grep</code> auf einen Ordner bekommt <code>-r</code>). Was offen bleibt, ist als <em>unbestätigt</em> markiert und die KI versucht es noch einmal. Idee aus lxask.</p></div>
|
||||
<div class="card"><h3>Satz → Befehl, erklären ohne KI</h3><p>Am Prompt in eigenen Worten tippen, was du willst, <kbd>Strg</kbd>+<kbd>G</kbd> macht daraus einen geprüften Befehl. <kbd>Alt</kbd>+<kbd>H</kbd> erklärt den getippten oder letzten Befehl Teil für Teil aus der man-Seite des Hosts, offline und ganz ohne KI.</p></div>
|
||||
<div class="card"><h3>Kleine Offline-KI, oder gar keine</h3><p>Keine KI? Dann sind alle KI-Funktionen ausgeblendet, Prüfen und Erklären gehen trotzdem. Ein Knopf lädt eine kleine Offline-KI herunter (lxask-Modell über llama.cpp, etwa 1 GB, Windows, macOS, Linux), die einspringt, wenn sonst keine antwortet; Ziel-, Agent- und Plan-Modus bleiben ausgeblendet, bis eine größere KI angebunden ist.</p></div>
|
||||
<div class="card"><h3>Kleine Offline-KI, oder gar keine</h3><p>Keine KI? Dann sind alle KI-Funktionen ausgeblendet, Prüfen und Erklären gehen trotzdem. Ein Knopf lädt eine kleine Offline-KI herunter (lxask-Modell über llama.cpp, etwa 1 GB, Windows, macOS, Linux, jede Datei mit SHA-256 geprüft), die einspringt, wenn sonst keine antwortet; Ziel-, Agent- und Plan-Modus bleiben ausgeblendet, bis eine größere KI angebunden ist.</p></div>
|
||||
<div class="card"><h3>KI-Begleiter</h3><p>Liest mit und kommentiert von selbst: leise (Fehler, riskante Zeilen vor Enter, Wiederholungen), gesprächig (jeder Befehl) oder Coach (erkennt dein Ziel, Rückblick mit Runbook). Eigene KI-Server, auch extern, lassen sich eintragen. Schlägt ein Befehl aus einer Antwortkarte fehl, zeigt die Karte den Fehler und einen korrigierten Befehl; <kbd>u</kbd> übernimmt ihn und korrigiert denselben Fehler in den anderen Karten mit.</p></div>
|
||||
<div class="card"><h3>Vorgang über Fenster</h3><p><kbd>Alt</kbd>+<kbd>V</kbd> verbindet die Fenster einer Arbeit (Webserver, Datenbank, Switch). Die KI sieht alle und sagt bei jedem Schritt, in welches Fenster er gehört; Fahrplan Fenster für Fenster mit übernommenen Werten, Plan in Bahnen, Rückblick als Change-Protokoll. Vor dem Vortippen prüft sshTermy das Zielfenster (Host-Key, Prompt, System) und fügt nichts ein, wenn es nicht passt.</p></div>
|
||||
<div class="card"><h3>Agent- & Plan-Modus</h3><p>Die KI arbeitet selbstständig aufs Ziel hin, legt Skripte an und führt sie aus; drei Stufen, gefährliche Schritte warten immer auf dich. Erst planen: den ganzen Plan prüfen und freigeben.</p></div>
|
||||
@@ -171,7 +171,8 @@ sudo apt update && sudo apt install sshtermy</pre></div>
|
||||
<div class="features">
|
||||
<div class="card"><h3>Dateien (F5)</h3><p>SFTP über dieselbe Verbindung: links lokal, rechts der Server. <kbd>e</kbd> öffnet eine Server-Datei in VS Code, Notepad++ oder TextEdit, Speichern lädt sie zurück. Beim Kopieren: Prozent, MB/s, Restzeit und Tempo-Kurve. „Permission denied“? sshTermy bietet an, mit sudo zu wiederholen (<kbd>j</kbd> zweimal).</p></div>
|
||||
<div class="card"><h3>Dateien wie im Dateimanager</h3><p>In F5: <kbd>d</kbd> legt in den Papierkorb, <kbd>Strg</kbd>+<kbd>Z</kbd> holt zurück. <kbd>z</kbd>/<kbd>u</kbd> packt und entpackt direkt auf dem Server, <kbd>/</kbd> findet Dateien unscharf im ganzen Ordnerbaum, <kbd>i</kbd> zeigt die Platzfresser, <kbd>⇧I</kbd> doppelte Dateien. <kbd>g</kbd> öffnet Orte mit gemerkten Ordnern und Laufwerken, <kbd>x</kbd>/<kbd>p</kbd> verschiebt, <kbd>⇧F2</kbd> benennt viele Dateien im eigenen Editor um. Die Vorschau zeigt Ordner, Archive, Bildgrößen, Markdown und CSV als Tabelle.</p></div>
|
||||
<div class="card"><h3>Dateien mit der Maus</h3><p>Doppelklick auf eine Datei zeigt sie direkt in sshTermy: Farben, Suche, markieren und kopieren, mitlesen wie <code>tail -f</code>. Bilder und PDFs öffnen sich mit dem Standardprogramm. Ein Einfachklick zeigt eine Vorschau, Rechtsklick ein Menü mit Umbenennen, Rechten, Pfad kopieren und <code>cd</code> hierhin. Klickbarer Pfad, sortierbare Spalten, Strg/Umschalt+Klick markiert.</p></div>
|
||||
<div class="card"><h3>Dateien mit der Maus</h3><p>Doppelklick auf eine Datei zeigt sie direkt in sshTermy: Farben, Suche, markieren und kopieren, mitlesen wie <code>tail -f</code>. Bilder und PDFs öffnen sich mit dem Standardprogramm. Ein Einfachklick zeigt eine Vorschau, Rechtsklick ein Menü mit Umbenennen, Rechten, Pfad kopieren und <code>cd</code> hierhin. Klickbarer Pfad, sortierbare Spalten, Strg/Umschalt+Klick markiert. Programme vom Server fragen vor dem Start.</p></div>
|
||||
<div class="card"><h3>Alles mit der Maus</h3><p>Jedes Menü öffnet und schließt per Klick: <kbd>Esc</kbd> bleibt in der Fußzeile klickbar, das Mausrad blättert in allen Listen und Ergebnisfenstern, die Zurück-Taste der Maus wirkt wie <kbd>Esc</kbd>, Rechtsklick ins Leere führt eine Ebene zurück, in der Hilfe wechseln Reiter per Klick. Im Manager bietet ein Rechtsklick auf die freie Fläche neue Verbindung, neuen Ordner, Import, Scan und Tag-Filter.</p></div>
|
||||
<div class="card"><h3>Container</h3><p>Docker, Podman und Kubernetes-Pods in einer Liste: Shell im Container, Logs live, KI-Auswertung der Logs.</p></div>
|
||||
<div class="card"><h3>Host-Übersicht (F6)</h3><p>CPU, Last, RAM, alle Platten und Updates bei Servern, Live-Graphen aus Braille-Punkten über 5 min oder 1 h mit Top-Prozessen; Firmware, Ports und VLANs bei über 35 Switch-, Router- und Firewall-Systemen, mit Konfig-Sicherung und Diff.</p></div>
|
||||
<div class="card"><h3>Tunnel</h3><p><code>-L</code>, <code>-R</code>, <code>-D</code> (SOCKS5) und Webdienste mit einem Klick.</p></div>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+3
-2
@@ -144,7 +144,7 @@ sudo apt update && sudo apt install sshtermy</pre></div>
|
||||
<div class="card"><h3>Tasks, diff and cross-check</h3><p>Open work per connection or folder with a due date (<kbd>u</kbd> in the manager, <kbd>Alt</kbd>+<kbd>A</kbd>): <kbd>⏎</kbd> starts a task as a goal, then it waits for your review. After every goal a second AI checks read-only whether it was really reached, and <kbd>d</kbd> shows every changed file as a diff.</p></div>
|
||||
<div class="card"><h3>AI commands checked on the host</h3><p>Before a card command is inserted or run, sshTermy asks the real host whether the program exists and every option is in its man page or <code>--help</code>. macOS forms on Linux, the wrong package manager and anything the question rules out (“without lsof”) are caught, known slips repaired (<code>grep</code> on a folder gets <code>-r</code>). What stays open is marked <em>unconfirmed</em> and the AI tries again. Idea from lxask.</p></div>
|
||||
<div class="card"><h3>Sentence → command, explain without AI</h3><p>Type what you want at the prompt in plain words, <kbd>Ctrl</kbd>+<kbd>G</kbd> turns the line into a checked command. <kbd>Alt</kbd>+<kbd>H</kbd> explains the typed or last command part by part from the host's man page, offline and without any AI.</p></div>
|
||||
<div class="card"><h3>Small offline AI, or none</h3><p>No AI? Every AI feature is hidden, checks and explanations still work. One button downloads a small offline AI (lxask model via llama.cpp, about 1 GB, Windows, macOS, Linux) that steps in when nothing else answers; goal, agent and plan mode stay hidden until a larger AI is connected.</p></div>
|
||||
<div class="card"><h3>Small offline AI, or none</h3><p>No AI? Every AI feature is hidden, checks and explanations still work. One button downloads a small offline AI (lxask model via llama.cpp, about 1 GB, Windows, macOS, Linux, every file checked by SHA-256) that steps in when nothing else answers; goal, agent and plan mode stay hidden until a larger AI is connected.</p></div>
|
||||
<div class="card"><h3>AI companion</h3><p>Reads along and comments on its own: quiet (errors, risky lines before Enter, repeats), chatty (every command) or coach (spots your goal, recap with runbook). Your own AI servers, also external, can be registered. If a command from an answer card fails, the card shows the error and a corrected command; <kbd>u</kbd> takes it over and fixes the same mistake in the other cards.</p></div>
|
||||
<div class="card"><h3>Task across windows</h3><p><kbd>Alt</kbd>+<kbd>V</kbd> links the windows of one job (web server, database, switch). The AI sees all of them and says for each step which window it belongs in; route window by window with values carried over, plan in lanes, recap as change log. Before typing, sshTermy checks the target window (host key, prompt, system) and inserts nothing if it does not match.</p></div>
|
||||
<div class="card"><h3>Agent & plan mode</h3><p>The AI works towards a goal on its own, writes and runs scripts; three levels, dangerous steps always wait for you. Plan first: review and approve the whole plan.</p></div>
|
||||
@@ -171,7 +171,8 @@ sudo apt update && sudo apt install sshtermy</pre></div>
|
||||
<div class="features">
|
||||
<div class="card"><h3>Files (F5)</h3><p>SFTP over the same connection: local on the left, server on the right. <kbd>e</kbd> opens a server file in VS Code, Notepad++ or TextEdit, saving uploads it back. While copying: percent, MB/s, time left and a speed curve. “Permission denied”? sshTermy offers to repeat it with sudo (<kbd>j</kbd> twice).</p></div>
|
||||
<div class="card"><h3>Files like a file manager</h3><p>In F5: <kbd>d</kbd> moves to the trash, <kbd>Ctrl</kbd>+<kbd>Z</kbd> restores. <kbd>z</kbd>/<kbd>u</kbd> pack and extract right on the server, <kbd>/</kbd> finds files fuzzily in the whole folder tree, <kbd>i</kbd> shows the space hogs, <kbd>⇧I</kbd> duplicate files. <kbd>g</kbd> opens places with bookmarked folders and drives, <kbd>x</kbd>/<kbd>p</kbd> moves, <kbd>⇧F2</kbd> renames many files in your own editor. The preview shows folders, archives, image sizes, Markdown and CSV as a table.</p></div>
|
||||
<div class="card"><h3>Files with the mouse</h3><p>Double-click a file to view it right in sshTermy: colors, search, select and copy, follow like <code>tail -f</code>. Images and PDFs open with your default app. A single click shows a preview, right-click opens a menu with rename, permissions, copy path and <code>cd</code> here. Clickable path, sortable columns, Ctrl/Shift+click to mark.</p></div>
|
||||
<div class="card"><h3>Files with the mouse</h3><p>Double-click a file to view it right in sshTermy: colors, search, select and copy, follow like <code>tail -f</code>. Images and PDFs open with your default app. A single click shows a preview, right-click opens a menu with rename, permissions, copy path and <code>cd</code> here. Clickable path, sortable columns, Ctrl/Shift+click to mark. Programs from the server ask before they run.</p></div>
|
||||
<div class="card"><h3>Everything with the mouse</h3><p>Every menu opens and closes with a click: <kbd>Esc</kbd> stays clickable in the footer, the mouse wheel scrolls in all lists and result windows, the mouse back button works like <kbd>Esc</kbd>, a right-click on empty space goes up one level, help tabs switch with a click. In the manager a right-click on empty space offers new connection, new folder, import, scan and tag filter.</p></div>
|
||||
<div class="card"><h3>Containers</h3><p>Docker, Podman and Kubernetes pods in one list: shell in the container, live logs, AI log analysis.</p></div>
|
||||
<div class="card"><h3>Host overview (F6)</h3><p>CPU, load, RAM, every disk and updates for servers, live Braille graphs over 5 min or 1 h with top processes; firmware, ports and VLANs for more than 35 switch, router and firewall systems, with config backup and diff.</p></div>
|
||||
<div class="card"><h3>Tunnels</h3><p><code>-L</code>, <code>-R</code>, <code>-D</code> (SOCKS5) and web services with one click.</p></div>
|
||||
|
||||
@@ -83,6 +83,7 @@ export const de = {
|
||||
['Strg+_Klick_', 'URL im Browser öffnen'],
|
||||
['⇧+_Ziehen_', 'markieren in htop / vim'],
|
||||
['_Ablegen_', 'Datei aus Explorer/Finder hochladen'],
|
||||
['_Zurück-Taste_', 'wie Esc · Rechtsklick ins Leere: zurück'],
|
||||
]},
|
||||
{ t: 'Anzeigen lesen', ic: 'i', legend: true, rows: [
|
||||
['●', 'KI-Punkt grün: KI erreichbar', 'ok'],
|
||||
@@ -272,6 +273,7 @@ export const en = {
|
||||
['Ctrl+_click_', 'open URL in the browser'],
|
||||
['⇧+_drag_', 'select inside htop / vim'],
|
||||
['_drop_', 'upload a file from Explorer/Finder'],
|
||||
['_back button_', 'like Esc · right-click on empty: back'],
|
||||
]},
|
||||
{ t: 'Reading the screen', ic: 'i', legend: true, rows: [
|
||||
['●', 'AI dot green: AI reachable', 'ok'],
|
||||
|
||||
Reference in new issue
Block a user