From 0dafd7be72bfa957c11185e78b5fd60101b5d872 Mon Sep 17 00:00:00 2001 From: luocai Date: Fri, 5 Jan 2024 10:58:11 +0800 Subject: [PATCH] modify conf. --- Server/SharedState.cpp | 12 +++++++++--- Server/conf/nginx.conf | 8 ++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Server/SharedState.cpp b/Server/SharedState.cpp index 037ee40..0904ae5 100644 --- a/Server/SharedState.cpp +++ b/Server/SharedState.cpp @@ -68,9 +68,15 @@ SharedState::SharedState(boost::asio::io_context &ioContext, std::string doc_roo using namespace boost::beast; LOG(info) << "add task: " << request.body(); auto database = Amass::Singleton::instance(); - auto root = boost::json::parse(request.body()); - bool ret = database->addTask(root.at("createTime").as_int64(), std::string(root.at("content").as_string()), - std::string(root.at("comment").as_string()), root.at("parentId").as_int64()); + auto rootJson = boost::json::parse(request.body()); + auto &root = rootJson.as_object(); + + std::string content; + if (root.contains("content")) { + content = root.at("content").as_string(); + } + bool ret = database->addTask(root.at("createTime").as_int64(), content, + std::string(root.at("comment").as_string()), root.at("parentId").as_int64()); boost::json::object reply; reply["status"] = ret ? 0 : -1; http::response s{boost::beast::http::status::ok, request.version()}; diff --git a/Server/conf/nginx.conf b/Server/conf/nginx.conf index 8b82ea7..22911b4 100644 --- a/Server/conf/nginx.conf +++ b/Server/conf/nginx.conf @@ -293,12 +293,8 @@ http { location /phtot_gallery { proxy_pass http://local; } - - location = /blog/list { - header_filter_by_lua_block { - ngx.header.content_length = nil - } - body_filter_by_lua_file lua/blog_list.lua; # 过滤掉 隐私文件夹 + + location ~ /api/v1/.*$ { proxy_pass http://local; }