Giter VIP home page Giter VIP logo

Comments (7)

andrepxx avatar andrepxx commented on May 27, 2024 1

Just thinking about it a bit deeper ...

I think it's even more complicated, since it's currently not possible to redirect from a "CGI". HTTP redirects (HTTP 3xx) are handled completely different from a "regular" (HTTP 200) response. So one would have to extend the web server code and API for this as well, or use the even more ugly and super-legacy "meta http-equiv" mechanism for it (if that is even still supported in modern browsers) or return an HTML document that includes JavaScript code that directs the browser back to the main page for the application after the form submission.

I'd still say it's technically possible, but it gets pretty "hacky" - which was probably why I decided to use drag and drop only in the first place. ;-)

(But I get it doesn't work on mobile.)

from go-dsp-guitar.

andrepxx avatar andrepxx commented on May 27, 2024 1

Ah, I thought you wanted to trigger a patch change from a mobile device (that you have on stage for example).

What you describe now (load a patch) is already possible - more or less. It's not exactly what you write, but in some regard it's even better / more flexible. I'll describe how it works.

There's currently no option for the DSP to load a patch on startup. This would probably not be too hard to implement, but perhaps you don't even need that functionality. Let me describe what is already possible.

As you know, you can already upload a patch file by dragging it into the browser window. The browser runs JavaScript code for the UI, which then performs the upload via XmlHttpRequest.

You can do that same file upload with a Linux utility called curl, without opening a browser, without displaying any UI or having any user interaction.

Start the dsp process in one terminal.

After the DSP is running (shows "Web interface ready: ..." message), in another terminal, use curl to send a patch file.

curl --http1.1 -k -F "cgi=persistence-restore" -F "patchfile=@/absolute/path/to/your/patch.json" https://localhost:8443/cgi-bin/dsp

curl will connect to the DSP process and upload the patch.

Other than your suggested solution, this requires two concurrent processes and you'll have to wait until the DSP is ready (and you won't have a signal when this is the case) before you can run the curl command to upload the patch file. This could be seen as a disadvantage.

The advantage is that this allows you to change patches "on-the-fly", without stopping the DSP. So you can change patches during your show, just as you would with another modeller. You just have to run curl whenever you need to change the patch. You can keep the DSP itself running. And of course, you can even do it remotely (have a different machine on the network send a patch file to the DSP) if you replace "localhost" with a different host / domain name or IP address.

Of course, if you have changed the default "TLSPort" in config/config.json, you will have to replace 8443 by the port number that your DSP process listens on for TLS connections.

Does this support your use-case or do you still feel like you need additional functionality?

from go-dsp-guitar.

andrepxx avatar andrepxx commented on May 27, 2024

Well, one could use forms with a file input, but it is very ugly and yields platform-specific UI, which cannot be styled with CSS, so it's not a good / consistent user experience.

I could try creating a separate upload page for mobile, which "somehow" uses file input and form submission. Then, the server / DSP process, upon receiving the form POST, would have to respond with a redirect, directing the browser back at the "main" UI page / HTML. To achieve this, it has to distinguish between "file uploaded by XmlHttpRequest" (respond with HTTP 200 OK and JSON content) and "file uploaded by form submission" (respond with a HTTP redirect back to the main page) as well, which one could do by including additional parameters to be submitted alongside the file.

It's a bit of a hack, since it "breaks" with the XmlHttpRequest / single-page design, and I'll have to see if I can make it so that at least the file input field itself is not visible, but still the (platform-specific) file chooser shows up.

Sounds like a nice programming exercise when one finds the time. ;-)

So technically, I'd expect it to be possible. As always, I'll have to see when I'm gonna find the time to experiment with this though.

from go-dsp-guitar.

benalb avatar benalb commented on May 27, 2024

Thank you very much for your quick answer, and for dsp, a great piece of software.

What about launch dsp with param, like "dsp --patchfile=/path/to/awesome_patch_file.json"?

from go-dsp-guitar.

benalb avatar benalb commented on May 27, 2024

Wow, that works, I scp the patch files to my phone, and then use the curl command from termux in my phone. Thank you very much. I'm closing the issue.

from go-dsp-guitar.

benalb avatar benalb commented on May 27, 2024

Even better, I can launch dsp and the curl command in the headless machine, No need to scp the patches.

from go-dsp-guitar.

andrepxx avatar andrepxx commented on May 27, 2024

Great that you found a solution that works! :-)

Just a hint: The communication between the DSP process and the UI is considered an "internal API" by our project. This means that it might change between versions of go-dsp-guitar without any regard for forward- or backwards-compatibility and without notice.

from go-dsp-guitar.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.