File tree Expand file tree Collapse file tree 4 files changed +14
-12
lines changed
sessions/WebSocketSession Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -151,8 +151,6 @@ export class Sandbox {
151151 ? await this . createSession ( customSession )
152152 : this . globalSession ;
153153
154- console . log ( "SESSION" , session ) ;
155-
156154 const pitcherClient = await initPitcherClient (
157155 {
158156 appId : "sdk" ,
@@ -210,7 +208,10 @@ export class Sandbox {
210208 ) ;
211209
212210 return new WebSocketSession ( pitcherClient , {
213- sessionId : customSession ?. id ,
211+ username : customSession
212+ ? // @ts -ignore
213+ pitcherClient [ "joinResult" ] . client . username
214+ : undefined ,
214215 env : customSession ?. env ,
215216 hostToken : customSession ?. hostToken ,
216217 } ) ;
Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ export async function connectToSandbox(options: {
4646 ) ;
4747
4848 return new WebSocketSession ( pitcherClient , {
49+ username : options . session . sessionId
50+ ? // @ts -ignore
51+ pitcherClient [ "joinResult" ] . client . username
52+ : undefined ,
4953 env : options . session . env ,
5054 hostToken : options . session . hostToken ,
5155 } ) ;
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export class FileSystem {
4343 constructor (
4444 sessionDisposable : Disposable ,
4545 private pitcherClient : IPitcherClient ,
46- private sessionId ?: string
46+ private username ?: string
4747 ) {
4848 sessionDisposable . onWillDispose ( ( ) => {
4949 this . disposable . dispose ( ) ;
@@ -214,14 +214,11 @@ export class FileSystem {
214214 path ,
215215 options ,
216216 ( event ) => {
217- if ( this . sessionId ) {
217+ if ( this . username ) {
218218 emitter . fire ( {
219219 ...event ,
220220 paths : event . paths . map ( ( path ) =>
221- path . replace (
222- `home/csb-session-${ this . sessionId } /workspace/` ,
223- "sandbox/"
224- )
221+ path . replace ( `home/${ this . username } /workspace/` , "sandbox/" )
225222 ) ,
226223 } ) ;
227224 } else {
Original file line number Diff line number Diff line change @@ -78,11 +78,11 @@ export class WebSocketSession {
7878 {
7979 env,
8080 hostToken,
81- sessionId ,
81+ username ,
8282 } : {
8383 env ?: Record < string , string > ;
8484 hostToken ?: HostToken ;
85- sessionId ?: string ;
85+ username ?: string ;
8686 }
8787 ) {
8888 // TODO: Bring this back once metrics polling does not reset inactivity
@@ -92,7 +92,7 @@ export class WebSocketSession {
9292 // };
9393
9494 // this.addDisposable(metricsDisposable);
95- this . fs = new FileSystem ( this . disposable , this . pitcherClient , sessionId ) ;
95+ this . fs = new FileSystem ( this . disposable , this . pitcherClient , username ) ;
9696 this . terminals = new Terminals ( this . disposable , this . pitcherClient , env ) ;
9797 this . commands = new Commands ( this . disposable , this . pitcherClient , env ) ;
9898
You can’t perform that action at this time.
0 commit comments