HISE Logo Forum
    • Categories
    • Register
    • Login

    New API: Server and FileSystem

    Scheduled Pinned Locked Moved General Questions
    71 Posts 8 Posters 5.3k Views
    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.
    • ustkU
      ustk @Christoph Hart
      last edited by ustk

      @Christoph-Hart
      Here's my habitual call
      https://www.studio427audio.com/?wc-api=serial-numbers-api&request=check&...

      here's what I set

      Server.setBaseURL("https://www.studio427audio.com");
      const var SerialNumbersAPI = "?wc-api=serial-numbers-api";    // subURL
      

      Can't help pressing F5 in the forum...

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by Christoph Hart

        That's not the sub-URL these are the GET arguments. Your sub URL is empty if you call the domain directly (haven't checked whether this works though, in my experience I've always called a sub URL). The parameter object should be

        const var p =
        {
            "wc-api": "serial-numbers-api",
            "request": "check"
        };
        
        Server.setBaseURL("https://www.studio427audio.com");
        Server.callWithGET("/", p, function(status, response)
        {
        
        });
        

        But what does the server return? If it's just a plain old text, it won't work so you need to make sure your server returns a JSON file.

        ustkU 2 Replies Last reply Reply Quote 1
        • ustkU
          ustk @Christoph Hart
          last edited by

          @Christoph-Hart I noticed in your example, the call adds a question mark at the end of the subURL.
          I don't know if it's added or not to my url, but I know I shouldn't have one...

          Can't help pressing F5 in the forum...

          1 Reply Last reply Reply Quote 0
          • ustkU
            ustk @Christoph Hart
            last edited by

            @Christoph-Hart I see! testing...

            Can't help pressing F5 in the forum...

            1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart
              last edited by

              This works here:

              Content.makeFrontInterface(600, 500);
              
              const var p =
              {
                  "wc-api": "serial-numbers-api",
                  "request": "check"
              };
              
              reg r;
              
              Server.setBaseURL("https://www.studio427audio.com");
              Server.callWithGET("/", p, function(status, response)
              {
                  r = response;
              });
              

              If you check r in the script watch table, it contains

              1 Reply Last reply Reply Quote 0
              • ustkU
                ustk @Christoph Hart
                last edited by

                @Christoph-Hart Yeah! Working! :)
                I didn't know the api is par of GET arguments, though it was the sub...
                It works like a charm! Thanks!

                Can't help pressing F5 in the forum...

                1 Reply Last reply Reply Quote 0
                • Christoph HartC
                  Christoph Hart
                  last edited by

                  Yes, the GET arguments will be embedded into the URL and POST data will be sent along with it. If your server supports it I'd recommend using POST data for sending authentification information as the other one is visible throughout the communication (which makes your SSL certificate pointless).

                  ustkU 1 Reply Last reply Reply Quote 1
                  • ustkU
                    ustk @Christoph Hart
                    last edited by ustk

                    @Christoph-Hart Yes that's what I intended to do once the most simple part works :)

                    Can't help pressing F5 in the forum...

                    1 Reply Last reply Reply Quote 0
                    • Christoph HartC
                      Christoph Hart
                      last edited by

                      FYI, I just added the deleteFileOrDirectory() function...

                      ustkU 1 Reply Last reply Reply Quote 1
                      • Casey KolbC
                        Casey Kolb
                        last edited by

                        This is awesome! Have been waiting for these features. Bravo!!

                        Casey Kolb
                        Founder & CEO of Lunacy Audio
                        Composer | Producer | Software Developer

                        1 Reply Last reply Reply Quote 1
                        • ustkU
                          ustk @Christoph Hart
                          last edited by

                          @Christoph-Hart Did someone tinkered with the File APIs?
                          I tried getFolder and findFiles with no success.
                          I put a *.js on the Desktop and used the location wildcard but findFiles returns an empty array...

                          FileSystem.getFolder("Desktop");
                          var fileList = FileSystem.findFiles("Desktop", "*.js", true)
                          

                          My end goal is to dump an encrypted file (but I don't see a dump file method except for the ol'dumpJSON of course)

                          Can't help pressing F5 in the forum...

                          1 Reply Last reply Reply Quote 0
                          • Christoph HartC
                            Christoph Hart
                            last edited by Christoph Hart

                            Use FileSystem.Desktop as argument.

                            And your end goal is one line of code :)

                            FileSystem.getFolder(FileSystem.Desktop).getChildFile("license.dat").writeEncryptedObject({"key": "1234"}, "1haDUHNEK1($NR");
                            
                            ustkU 3 Replies Last reply Reply Quote 1
                            • ustkU
                              ustk @Christoph Hart
                              last edited by

                              @Christoph-Hart 😎

                              Can't help pressing F5 in the forum...

                              1 Reply Last reply Reply Quote 0
                              • ustkU
                                ustk @Christoph Hart
                                last edited by ustk

                                @Christoph-Hart Thanks it works like a charm.
                                Although when using AppData location it does not work in Hise (Unknown function 'getChildFile')
                                USE_BACKEND issue?

                                Can't help pressing F5 in the forum...

                                1 Reply Last reply Reply Quote 0
                                • ustkU
                                  ustk @Christoph Hart
                                  last edited by

                                  @Christoph-Hart AppData does not work on compiled plugin either

                                  Can't help pressing F5 in the forum...

                                  1 Reply Last reply Reply Quote 0
                                  • Christoph HartC
                                    Christoph Hart
                                    last edited by

                                    Ah yes, I forgot to implement that one - it's a bit annoying because I have to rewrite some things to get the app data folder working in HISE...

                                    ustkU 1 Reply Last reply Reply Quote 1
                                    • ustkU
                                      ustk @Christoph Hart
                                      last edited by

                                      @Christoph-Hart Just seen the commit 👍
                                      testing...

                                      Can't help pressing F5 in the forum...

                                      1 Reply Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey
                                        last edited by d.healey

                                        Is there a way to pull an image from a server to paint onto a panel?

                                        Also could you add a function to check for network connectivity? because it's desirable to display different content if the user is working offline.

                                        Libre Wave - Freedom respecting instruments and effects
                                        My Patreon - HISE tutorials
                                        YouTube Channel - Public HISE tutorials

                                        1 Reply Last reply Reply Quote 1
                                        • d.healeyD
                                          d.healey
                                          last edited by d.healey

                                          FileSystem.browse(var startFolder, bool forSaving, String wildcard, var callback)

                                          Documentation not clear. What is the wildcard? Is there a way to get the start folder to be the config files location (similar to the {PROJECT_FOLDER} wildcard)? When I set forSaving to true it brings up an Open file dialog, when set to false it brings up a Save dialog. Shouldn't this be the other way around? What parameters are passed to the callback, is it just the file?

                                          FileSystem.getFolder(var locationType) What is locationType?

                                          Libre Wave - Freedom respecting instruments and effects
                                          My Patreon - HISE tutorials
                                          YouTube Channel - Public HISE tutorials

                                          Casey KolbC 1 Reply Last reply Reply Quote 1
                                          • Casey KolbC
                                            Casey Kolb @d.healey
                                            last edited by

                                            @d-healey I see your newest develop branch commit includes the new Server API 😍 Is this safe to use for now?

                                            Casey Kolb
                                            Founder & CEO of Lunacy Audio
                                            Composer | Producer | Software Developer

                                            d.healeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            13

                                            Online

                                            1.7k

                                            Users

                                            11.9k

                                            Topics

                                            103.4k

                                            Posts