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.

    Trading module

    Scheduled Pinned Locked Moved Requests
    25 Posts 4 Posters 19.0k 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.
    • P
      plumcraft
      last edited by

      Yes, will be happy to try it !

      thks

      1 Reply Last reply
      Reply Quote 0
      • A
        alexyak
        last edited by

        Alright I’ve just published it. Enjoy: :)

        https://forum.magicmirror.builders/topic/496/stocks

        1 Reply Last reply
        Reply Quote 0
        • P
          plumcraft
          last edited by

          I got an error when trying your module :

          stocks.js:110 GET http://finance.google.com/finance/info?client=ig&q=.DJI,MSFT,AAPL,GOOG,INTC,CICS,TSLA,FB getStocks @ stocks.js:110start @ stocks.js:19startModules @ loader.js:55(anonymous function) @ loader.js:40stylesheet.onload @ loader.js:190
          192.168.0.31/:1 XMLHttpRequest cannot load http://finance.google.com/finance/info?client=ig&q=.DJI,MSFT,AAPL,GOOG,INTC,CICS,TSLA,FB. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://192.168.0.31:8080’ is therefore not allowed access. The response had HTTP status code 500.

          It might be a configuration issue on my side ?

          Thanks

          A 1 Reply Last reply
          Reply Quote 0
          • A
            alexyak @plumcraft
            last edited by

            @plumcraft Hmm… that’s strange why you’re getting the CORS error. It works for me directly from the chromium… Where’re you running it from?

            1 Reply Last reply
            Reply Quote 0
            • P
              plumcraft
              last edited by

              @alexyak : I’m testing it from a remote computer and directly on my RPI , and same issue…, don’t get it :(

              A 1 Reply Last reply
              Reply Quote 0
              • A
                alexyak
                last edited by

                ok then the easiest solution would be to move this call to the node_helper…

                1 Reply Last reply
                Reply Quote 0
                • A
                  alexyak @plumcraft
                  last edited by

                  @plumcraft Ok, I found a bug in the code. Try to pull the latest and see if it runs for you.

                  1 Reply Last reply
                  Reply Quote 0
                  • P
                    plumcraft
                    last edited by

                    @alexyak : thanks for your quick reply but no luck with the latest pull

                    1 Reply Last reply
                    Reply Quote 0
                    • P
                      plumcraft
                      last edited by

                      I’ve tried to enable Cors which looks like the issue here but does not make any difference

                      (I’ve followed instructions on this website : http://jonathanmh.com/how-to-enable-cors-in-express-js-node-js/)

                      A 1 Reply Last reply
                      Reply Quote 0
                      • A
                        alexyak @plumcraft
                        last edited by

                        @plumcraft could you please try the following:

                        Update the electron.js (it’s in the \js\ folder). Instead of:

                        mainWindow = new BrowserWindow({width: 800, height: 600,  fullscreen: true, autoHideMenuBar: true, darkTheme: true, webPreferences: {nodeIntegration: false}});
                        

                        Replace it with:

                        mainWindow = new BrowserWindow({width: 800, height: 600,  fullscreen: true, autoHideMenuBar: true, darkTheme: true, webPreferences: {nodeIntegration: false, webSecurity: false}});
                        
                        1 Reply Last reply
                        Reply Quote 0
                        • P
                          plumcraft
                          last edited by

                          @alexyak,

                          My bad Alexyak, it was working even if webSecurity was not set. It was an issue in my config.js, sorry for that.

                          Your module is working only on the RPI, not inside a browser (webSecurity: false or true) but it’s not a big deal.

                          I will try to find a solution

                          A 1 Reply Last reply
                          Reply Quote 0
                          • A
                            alexyak @plumcraft
                            last edited by

                            @plumcraft the webSecurity flag will only work for running in the electron on RPI. Which web browser are you trying to run it in? It works for me for chrome and safari.

                            1 Reply Last reply
                            Reply Quote 0
                            • P
                              plumcraft
                              last edited by

                              @alexyak I’m using Google Chrome, does not work on Safari either.

                              A 1 Reply Last reply
                              Reply Quote 0
                              • A
                                alexyak @plumcraft
                                last edited by

                                @plumcraft could you please make sure that you pulled the latest version of the MM from github?

                                1 Reply Last reply
                                Reply Quote 0
                                • P
                                  plumcraft
                                  last edited by plumcraft

                                  @alexyak Just tried it, i’m having the same issue :(

                                  A 1 Reply Last reply
                                  Reply Quote 0
                                  • MichMichM
                                    MichMich
                                    last edited by MichMich

                                    To prevent these kind of issues (and improve security) I suggest all cross server calls are done in the node helper. (That’s what the node helper is for)

                                    A 1 Reply Last reply
                                    Reply Quote 0
                                    • A
                                      alexyak @MichMich
                                      last edited by

                                      @MichMich as a rule of thumb yes, but there could be exceptions :)

                                      MichMichM 1 Reply Last reply
                                      Reply Quote 0
                                      • A
                                        alexyak @plumcraft
                                        last edited by

                                        @plumcraft I’ve updated the module to move the data request to the node_helper which means it should fix your CORS related error.
                                        Just pull the latest.

                                        1 Reply Last reply
                                        Reply Quote 0
                                        • P
                                          plumcraft
                                          last edited by

                                          @alexyak thanks, it works for me now :)

                                          A 1 Reply Last reply
                                          Reply Quote 0
                                          • A
                                            alexyak @plumcraft
                                            last edited by

                                            @plumcraft great! Enjoy :)

                                            1 Reply Last reply
                                            Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • 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