From a808ec07cbbb4fc6118d97b8e7985debe1274a5f Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 19 May 2024 00:58:38 +0500 Subject: feat: use cfg to replace placeholders --- web/src/handlers.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'web/src/handlers.cpp') diff --git a/web/src/handlers.cpp b/web/src/handlers.cpp index 1dfeb81..03cddd9 100644 --- a/web/src/handlers.cpp +++ b/web/src/handlers.cpp @@ -2,14 +2,17 @@ #include #include +#include #include +#include "config.hpp" #include "crow/http_response.h" #include "crow/mustache.h" #include "maddy/parser.h" namespace botweb { - crow::response get_wiki_page(const std::string &path) { + crow::response get_wiki_page(const std::string &path, + const std::optional &cfg) { std::shared_ptr parser = std::make_shared(); std::ifstream contents("docs/" + path + ".md"); @@ -25,6 +28,8 @@ namespace botweb { crow::mustache::context ctx; ctx["content"] = contents_html; ctx["summary"] = summary_html; + ctx["contact_url"] = (*cfg).contact_url; + ctx["contact_name"] = (*cfg).contact_name; return crow::response(200, page.render(ctx)); } -- cgit v1.2.3