Skip to content

Commit 584e271

Browse files
committed
add back /edit/ handler and specify ES6 quote chars for jsmin
1 parent a46a44d commit 584e271

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

supervisor/shared/web_workflow/static/edit.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ require(["ace/ace", "ace/ext/settings_menu"], function (ace) {
4040
},
4141
readOnly: true
4242
}]);
43-
44-
4543
});
4644

4745
let filename = location.hash.substring(1);

supervisor/shared/web_workflow/web_workflow.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,16 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) {
10131013
}
10141014
}
10151015
}
1016+
} else if (strcmp(request->path, "/edit/") == 0) {
1017+
if (!request->authenticated) {
1018+
if (_api_password[0] != '\0') {
1019+
_reply_unauthorized(socket, request);
1020+
} else {
1021+
_reply_forbidden(socket, request);
1022+
}
1023+
} else {
1024+
_REPLY_STATIC(socket, request, edit_html);
1025+
}
10161026
} else if (memcmp(request->path, "/cp/", 4) == 0) {
10171027
const char *path = request->path + 3;
10181028
if (strcmp(request->method, "GET") != 0) {

tools/gen_web_workflow_static.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
if f.name.endswith(".html"):
3030
uncompressed = minify_html.minify(uncompressed.decode("utf-8")).encode("utf-8")
3131
elif f.name.endswith(".js"):
32-
uncompressed = jsmin.jsmin(uncompressed.decode("utf-8")).encode("utf-8")
32+
uncompressed = jsmin.jsmin(uncompressed.decode("utf-8"), quote_chars="'\"`").encode(
33+
"utf-8"
34+
)
3335
compressed = gzip.compress(uncompressed)
3436
clen = len(compressed)
3537
compressed = ", ".join([hex(x) for x in compressed])

0 commit comments

Comments
 (0)