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.

    Show calendar based on IP Address accessed

    Scheduled Pinned Locked Moved Development
    68 Posts 3 Posters 21.4k Views 3 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.
    • M Offline
      MMRIZE @Spinster
      last edited by

      @Spinster
      Ah I suddenly remember that getting Internal IP with only JavaScript on client browseris hard.
      Hmmm another approach might be needed.

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

        @MMRIZE that is why you need the express api call…

        I would make a separate module that has ip in div, not shown, but w id

        then call in calendar is document.get…
        compare, your way or on cal entries
        more synchronous…

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        M 1 Reply Last reply Reply Quote 0
        • M Offline
          MMRIZE @sdetweil
          last edited by

          @sdetweil
          Yes. I thought a small module with node_helper that could return clients’ ip as a result of REST api call from calendar module.

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

            @MMRIZE and that module calls its own rest call publishes the address in its getDom() result, with id= on div

            and then cal module can use synchronous document.getElementsById()

            to get that value.

            Sam

            How to add modules

            learning how to use browser developers window for css changes

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

              @MMRIZE @Spinster

              so the little module is

              https://github.com/sdetweil/getip

              and it does correctly return the ip address of the client… tested from 4 different systems to the same MM…

              see later post for final solution

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              S 2 Replies Last reply Reply Quote 0
              • S Offline
                Spinster @sdetweil
                last edited by

                @sdetweil @MMRIZE

                Wow, you are quick, you have given me some homework. Will use your code and get back with the result.

                Thank you so much for your patience and understanding.

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

                  @sdetweil

                  I tried your code, but find that once I include getip module in config.js, I am not seeing any output for calendar. Is this the expected output. Without getip module, I find that client_ip = document.getElementById("getip is returning null.Please advice

                  S M 3 Replies Last reply Reply Quote 0
                  • S Offline
                    sdetweil @Spinster
                    last edited by sdetweil

                    @Spinstersee later post

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    S 1 Reply Last reply Reply Quote 0
                    • M Offline
                      MMRIZE @Spinster
                      last edited by

                      @Spinster
                      By the way, which client are you using? Electron? Or Browser?

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        Spinster @MMRIZE
                        last edited by

                        @MMRIZE Browser as of now.

                        I also tried using express ipfilter, but the problem is I don’t know how to use it in module.js, it is throwing error saying ipfilter not known etc

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 5
                        • 6
                        • 7
                        • 1 / 7
                        • 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