Skip to content

Commit 3cd6dff

Browse files
authored
Merge pull request #7869 from thess/static-web-pages
Some improvements to Web Workflow static web pages
2 parents 4d7e543 + 27a97de commit 3cd6dff

File tree

8 files changed

+27
-5
lines changed

8 files changed

+27
-5
lines changed
Binary file not shown.
Binary file not shown.

supervisor/shared/web_workflow/static/directory.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<head>
44
<title></title>
55
<meta charset="UTF-8">
6-
<script src="/directory.js" defer=true></script>
76
<link rel="stylesheet" href="/style.css">
87
<link rel="stylesheet" href="http://circuitpython.org/assets/css/webworkflow-8.css">
98
</head>
@@ -21,4 +20,5 @@ <h1><a href="/"><img src="/favicon.ico"/></a>&nbsp;<span id="path"></span></h1>
2120
<label>Upload progress:<progress value="0"></progress></label>
2221
<hr>
2322
+📁&nbsp;<input type="text" id="name"><button type="submit" id="mkdir">Create Directory</button>
23+
<script src="/directory.js" defer=true></script>
2424
</body></html>

supervisor/shared/web_workflow/static/directory.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,13 @@ new_directory_name.oninput = () => {
267267
}
268268

269269
window.onhashchange = refresh_list;
270+
271+
window.addEventListener("pageshow", function (event) {
272+
var historyTraversal = event.persisted ||
273+
(typeof window.performance != "undefined" &&
274+
window.performance.navigation.type === 2);
275+
if (historyTraversal) {
276+
// Handle page restore.
277+
window.location.reload();
278+
}
279+
});

supervisor/shared/web_workflow/static/serial.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<title>Simple client</title>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<script src="/serial.js" defer=true></script>
87
<link rel="stylesheet" href="/style.css">
98
<link rel="stylesheet" href="http://circuitpython.org/assets/css/webworkflow-8.css">
109
</head>
@@ -16,11 +15,13 @@
1615
<div id="controls" style="flex: none; display: flex;">
1716
<fieldset style="display: inline-block; padding: 0;">
1817
<legend>Ctrl</legend>
18+
<button id="b">B</button>
1919
<button id="c">C</button>
2020
<button id="d">D</button>
2121
</fieldset>
2222
<textarea id="input" rows="1" spellcheck="false" wrap="off" style="resize: none; flex: auto; font-size: 1rem;" autocapitalize="none" autocomplete="off" autocorrect="off"></textarea>
2323
<button onclick="onSubmit(); return false;">Send</button>
2424
</div>
25+
<script src="/serial.js" defer=true></script>
2526
</body>
2627
</html>

supervisor/shared/web_workflow/static/serial.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ input.addEventListener("beforeinput", function(e) {
7272
}
7373
});
7474

75+
window.addEventListener("unload", function() {
76+
if (ws.readyState == WebSocket.OPEN) {
77+
ws.close();
78+
}
79+
});
80+
81+
let ctrl_b = document.querySelector("#b");
82+
ctrl_b.onclick = function() {
83+
ws.send("\x02");
84+
}
85+
7586
let ctrl_c = document.querySelector("#c");
7687
ctrl_c.onclick = function() {
7788
ws.send("\x03");

supervisor/shared/web_workflow/static/welcome.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<title>CircuitPython</title>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<script src="/welcome.js" defer=true></script>
87
<link rel="stylesheet" href="/style.css">
98
<link rel="stylesheet" href="http://circuitpython.org/assets/css/webworkflow-8.css">
109
</head>
@@ -30,5 +29,6 @@ <h2>Device Info:</h2>
3029
<h2>Here are other CircuitPython devices on your network:</h2>
3130
<ul id="devices">
3231
</ul>
32+
<script src="/welcome.js" defer=true></script>
3333
</body>
3434
</html>

supervisor/shared/web_workflow/web_workflow.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ STATIC_FILE(edit_js);
10021002
STATIC_FILE(style_css);
10031003
STATIC_FILE(serial_html);
10041004
STATIC_FILE(serial_js);
1005-
STATIC_FILE(blinka_16x16_ico);
1005+
STATIC_FILE(blinka_32x32_ico);
10061006

10071007
static void _reply_static(socketpool_socket_obj_t *socket, _request *request, const uint8_t *response, size_t response_len, const char *content_type) {
10081008
uint32_t total_length = response_len;
@@ -1303,7 +1303,7 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) {
13031303
} else if (strcmp(request->path, "/favicon.ico") == 0) {
13041304
// TODO: Autogenerate this based on the blinka bitmap and change the
13051305
// palette based on MAC address.
1306-
_REPLY_STATIC(socket, request, blinka_16x16_ico);
1306+
_REPLY_STATIC(socket, request, blinka_32x32_ico);
13071307
} else {
13081308
_reply_missing(socket, request);
13091309
}

0 commit comments

Comments
 (0)