Merge branch 'main' into 2027

This commit is contained in:
Peter Johnson
2025-02-20 00:26:23 -08:00
123 changed files with 4634 additions and 2291 deletions

View File

@@ -270,6 +270,7 @@ void MyHttpConnection::ProcessRequest() {
}
// generate directory listing
wpi::SmallString<64> formatBuf;
fs::path indexpath = fs::path{fullpath} / "index.html";
if (qmap.Get("format", formatBuf).value_or("") == "json") {
wpi::json dirs = wpi::json::array();
wpi::json files = wpi::json::array();
@@ -288,6 +289,9 @@ void MyHttpConnection::ProcessRequest() {
200, "OK", "text/json",
wpi::json{{"dirs", std::move(dirs)}, {"files", std::move(files)}}
.dump());
} else if (fs::exists(indexpath)) {
SendFileResponse(200, "OK", GetMimeType("html"), indexpath,
"Content-Disposition: filename=\"index.html\"\r\n");
} else {
wpi::StringMap<std::string> dirs;
wpi::StringMap<std::string> files;