• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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 3.8k 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.
  • P Offline
    preetpuri
    last edited by Oct 18, 2019, 12:00 AM

    Can we run single instance of magic mirror to cater to multiple clients with different module configuration. this is more of request where we let the Magic mirror run as Web Server and respond based on user profile and custom configuration?

    S 1 Reply Last reply Oct 18, 2019, 12:24 AM Reply Quote 0
    • S Away
      sdetweil @preetpuri
      last edited by Oct 18, 2019, 12:24 AM

      @preetpuri I believe the answer is no.
      It’s still a single instance, configured at the server.

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      P 1 Reply Last reply Oct 18, 2019, 12:27 AM Reply Quote 0
      • P Offline
        preetpuri @sdetweil
        last edited by Oct 18, 2019, 12:27 AM

        @sdetweil yeah, that’s what I think. I am trying to understand the flow in code to see if there is a simple/easier way to do it. Node.js not my strong suite so any inputs will be appreciated.

        S 1 Reply Last reply Oct 18, 2019, 1:01 AM Reply Quote 0
        • S Away
          sdetweil @preetpuri
          last edited by sdetweil Oct 18, 2019, 1:30 AM Oct 18, 2019, 1:01 AM

          @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 Oct 18, 2019, 5:54 PM

            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 Oct 18, 2019, 6:10 PM Reply Quote 0
            • S Away
              sdetweil @preetpuri
              last edited by sdetweil Oct 18, 2019, 8:20 PM Oct 18, 2019, 6:10 PM

              @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 Oct 18, 2019, 6:33 PM

                @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 Oct 18, 2019, 6:36 PM Reply Quote 0
                • S Away
                  sdetweil @preetpuri
                  last edited by Oct 18, 2019, 6:36 PM

                  @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
                  1 / 1
                  • First post
                    2/8
                    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