дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
Host startup now moves legacy plaintext SSH passwords and key passphrases from ssh-passwords.json into the OS credential store, without waiting for the next SSH connection. When the move cannot finish, each workbench shows a sticky warning with Retry migration and a confirmed Remove plaintext copy, which keeps credentials already moved. A credential that cannot be saved stays for the session and the requesting window is warned. An unreadable ssh-passwords.json is set aside (renamed, never deleted) like the other secret files, so it no longer blocks saving new credentials. Co-authored-by: dengliu <[email protected]>
46 рядки
1.8 KiB
TypeScript
46 рядки
1.8 KiB
TypeScript
/**
|
||
* SSH: credential prompts of `ssh` / `git` child processes (askpass) and
|
||
* Tools › Start SSH Session. The configurations live in Settings › Tools ›
|
||
* SSH Configurations.
|
||
*/
|
||
import { executeAction, registerActions } from "@/platform/actions";
|
||
import { onIdeEvent } from "@/platform/ipc";
|
||
import { registerOverlay } from "@/workbench/contributions";
|
||
import { dropAskpass, enqueueAskpass, useAskpass } from "./askpass";
|
||
import { AskpassHost } from "./AskpassDialog";
|
||
import { startPasswordMigrationNotice } from "./passwordMigration";
|
||
import { chooseSshSession, SSH_SETTINGS_PAGE, startSshSession } from "./session";
|
||
|
||
export function activate(): () => void {
|
||
const disposers = [
|
||
startPasswordMigrationNotice(),
|
||
registerOverlay({ id: "ssh.askpass", component: AskpassHost }),
|
||
onIdeEvent("askpass", (e) => enqueueAskpass({ id: e.id, prompt: e.prompt, kind: e.kind, remember: e.remember })),
|
||
onIdeEvent("askpassDone", (e) => dropAskpass(e.id)),
|
||
registerActions([
|
||
{
|
||
id: "ssh.startSession",
|
||
title: "Start SSH Session…",
|
||
description: "Opens a terminal tab connected to an SSH configuration (`arg`: its id; otherwise a chooser).",
|
||
category: "Tools",
|
||
icon: "terminal",
|
||
when: "projectOpen",
|
||
keywords: ["ssh", "remote", "terminal", "shell", "connect"],
|
||
run: ({ arg }) => (typeof arg === "string" && arg ? startSshSession(arg) : chooseSshSession()),
|
||
},
|
||
{
|
||
id: "ssh.configurations",
|
||
title: "SSH Configurations…",
|
||
category: "Tools",
|
||
icon: "settings",
|
||
keywords: ["ssh", "remote", "host"],
|
||
run: () => void executeAction("file.settings", SSH_SETTINGS_PAGE),
|
||
},
|
||
]),
|
||
];
|
||
return () => {
|
||
disposers.reverse().forEach((d) => d());
|
||
useAskpass.setState({ queue: [] });
|
||
};
|
||
}
|