Merge branch 'master' of https://git.schle.nz/fabian/pitrix; added new effect tv_static.
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
@ -18,9 +18,9 @@ File upload_file;
|
||||
|
||||
void http_server_handle_file_upload() {
|
||||
if (http_server.uri() != "/upload") return;
|
||||
|
||||
|
||||
HTTPUpload upload = http_server.upload();
|
||||
|
||||
|
||||
if (upload.status == UPLOAD_FILE_START) {
|
||||
String filename = upload.filename;
|
||||
if (!filename.startsWith("/")) filename = "/" + filename;
|
||||
@ -42,7 +42,7 @@ void http_server_setup() {
|
||||
PGM_P text_plain = PSTR("text/plain");
|
||||
http_server.on("/", HTTP_GET, [&](){
|
||||
LOGln("HTTP * GET /");
|
||||
String message = "<html><head><title>Pitrix</title></head><body><h1>Pitrix</h1><a href='/settings'>Settings</a><p>Known animations:</p>";
|
||||
String message = "<html><head><title>Pitrix</title></head><body><h1>Pitrix</h1><p><a href='/settings'>Settings</a></p><p><a href='/effects'>Effect</a></p><p>Known animations:</p>";
|
||||
if (!SPIFFS.begin()) {
|
||||
message += "<strong>No SPIFFS file system found.</strong>";
|
||||
} else {
|
||||
@ -116,7 +116,7 @@ void http_server_setup() {
|
||||
}
|
||||
String name = http_server.arg("key");
|
||||
uint16_t value = http_server.arg("value").toInt();
|
||||
|
||||
|
||||
if (change_setting(name.c_str(), value)) {
|
||||
if (http_server.hasArg("redir")) {
|
||||
http_server.sendHeader("Location", "/settings");
|
||||
@ -150,6 +150,16 @@ void http_server_setup() {
|
||||
}
|
||||
http_server.send(500, "text/plain", "Could not read settings.");
|
||||
});
|
||||
http_server.on("/effects", HTTP_GET, [&]() {
|
||||
String message = "<html><head><title>Pitrix effects</title></head><body><h1>Pitrix settings</h1><a href='/'>Back to main page</a><table>";
|
||||
for (int i=0; i<effects_size; i++) {
|
||||
message += "<tr><td>";
|
||||
message += effects[i].name;
|
||||
message += "</td></tr>";
|
||||
}
|
||||
message += "</table></body></html>";
|
||||
http_server.send(200, "text/html", message);
|
||||
});
|
||||
http_server.on("/delete", HTTP_GET, [&]() {
|
||||
LOGln("HTTP * GET /delete");
|
||||
if (http_server.args()==0) {
|
||||
@ -216,7 +226,7 @@ void http_server_setup() {
|
||||
}
|
||||
});
|
||||
http_server.begin();
|
||||
|
||||
|
||||
MDNS.addService("_http", "_tcp", 80);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user