Disable auto-updater for client localization

This commit is contained in:
Ahrimdon 2024-03-07 03:36:22 -05:00
parent 00c4a8463d
commit e2e3460375
3 changed files with 33 additions and 14 deletions

View File

@ -283,7 +283,7 @@ namespace motd
{
init_links(map);
});
/* // Ahrimdon
marketing.access([&](nlohmann::json& data)
{
data.clear();
@ -308,6 +308,7 @@ namespace motd
}
}
});
*/
}
}

View File

@ -181,7 +181,7 @@ namespace updater
{
return utils::string::va("%i", uint32_t(time(nullptr)));
}
/*
std::optional<std::string> download_data_file(const std::string& name)
{
const auto file = std::format("{}{}?{}", select(DATA_PATH, DATA_PATH_DEV), name, get_time_str());
@ -193,7 +193,7 @@ namespace updater
const auto file = std::format("{}?{}", select(FILES_PATH, FILES_PATH_DEV), get_time_str());
return updater::get_server_file(file);
}
*/
bool is_update_cancelled()
{
return update_data.access<bool>([](update_data_t& data_)
@ -286,7 +286,8 @@ namespace updater
return garbage_files;
}
}
// Ahrimdon
/*
std::optional<std::string> get_server_file(const std::string& endpoint)
{
static std::vector<std::string> server_urls =
@ -314,7 +315,7 @@ namespace updater
return {};
}
*/
void relaunch()
{
utils::nt::relaunch_self("-singleplayer");
@ -411,7 +412,8 @@ namespace updater
data_.cancelled = true;
});
}
// Ahrimdon
/*
void start_update_check()
{
cancel_update();
@ -502,7 +504,20 @@ namespace updater
notify("update_check_done");
}, scheduler::pipeline::async);
}
*/
// Ahrimdon
void start_update_check()
{
console::debug("[Updater] Skipping update check as master server is not defined.\n");
update_data.access([](update_data_t& data_)
{
data_.check.done = true;
data_.check.success = true;
});
notify("update_check_done");
}
void start_update_download()
{
#ifdef DEBUG
@ -555,18 +570,19 @@ namespace updater
data_.current_file = file.name;
});
#ifdef DEBUG
console::info("[Updater] downloading file %s\n", file.name.data());
#ifdef DEBUG // Ahrimdon
// console::info("[Updater] downloading file %s\n", file.name.data());
#endif
const auto data = download_data_file(file.name);
// Ahrimdon
// const auto data = download_data_file(file.name);
if (is_update_cancelled())
{
reset_data();
return;
}
// Ahrimdon
/*
if (!data.has_value())
{
set_update_download_status(true, false, ERR_DOWNLOAD_FAIL + file.name);
@ -581,8 +597,10 @@ namespace updater
}
downloads.emplace_back(file.name, data.value());
*/
}
// Ahrimdon
/*
for (const auto& download : downloads)
{
if (!write_file(download.name, download.data))
@ -591,7 +609,7 @@ namespace updater
return;
}
}
*/
set_update_download_status(true, true);
}, scheduler::pipeline::async);
}

View File

@ -11,7 +11,7 @@ namespace updater
branch_count
};
std::optional<std::string> get_server_file(const std::string& endpoint);
// std::optional<std::string> get_server_file(const std::string& endpoint);
void relaunch();