• 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.

remoteFile in compliments module

Scheduled Pinned Locked Moved Troubleshooting
71 Posts 14 Posters 91.7k Views 15 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.
  • L Offline
    Lahim
    last edited by Dec 22, 2017, 9:31 PM

    I tried to change

    remoteFile: null,
    

    for remoteFile: ‘compliments.json’ previously but, as you know, did not help.
    Now I came back to the oryginal file, saved your compliments as json file in Notepad++ as you wrote, and…
    IT IS WORKING!!!

    Thank you so much!!!
    F…ck, so many time I spent tring different solutions and finaly it works.
    One more time thank you for attention and help!
    The module - great job!!

    M 1 Reply Last reply Dec 22, 2017, 11:09 PM Reply Quote 0
    • L Offline
      Lahim
      last edited by Dec 22, 2017, 10:43 PM

      Ok, I found where was the problem and where is the problem now.
      Because I am using Pi0 with Midori, with oryginal file the compliments were not show on the mirror but I was able to see them thru LAN.
      So I found the solution to change:

      if (this.config.remoteFile != null) {
                      this.complimentFile((response) => {
                              this.config.compliments = JSON.parse(response);
                      });
              }
      

      to:

               if (this.config.remoteFile != null) {
                      this.complimentFile(
                              function(response){
                                      this.config.compliments = JSON.parse(response);
                      });
              }
      

      and yes, that make my compliments shown on mirror but in same time the text is only from compliments.js file.
      So now, to see the compliments I have to copy own text to .js file :(

      That is the problem.

      1 Reply Last reply Reply Quote 0
      • M Offline
        Mykle1 Project Sponsor Module Developer @Lahim
        last edited by Dec 22, 2017, 11:09 PM

        @Lahim said in remoteFile in compliments module:

        IT IS WORKING!!!
        Thank you so much!!!

        Fantastic! You’re welcome. :-)

        Create a working config
        How to add modules

        1 Reply Last reply Reply Quote 0
        • L Offline
          Lahim
          last edited by Dec 23, 2017, 9:11 AM

          Will you be able to find the solution to the problem I described above?

          S 1 Reply Last reply Dec 23, 2017, 9:36 AM Reply Quote 0
          • S Offline
            strawberry 3.141 Project Sponsor Module Developer @Lahim
            last edited by Dec 23, 2017, 9:36 AM

            @Lahim because you changed the context by removing the arrow function, to preserve the context you have to do something like:

             if (this.config.remoteFile != null) {
              var self = this;
              this.complimentFile(function(response){
                self.config.compliments = JSON.parse(response);
              });
            }
            

            Please create a github issue if you need help, so I can keep track

            1 Reply Last reply Reply Quote 3
            • L Offline
              Lahim
              last edited by Dec 23, 2017, 2:22 PM

              I found it in the meantime but now I tested it - yes, it works!!!
              Thank you!

              1 Reply Last reply Reply Quote 0
              • Z Offline
                zeal
                last edited by zeal Jan 29, 2018, 1:09 PM Jan 29, 2018, 1:08 PM

                has anyone tried to get the compliments in an file on a external Server?

                M 1 Reply Last reply Jan 29, 2018, 1:28 PM Reply Quote 0
                • M Offline
                  Mykle1 Project Sponsor Module Developer @zeal
                  last edited by Jan 29, 2018, 1:28 PM

                  @zeal

                  I have not. By default, the compliments module looks for the compliments.json file in the compliments module folder. I suppose you could try using the path to the file on your server in your config entry

                  remoteFile: "PATH_TO_FILE_ON_SERVER/comliments.json",

                  Dunno if that will work though.

                  Create a working config
                  How to add modules

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