const std::string HS_Config::lastmode_json = "lastmode.json";
const std::string HS_Config::key_appid = "appid";
const std::string HS_Config::key_visibility = "visibility";
+const std::string HS_Config::key_after = "after";
std::string HS_Config::root_dir = "";
/**
path = root_dir + "/etc/" + lastmode_json;
if(readJsonFile(path.c_str(), &m_lastmode) < 0) {
- AFB_ERROR("read %s failed.", lastmode_json.c_str());
+ AFB_WARNING("read %s failed.", lastmode_json.c_str());
m_lastmode = nullptr;
}
if(json_object_get_type(m_lastmode) == json_type_array ) {
struct std::vector<recover_app_info> v_lastmode = std::move(getRecoverAppInfo(m_lastmode));
if(!v_lastmode.empty()) { // got saving lastmode isn't null, instead of default lastmode
+ for(auto &it : v_lastmode) {
+ if(it.after.empty() && !m_recover_map[keys_recover_type[1]].empty()) {
+ it.after = m_recover_map[keys_recover_type[1]][0].after;
+ }
+ }
m_recover_map[keys_recover_type[1]] = std::move(v_lastmode);
}
}
else {
info.visibility = false;
}
+ if(json_object_object_get_ex(info_obj, key_after.c_str(), &value_obj)) {
+ info.after = json_object_get_string(value_obj);
+ }
+ else {
+ info.after.clear();
+ }
v_app_info.push_back(info);
}