diff --git a/.gitignore b/.gitignore
index 3d76381..5b2ff74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,9 +4,7 @@
*.o
# Generated Asset Headers
-include/assets_index_html.h
-include/assets_cache_appcache.h
-include/assets_cacert_pem.h
+include/assets_*.h
# Frontend build artifacts
frontend/dist/
diff --git a/Makefile b/Makefile
index 91d4334..3bc0315 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,9 @@ ASSET_HEADER := include/assets_index_html.h
CA_HEADER := include/assets_cacert_pem.h
MANIFEST_HEADER := include/assets_cache_appcache.h
FRONTEND_MANIFEST := frontend/dist/cache.appcache
+FAVICON_SVG_HEADER := include/assets_favicon_svg.h
+ICON_PNG_HEADER := include/assets_icon_png.h
+
@@ -56,6 +59,14 @@ $(MANIFEST_HEADER): $(FRONTEND_DIST)
@echo "Generating Manifest asset header..."
$(PYTHON) tools/gen_assets.py $(FRONTEND_MANIFEST) $(MANIFEST_HEADER) cache_appcache
+$(FAVICON_SVG_HEADER): $(FRONTEND_DIST)
+ @echo "Generating Favicon SVG asset header..."
+ $(PYTHON) tools/gen_assets.py frontend/dist/favicon.svg $(FAVICON_SVG_HEADER) favicon_svg
+
+$(ICON_PNG_HEADER): $(FRONTEND_DIST)
+ @echo "Generating Icon PNG asset header..."
+ $(PYTHON) tools/gen_assets.py frontend/dist/icon.png $(ICON_PNG_HEADER) icon_png
+
$(CA_HEADER):
@echo "Downloading CA bundle..."
wget -O include/cacert.pem https://curl.se/ca/cacert.pem
@@ -67,14 +78,14 @@ $(FRONTEND_DIST):
@echo "Please run 'make frontend-build' locally on your host machine first."
@exit 1
-$(ELF): $(ASSET_HEADER) $(MANIFEST_HEADER) $(CA_HEADER) $(SRCS)
+$(ELF): $(ASSET_HEADER) $(MANIFEST_HEADER) $(CA_HEADER) $(FAVICON_SVG_HEADER) $(ICON_PNG_HEADER) $(SRCS)
@echo "Building $(ELF)..."
$(CC) $(CFLAGS) $(LDFLAGS) -o $(ELF) $(SRCS) $(LIBS)
@echo "Stripping $(ELF)..."
$(STRIP) $(ELF)
clean:
- rm -f $(ELF) $(ASSET_HEADER) $(MANIFEST_HEADER) $(CA_HEADER) src/*.o
+ rm -f $(ELF) $(ASSET_HEADER) $(MANIFEST_HEADER) $(CA_HEADER) $(FAVICON_SVG_HEADER) $(ICON_PNG_HEADER) src/*.o
diff --git a/frontend/index.html b/frontend/index.html
index 9fd61ee..a142bda 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -4,6 +4,8 @@
+
+
[[TITLE_PLACEHOLDER]]
diff --git a/frontend/public/apple-touch-icon.png b/frontend/public/apple-touch-icon.png
new file mode 100644
index 0000000..af73d86
Binary files /dev/null and b/frontend/public/apple-touch-icon.png differ
diff --git a/frontend/public/favicon-16x16.png b/frontend/public/favicon-16x16.png
new file mode 100644
index 0000000..65f1504
Binary files /dev/null and b/frontend/public/favicon-16x16.png differ
diff --git a/frontend/public/favicon-32x32.png b/frontend/public/favicon-32x32.png
new file mode 100644
index 0000000..9a7bd76
Binary files /dev/null and b/frontend/public/favicon-32x32.png differ
diff --git a/frontend/public/favicon.svg b/frontend/public/favicon.svg
index 6893eb1..f3c3a03 100644
--- a/frontend/public/favicon.svg
+++ b/frontend/public/favicon.svg
@@ -1 +1,16 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/frontend/public/icon-192.png b/frontend/public/icon-192.png
new file mode 100644
index 0000000..e6da7f2
Binary files /dev/null and b/frontend/public/icon-192.png differ
diff --git a/frontend/public/icon.png b/frontend/public/icon.png
new file mode 100644
index 0000000..15120c5
Binary files /dev/null and b/frontend/public/icon.png differ
diff --git a/src/main.c b/src/main.c
index faf21cf..ed9ca72 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,6 +17,8 @@
#include "assets_index_html.h"
#include "assets_cache_appcache.h"
+#include "assets_favicon_svg.h"
+#include "assets_icon_png.h"
#include "pldmgr.h"
@@ -720,9 +722,10 @@ static enum MHD_Result on_request(void *cls, struct MHD_Connection *conn,
}
}
- /* Only log significant requests, not pollers like /log */
+ /* Only log significant requests, not pollers like /log or static assets */
if (strcmp(url, ROUTE_LOG) != 0 && strcmp(url, ROUTE_INDEX) != 0 &&
- strcmp(url, ROUTE_INDEX_HTML) != 0) {
+ strcmp(url, ROUTE_INDEX_HTML) != 0 && strcmp(url, "/favicon.svg") != 0 &&
+ strcmp(url, "/icon.png") != 0) {
pldmgr_log("[PLDMGR] Request: %s %s\n", method, url);
}
@@ -801,6 +804,18 @@ static enum MHD_Result on_request(void *cls, struct MHD_Connection *conn,
MHD_RESPMEM_PERSISTENT);
MHD_add_response_header(resp, "Content-Type", "text/cache-manifest");
MHD_add_response_header(resp, "Cache-Control", "no-cache, must-revalidate");
+ } else if (strcmp(url, "/favicon.svg") == 0) {
+ resp = MHD_create_response_from_buffer(assets_favicon_svg_len,
+ (void *)assets_favicon_svg,
+ MHD_RESPMEM_PERSISTENT);
+ MHD_add_response_header(resp, "Content-Type", "image/svg+xml");
+ MHD_add_response_header(resp, "Cache-Control", "max-age=604800");
+ } else if (strcmp(url, "/icon.png") == 0) {
+ resp = MHD_create_response_from_buffer(assets_icon_png_len,
+ (void *)assets_icon_png,
+ MHD_RESPMEM_PERSISTENT);
+ MHD_add_response_header(resp, "Content-Type", "image/png");
+ MHD_add_response_header(resp, "Cache-Control", "max-age=604800");
} else if (strcmp(url, ROUTE_CHECK) == 0) {