fix: auto-switch sidebar to SFTP on SSH connect + credential debug logging
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 1m4s

Sidebar automatically switches from Connections to SFTP tab when an SSH
session becomes active. Added slog debug output to ConnectSSH showing
credentialID, vault state, and loaded credential details to diagnose
pubkey auth failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell 2026-03-17 11:54:21 -04:00
parent 999f8f0539
commit 9338fef0c2
2 changed files with 16 additions and 1 deletions

View File

@ -211,7 +211,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onUnmounted } from "vue";
import { Call, Application } from "@wailsio/runtime"; import { Call, Application } from "@wailsio/runtime";
import { useAppStore } from "@/stores/app.store"; import { useAppStore } from "@/stores/app.store";
import { useConnectionStore } from "@/stores/connection.store"; import { useConnectionStore } from "@/stores/connection.store";
@ -247,6 +247,13 @@ const sidebarWidth = ref(240);
const sidebarTab = ref<SidebarTab>("connections"); const sidebarTab = ref<SidebarTab>("connections");
const quickConnectInput = ref(""); const quickConnectInput = ref("");
// Auto-switch to SFTP tab when an SSH session becomes active
watch(() => sessionStore.activeSession, (session) => {
if (session && session.protocol === "ssh") {
sidebarTab.value = "sftp";
}
});
/** Currently open file in the editor panel (null = no file open). */ /** Currently open file in the editor panel (null = no file open). */
const editorFile = ref<{ content: string; path: string; sessionId: string } | null>(null); const editorFile = ref<{ content: string; path: string; sessionId: string } | null>(null);

View File

@ -261,11 +261,19 @@ func (a *WraithApp) ConnectSSH(connectionID int64, cols, rows int) (string, erro
var authMethods []gossh.AuthMethod var authMethods []gossh.AuthMethod
username := "root" // default username := "root" // default
slog.Info("ConnectSSH resolving auth",
"connectionID", connectionID,
"host", conn.Hostname,
"credentialID", conn.CredentialID,
"vaultUnlocked", a.Credentials != nil,
)
if conn.CredentialID != nil && a.Credentials != nil { if conn.CredentialID != nil && a.Credentials != nil {
cred, err := a.Credentials.GetCredential(*conn.CredentialID) cred, err := a.Credentials.GetCredential(*conn.CredentialID)
if err != nil { if err != nil {
slog.Warn("failed to load credential", "id", *conn.CredentialID, "error", err) slog.Warn("failed to load credential", "id", *conn.CredentialID, "error", err)
} else { } else {
slog.Info("credential loaded", "name", cred.Name, "type", cred.Type, "username", cred.Username, "sshKeyID", cred.SSHKeyID)
if cred.Username != "" { if cred.Username != "" {
username = cred.Username username = cred.Username
} }