@@ -3,7 +3,6 @@ const { default: fetch } = require("node-fetch-cjs");
33
44import * as httpModule from "http" ;
55import * as httpsModule from "https" ;
6- import * as url from "url" ;
76import * as vscode from "vscode" ;
87import * as Cache from "vscode-cache" ;
98import {
@@ -57,16 +56,13 @@ export class AtelierAPI {
5756 public get config ( ) : ConnectionSettings {
5857 const { serverName, active = false , https = false , pathPrefix = "" , username } = this . _config ;
5958 const ns = this . namespace || this . _config . ns ;
60- const host = this . externalServer
61- ? this . _config . host
62- : workspaceState . get ( this . configName + ":host" , this . _config . host ) ;
63- const port = this . externalServer
64- ? this . _config . port
65- : workspaceState . get ( this . configName + ":port" , this . _config . port ) ;
66- const password = workspaceState . get ( this . configName + ":password" , this . _config . password ) ;
67- const apiVersion = workspaceState . get ( this . configName + ":apiVersion" , DEFAULT_API_VERSION ) ;
68- const docker = workspaceState . get ( this . configName + ":docker" , false ) ;
69- const dockerService = workspaceState . get < string > ( this . configName + ":dockerService" ) ;
59+ const wsKey = this . configName . toLowerCase ( ) ;
60+ const host = this . externalServer ? this . _config . host : workspaceState . get ( wsKey + ":host" , this . _config . host ) ;
61+ const port = this . externalServer ? this . _config . port : workspaceState . get ( wsKey + ":port" , this . _config . port ) ;
62+ const password = workspaceState . get ( wsKey + ":password" , this . _config . password ) ;
63+ const apiVersion = workspaceState . get ( wsKey + ":apiVersion" , DEFAULT_API_VERSION ) ;
64+ const docker = workspaceState . get ( wsKey + ":docker" , false ) ;
65+ const dockerService = workspaceState . get < string > ( wsKey + ":dockerService" ) ;
7066 return {
7167 serverName,
7268 active,
@@ -108,11 +104,9 @@ export class AtelierAPI {
108104 workspaceFolderName = parts [ 0 ] ;
109105 namespace = parts [ 1 ] ;
110106 } else {
111- const { query } = url . parse ( wsOrFile . toString ( true ) , true ) ;
112- if ( query ) {
113- if ( query . ns && query . ns !== "" ) {
114- namespace = query . ns . toString ( ) ;
115- }
107+ const params = new URLSearchParams ( wsOrFile . query ) ;
108+ if ( params . has ( "ns" ) && params . get ( "ns" ) != "" ) {
109+ namespace = params . get ( "ns" ) ;
116110 }
117111 }
118112 } else {
@@ -198,7 +192,7 @@ export class AtelierAPI {
198192 this . _config = {
199193 serverName,
200194 active : this . externalServer || conn . active ,
201- apiVersion : workspaceState . get ( this . configName + ":apiVersion" , DEFAULT_API_VERSION ) ,
195+ apiVersion : workspaceState . get ( this . configName . toLowerCase ( ) + ":apiVersion" , DEFAULT_API_VERSION ) ,
202196 https : scheme === "https" ,
203197 ns,
204198 host,
@@ -432,8 +426,8 @@ export class AtelierAPI {
432426 authRequestMap . delete ( target ) ;
433427 panel . text = `${ this . connInfo } $(debug-disconnect)` ;
434428 panel . tooltip = "Disconnected" ;
435- workspaceState . update ( this . configName + ":host" , undefined ) ;
436- workspaceState . update ( this . configName + ":port" , undefined ) ;
429+ workspaceState . update ( this . configName . toLowerCase ( ) + ":host" , undefined ) ;
430+ workspaceState . update ( this . configName . toLowerCase ( ) + ":port" , undefined ) ;
437431 if ( ! checkingConnection ) {
438432 setTimeout ( ( ) => checkConnection ( false , undefined , true ) , 30000 ) ;
439433 }
@@ -458,8 +452,8 @@ export class AtelierAPI {
458452 } ;
459453 }
460454 return Promise . all ( [
461- workspaceState . update ( this . configName + ":apiVersion" , apiVersion ) ,
462- workspaceState . update ( this . configName + ":iris" , data . version . startsWith ( "IRIS" ) ) ,
455+ workspaceState . update ( this . configName . toLowerCase ( ) + ":apiVersion" , apiVersion ) ,
456+ workspaceState . update ( this . configName . toLowerCase ( ) + ":iris" , data . version . startsWith ( "IRIS" ) ) ,
463457 ] ) . then ( ( ) => info ) ;
464458 }
465459 } ) ;
0 commit comments