Fix backend SSH issues
This commit is contained in:
@@ -62,16 +62,6 @@ function createWindow() {
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
mainWindow.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => {
|
||||
callback({ requestHeaders: details.requestHeaders });
|
||||
});
|
||||
|
||||
mainWindow.webContents.session.cookies.onChanged((event, cookie, cause, removed) => {
|
||||
if (!removed) {
|
||||
console.log('Cookie set:', cookie.name, 'for domain:', cookie.domain);
|
||||
}
|
||||
});
|
||||
|
||||
mainWindow.webContents.on(
|
||||
"did-fail-load",
|
||||
(event, errorCode, errorDescription, validatedURL) => {
|
||||
|
||||
@@ -275,7 +275,9 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => {
|
||||
},
|
||||
};
|
||||
|
||||
if (resolvedCredentials.sshKey && resolvedCredentials.sshKey.trim()) {
|
||||
if (resolvedCredentials.authType === "password" && resolvedCredentials.password && resolvedCredentials.password.trim()) {
|
||||
config.password = resolvedCredentials.password;
|
||||
} else if (resolvedCredentials.authType === "key" && resolvedCredentials.sshKey && resolvedCredentials.sshKey.trim()) {
|
||||
try {
|
||||
if (
|
||||
!resolvedCredentials.sshKey.includes("-----BEGIN") ||
|
||||
@@ -302,16 +304,14 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => {
|
||||
});
|
||||
return res.status(400).json({ error: "Invalid SSH key format" });
|
||||
}
|
||||
} else if (
|
||||
resolvedCredentials.password &&
|
||||
resolvedCredentials.password.trim()
|
||||
) {
|
||||
config.password = resolvedCredentials.password;
|
||||
} else {
|
||||
fileLogger.warn("No authentication method provided for file manager", {
|
||||
fileLogger.warn("No valid authentication method provided for file manager", {
|
||||
operation: "file_connect",
|
||||
sessionId,
|
||||
hostId,
|
||||
authType: resolvedCredentials.authType,
|
||||
hasPassword: !!resolvedCredentials.password,
|
||||
hasKey: !!resolvedCredentials.sshKey,
|
||||
});
|
||||
return res
|
||||
.status(400)
|
||||
|
||||
@@ -588,7 +588,9 @@ wss.on("connection", async (ws: WebSocket, req) => {
|
||||
compress: ["none", "zlib@openssh.com", "zlib"],
|
||||
},
|
||||
};
|
||||
if (resolvedCredentials.authType === "key" && resolvedCredentials.key) {
|
||||
if (resolvedCredentials.authType === "password" && resolvedCredentials.password) {
|
||||
connectConfig.password = resolvedCredentials.password;
|
||||
} else if (resolvedCredentials.authType === "key" && resolvedCredentials.key) {
|
||||
try {
|
||||
if (
|
||||
!resolvedCredentials.key.includes("-----BEGIN") ||
|
||||
@@ -634,7 +636,14 @@ wss.on("connection", async (ws: WebSocket, req) => {
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
connectConfig.password = resolvedCredentials.password;
|
||||
sshLogger.error("No valid authentication method provided");
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
type: "error",
|
||||
message: "No valid authentication method provided",
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
sshConn.connect(connectConfig);
|
||||
|
||||
@@ -914,9 +914,6 @@ export function CredentialsManager({
|
||||
setDropdownOpen(false);
|
||||
}
|
||||
}}
|
||||
onFocus={() => {
|
||||
setDropdownOpen(true);
|
||||
}}
|
||||
className="w-full"
|
||||
autoFocus={false}
|
||||
/>
|
||||
|
||||
@@ -598,6 +598,7 @@ export const Terminal = forwardRef<any, SSHTerminalProps>(function SSHTerminal(
|
||||
resizeObserver.observe(xtermRef.current);
|
||||
|
||||
setVisible(true);
|
||||
setIsConnecting(true); // Show connecting state immediately
|
||||
|
||||
const readyFonts =
|
||||
(document as any).fonts?.ready instanceof Promise
|
||||
|
||||
Reference in New Issue
Block a user