pajowu / superbird-custom-webapp

92 stars 1 forks source link

write wrapper for websocket #2

Open pajowu opened 1 year ago

pajowu commented 1 year ago
huangyq23 commented 1 year ago

I think a lot of the functionality can be borrowed directly from the stock app.

It is possible to kill supervisord and run with a modified version of /etc/supervisord.conf.

By pass QTWEBENGINE_REMOTE_DEBUGGING per https://doc.qt.io/qt-5/qtwebengine-debugging.html and adb forward to the host, chromium dev tools can be attached directly to the device.

It is also possible to spin up a webserver from host and adb reverse into the device.

pajowu commented 1 year ago

oh nice, i haden't looked into the qtwebengine options. at least in my first simple tests i wasn't able to get the browser on the device to load the website from a webserver forwarded to the device via adb reverse (I could access the server on the device via curl, but the superbird app refused to load any content). But maybe I just tried the wrong way

pajowu commented 1 year ago

And regarding borrowing functionality from the stock app: Yes, certainly possible, however copyright. Also I think I would implement some stuff differently

huangyq23 commented 1 year ago

Here is the setup I have:

Adding QTWEBENGINE_REMOTE_DEBUGGING="0.0.0.0:4243", to superbird's environment setting in /tmp/supervisord.conf. (I copied it from /etc/supervisord.conf to not worry about read-only fs).

$ADB_COMMAND shell 'supervisorctl stop superbird'
$ADB_COMMAND shell 'killall supervisord'
sleep 5
$ADB_COMMAND shell '/usr/bin/python /usr/bin/supervisord -c /tmp/supervisord.conf'
$ADB_COMMAND forward tcp:4243 tcp:4243
$ADB_COMMAND reverse tcp:8080 tcp:8080

Obviously, the webpage will still have to open a websocket to avoid getting killed by Qt.

If you run a http proxy server on your host at 8080, you can add more environment variables like no_proxy="127.0.0.1,0.0.0.0,localhost", http_proxy="http://127.0.0.1:8080", https_proxy="http://127.0.0.1:8080", to allow it to connect to the internet via your host.

I also had to deal with cert date issue and manually update system clock via date command.

But in the end I can use it to browse the internet using chromium devtool.