File tree 2 files changed +25
-3
lines changed
2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -1398,9 +1398,14 @@ function attachServerEventHandlers(serverProcess: ChildProcessWithoutNullStreams
1398
1398
}
1399
1399
1400
1400
if ( isHeadlessMode ) {
1401
- serverProcess = startServer ( [ '-html-static-dir' , path . join ( process . resourcesPath , './frontend' ) ] ) ;
1402
- attachServerEventHandlers ( serverProcess ) ;
1403
- shell . openExternal ( `http://localhost:${ defaultPort } ` ) ;
1401
+ startServer ( [ '-html-static-dir' , path . join ( process . resourcesPath , './frontend' ) ] ) . then (
1402
+ serverProcess => {
1403
+ attachServerEventHandlers ( serverProcess ) ;
1404
+
1405
+ // Give 1s for backend to start
1406
+ setTimeout ( ( ) => shell . openExternal ( `http://localhost:${ defaultPort } ` ) , 1000 ) ;
1407
+ }
1408
+ ) ;
1404
1409
} else {
1405
1410
startElecron ( ) ;
1406
1411
}
Original file line number Diff line number Diff line change @@ -930,6 +930,23 @@ func (c *HeadlampConfig) OIDCTokenRefreshMiddleware(next http.Handler) http.Hand
930
930
}
931
931
932
932
func StartHeadlampServer (config * HeadlampConfig ) {
933
+ // Copy static files as squashFS is read-only (AppImage)
934
+ if config .staticDir != "" {
935
+ dir , err := os .MkdirTemp (os .TempDir (), ".headlamp" )
936
+ if err != nil {
937
+ logger .Log (logger .LevelError , nil , err , "Failed to create static dir" )
938
+ os .Exit (1 )
939
+ }
940
+
941
+ err = os .CopyFS (dir , os .DirFS (config .staticDir ))
942
+ if err != nil {
943
+ logger .Log (logger .LevelError , nil , err , "Failed to copy files from static dir" )
944
+ os .Exit (1 )
945
+ }
946
+
947
+ config .staticDir = dir
948
+ }
949
+
933
950
handler := createHeadlampHandler (config )
934
951
935
952
handler = config .OIDCTokenRefreshMiddleware (handler )
You can’t perform that action at this time.
0 commit comments