@@ -210,55 +210,6 @@ window.initgui = async function(options){
210
210
}
211
211
}
212
212
213
- //--------------------------------------------------------------------------------------
214
- // `share_token` provided
215
- // i.e. https://puter.com/?share_token=<share_token>
216
- //--------------------------------------------------------------------------------------
217
- if ( window . url_query_params . has ( 'share_token' ) ) {
218
- let share_token = window . url_query_params . get ( 'share_token' ) ;
219
-
220
- fetch ( `${ puter . APIOrigin } /sharelink/check` , {
221
- "headers" : {
222
- "Content-Type" : "application/json" ,
223
- "Authorization" : `Bearer ${ puter . authToken } ` ,
224
- } ,
225
- "body" : JSON . stringify ( {
226
- token : share_token ,
227
- } ) ,
228
- "method" : "POST" ,
229
- } ) . then ( response => response . json ( ) )
230
- . then ( async data => {
231
- // Show register screen
232
- if ( data . email && data . email !== window . user . email ) {
233
- await UIWindowSignup ( {
234
- reload_on_success : true ,
235
- send_confirmation_code : false ,
236
- window_options :{
237
- has_head : false
238
- }
239
- } ) ;
240
- }
241
- // Show email confirmation screen
242
- else if ( data . email && data . email === window . user . email && ! window . user . email_confirmed ) {
243
- // todo show email confirmation window
244
- await UIWindowEmailConfirmationRequired ( {
245
- stay_on_top : true ,
246
- has_head : false
247
- } ) ;
248
- }
249
-
250
- // show shared item
251
- UIWindow ( {
252
- path : data . path ,
253
- title : path . basename ( data . path ) ,
254
- icon : await item_icon ( { is_dir : data . is_dir , path : data . path } ) ,
255
- is_dir : data . is_dir ,
256
- app : 'explorer' ,
257
- } ) ;
258
- } ) . catch ( error => {
259
- console . error ( 'Error:' , error ) ;
260
- } )
261
- }
262
213
//--------------------------------------------------------------------------------------
263
214
// Determine if an app was launched from URL
264
215
// i.e. https://puter.com/app/<app_name>
@@ -818,6 +769,56 @@ window.initgui = async function(options){
818
769
window . update_sites_cache ( ) ;
819
770
}
820
771
}
772
+ //--------------------------------------------------------------------------------------
773
+ // `share_token` provided
774
+ // i.e. https://puter.com/?share_token=<share_token>
775
+ //--------------------------------------------------------------------------------------
776
+ if ( window . url_query_params . has ( 'share_token' ) ) {
777
+ let share_token = window . url_query_params . get ( 'share_token' ) ;
778
+
779
+ fetch ( `${ puter . APIOrigin } /sharelink/check` , {
780
+ "headers" : {
781
+ "Content-Type" : "application/json" ,
782
+ "Authorization" : `Bearer ${ puter . authToken } ` ,
783
+ } ,
784
+ "body" : JSON . stringify ( {
785
+ token : share_token ,
786
+ } ) ,
787
+ "method" : "POST" ,
788
+ } ) . then ( response => response . json ( ) )
789
+ . then ( async data => {
790
+ // Show register screen
791
+ if ( data . email && data . email !== window . user ?. email ) {
792
+ await UIWindowSignup ( {
793
+ reload_on_success : true ,
794
+ email : data . email ,
795
+ send_confirmation_code : false ,
796
+ window_options :{
797
+ has_head : false
798
+ }
799
+ } ) ;
800
+ }
801
+ // Show email confirmation screen
802
+ else if ( data . email && data . email === window . user . email && ! window . user . email_confirmed ) {
803
+ // todo show email confirmation window
804
+ await UIWindowEmailConfirmationRequired ( {
805
+ stay_on_top : true ,
806
+ has_head : false
807
+ } ) ;
808
+ }
809
+
810
+ // show shared item
811
+ UIWindow ( {
812
+ path : data . path ,
813
+ title : path . basename ( data . path ) ,
814
+ icon : await item_icon ( { is_dir : data . is_dir , path : data . path } ) ,
815
+ is_dir : data . is_dir ,
816
+ app : 'explorer' ,
817
+ } ) ;
818
+ } ) . catch ( error => {
819
+ console . error ( 'Error:' , error ) ;
820
+ } )
821
+ }
821
822
// -------------------------------------------------------------------------------------
822
823
// Desktop Background
823
824
// If we're in fullpage/emebedded/Auth Popup mode, we don't want to load the custom background
0 commit comments