diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-02-03 22:23:07 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-02-16 01:20:39 +0100 |
| commit | 6be0c4fd6d80b99084c724277361ef84dd8aafb1 (patch) | |
| tree | 37654c09ad8760b3dd158c4da7f0d739c4301242 | |
| parent | edf67efd4662f63c62a1cb524761cc44831c7020 (diff) | |
Add dom.png and ::PNG content type.
| -rw-r--r-- | src/lib/http_server.cc | 6 | ||||
| -rw-r--r-- | src/lib/http_server.h | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/http_server.cc b/src/lib/http_server.cc index 83ad2551c..4a708a88c 100644 --- a/src/lib/http_server.cc +++ b/src/lib/http_server.cc @@ -92,6 +92,9 @@ Response::send(shared_ptr<Socket> socket) case Type::CSS: socket->write("Content-Type: text/css; charset=utf-8\r\n"); break; + case Type::PNG: + socket->write("Content-Type: image/png;\r\n"); + break; } socket->write(fmt::format("Content-Length: {}\r\n", _payload.length())); for (auto const& header: _headers) { @@ -118,6 +121,9 @@ HTTPServer::get_request(string const& url) } else if (url == "/common.css") { auto page = dcp::file_to_string(resources_path() / "web" / "common.css"); return Response(200, page, Response::Type::CSS); + } else if (url == "/dom.png") { + auto page = dcp::file_to_string(resources_path() / "web" / "dom.png"); + return Response(200, page, Response::Type::PNG); } else if (url == "/api/v1/status") { nlohmann::json json; { diff --git a/src/lib/http_server.h b/src/lib/http_server.h index 42307b124..d22a347d3 100644 --- a/src/lib/http_server.h +++ b/src/lib/http_server.h @@ -33,7 +33,8 @@ public: enum class Type { HTML, JSON, - CSS + CSS, + PNG }; Response(int code); |
