diff options
| author | ilotterytea <iltsu@alright.party> | 2024-05-19 00:58:38 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-05-19 00:58:38 +0500 |
| commit | a808ec07cbbb4fc6118d97b8e7985debe1274a5f (patch) | |
| tree | 4d9ce401fac0265018274db20531f73fe612fa8e /web/src/handlers.cpp | |
| parent | feede6c8024147d0b2f12c18d7dca622a797645b (diff) | |
feat: use cfg to replace placeholders
Diffstat (limited to 'web/src/handlers.cpp')
| -rw-r--r-- | web/src/handlers.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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 <fstream> #include <memory> +#include <optional> #include <string> +#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<Configuration> &cfg) { std::shared_ptr<maddy::Parser> parser = std::make_shared<maddy::Parser>(); 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)); } |
