Moved html and http from core to a new web folder.

This commit is contained in:
Relintai 2022-02-05 15:30:48 +01:00
parent d1e8def48d
commit 80d2a379fe
58 changed files with 86 additions and 72 deletions

View File

@ -274,6 +274,7 @@ if scons_ver >= (4, 0, 0):
Export("env")
SConscript("core/SCsub")
SConscript("web/SCsub")
SConscript("platform/SCsub")
if env_base["databases"]:

View File

@ -1,7 +1,7 @@
#ifndef DROGON_WEB_SERVER_H
#define DROGON_WEB_SERVER_H
#include "core/http/web_server.h"
#include "web/http/web_server.h"
#include "core/object.h"
#include <functional>

View File

@ -2,7 +2,7 @@
#include "drogon_web_server.h"
#include "core/http/cookie.h"
#include "web/http/cookie.h"
const String DRequest::get_cookie(const String &key) {
return request->getCookie(key);

View File

@ -4,7 +4,7 @@
#include "core/string.h"
#include "core/containers/vector.h"
#include "core/http/request.h"
#include "web/http/request.h"
#include <mutex>

13
web/SCsub Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
Import("env")
env.core_sources = []
env.add_source_files(env.core_sources, "*.cpp")
env.add_source_files(env.core_sources, "./html/*.cpp")
env.add_source_files(env.core_sources, "./http/*.cpp")
# Build it all as a library
lib = env.add_library("core", env.core_sources)
env.Prepend(LIBS=[lib])

View File

@ -1,6 +1,6 @@
#include "form_validator.h"
#include "core/http/request.h"
#include "web/http/request.h"
//FormFieldEntry

View File

@ -1,7 +1,7 @@
#include "html_builder.h"
#include "core/string.h"
#include "core/http/request.h"
#include "web/http/request.h"
HTMLTag *HTMLTag::str(const String &str) {
result += " " + str;

View File

@ -1,11 +1,11 @@
#include "request.h"
#include "core/http/cookie.h"
#include "web/http/cookie.h"
#include "web_server.h"
#include "http_session.h"
#include "core/http/web_root.h"
#include "web/http/web_root.h"
#include "session_manager.h"
Ref<HTTPSession> Request::get_or_create_session() {

View File

@ -4,7 +4,7 @@
#include "http_enums.h"
#include "request.h"
#include "core/http/web_server.h"
#include "web/http/web_server.h"
#include "core/settings/settings.h"
#ifdef DATABASES_ENABLED

View File

@ -29,7 +29,7 @@ void WebRoot::setup_middleware() {
// --- SessionSetupMiddleware ---
// If you want sessions add this to your inherited class.
// (#include "core/http/session_manager.h")
// (#include "web/http/session_manager.h")
// _middlewares.push_back(Ref<SessionSetupMiddleware>(new SessionSetupMiddleware()));
@ -48,7 +48,7 @@ void WebRoot::setup_middleware() {
// _middlewares.push_back(Ref<RBACDefaultUserSessionSetupMiddleware>(new RBACDefaultUserSessionSetupMiddleware()));
// --- CSRF Token Middlweare ---
// (#include "core/http/csrf_token.h")
// (#include "web/http/csrf_token.h")
// Ref<CSRFTokenMiddleware> csrf_middleware;
// csrf_middleware.instance();

View File

@ -1,7 +1,7 @@
#include "web_server.h"
#include "request.h"
#include "core/http/web_node.h"
#include "web/http/web_node.h"
WebNode *WebServer::get_web_root() {
return _web_root;

View File

@ -1,11 +1,11 @@
#include "admin_node.h"
#include "core/html/form_validator.h"
#include "core/html/html_builder.h"
#include "core/http/cookie.h"
#include "core/http/http_session.h"
#include "core/http/request.h"
#include "core/http/session_manager.h"
#include "web/html/form_validator.h"
#include "web/html/html_builder.h"
#include "web/http/cookie.h"
#include "web/http/http_session.h"
#include "web/http/request.h"
#include "web/http/session_manager.h"
void AdminNode::admin_handle_request_main(Request *request) {

View File

@ -1,7 +1,7 @@
#ifndef ADMIN_NODE_H
#define ADMIN_NODE_H
#include "core/http/web_node.h"
#include "web/http/web_node.h"
#include "core/containers/vector.h"
#include "core/string.h"

View File

@ -1,11 +1,11 @@
#include "admin_panel.h"
#include "core/html/form_validator.h"
#include "core/html/html_builder.h"
#include "core/http/cookie.h"
#include "core/http/http_session.h"
#include "core/http/request.h"
#include "core/http/session_manager.h"
#include "web/html/form_validator.h"
#include "web/html/html_builder.h"
#include "web/http/cookie.h"
#include "web/http/http_session.h"
#include "web/http/request.h"
#include "web/http/session_manager.h"
#include "admin_node.h"

View File

@ -1,7 +1,7 @@
#ifndef ADMIN_PANEL_H
#define ADMIN_PANEL_H
#include "core/http/web_node.h"
#include "web/http/web_node.h"
#include "core/string.h"
#include "core/containers/vector.h"

View File

@ -1,11 +1,11 @@
#include "static_folder_page.h"
#include "core/http/request.h"
#include "web/http/request.h"
#include <iostream>
#include "core/file_cache.h"
#include "core/database/database_manager.h"
#include "core/html/html_builder.h"
#include "web/html/html_builder.h"
void StaticFolderPage::handle_request_main(Request *request) {
}

View File

@ -3,7 +3,7 @@
#include "core/string.h"
#include "core/http/web_node.h"
#include "web/http/web_node.h"
//StaticFolderPage
//Just serve files

View File

@ -1,7 +1,7 @@
#include "list_page.h"
#include "core/html/html_builder.h"
#include "core/html/utils.h"
#include "web/html/html_builder.h"
#include "web/html/utils.h"
#include "core/math/math.h"
#include <tinydir/tinydir.h>

View File

@ -4,9 +4,9 @@
#include "core/containers/vector.h"
#include "core/string.h"
#include "core/http/web_node.h"
#include "web/http/web_node.h"
#include "core/http/request.h"
#include "web/http/request.h"
// This class will load and generate pages from a folder of md files. It supports pagination,
// it will put entry_per_page md files per page. It generates html on enter tree, and caches everything.

View File

@ -4,9 +4,9 @@
#include "core/containers/vector.h"
#include "core/string.h"
#include "core/http/web_node.h"
#include "web/http/web_node.h"
#include "core/http/request.h"
#include "web/http/request.h"
class MessagePage : public WebNode {

View File

@ -1,7 +1,7 @@
#include "paged_article.h"
#include "core/os/directory.h"
#include "core/html/utils.h"
#include "web/html/utils.h"
#include <iostream>

View File

@ -6,9 +6,9 @@
#include "core/string.h"
#include "core/file_cache.h"
#include "core/http/web_node.h"
#include "web/http/web_node.h"
#include "core/http/request.h"
#include "web/http/request.h"
class PagedArticle : public WebNode {
RCPP_OBJECT(PagedArticle, WebNode);

View File

@ -1,9 +1,9 @@
#include "paged_articles.h"
#include "core/html/html_builder.h"
#include "web/html/html_builder.h"
#include "core/os/directory.h"
#include "core/html/utils.h"
#include "web/html/utils.h"
#include "paged_article.h"
#include <iostream>

View File

@ -5,9 +5,9 @@
#include "core/string.h"
#include "core/file_cache.h"
#include "core/http/web_node.h"
#include "web/http/web_node.h"
#include "core/http/request.h"
#include "web/http/request.h"
//todo pagination

View File

@ -1,8 +1,8 @@
#include "paged_articles_md_index.h"
#include "core/http/request.h"
#include "web/http/request.h"
#include "core/html/html_builder.h"
#include "web/html/html_builder.h"
void PagedArticlesMDIndex::handle_request_main(Request *request) {
const String path = request->get_current_path_segment();

View File

@ -3,7 +3,7 @@
#include "core/string.h"
#include "core/http/web_node.h"
#include "web/http/web_node.h"
#include "web_modules/list_page/list_page.h"
#include "web_modules/paged_article/paged_article.h"

View File

@ -2,12 +2,12 @@
#include "core/error_macros.h"
#include "core/html/form_validator.h"
#include "core/html/html_builder.h"
#include "core/http/cookie.h"
#include "core/http/http_session.h"
#include "core/http/request.h"
#include "core/http/session_manager.h"
#include "web/html/form_validator.h"
#include "web/html/html_builder.h"
#include "web/http/cookie.h"
#include "web/http/http_session.h"
#include "web/http/request.h"
#include "web/http/session_manager.h"
#include "rbac_default_permissions.h"
#include "web_modules/users/user.h"

View File

@ -1,6 +1,6 @@
#include "rbac_rank.h"
#include "core/http/request.h"
#include "web/http/request.h"
Ref<RBACPermission> RBACRank::match_request(Request *request) {
const String &full_path = request->get_path_full();

View File

@ -1,7 +1,7 @@
#include "rbac_user_controller.h"
#include "core/http/http_session.h"
#include "core/http/request.h"
#include "web/http/http_session.h"
#include "web/http/request.h"
#include "web_modules/rbac/rbac_controller.h"
#include "web_modules/rbac/rbac_default_permissions.h"

View File

@ -3,7 +3,7 @@
#include "web_modules/users/user_controller.h"
#include "core/http/middleware.h"
#include "web/http/middleware.h"
class Request;

View File

@ -1,8 +1,8 @@
#include "static_page.h"
#include "core/http/request.h"
#include "web/http/request.h"
#include "core/file_cache.h"
#include "core/html/html_builder.h"
#include "web/html/html_builder.h"
void StaticPage::handle_request_main(Request *request) {
}

View File

@ -3,7 +3,7 @@
#include "core/string.h"
#include "core/http/web_node.h"
#include "web/http/web_node.h"
/*

View File

@ -13,13 +13,13 @@
#include "core/database/query_result.h"
#include "core/database/table_builder.h"
#include "core/html/form_validator.h"
#include "core/html/html_builder.h"
#include "core/http/cookie.h"
#include "core/http/http_session.h"
#include "core/http/request.h"
#include "core/http/session_manager.h"
#include "core/html/utils.h"
#include "web/html/form_validator.h"
#include "web/html/html_builder.h"
#include "web/http/cookie.h"
#include "web/http/http_session.h"
#include "web/http/request.h"
#include "web/http/session_manager.h"
#include "web/html/utils.h"
String User::to_json(rapidjson::Document *into) {
rapidjson::Document *document;

View File

@ -1,11 +1,11 @@
#include "user_controller.h"
#include "core/html/form_validator.h"
#include "core/html/html_builder.h"
#include "core/http/cookie.h"
#include "core/http/http_session.h"
#include "core/http/request.h"
#include "core/http/session_manager.h"
#include "web/html/form_validator.h"
#include "web/html/html_builder.h"
#include "web/http/cookie.h"
#include "web/http/http_session.h"
#include "web/http/request.h"
#include "web/http/session_manager.h"
#include "core/database/database.h"
#include "core/database/database_manager.h"

View File

@ -4,10 +4,10 @@
#include "core/containers/vector.h"
#include "core/string.h"
#include "core/http/web_node.h"
#include "web/http/web_node.h"
#include "user.h"
#include "core/http/middleware.h"
#include "web/http/middleware.h"
class Request;
class FormValidator;