Skip to content

Commit

Permalink
move css into include file, and reduce whitespace in hosted site. (#36)
Browse files Browse the repository at this point in the history
* Move all CSS into a include file, reduce whitespace count on primary html
* loading spinner, script tweaks, css fixes for image position/flow
* move camera index pages
* close button location needs to move as it rotates
  • Loading branch information
easytarget authored Sep 13, 2020
1 parent 71dd634 commit 91810ea
Show file tree
Hide file tree
Showing 7 changed files with 1,677 additions and 2,221 deletions.
22 changes: 20 additions & 2 deletions app_httpd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
#include "img_converters.h"
#include "Arduino.h"

#include "camera_index_ov2640.h"
#include "camera_index_ov3660.h"
#include "index_ov2640.h"
#include "index_ov3660.h"
#include "miniviewer.h"
#include "css.h"
#include "favicon/favicons.h"

//#define DEBUG_STREAM_DATA // Debug: dump info for each stream frame on serial port
Expand Down Expand Up @@ -664,6 +665,15 @@ static esp_err_t favicon_ico_handler(httpd_req_t *req){
return httpd_resp_send(req, (const char *)favicon_ico, favicon_ico_len);
}

static esp_err_t style_handler(httpd_req_t *req){
flashLED(75); // a little feedback to user
delay(75);
flashLED(75);
httpd_resp_set_type(req, "text/css");
httpd_resp_set_hdr(req, "Content-Encoding", "identity");
return httpd_resp_send(req, (const char *)style_css, style_css_len);
}

static esp_err_t miniviewer_handler(httpd_req_t *req){
flashLED(75); // a little feedback to user
delay(75);
Expand Down Expand Up @@ -724,6 +734,13 @@ void startCameraServer(int hPort, int sPort){
.user_ctx = NULL
};

httpd_uri_t style_uri = {
.uri = "/style.css",
.method = HTTP_GET,
.handler = style_handler,
.user_ctx = NULL
};

httpd_uri_t favicon_16x16_uri = {
.uri = "/favicon-16x16.png",
.method = HTTP_GET,
Expand Down Expand Up @@ -780,6 +797,7 @@ void startCameraServer(int hPort, int sPort){
httpd_register_uri_handler(camera_httpd, &status_uri);
httpd_register_uri_handler(camera_httpd, &capture_uri);
httpd_register_uri_handler(camera_httpd, &miniviewer_uri);
httpd_register_uri_handler(camera_httpd, &style_uri);
httpd_register_uri_handler(camera_httpd, &favicon_16x16_uri);
httpd_register_uri_handler(camera_httpd, &favicon_32x32_uri);
httpd_register_uri_handler(camera_httpd, &favicon_ico_uri);
Expand Down
Loading

0 comments on commit 91810ea

Please sign in to comment.