From 525eb711c1f5b4e13c951aeae6ce123bd8f53393 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 16 Aug 2022 15:44:58 -0700 Subject: [PATCH] Add /code/ for online editing --- supervisor/shared/web_workflow/static/code.html | 12 ++++++++++++ supervisor/shared/web_workflow/static/edit.html | 2 +- supervisor/shared/web_workflow/web_workflow.c | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 supervisor/shared/web_workflow/static/code.html diff --git a/supervisor/shared/web_workflow/static/code.html b/supervisor/shared/web_workflow/static/code.html new file mode 100644 index 0000000000..e70266e2ed --- /dev/null +++ b/supervisor/shared/web_workflow/static/code.html @@ -0,0 +1,12 @@ + + + + + + Online Code Editor + + + + + + diff --git a/supervisor/shared/web_workflow/static/edit.html b/supervisor/shared/web_workflow/static/edit.html index e11b094d2c..85408ed2b5 100644 --- a/supervisor/shared/web_workflow/static/edit.html +++ b/supervisor/shared/web_workflow/static/edit.html @@ -2,7 +2,7 @@ - Code Edit + Offline Code Edit diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 1144d41bdc..ec0ecb2775 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -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); @@ -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) {