diff --git a/bin/github_action/daily_reporter b/bin/github_action/daily_reporter index a78bbe4..da93fe5 100755 Binary files a/bin/github_action/daily_reporter and b/bin/github_action/daily_reporter differ diff --git a/include/config.h b/include/config.h index 9b6aac1..60f6e84 100644 --- a/include/config.h +++ b/include/config.h @@ -39,7 +39,7 @@ inline nlohmann::json &default_json() { {"user_agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 Edg/92.0.902.84"}, {"form_data", "{\"formData\":[{\"name\":\"select_1582538796361\",\"title\":\"\\u4ECA\\u65E5\\u4F53\\u6E29 Body temperature today \\uFF08\\u2103\\uFF09\",\"value\":{\"stringValue\":\"37.3\\u4EE5\\u4E0B Below 37.3 degree celsius\"},\"hide\":false},{\"name\":\"select_1582538846920\",\"title\":\"\\u662F\\u5426\\u51FA\\u73B0\\u53D1\\u70ED\\u6216\\u54B3\\u55FD\\u6216\\u80F8\\u95F7\\u6216\\u547C\\u5438\\u56F0\\u96BE\\u7B49\\u75C7\\u72B6\\uFF1FDo you have sypmtoms such as fever, coughing, chest tightness or breath difficulties?\",\"value\":{\"stringValue\":\"\\u5426 No\"},\"hide\":false},{\"name\":\"select_1584240106785\",\"title\":\"\\u5B66\\u751F\\u672C\\u4EBA\\u662F\\u5426\\u586B\\u5199\",\"value\":{\"stringValue\":\"\\u662F\"},\"hide\":false},{\"name\":\"select_1582538939790\",\"title\":\"Can you hereby declare that all the information provided is all true and accurate and there is no concealment, false information or omission. \\u672C\\u4EBA\\u662F\\u5426\\u627F\\u8BFA\\u6240\\u586B\\u62A5\\u7684\\u5168\\u90E8\\u5185\\u5BB9\\u5747\\u5C5E\\u5B9E\\u3001\\u51C6\\u786E\\uFF0C\\u4E0D\\u5B58\\u5728\\u4EFB\\u4F55\\u9690\\u7792\\u548C\\u4E0D\\u5B9E\\u7684\\u60C5\\u51B5\\uFF0C\\u66F4\\u65E0\\u9057\\u6F0F\\u4E4B\\u5904\\u3002\",\"value\":{\"stringValue\":\"\\u662F Yes\"},\"hide\":false},{\"name\":\"input_1582538924486\",\"title\":\"\\u5907\\u6CE8 Notes\",\"value\":{\"stringValue\":\"\"},\"hide\":false},{\"name\":\"datetime_1611146487222\",\"title\":\"\\u6253\\u5361\\u65F6\\u95F4\\uFF08\\u65E0\\u9700\\u586B\\u5199\\uFF0C\\u4FDD\\u5B58\\u540E\\u4F1A\\u81EA\\u52A8\\u66F4\\u65B0\\uFF09\",\"value\":{\"dateValue\":\"\"},\"hide\":false}],\"playerId\":\"owner\"}"}, - {"report_retry", {{"duration", 10}, {"counts", 30}}}, + {"report_retry", {{"duration", 10}, {"counts", 100}}}, {"mail", {{"address", ""}, {"smtp_password", ""}, {"reporter_name", "HAL-9000"}}}, {"xmu", {{"ID", ""}, {"password", ""}}}}; return default_json; diff --git a/src/login.cpp b/src/login.cpp index 962bdc3..310e6de 100644 --- a/src/login.cpp +++ b/src/login.cpp @@ -89,9 +89,9 @@ unique_ptr login(const string_view src_url, optional login(const string_view src_url, optionalget_header_value("Location")); SPDLOG_DEBUG("redirect host:{} path:{}",host, path); + cli.stop(); auto cli2 = make_unique(host.data()); cli2->set_keep_alive(true); - cli2->set_connection_timeout(100s); - cli2->set_read_timeout(100s); - cli2->set_write_timeout(100s); + cli2->set_connection_timeout(200s); + cli2->set_read_timeout(200s); + cli2->set_write_timeout(200s); cli2->enable_server_certificate_verification(false); res = cli2->Get(path.data(), headers); @@ -166,7 +167,6 @@ unique_ptr login(const string_view src_url, optionalheaders.equal_range("Set-Cookie"); for (; iter != iterend; ++iter) diff --git a/src/main.cpp b/src/main.cpp index c90a8ef..e6944cf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,7 +16,7 @@ bool is_in_report_time() } bool report(int count = get_report_retry_counts()) { - while (--count > 0 && report_now()==false) + while (count-- > 0 && report_now()==false) { SPDLOG_ERROR("We will try again after {}s", get_report_retry_duration()); SPDLOG_INFO("Least retry count: {}",count); diff --git a/src/report.cpp b/src/report.cpp index dfc580b..68749ea 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -14,7 +14,7 @@ bool report_now() auto cli = login("https://xmuxg.xmu.edu.cn/login/cas/xmu", "/platform"); if (!cli) { - SPDLOG_ERROR("login failed:{}! please check your username and password."); + SPDLOG_ERROR("login failed! please check your username and password."); return false; } this_thread::sleep_for(2s);