webrepl: Allow the page to run from the device (over HTTP). #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 micropython/micropython#5266The new behaviour is that the device itself serves up the webrepl client, but in order to minimise space on the device it is a very minimal page that contains a script tag that loads
https://micropython.org/webrepl/webrepl_content.js
. This then document.write's the HTML content that would have otherwise been loaded fromhttps://micropython.org/webrepl
.So now the page is allowed to access the device over non-secure websocket (as the page itself is http, despite the resources were loaded via https), and furthermore it's same-origin.
See edit-with-link-to-main-repo-PR-when-submitted for the corresponding change to the on-device code.
This PR contains:
webrepl_content.js
as there's only HTML to escape.