Files
sshtermy/internal/ui/debuglog.go
T
Claude 7238d5d010 Host-Key-Dialog: Handshake-Frist pausiert, j/n unabhängig von Groß/klein, Eingabe-Protokoll
- Die 15-s-Handshake-Frist lief weiter, während der Dialog offen war; wer
  länger überlegte, bekam nach 'j' nur 'handshake failed: i/o timeout'.
  Jetzt pausiert die Frist während Host-Key- und Passwort-Abfrage.
- j/y/n in Host-Key- und Ja/Nein-Dialogen: Groß/klein egal (Feststelltaste),
  auch ohne mitgelieferten Text (Windows-Konsole).
- SSHTERMY_DEBUG=1 schreibt Eingaben nach debug-input.log (ohne Passwörter),
  um den Windows-Hänger einzugrenzen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUhg5AdrmYRiFgqJoUd
2026-11-05 12:00:51 +00:00

60 lines
1.6 KiB
Go

package ui
import (
"fmt"
"os"
"path/filepath"
"time"
tea "charm.land/bubbletea/v2"
)
// Eingabe-Protokoll zur Fehlersuche (z. B. Tasten, die unter Windows nicht
// ankommen). Nur mit SSHTERMY_DEBUG=1; Datei debug-input.log im
// sshTermy-Ordner. Getippte Zeichen werden in Passwort-Dialogen und beim
// Entsperren nicht protokolliert.
func openInputLog(dir string) *os.File {
if os.Getenv("SSHTERMY_DEBUG") == "" || dir == "" {
return nil
}
f, err := os.OpenFile(filepath.Join(dir, "debug-input.log"), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o600)
if err != nil {
return nil
}
fmt.Fprintf(f, "---- Start %s\n", time.Now().Format(time.RFC3339))
return f
}
func (a *App) logInput(msg tea.Msg) {
if a.inputLog == nil {
return
}
var line string
secret := a.scr == scrUnlock || (a.modal != nil && a.modal.kind == mSecret)
switch m := msg.(type) {
case tea.KeyPressMsg:
if secret && m.Text != "" {
line = "key [verborgen]"
} else {
line = fmt.Sprintf("key %q code=%U base=%U shifted=%U text=%q mod=%d", m.String(), m.Code, m.BaseCode, m.ShiftedCode, m.Text, m.Mod)
}
case tea.MouseClickMsg:
line = fmt.Sprintf("click %+v", m.Mouse())
case tea.MouseReleaseMsg:
line = fmt.Sprintf("release %+v", m.Mouse())
case tea.PasteMsg:
line = fmt.Sprintf("paste len=%d", len(m.Content))
case hostKeyAskMsg:
line = "hostkey-frage " + m.host
case secretAskMsg:
line = "secret-frage"
default:
return
}
modal := "-"
if a.modal != nil {
modal = fmt.Sprint(a.modal.kind)
}
fmt.Fprintf(a.inputLog, "%s scr=%d modal=%s %s\n", time.Now().Format("15:04:05.000"), a.scr, modal, line)
}