Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webrepl: Changes for more webrepl features while making it smaller. #814

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

felixdoerre
Copy link
Contributor

This change:

  • Moves the password checking to python
  • Removes the special file transfer protocol (This changes allows to extend mpremote to support webrepl just like a serial port)
  • Moves the REPL data to websocket binary packages

The change should be compatible with the current micropython version, however a new webrepl client needs to be deployed under https://micropython.org/webrepl/

Currently, to help you testing, I've adjusted the default URL to https://felix.dogcraft.de/webrepl/, where I host the corresponding draft "new" webrepl client. I've pushed the modified js code here, if you want to take a look: https://github.com/felixdoerre/webreplv2. I'm not completely sure, if I should open a PR in https://github.com/micropython/webrepl, as this seems to be the authoritative source of the client, but the repo seems to be abandoned for some time now.

The new webrepl client currently features (See also #13540):

  • A file browser, allowing directory listings, downloads and uploads. This uses the same injected code as mpremote.
  • An implementation of the mount-feature from mpremote that works with the same injected code. It allows mounting files from the browser's local storage (which can host some python scripts that one wants to bring for debugging), or from a local folder, that is drag-and-dropped into the webrepl (read-only), this is useful for rapid development/testing.
  • An implementation of mip with a package browser to list and download packages directly from https://micropython.org/pi/

Currently the "mount" feature has to be activated "manually" (by calling hookme() from the developer tools, and then executing __mount() in the repl manually). Also the UI for the file browser might not be super intuitive yet (the + for upload and mounting a local folder might be too small and not clear enough). So I'm hoping for UI improvement suggestions.

If you want, I can split the mount and the mip implementation into separate PRs, but the file-browser and this PR are dependent on each other.

With this change the _webrepl module from micropython is not needed anymore and can be removed.

@Carglglz
Copy link
Contributor

@felixdoerre this could be a good opportunity
to add SSL support to WebREPL using SSLContext see micropython/micropython#5611 (comment) 👍🏼

This change:
- Moves the password checking to python
- Removes the special file transfer protocol
- Moves the REPL data to websocket binary packages

Signed-off-by: Felix Dörre <felix@dogcraft.de>
Signed-off-by: Felix Dörre <felix@dogcraft.de>
@felixdoerre
Copy link
Contributor Author

I've pushed a few adjustments and an (optional) bonus commit to allow specifying an ssl context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants