@@ -77,14 +77,14 @@ class VirtualNetworkInterface {
7777 this . abort . abort ( ) ;
7878 }
7979
80- handleErrorMessage ( msg : Message ) {
80+ private handleErrorMessage ( msg : Message ) {
8181 const data = msg . data as { translation : string , format ?: Record < string , unknown > } ;
8282 showAlert ( i18n . t ( data . translation , data . format ) as string , "danger" ) ;
8383 this . route ( "/devices" ) ;
8484 }
8585
8686 // This handles Messages from the iframe/ Device-Webinterface
87- iframeMessageHandler ( e : MessageEvent ) {
87+ private iframeMessageHandler ( e : MessageEvent ) {
8888 const iframe = document . getElementById ( "interface" ) as HTMLIFrameElement ;
8989 if ( typeof e . data !== "string" ) {
9090 const data = e . data as Message ;
@@ -116,7 +116,7 @@ class VirtualNetworkInterface {
116116 }
117117
118118 // This waits for the Worker to be done with the setup
119- setupHandler ( e : MessageEvent ) {
119+ private setupHandler ( e : MessageEvent ) {
120120 if ( e . data === "started" ) {
121121 this . worker . onmessage = ( e ) => this . handleWorkerMessage ( e ) ;
122122 const message_data : SetupMessage = {
@@ -149,7 +149,7 @@ class VirtualNetworkInterface {
149149 }
150150
151151 // This handles the Message coming from the Charger once the setup is done
152- handleWorkerMessage ( e : MessageEvent ) {
152+ private handleWorkerMessage ( e : MessageEvent ) {
153153 if ( typeof e . data === "string" ) {
154154 switch ( e . data ) {
155155 case "ready" :
@@ -224,7 +224,7 @@ class VirtualNetworkInterface {
224224 }
225225 }
226226
227- keyDownHandler ( e : KeyboardEvent ) {
227+ private keyDownHandler ( e : KeyboardEvent ) {
228228 if ( e . ctrlKey && e . altKey && e . code === "KeyP" ) {
229229 this . worker . postMessage ( "download" ) ;
230230 } else if ( e . ctrlKey && e . altKey && e . shiftKey && e . code === "KeyR" ) {
@@ -341,6 +341,14 @@ export class Frame extends Component<{}, FrameState> {
341341 document . title = name ;
342342 }
343343
344+ const iframe = document . getElementById ( "interface" ) as HTMLIFrameElement ;
345+ iframe . addEventListener ( "load" , ( v ) => {
346+ const iframeSrc = ( v . target as HTMLIFrameElement ) . contentWindow ?. location . href ;
347+ if ( iframeSrc ?. includes ( "devices" ) ) {
348+ location . reload ( ) ;
349+ }
350+ } ) ;
351+
344352 connected . value = true ;
345353 } ) ;
346354
0 commit comments