From 06a3bfaad79750f5fa19746cf40c9c5aeab6a2e0 Mon Sep 17 00:00:00 2001 From: Alex Lee <3076438032@qq.com> Date: Tue, 3 Dec 2024 10:31:03 +0800 Subject: [PATCH] fix: remote-ssh remove config code (#5255) * fix: remote-ssh bug * fix: remove config remote-ssh code --- extensions/ide/vscode/devbox/package.json | 2 +- .../devbox/src/commands/remoteConnector.ts | 3 -- .../devbox/src/utils/remoteSSHConfig.ts | 45 ------------------- 3 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 extensions/ide/vscode/devbox/src/utils/remoteSSHConfig.ts diff --git a/extensions/ide/vscode/devbox/package.json b/extensions/ide/vscode/devbox/package.json index 1e476badc43..c6a969dcb1a 100644 --- a/extensions/ide/vscode/devbox/package.json +++ b/extensions/ide/vscode/devbox/package.json @@ -2,7 +2,7 @@ "name": "devbox-aio", "displayName": "%displayName%", "description": "%description%", - "version": "1.2.2024112203", + "version": "1.2.2024120201", "keywords": [ "devbox", "remote development", diff --git a/extensions/ide/vscode/devbox/src/commands/remoteConnector.ts b/extensions/ide/vscode/devbox/src/commands/remoteConnector.ts index 7c3b36f1824..ce3e47eb629 100644 --- a/extensions/ide/vscode/devbox/src/commands/remoteConnector.ts +++ b/extensions/ide/vscode/devbox/src/commands/remoteConnector.ts @@ -11,7 +11,6 @@ import { } from '../constant/file' import { Logger } from '../common/logger' import { Disposable } from '../common/dispose' -import { modifiedRemoteSSHConfig } from '../utils/remoteSSHConfig' import { convertSSHConfigToVersion2 } from '../utils/sshConfig' import { GlobalStateManager } from '../utils/globalStateManager' import { ensureFileAccessPermission, ensureFileExists } from '../utils/file' @@ -131,8 +130,6 @@ export class RemoteSSHConnector extends Disposable { const { sshDomain, sshPort, base64PrivateKey, sshHostLabel, workingDir } = args - modifiedRemoteSSHConfig(sshHostLabel) - const sshUser = sshDomain.split('@')[0] const sshHost = sshDomain.split('@')[1] diff --git a/extensions/ide/vscode/devbox/src/utils/remoteSSHConfig.ts b/extensions/ide/vscode/devbox/src/utils/remoteSSHConfig.ts deleted file mode 100644 index 1d3741908ba..00000000000 --- a/extensions/ide/vscode/devbox/src/utils/remoteSSHConfig.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as vscode from 'vscode' -import { Logger } from '../common/logger' - -// update Remote-SSH config -export const modifiedRemoteSSHConfig = async (sshHostLabel: string) => { - Logger.info(`Modifying Remote-SSH config for ${sshHostLabel}`) - - const existingSSHHostPlatforms = vscode.workspace - .getConfiguration('remote.SSH') - .get<{ [host: string]: string }>('remotePlatform', {}) - - // delete repeated remotePlatform by sshDomain_namespace_devboxName - const newSSHHostPlatforms = Object.keys(existingSSHHostPlatforms).reduce( - (acc: { [host: string]: string }, host: string) => { - if (host.startsWith(sshHostLabel)) { - return acc - } - acc[host] = existingSSHHostPlatforms[host] - return acc - }, - {} - ) - // add new ssh host label - newSSHHostPlatforms[sshHostLabel] = 'linux' - - await vscode.workspace - .getConfiguration('remote.SSH') - .update( - 'remotePlatform', - newSSHHostPlatforms, - vscode.ConfigurationTarget.Global - ) - - await vscode.workspace - .getConfiguration('remote.SSH') - .update('useExecServer', false, vscode.ConfigurationTarget.Global) - await vscode.workspace - .getConfiguration('remote.SSH') - .update('localServerDownload', 'off', vscode.ConfigurationTarget.Global) - await vscode.workspace - .getConfiguration('remote.SSH') - .update('useLocalServer', true, vscode.ConfigurationTarget.Global) - - Logger.info(`Modified Remote-SSH config for ${sshHostLabel}`) -}