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/main.cpp | |
| parent | feede6c8024147d0b2f12c18d7dca622a797645b (diff) | |
feat: use cfg to replace placeholders
Diffstat (limited to 'web/src/main.cpp')
| -rw-r--r-- | web/src/main.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/web/src/main.cpp b/web/src/main.cpp index b63151c..314d2bf 100644 --- a/web/src/main.cpp +++ b/web/src/main.cpp @@ -9,15 +9,22 @@ int main(int argc, char *argv[]) { crow::SimpleApp app; CROW_ROUTE(app, "/") - ([]() { + ([&cfg]() { auto page = crow::mustache::load("index.html"); - return page.render(); + crow::mustache::context ctx; + ctx["contact_url"] = (*cfg).contact_url; + ctx["contact_name"] = (*cfg).contact_name; + + return page.render(ctx); }); - CROW_ROUTE(app, "/wiki")([]() { return botweb::get_wiki_page("/README"); }); + CROW_ROUTE(app, "/wiki") + ([&cfg]() { return botweb::get_wiki_page("/README", cfg); }); CROW_ROUTE(app, "/wiki/<path>") - ([](const std::string &path) { return botweb::get_wiki_page(path); }); + ([&cfg](const std::string &path) { + return botweb::get_wiki_page(path, cfg); + }); app.multithreaded().port(18083).run(); return 0; |
