filter not existed url.
Some checks failed
Deploy / PullDocker (push) Failing after 5s
Deploy / Build (push) Failing after 7s

This commit is contained in:
amass 2024-08-06 22:24:26 +08:00
parent 0b6ccfd841
commit 303f89d345

View File

@ -126,22 +126,24 @@ Application::Application(const std::string &path)
auto rootJson = boost::json::parse(request.body());
auto &root = rootJson.as_object();
std::string url;
std::string visitorUuid;
std::string userAgent;
if (root.contains("url")) {
url = root["url"].as_string();
}
if (root.contains("visitor_uuid")) {
visitorUuid = root["visitor_uuid"].as_string();
}
if (root.contains("user_agent")) {
userAgent = root["user_agent"].as_string();
}
auto database = Amass::Singleton<Database>::instance();
auto now = std::chrono::system_clock::now();
std::time_t now_time = std::chrono::system_clock::to_time_t(now);
database->updateVisitCount(url, visitorUuid, userAgent, now_time);
if (std::filesystem::exists("amass_blog" + url)) {
std::string visitorUuid;
if (root.contains("visitor_uuid")) {
visitorUuid = root["visitor_uuid"].as_string();
}
std::string userAgent;
if (root.contains("user_agent")) {
userAgent = root["user_agent"].as_string();
}
auto now = std::chrono::system_clock::now();
std::time_t now_time = std::chrono::system_clock::to_time_t(now);
database->updateVisitCount(url, visitorUuid, userAgent, now_time);
}
auto data = database->visitAnalysisData(std::string(url));
auto total = database->siteVisitAnalysisData();