A web UI to run on balenaDash. Make post
requests with a URL parameter to have the server launch a subprocess and show the submitted URL on screen.
- I wrote a blog post about the project.
- See also resin.io's excellent instructions for using this system
Quick video demo below (click to play on YouTube). The "Hello World" page is our base WPE_URL
:
To compile for raspi:
env GOOS=linux GOARCH=arm GOARM=5 go build
Copy the binary and templates
directory onto the raspi and run it:
chmod +x tohora
./tohora PORT COMMAND
PORT
is the port number. Use 80 for vanilla httpCOMMAND
is the command that the URL is passed to. On balenaDash, useWPELauncher
e.g../tohora 80 WPELauncher
. For manual testing/development try-outs usesleep
or something equally harmless, e.g.go run tohora.go 8000 sleep
.
In balena, open port 80 on your docker container and turn on the public URL feature. Then the web UI will be served at the public URL.
After opening the public URL (see above), add a slack app to allow you to throw URLs onto your screen. Start at https://api.slack.com/apps?new_app=1 and set up a new "Slash command" like this:
Post or Slack an empty URL or click the 'Clear' button to clear the screen.
Make changes to your display by sending POST requests with a url
parameter to /launch/
from any other app/language that can communicate over HTTP.
Here's an example with curl
:
curl --data-urlencode "url=https://www.google.com/?q=tohora&a=b" http://<Device IP address>:8080/launch/
Note that URL encoding (aka percent encoding) is necessary here, otherwise the ampersand is interpreted as a separation character and &a=b
isn't included in the value of url
. curl -d
doesn't do exactly the same thing. Be careful to think about encoding if you are calling from other languages too.
tohora Copyright (C) 2019 Richard Morrison www.rmorrison.net
This program comes with ABSOLUTELY NO WARRANTY; for details see `LICENSE`.
This is free software, and you are welcome to redistribute it
under certain conditions; see `LICENSE` for details.