fix(open with vscode with access token): don't open project after logging
This commit is contained in:
		
							
								
								
									
										36
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								src/main.ts
									
									
									
									
									
								
							@@ -35,8 +35,24 @@ export class DevStarExtension {
 | 
			
		||||
                // 如果没有用户登录,则直接登录;
 | 
			
		||||
                this.user.setUserTokenToLocal(access_token)
 | 
			
		||||
                this.user.setUsernameToLocal(devstar_username)
 | 
			
		||||
                // 使用登录已经登录过的容器连接方法
 | 
			
		||||
                await this.remoteContainer.firstConnect(container_host, container_username, container_port)
 | 
			
		||||
                  .then((_res) => {
 | 
			
		||||
                    if (_res == 'success') {
 | 
			
		||||
                      //  only success then open folder
 | 
			
		||||
                      this.remoteContainer.openRemoteFolder(container_host, container_port, container_username, project_path);
 | 
			
		||||
                    }
 | 
			
		||||
                  })
 | 
			
		||||
              } else if (devstar_username === this.user.getUsernameFromLocal()){
 | 
			
		||||
                // 如果同用户已经登录,则弃用,无操作;
 | 
			
		||||
                // 如果同用户已经登录,则忽略;
 | 
			
		||||
                // 使用登录已经登录过的容器连接方法
 | 
			
		||||
                await this.remoteContainer.firstConnect(container_host, container_username, container_port)
 | 
			
		||||
                  .then((_res) => {
 | 
			
		||||
                    if (_res == 'success') {
 | 
			
		||||
                      //  only success then open folder
 | 
			
		||||
                      this.remoteContainer.openRemoteFolder(container_host, container_port, container_username, project_path);
 | 
			
		||||
                    }
 | 
			
		||||
                  })
 | 
			
		||||
              } else {
 | 
			
		||||
                // 如果不是同用户,可以选择切换用户,或者不切换登录用户,直接打开容器
 | 
			
		||||
                const selection = await vscode.window.showWarningMessage(`已登录用户:${this.user.getUsernameFromLocal()},是否切换用户?`,
 | 
			
		||||
@@ -44,19 +60,19 @@ export class DevStarExtension {
 | 
			
		||||
                if (selection === 'Yes') {
 | 
			
		||||
                  this.user.setUserTokenToLocal(access_token);
 | 
			
		||||
                  this.user.setUsernameToLocal(devstar_username);
 | 
			
		||||
                  // 使用登录已经登录过的容器连接方法
 | 
			
		||||
                  await this.remoteContainer.firstConnect(container_host, container_username, container_port)
 | 
			
		||||
                    .then((_res) => {
 | 
			
		||||
                      if (_res == 'success') {
 | 
			
		||||
                        //  only success then open folder
 | 
			
		||||
                        this.remoteContainer.openRemoteFolder(container_host, container_port, container_username, project_path);
 | 
			
		||||
                      }
 | 
			
		||||
                    })
 | 
			
		||||
                } else if (selection === 'No') {
 | 
			
		||||
                  await openProjectWithoutLogging(container_host, container_port, container_username, project_path);
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              // 使用登录已经登录过的容器连接方法
 | 
			
		||||
              await this.remoteContainer.firstConnect(container_host, container_username, container_port)
 | 
			
		||||
                .then((_res) => {
 | 
			
		||||
                  if (_res == 'success') {
 | 
			
		||||
                    //  only success then open folder
 | 
			
		||||
                    this.remoteContainer.openRemoteFolder(container_host, container_port, container_username, project_path);
 | 
			
		||||
                  }
 | 
			
		||||
                })
 | 
			
		||||
              }
 | 
			
		||||
            } else {
 | 
			
		||||
              await openProjectWithoutLogging(container_host, container_port, container_username, project_path);
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user