diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-02-03 22:40:27 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-02-16 01:20:39 +0100 |
| commit | 425d599055c66c63b6d52f0c6ef2da522e359ee7 (patch) | |
| tree | d5472468f6ea1228455624dd68f1338f047a84d7 /src/lib/http_server.cc | |
| parent | f3b446cdb542211ba0813c90899bce875f4da772 (diff) | |
Add substitute().
Diffstat (limited to 'src/lib/http_server.cc')
| -rw-r--r-- | src/lib/http_server.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/http_server.cc b/src/lib/http_server.cc index 4a708a88c..f30260d95 100644 --- a/src/lib/http_server.cc +++ b/src/lib/http_server.cc @@ -105,18 +105,24 @@ Response::send(shared_ptr<Socket> socket) } +void +HTTPServer::substitute(string& page) const +{ + boost::algorithm::replace_all(page, "TITLE", variant::dcpomatic_player()); + boost::algorithm::replace_all(page, "SIDEBAR", dcp::file_to_string(resources_path() / "web" / "sidebar.html")); +} + + Response HTTPServer::get_request(string const& url) { if (url == "/") { auto page = dcp::file_to_string(resources_path() / "web" / "index.html"); - boost::algorithm::replace_all(page, "TITLE", variant::dcpomatic_player()); - boost::algorithm::replace_all(page, "SIDEBAR", dcp::file_to_string(resources_path() / "web" / "sidebar.html")); + substitute(page); return Response(200, page); } else if (url == "/playlists") { auto page = dcp::file_to_string(resources_path() / "web" / "playlists.html"); - boost::algorithm::replace_all(page, "TITLE", variant::dcpomatic_player()); - boost::algorithm::replace_all(page, "SIDEBAR", dcp::file_to_string(resources_path() / "web" / "sidebar.html")); + substitute(page); return Response(200, page); } else if (url == "/common.css") { auto page = dcp::file_to_string(resources_path() / "web" / "common.css"); |
