check for new version rework, support "check for stable updates only" mode

This commit is contained in:
SoftFever 2023-12-29 12:04:40 +08:00
parent f89932f63e
commit 63f9b3b1ba
6 changed files with 98 additions and 76 deletions

View file

@ -42,7 +42,8 @@ using namespace nlohmann;
namespace Slic3r {
static const std::string VERSION_CHECK_URL = "https://api.github.com/repos/softfever/OrcaSlicer/releases/latest";
static const std::string VERSION_CHECK_URL_STABLE = "https://api.github.com/repos/softfever/OrcaSlicer/releases/latest";
static const std::string VERSION_CHECK_URL = "https://api.github.com/repos/softfever/OrcaSlicer/releases";
static const std::string MODELS_STR = "models";
const std::string AppConfig::SECTION_FILAMENTS = "filaments";
@ -240,6 +241,10 @@ void AppConfig::set_defaults()
set_bool("stealth_mode", false);
}
if(get("check_stable_update_only").empty()) {
set_bool("check_stable_update_only", false);
}
// Orca
if(get("show_splash_screen").empty()) {
set_bool("show_splash_screen", true);
@ -1253,10 +1258,10 @@ std::string AppConfig::config_path()
return path;
}
std::string AppConfig::version_check_url() const
std::string AppConfig::version_check_url(bool stable_only/* = false*/) const
{
auto from_settings = get("version_check_url");
return from_settings.empty() ? VERSION_CHECK_URL : from_settings;
return from_settings.empty() ? stable_only ? VERSION_CHECK_URL_STABLE : VERSION_CHECK_URL : from_settings;
}
bool AppConfig::exists()