Skip to content

Add /code/ for online editing #6771

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

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions supervisor/shared/web_workflow/static/code.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Online Code Editor</title>
</head>

<body>
<script type="module" src="https://code.circuitpython.org/assets/js/device.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion supervisor/shared/web_workflow/static/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Edit</title>
<title>Offline Code Edit</title>
<link rel="stylesheet" href="http://circuitpython.org/assets/css/webworkflow-8.css">
<link rel="stylesheet" href="/style.css">
</head>
Expand Down
3 changes: 3 additions & 0 deletions supervisor/shared/web_workflow/web_workflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ static void _write_file_and_reply(socketpool_socket_obj_t *socket, _request *req

#define STATIC_FILE(filename) extern uint32_t filename##_length; extern uint8_t filename[]; extern const char *filename##_content_type;

STATIC_FILE(code_html);
STATIC_FILE(directory_html);
STATIC_FILE(directory_js);
STATIC_FILE(welcome_html);
Expand Down Expand Up @@ -1143,6 +1144,8 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) {
} else {
_REPLY_STATIC(socket, request, edit_html);
}
} else if (strcmp(request->path, "/code/") == 0) {
_REPLY_STATIC(socket, request, code_html);
} else if (strncmp(request->path, "/cp/", 4) == 0) {
const char *path = request->path + 3;
if (strcasecmp(request->method, "OPTIONS") == 0) {
Expand Down