add back /edit/ handler and specify ES6 quote chars for jsmin

This commit is contained in:
foamyguy 2022-07-15 19:49:03 -05:00
parent a46a44db26
commit 584e27139e
3 changed files with 13 additions and 3 deletions

View File

@ -40,8 +40,6 @@ require(["ace/ace", "ace/ext/settings_menu"], function (ace) {
}, },
readOnly: true readOnly: true
}]); }]);
}); });
let filename = location.hash.substring(1); let filename = location.hash.substring(1);

View File

@ -1013,6 +1013,16 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) {
} }
} }
} }
} else if (strcmp(request->path, "/edit/") == 0) {
if (!request->authenticated) {
if (_api_password[0] != '\0') {
_reply_unauthorized(socket, request);
} else {
_reply_forbidden(socket, request);
}
} else {
_REPLY_STATIC(socket, request, edit_html);
}
} else if (memcmp(request->path, "/cp/", 4) == 0) { } else if (memcmp(request->path, "/cp/", 4) == 0) {
const char *path = request->path + 3; const char *path = request->path + 3;
if (strcmp(request->method, "GET") != 0) { if (strcmp(request->method, "GET") != 0) {

View File

@ -29,7 +29,9 @@ for f in args.files:
if f.name.endswith(".html"): if f.name.endswith(".html"):
uncompressed = minify_html.minify(uncompressed.decode("utf-8")).encode("utf-8") uncompressed = minify_html.minify(uncompressed.decode("utf-8")).encode("utf-8")
elif f.name.endswith(".js"): elif f.name.endswith(".js"):
uncompressed = jsmin.jsmin(uncompressed.decode("utf-8")).encode("utf-8") uncompressed = jsmin.jsmin(uncompressed.decode("utf-8"), quote_chars="'\"`").encode(
"utf-8"
)
compressed = gzip.compress(uncompressed) compressed = gzip.compress(uncompressed)
clen = len(compressed) clen = len(compressed)
compressed = ", ".join([hex(x) for x in compressed]) compressed = ", ".join([hex(x) for x in compressed])