MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Magic Mirror Server Only Mode

    Scheduled Pinned Locked Moved General Discussion
    8 Posts 2 Posters 4.2k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @preetpuri
      last edited by sdetweil

      @preetpuri js/app.js is the core app starter.

      It is used from js/electron.js or serveronly/index.js

      js/server.js is the express web server

      Server.js sets up to load index.html
      Electron.js loads index.html into the electron browser window.
      Otherwise, other browsers cause the file to be loaded

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • P Offline
        preetpuri
        last edited by

        Thanks, this helps. I made some quick changes in server.js to see if I can download different config.js based on user id (which has modules defined in it) but whenever browser renders with config1.js it shows me error page with “Please create a Config File”. So looks like config.js in tied or hardcoded with main app context. Still trying to troubleshoot but looks like it might not be that simple :(

        var userId = req.query.user;
        		if(userId === undefined){
        			configFile = "config/config.js";
        			console.log(+configFile)
        		} else {
        			configFile = "config/config" + userId	 + ".js";
        			console.log(configFile)
        		}
        
        
        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @preetpuri
          last edited by sdetweil

          @preetpuri yeh, its sort of backwards from what you want…

          it loads the config (app.start.loadconfig())
          loads the modules from the config (app.start.loadmodules())
          then starts the server from that config (app.start. new Server(config)

          what you want is
          load the config
          start the server

          on request/logon
          load the modules for this user
          redirect to index.html to load module side

          but this is not connection focused, therer is no unique storage by user/connection…

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • P Offline
            preetpuri
            last edited by

            @sdetweil said in Magic Mirror Server Only Mode:

            but this is not connection focused no unique storage by user/connection…

            Not sure If I understand the last part? Connection will be handled by Express and I can add user management module later.

            What I am thinking is that if I am able to load multiple modules for different user (trying it with multi config file). I can add logic to save module configuration for each user in DB (may be mongo) and whenever user logs in - fetch the module configuration from DB for that user and voila !!! (again easier said then done :))

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @preetpuri
              last edited by

              @preetpuri said in Magic Mirror Server Only Mode:

              and I can add user management module later.

              thats what I meant

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy