HISE Logo Forum
    • Categories
    • Register
    • Login

    Accessing Server API from HISE

    Scheduled Pinned Locked Moved General Questions
    server api
    31 Posts 7 Posters 2.0k 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.
    • gorangroovesG
      gorangrooves
      last edited by

      I am looking to provide plugin version-checking to display a message if a newer version is available. I have an API built and available on a server but need to somehow make the calls to it from HISE. I have a skilled developer doing this for me but we need to know the right direction/ approach to accomplish this.

      I understand that JUCE already has an API for interacting with a server. How do we bring this functionality into HISE @Christoph-Hart, please?

      Goran Rista
      https://gorangrooves.com

      Handy Drums and Handy Grooves
      https://library.gorangrooves.com

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

        @gorangrooves Adding an API is very easy, have a look at this recent commit I've made:
        https://github.com/davidhealey/HISE/commit/f56a93f281c9e22a0457dfc3ab42db4e390e6206

        If you want it to appear in the API list, however, there are additional steps:
        https://forum.hise.audio/topic/2773/how-to-update-apicollection-autocomplete-menu

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

        gorangroovesG J 2 Replies Last reply Reply Quote 1
        • gorangroovesG
          gorangrooves @ustk
          last edited by

          @ustk Thanks very much! Hopefully, this will be a good-enough pointer to make it happen 😉
          Am I correct to assume that we would need to recompile HISE with this module included?

          Goran Rista
          https://gorangrooves.com

          Handy Drums and Handy Grooves
          https://library.gorangrooves.com

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

            @gorangrooves Any change in the sources needs a new build to be effective (at least for the APIs though...)

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

            1 Reply Last reply Reply Quote 0
            • gorangroovesG
              gorangrooves
              last edited by

              @ustk Thank you. This should give us a pretty good direction.

              Goran Rista
              https://gorangrooves.com

              Handy Drums and Handy Grooves
              https://library.gorangrooves.com

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

                Maybe I can wrap the stuff I wrote for PercX into some Scripting API calls.

                It could be a minimal API to be as generic as possible, but should be able to handle session cookies for user authentication:

                
                // Use a RSA key to encrypt the login data
                var myprivatekey = "512.ljsdnvlkjnldsfkjvlkjdflkvjnsdfvkjnldkvbdfvdf";
                var mypublickey = "512.lkdncfdlkjfnvlkjsdnflkjvnbsdjhvasldfiaslkdnv";
                var credentials = Server.getLocalCredentials("credentials.dat", mypublickey);
                
                if(!isDefined(credentials))
                    credentials = { "user": "AAX/VST SDK", "password": "4321" };
                
                if(isDefined(credentials))
                {
                    // Call a login function on your server
                    Server.login("https://mysite.com/login", credentials, function(status, response)
                    {
                        // Any HTTP request will return 200 as status code for OK
                        if(status == 200)
                        {
                            // Save the credentials to a local file
                            Server.storeCredentials(credentials, myprivatekey);
                            // Store the session key into the cookie.
                            cookie = response;
                        }
                    });
                }
                
                // For each authenticated call you need to pass in the cookie plus a callback
                Server.call("https://mysite.com/getuserinfo", cookie, function(status, response)
                {
                    if(status == Server.StatusOK) // = 200
                    {
                        // do something with the response
                        // (probably a JSON object)
                    }
                    else
                    {
                        Console.print(status);
                    }    
                });
                

                However this requires some proper coding on the server backend to handle cookies and do proper HTTP responses.

                d.healeyD 1 Reply Last reply Reply Quote 2
                • d.healeyD
                  d.healey @Christoph Hart
                  last edited by

                  @Christoph-Hart Yes please!

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

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

                    what do you guys think about:

                    • Checking account via the internet at every session (so needs permanent access, which might suck)
                    • Or storing a unique license file on the client-side after activation (but a naughty customer might still keep the file for after a refund/cancel action)

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

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

                      @ustk said in Accessing Server API from HISE:

                      • Checking account via the internet at every session (so needs permanent access, which might suck)

                      I won't buy it.

                      • Or storing a unique license file on the client-side after activation (but a naughty client might still keep the file for after a refund/cancel action)

                      I also won't buy it :) but it is the lesser of the two evils (still evil though :p ).

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

                      ustkU 1 Reply Last reply Reply Quote 1
                      • ustkU
                        ustk @d.healey
                        last edited by

                        @d-healey I find the 1st dumb...
                        But what is you think is bad in the second? Is it not Christoph's principle above?

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

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

                          @ustk said in Accessing Server API from HISE:

                          But what is you think is bad in the second? Is it not Christoph's principle above?

                          I didn't look at Christoph's implementation, my use for server communication is not for restricting the user, I mainly want it to alert them to updates and provide an easy download interface.

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

                          ustkU LightandSoundL 2 Replies Last reply Reply Quote 1
                          • ustkU
                            ustk @d.healey
                            last edited by ustk

                            @d-healey So are you against a license activation system? without that you can distribute freely your product I think... :)
                            I don't see restriction where you just want an activation of the product

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

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

                              @ustk

                              So are you against a license activation system?

                              Basically, I'm anti-DRM.

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

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

                                Requiring an internet connection each time you load the plugin is an absolute no-go.

                                Or storing a unique license file on the client-side after activation (but a naughty client might still keep the file for after a refund/cancel action)

                                This is the way to go and don't bother about the naughty client, think about the legit customer who wants to use your plugin without Wifi access..

                                d.healeyD 1 Reply Last reply Reply Quote 4
                                • d.healeyD
                                  d.healey @Christoph Hart
                                  last edited by d.healey

                                  @Christoph-Hart said in Accessing Server API from HISE:

                                  This is the way to go and don't bother about the naughty client, think about the legit customer who wants to use your plugin without Wifi access..

                                  Why does the legit customer need restricting, unless they're naughty. ;)

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

                                  ustkU 1 Reply Last reply Reply Quote 0
                                  • LightandSoundL
                                    LightandSound @d.healey
                                    last edited by

                                    @d-healey you can do an a cheap and dirty update approach. Juce has an easy way to read a URL result as a text string and compare it with an input string, so you can just stick a .txt file on your site (hidden of course) and literally just have the text as the version number and match it against the current version. Whenever you load the plugin it can check that result against the internal version number and display it if needed. Just means you need to remember to update the text file.

                                    Similarly you can do this for file activation for online list of CD keys, and it helps you to be able to disable any cd keys that are chargebacked/refunded. For this you probably would want credentials though, as having a publicly available list of keys is not really ideal :p

                                    I might implement this in to my public branch once I'm finished with this chunk of work on release triggers

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

                                      Because there are different levels of naughtiness and you want to prevent the moderately naughty customer to just upload it on some filesharing hoster.

                                      Everybody has to find a solution that matches his paranoia and mine is a simple license scheme that prevents passing around a single copy across different computers without restriction, but I know there is a spectrum that spans from @d-healey to PACE :)

                                      1 Reply Last reply Reply Quote 3
                                      • ustkU
                                        ustk @d.healey
                                        last edited by

                                        @d-healey The solution lies in the payment form, just add a "I am a naughty customer" checkbox :)

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

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

                                          @ustk said in Accessing Server API from HISE:

                                          @d-healey The solution lies in the payment form, just add a "I am a naughty customer" checkbox :)

                                          I'm very tempted to implement that technique.

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

                                          1 Reply Last reply Reply Quote 1
                                          • ustkU
                                            ustk
                                            last edited by ustk

                                            It takes weeks if not months to take the plunge of buying a plugin (at least I am)
                                            Then 20min to actually buy it
                                            Then 1min to hours for the download
                                            Then 1-10min for the install/running
                                            Then 30sec to type the credentials
                                            Then 5-10sec to click activate and wait for the result...

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

                                            LindonL gorangroovesG 2 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            53

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts