@@ -451,12 +451,12 @@ function updateWrapperStates () {
451451 */
452452async function loadConfig ( ) {
453453 try {
454- const res = await fetch ( new URL ( "config/" , `${ location . origin } ${ config . basePath } ` ) ) ;
454+ const res = await fetch ( new URL ( "config/" , `${ location . origin } ${ globalThis . config . basePath } ` ) ) ;
455455
456456 // The server tags functions as { __mmFunction: "<source>" } because
457457 // JSON.stringify can't serialise live functions. This reviver turns
458458 // those tagged objects back into callable functions.
459- config = JSON . parse ( await res . text ( ) , ( key , value ) => {
459+ globalThis . config = JSON . parse ( await res . text ( ) , ( key , value ) => {
460460 if ( value && typeof value === "object" && typeof value . __mmFunction === "string" ) {
461461 try {
462462 return new Function ( `return (${ value . __mmFunction } )` ) ( ) ;
@@ -572,9 +572,9 @@ export const MM = {
572572 Log . info ( "Initializing MagicMirror²." ) ;
573573 await loadConfig ( ) ;
574574
575- Log . setLogLevel ( config . logLevel ) ;
575+ Log . setLogLevel ( globalThis . config . logLevel ) ;
576576
577- await Translator . loadCoreTranslations ( config . language ) ;
577+ await Translator . loadCoreTranslations ( globalThis . config . language ) ;
578578 await loadModules ( ) ;
579579 } ,
580580
@@ -595,20 +595,20 @@ export const MM = {
595595
596596 // Setup global socket listener for RELOAD event (watch mode)
597597 const socket = io ( "/" , {
598- path : `${ config . basePath || "/" } socket.io`
598+ path : `${ globalThis . config . basePath || "/" } socket.io`
599599 } ) ;
600600
601601 socket . on ( "RELOAD" , ( ) => {
602602 Log . warn ( "Reload notification received from server" ) ;
603603 window . location . reload ( true ) ;
604604 } ) ;
605605
606- if ( config . reloadAfterServerRestart ) {
606+ if ( globalThis . config . reloadAfterServerRestart ) {
607607 setInterval ( async ( ) => {
608608 // if server startup time has changed (which means server was restarted)
609609 // the client reloads the mm page
610610 try {
611- const res = await fetch ( `${ location . protocol } //${ location . host } ${ config . basePath } startup` ) ;
611+ const res = await fetch ( `${ location . protocol } //${ location . host } ${ globalThis . config . basePath } startup` ) ;
612612 const curr = await res . text ( ) ;
613613 if ( startUp === "" ) startUp = curr ;
614614 if ( startUp !== curr ) {
@@ -619,7 +619,7 @@ export const MM = {
619619 } catch ( err ) {
620620 Log . error ( `MagicMirror not reachable: ${ err } ` ) ;
621621 }
622- } , config . checkServerInterval ) ;
622+ } , globalThis . config . checkServerInterval ) ;
623623 }
624624 } ,
625625
0 commit comments