Open
Description
The current webrepl-code seems to be a bit outdated lack behind the feature progress of mpremote
. Additionally, the current file-transfer logic that aims to work while the REPL is blocked, however this can lead to filesystem corruption if the blocking code accesses the filesystem at the same time.
I propose the following:
- move the password-checking logic from
_webrepl
towebrepl.py
- remove the current file-transfer protocol, and with it the
_webrepl
module. - move the repl interaction from websocket "text" packages to "binary" packages, as the output from the repl is not required to be valid UTF-8, but just a byte sequence.
- implement the same logic that
mpremote
uses for file transfers in the webrepl client.
Removing _webrepl
and moving the password logic to webrepl.py
even seems to make the firmware smaller:
text data bss dec hex filename
606100 0 381308 987408 f1110 /home/jenkins/tmp/micropython/ports/rp2/build-RPI_PICO_W/firmware.elf
605668 0 381292 986960 f0f50 /home/jenkins/tmp/micropython/ports/rp2/build-RPI_PICO_W/firmware.elf
I've implemented a proof-of-concept here: https://github.com/felixdoerre/webreplv2 together with a new webrepl client.
The benefits over the current webrepl are:
- Allow binary data transfers over the websocket (this also helps other usages of the webrepl, like Thonny, or using the websocket as backend for
mpremote
instead of a serial device) - Implement a File-Browser in the webrepl-client, with file up- and download using the same primitives as
mpremote
- Implement
mip
to install packages directly from the webrepl-client - Implement the filesystem-mounting feature
- Implement direct mounting of a local directory through the browser (without uploading). Due to webapi limitations this is only a readonly mount.
- Allow browser-saving of the webrepl password
- Auto-connect the webrepl, if the target (and password) is known.
Do you want to include this into micropython, replacing the current webrepl module?