feat: show SSH:project name in status bar
This commit is contained in:
10
src/main.ts
10
src/main.ts
@@ -26,14 +26,16 @@ export class DevStarExtension {
|
||||
if (uri.path === '/openProject') {
|
||||
const params = new URLSearchParams(uri.query);
|
||||
const host = params.get('host');
|
||||
const hostname = params.get('hostname');
|
||||
const port = params.get('port');
|
||||
const username = params.get('username');
|
||||
const path = params.get('path');
|
||||
const access_token = params.get('access_token');
|
||||
const devstar_username = params.get('devstar_username');
|
||||
|
||||
if (host && port && username && path) {
|
||||
if (host && hostname && port && username && path) {
|
||||
const container_host = host;
|
||||
const container_hostname = hostname
|
||||
const container_port = parseInt(port, 10);
|
||||
const container_username = username;
|
||||
const project_path = decodeURIComponent(path);
|
||||
@@ -43,12 +45,12 @@ export class DevStarExtension {
|
||||
// 如果没有用户登录,则直接登录;
|
||||
const res = await this.user.login(access_token, devstar_username)
|
||||
if (res === 'ok') {
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path, this.context)
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_hostname, container_port, container_username, project_path, this.context)
|
||||
}
|
||||
} else if (devstar_username === this.user.getUsernameFromLocal()) {
|
||||
// 如果同用户已经登录,则忽略;
|
||||
// 直接打开项目
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path, this.context)
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_hostname,container_port, container_username, project_path, this.context)
|
||||
} else {
|
||||
// 如果不是同用户,可以选择切换用户,或者不切换登录用户,直接打开容器
|
||||
const selection = await vscode.window.showWarningMessage(`已登录用户:${this.user.getUsernameFromLocal()},是否切换用户?`,
|
||||
@@ -57,7 +59,7 @@ export class DevStarExtension {
|
||||
// 如果没有用户登录,则直接登录;
|
||||
const res = await this.user.login(access_token, devstar_username)
|
||||
if (res === 'ok') {
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_port, container_username, project_path, this.context)
|
||||
await this.remoteContainer.firstOpenProject(container_host, container_hostname, container_port, container_username, project_path, this.context)
|
||||
}
|
||||
} else if (selection === 'No') {
|
||||
await openProjectWithoutLogging(container_host, container_port, container_username, project_path);
|
||||
|
Reference in New Issue
Block a user