feat: clean - clean ssh key and logout
This commit is contained in:
13
src/main.ts
13
src/main.ts
@@ -1,4 +1,5 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
import * as fs from 'fs';
|
||||||
import QuickAccessTreeProvider from './views/quick-access-tree';
|
import QuickAccessTreeProvider from './views/quick-access-tree';
|
||||||
import DSHome from './home';
|
import DSHome from './home';
|
||||||
import RemoteContainer, { openProjectWithoutLogging } from './remote-container';
|
import RemoteContainer, { openProjectWithoutLogging } from './remote-container';
|
||||||
@@ -95,7 +96,17 @@ export class DevStarExtension {
|
|||||||
vscode.commands.registerCommand('devstar.showHome', (url: string) =>
|
vscode.commands.registerCommand('devstar.showHome', (url: string) =>
|
||||||
this.dsHome.toggle(url)
|
this.dsHome.toggle(url)
|
||||||
),
|
),
|
||||||
vscode.commands.registerCommand('devstar.logout', () => {
|
vscode.commands.registerCommand('devstar.clean', () => {
|
||||||
|
// 先清除ssh key
|
||||||
|
if (fs.existsSync(this.user.getUserPrivateKeyPath())) {
|
||||||
|
fs.unlinkSync(this.user.getUserPrivateKeyPath())
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs.existsSync(this.user.getUserPublicKeyPath())) {
|
||||||
|
fs.unlinkSync(this.user.getUserPublicKeyPath())
|
||||||
|
}
|
||||||
|
console.log("User's ssh key has been deleted!")
|
||||||
|
// 退出登录
|
||||||
this.user.logout()
|
this.user.logout()
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user