Updating: Start using proper URLs

This commit is contained in:
Vojtech Kral 2018-04-25 17:43:01 +02:00
parent 03e9da804a
commit dce0aa6771
4 changed files with 15 additions and 6 deletions

View file

@ -7,7 +7,7 @@ name = Prusa Research
# This means, the server may force the Slic3r configuration to be downgraded.
config_version = 0.1.0
# Where to get the updates from?
config_update_url = https://raw.githubusercontent.com/vojtechkral/slic3r-settings-tmp/master/PrusaResearch
config_update_url = https://raw.githubusercontent.com/prusa3d/Slic3r-settings/master/live/PrusaResearch/
# The printer models will be shown by the Configuration Wizard in this order,
# also the first model installed & the first nozzle installed will be activated after install.

View file

@ -21,6 +21,7 @@ namespace Slic3r {
static const std::string VENDOR_PREFIX = "vendor:";
static const std::string MODEL_PREFIX = "model:";
static const std::string VERSION_CHECK_URL = "https://raw.githubusercontent.com/prusa3d/Slic3r-settings/master/live/Slic3rPE.version";
void AppConfig::reset()
{
@ -49,9 +50,6 @@ void AppConfig::set_defaults()
if (get("version_check").empty())
set("version_check", "1");
// TODO: proper URL
if (get("version_check_url").empty())
set("version_check_url", "https://gist.githubusercontent.com/vojtechkral/4d8fd4a3b8699a01ec892c264178461c/raw/2f05a64db19e45a7f8fe2cedeff555d544af679b/slic3rPE.version");
if (get("preset_update").empty())
set("preset_update", "1");
@ -241,6 +239,12 @@ std::string AppConfig::config_path()
return (boost::filesystem::path(Slic3r::data_dir()) / "slic3r.ini").make_preferred().string();
}
std::string AppConfig::version_check_url() const
{
auto from_settings = get("version_check_url");
return from_settings.empty() ? VERSION_CHECK_URL : from_settings;
}
bool AppConfig::exists()
{
return boost::filesystem::exists(AppConfig::config_path());

View file

@ -92,9 +92,14 @@ public:
// Get the default config path from Slic3r::data_dir().
static std::string config_path();
// Returns true if the user's data directory comes from before Slic3r 1.40.0 (no updating)
bool legacy_datadir() const { return m_legacy_datadir; }
// Get the Slic3r version check url.
// This returns a hardcoded string unless it is overriden by "version_check_url" in the ini file.
std::string version_check_url() const;
// Does the config file exist?
static bool exists();

View file

@ -135,7 +135,7 @@ PresetUpdater::priv::priv(int version_online_event) :
void PresetUpdater::priv::set_download_prefs(AppConfig *app_config)
{
enabled_version_check = app_config->get("version_check") == "1";
version_check_url = app_config->get("version_check_url");
version_check_url = app_config->version_check_url();
enabled_config_update = app_config->get("preset_update") == "1";
}