From 1686a64bf3ee21363f0139c05c55fabf8620e4a1 Mon Sep 17 00:00:00 2001 From: Jonas Kohl Date: Sat, 20 Jul 2024 14:43:51 +0200 Subject: Add favicon (support) --- Makefile | 6 +++++- dev-server.php | 7 +++++++ src/favicon.ico | Bin 0 -> 1150 bytes 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/favicon.ico diff --git a/Makefile b/Makefile index 5a649a3..86803b0 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,11 @@ DEV_SERVER_BINDING?=127.0.0.1:19310 .PHONY: build/static publish dev-server -all: $(HTMLTARGETS) $(STATICFILES) build/static +all: $(HTMLTARGETS) $(STATICFILES) build/static build/favicon.ico + +build/favicon.ico: src/favicon.ico + cp src/favicon.ico build/ + build/static: rsync -rupE src/static build/ diff --git a/dev-server.php b/dev-server.php index 0577fdd..2e5aacb 100644 --- a/dev-server.php +++ b/dev-server.php @@ -32,6 +32,13 @@ elseif (str_ends_with($name, ".html")) { http_response_code(302); header("Location: /$name"); exit; +} elseif ($name === "favicon.ico" && is_file(SRCDIR . "/favicon.ico")) { + $path = SRCDIR . "/favicon.ico"; + $len = filesize($path); + header("Content-Type: image/x-icon"); + header("Content-Length: $len"); + readfile($path); + exit; } $include_file = FALLBACK_FILE; diff --git a/src/favicon.ico b/src/favicon.ico new file mode 100644 index 0000000..65332b1 Binary files /dev/null and b/src/favicon.ico differ -- cgit v1.2.3