@@ -30,10 +30,11 @@ window.main_shell = async () => {
30
30
. entries ( )
31
31
) ;
32
32
33
- let resolveConfigured = null ;
34
- const configured_ = new Promise ( rslv => {
35
- resolveConfigured = rslv ;
36
- } ) ;
33
+ // let resolveConfigured = null;
34
+ // const configured_ = new Promise(rslv => {
35
+ // resolveConfigured = rslv;
36
+ // });
37
+ const puterSDK = globalThis . puter ;
37
38
38
39
const terminal = puter . ui . parentApp ( ) ;
39
40
if ( ! terminal ) {
@@ -45,9 +46,10 @@ window.main_shell = async () => {
45
46
if ( message . $ === 'config' ) {
46
47
const configValues = { ...message } ;
47
48
// Only copy the config that we actually need
48
- config [ 'puter.auth.username' ] = configValues [ 'puter.auth.username' ] ;
49
+ // config['puter.auth.username'] = configValues['puter.auth.username'];
49
50
config [ 'puter.auth.token' ] = configValues [ 'puter.auth.token' ] ;
50
- resolveConfigured ( ) ;
51
+ // console.log('set!');
52
+ // resolveConfigured();
51
53
}
52
54
} ) ;
53
55
terminal . on ( 'close' , ( ) => {
@@ -59,14 +61,17 @@ window.main_shell = async () => {
59
61
60
62
terminal . postMessage ( { $ : 'ready' } ) ;
61
63
62
- await configured_ ;
64
+ const ptt = new XDocumentPTT ( terminal ) ;
63
65
64
- const puterSDK = globalThis . puter ;
65
- if ( config [ 'puter.auth.token' ] ) {
66
- await puterSDK . setAuthToken ( config [ 'puter.auth.token' ] ) ;
67
- }
66
+ // await configured_;
67
+ const user = await puterSDK . auth . getUser ( ) ;
68
+ config [ 'puter.auth.username' ] = user . username ;
69
+ // await new Promise(rslv => setTimeout(rslv, 0));
70
+
71
+ // if ( config['puter.auth.token'] ) {
72
+ // await puterSDK.setAuthToken(config['puter.auth.token']);
73
+ // }
68
74
69
- const ptt = new XDocumentPTT ( terminal ) ;
70
75
await launchPuterShell ( new Context ( {
71
76
ptt,
72
77
config, puterSDK,
0 commit comments