过滤url。
This commit is contained in:
parent
9ea8771324
commit
e4a17cd5a3
@ -54,9 +54,19 @@ http::response<http::string_body> badRequest(const http::request<http::string_bo
|
||||
|
||||
void visitAnalysis() {
|
||||
using namespace Core;
|
||||
// clang-format off
|
||||
static std::vector<std::string> urlFilter = {
|
||||
"/", "/search", "/login", "/MessageBoard", "/我的笔记", "/我的笔记/", "/我的博客",
|
||||
"/",
|
||||
"/search",
|
||||
"/login",
|
||||
"/redirect",
|
||||
"/MessageBoard",
|
||||
"/我的笔记",
|
||||
"/我的笔记/",
|
||||
"/我的博客",
|
||||
"/我的博客/2020/11/22/如何给岛国小电影找字幕",
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
auto application = Singleton<Older::Application>::instance();
|
||||
application->insertUrl("/api/v1/visit_analysis", [](Older::HttpSession &session, const Older::Application::Request &request,
|
||||
@ -71,7 +81,7 @@ void visitAnalysis() {
|
||||
url = root["url"].as_string();
|
||||
}
|
||||
auto database = Singleton<Older::Database>::instance();
|
||||
if (std::filesystem::exists("amass_blog" + url) && (url.find("/我的博客/page") != 0) && (url.find("/wt") != 0)) {
|
||||
if (std::filesystem::exists("amass_blog" + url) && (url.find("/我的博客/page") != 0)) {
|
||||
if (url.size() > 1 && url.back() == '/') {
|
||||
url.pop_back();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user