diff --git a/.gitignore b/.gitignore index 5900ea9..f4288a4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ game/.prop_tool_temp/** settings.ini -www/** data/** export/** release/** diff --git a/app/wp_application.cpp b/app/wp_application.cpp index cfb3820..1a8529f 100644 --- a/app/wp_application.cpp +++ b/app/wp_application.cpp @@ -36,35 +36,32 @@ void WPApplication::routing_middleware(Object *instance, Request *request) { return; } - HandlerInstance handler_data; - handler_data.instance = instance; - if (request->get_path_segment_count() == 0) { - handler_data.handler_func = index; + request->handler_instance = app->index_func; } else { const std::string main_route = request->get_current_path_segment(); request->push_path(); if (main_route == "blog") { - handler_data.handler_func = blog; + request->handler_instance = app->blog_func; } } - if (!handler_data.handler_func) { + if (!request->handler_instance.handler_func) { app->send_error(404, request); return; } - request->handler_instance = handler_data; request->next_stage(); } void WPApplication::setup_routes() { DWebApplication::setup_routes(); - index_func = HandlerInstance(index); + index_func = HandlerInstance(index, this); + blog_func = HandlerInstance(blog, this); } void WPApplication::setup_middleware() { @@ -78,17 +75,14 @@ void WPApplication::compile_menu() { HTMLBuilder bh; bh.meta()->charset_utf_8(); - bh.meta()->name("description")->content("RPG browsergame"); - bh.meta()->name("keywords")->content("RPG,browsergame,Mourne,game,play"); bh.title(); - bh.w("Mourne"); + bh.w("WPSaver"); bh.ctitle(); - bh.link()->rel_stylesheet()->href("/css/base.css"); - bh.link()->rel_stylesheet()->href("/css/menu.css"); + bh.link()->rel_stylesheet()->href("site.css"); bh.write_tag(); - menu_head = bh.result; + header = bh.result; HTMLBuilder bf; @@ -108,5 +102,3 @@ WPApplication::WPApplication() : WPApplication::~WPApplication() { } -std::string WPApplication::menu_head = ""; -std::string WPApplication::footer = ""; diff --git a/app/wp_application.h b/app/wp_application.h index 0af17b3..cb0b9d8 100644 --- a/app/wp_application.h +++ b/app/wp_application.h @@ -4,6 +4,7 @@ //#include "core/http/web_application.h" #include "core/object.h" #include "modules/drogon/web_application.h" +#include "core/string.h" #undef LOG_TRACE #undef LOG_WARN @@ -27,8 +28,10 @@ public: WPApplication(); ~WPApplication(); - static std::string menu_head; - static std::string footer; + HandlerInstance blog_func; + + String header; + String footer; }; #endif \ No newline at end of file diff --git a/www/site.css b/www/site.css new file mode 100644 index 0000000..e69de29