-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
webrepl: Allow the page to run from the device (over HTTP). #8931
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
Conversation
This looks really good. Just thinking through the before and after: Prior requirements and workflow:
New requirements and workflow:
So there's really no change in the requirements. It's just that you have to load a bit of HTML from the device first. Arguably this is cleaner because you now browse to the device in your browser, instead of browsing somewhere else then having to enter the address of your device. The case where the client loads the webrepl page from a local file (or local server) will still work, because the device still acts as a ws:// server. The only thing I can think of where it won't work anymore is if you preload https://micropython.org/webrepl in your browser, then change networks to the network with the device (eg connect to its AP) and connect to it. But that doesn't currently work anyway because of the HTTPS/WSS issue. The way to get this working would be to just load the webrepl page from a local file/local HTTP server. |
I merged the corresponding change in the webrepl repo, but I can't get this PR working. Trying on both PYBD-SF2 and esp8266, the browser is able to load the webrepl page/terminal, but then clicking "Connect" it just prints "Disconnected" in the terminal and does nothing else. |
I see the problem (you're using Firefox, but it's my bug). Will update this PR soon. |
Fixed for Firefox. Also updated the default startup message to say:
instead of
so the link can be directly opened. |
Thanks, that does now work. But there's still a small problem: using |
Fixed. Now runs the server until we get a successful websocket connection. |
The device will respond to a non-WS request with a simple page that loads websocket_content.js from a static host (http or https). However, even if the resources are https, the page is still http and therefore allows requesting to a WS (not WSS) websocket on the device. Removed unused client_handshake from websocket_helper, and then merges the remainder of this file (server_handshake) into webrepl.py (to reduce firmware size). Also added the respond-as-HTTP handling to server_handshake. The default HTTP response is a simple page that sets the base URL and then loads webrepl_content.js which document.write's the actual HTML. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
I tested it with PYBD-SF2 + Firefox and it works. Thank you! |
Add M5Stack Dial development board
This is an attempt to solve the issue where the publicly-hosted webrepl on https://micropython.org/webrepl is currently non-functional due to the page being served via https, but attempting to connect to a device hosting a non-secure websocket. See #5266
The main details of this change are in the corresponding webrepl client PR -- micropython/webrepl#70
This PR contains:
<base><script>
page.webrepl_cfg.py
(Consider making this part ofwebrepl_setup
flow?)For testing I've set the default host to
https://gitcdn.link/cdn/jimmo/webrepl/webrepl-on-device/
to point to the files from the PR but this should behttps://micropython.org/webrepl/
once deployed.