mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-10 15:19:25 +00:00
fix poorly merged file
This commit is contained in:
parent
84beae1001
commit
4204c494ae
@ -298,86 +298,6 @@ void middlewareSpeedUp160(HTTPRequest *req, HTTPResponse *res, std::function<voi
|
|||||||
}
|
}
|
||||||
timeSpeedUp = millis();
|
timeSpeedUp = millis();
|
||||||
}
|
}
|
||||||
void handleStaticBrowse(HTTPRequest *req, HTTPResponse *res)
|
|
||||||
{
|
|
||||||
// Get access to the parameters
|
|
||||||
ResourceParameters *params = req->getParams();
|
|
||||||
std::string paramValDelete;
|
|
||||||
|
|
||||||
// Set a default content type
|
|
||||||
res->setHeader("Content-Type", "text/html");
|
|
||||||
|
|
||||||
if (params->getQueryParameter("delete", paramValDelete)) {
|
|
||||||
std::string pathDelete = "/" + paramValDelete;
|
|
||||||
if (SPIFFS.remove(pathDelete.c_str())) {
|
|
||||||
Serial.println(pathDelete.c_str());
|
|
||||||
res->println("<html><head><meta http-equiv=\"refresh\" content=\"3;url=/static\" /><title>File "
|
|
||||||
"deleted!</title></head><body><h1>File deleted!</h1>");
|
|
||||||
res->println("<meta http-equiv=\"refresh\" content=\"2;url=/static\" />\n");
|
|
||||||
res->println("</body></html>");
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
Serial.println(pathDelete.c_str());
|
|
||||||
res->println("<html><head><meta http-equiv=\"refresh\" content=\"3;url=/static\" /><title>Error deleteing "
|
|
||||||
"file!</title></head><body><h1>Error deleteing file!</h1>");
|
|
||||||
res->println("Error deleteing file!<br>");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
res->println("<h2>Upload new file</h2>");
|
|
||||||
res->println("<p><b>*** This interface is experimental ***</b></p>");
|
|
||||||
res->println("<p>This form allows you to upload files. Keep your filenames very short and files small. Big filenames and big "
|
|
||||||
"files are a known problem.</p>");
|
|
||||||
res->println("<form method=\"POST\" action=\"/upload\" enctype=\"multipart/form-data\">");
|
|
||||||
res->println("file: <input type=\"file\" name=\"file\"><br>");
|
|
||||||
res->println("<input type=\"submit\" value=\"Upload\">");
|
|
||||||
res->println("</form>");
|
|
||||||
|
|
||||||
res->println("<h2>All Files</h2>");
|
|
||||||
|
|
||||||
File root = SPIFFS.open("/");
|
|
||||||
if (root.isDirectory()) {
|
|
||||||
res->println("<script type=\"text/javascript\">function confirm_delete() {return confirm('Are you sure?');}</script>");
|
|
||||||
|
|
||||||
res->println("<table>");
|
|
||||||
File file = root.openNextFile();
|
|
||||||
while (file) {
|
|
||||||
String filePath = String(file.name());
|
|
||||||
if (filePath.indexOf("/static") == 0) {
|
|
||||||
res->println("<tr>");
|
|
||||||
res->println("<td>");
|
|
||||||
|
|
||||||
if (String(file.name()).substring(1).endsWith(".gz")) {
|
|
||||||
String modifiedFile = String(file.name()).substring(1);
|
|
||||||
modifiedFile.remove((modifiedFile.length() - 3), 3);
|
|
||||||
res->print("<a href=\"" + modifiedFile + "\">" + String(file.name()).substring(1) + "</a>");
|
|
||||||
} else {
|
|
||||||
res->print("<a href=\"" + String(file.name()).substring(1) + "\">" + String(file.name()).substring(1) +
|
|
||||||
"</a>");
|
|
||||||
}
|
|
||||||
res->println("</td>");
|
|
||||||
res->println("<td>");
|
|
||||||
res->print(String(file.size()));
|
|
||||||
res->println("</td>");
|
|
||||||
res->println("<td>");
|
|
||||||
res->print("<a href=\"/static?delete=" + String(file.name()).substring(1) +
|
|
||||||
"\" onclick=\"return confirm_delete()\">X</a>");
|
|
||||||
res->println("</td>");
|
|
||||||
}
|
|
||||||
|
|
||||||
file = root.openNextFile();
|
|
||||||
}
|
|
||||||
res->println("</table>");
|
|
||||||
|
|
||||||
res->print("<br>");
|
|
||||||
res->print("Total : " + String(SPIFFS.totalBytes()) + " Bytes<br>");
|
|
||||||
res->print("Used : " + String(SPIFFS.usedBytes()) + " Bytes<br>");
|
|
||||||
res->print("Free : " + String(SPIFFS.totalBytes() - SPIFFS.usedBytes()) + " Bytes<br>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleStaticPost(HTTPRequest *req, HTTPResponse *res)
|
void handleStaticPost(HTTPRequest *req, HTTPResponse *res)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user