mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-24 03:12:07 +00:00
feature update to get the url function
This commit is contained in:
@@ -39,19 +39,19 @@ namespace Slic3r {
|
|||||||
|
|
||||||
static const std::string VERSION_CHECK_URL_STABLE = "https://api.github.com/repos/Snapmaker/OrcaSlicer/releases/latest";
|
static const std::string VERSION_CHECK_URL_STABLE = "https://api.github.com/repos/Snapmaker/OrcaSlicer/releases/latest";
|
||||||
static const std::string VERSION_CHECK_URL = "https://api.github.com/repos/Snapmaker/OrcaSlicer/releases";
|
static const std::string VERSION_CHECK_URL = "https://api.github.com/repos/Snapmaker/OrcaSlicer/releases";
|
||||||
static const std::string PROFILE_UPDATE_URL = "https://public.resource.snapmaker.com/upgrade/packages/profile/preset_config.json";
|
static const std::string PROFILE_UPDATE_URL = "/upgrade/packages/profile/preset_config.json";
|
||||||
static const std::string FLUTTER_UPDATE_URL = "https://public.resource.snapmaker.com/upgrade/packages/flutter/flutter_config.json";
|
static const std::string FLUTTER_UPDATE_URL = "/upgrade/packages/flutter/flutter_config.json";
|
||||||
static const std::string MODELS_STR = "models";
|
static const std::string MODELS_STR = "models";
|
||||||
|
|
||||||
#define APP_UPDATE_URL_BASE_CN "https://public.resource.snapmaker.com/upgrade/packages/orca"
|
#define APP_UPDATE_URL_BASE_CN "https://public.resource.snapmaker.com"
|
||||||
#define APP_UPDATE_URL_BASE_EN "https://public.resource.snapmaker.com/upgrade/packages/orca"
|
#define APP_UPDATE_URL_BASE_EN "https://public.resource.snapmaker.com"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
static const std::string APP_UPDATE_URL = std::string("/win/manifest.json");
|
static const std::string APP_UPDATE_URL = std::string("/upgrade/packages/orca/win/manifest.json");
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
static const std::string APP_UPDATE_URL = std::string("/mac/manifest.json");
|
static const std::string APP_UPDATE_URL = std::string("/upgrade/packages/orca/mac/manifest.json");
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
static const std::string APP_UPDATE_URL = std::string("/linux/manifest.json");
|
static const std::string APP_UPDATE_URL = std::string("/upgrade/packages/orca/linux/manifest.json");
|
||||||
#else
|
#else
|
||||||
static const std::string APP_UPDATE_URL = "";
|
static const std::string APP_UPDATE_URL = "";
|
||||||
#endif
|
#endif
|
||||||
@@ -1438,6 +1438,26 @@ std::string AppConfig::config_path()
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AppConfig::get_preset_upgrade_url()
|
||||||
|
{
|
||||||
|
std::string url = APP_UPDATE_URL_BASE_EN + PROFILE_UPDATE_URL;
|
||||||
|
auto countryArea = get_country_code();
|
||||||
|
if (countryArea == std::string("CN"))
|
||||||
|
url = APP_UPDATE_URL_BASE_CN + PROFILE_UPDATE_URL;
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AppConfig::get_web_resource_upgrade_url()
|
||||||
|
{
|
||||||
|
std::string url = APP_UPDATE_URL_BASE_EN + FLUTTER_UPDATE_URL;
|
||||||
|
auto countryArea = get_country_code();
|
||||||
|
if (countryArea == std::string("CN"))
|
||||||
|
url = APP_UPDATE_URL_BASE_CN + FLUTTER_UPDATE_URL;
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
std::string AppConfig::get_version_upgrade_url(bool stable_only /* = false*/)
|
std::string AppConfig::get_version_upgrade_url(bool stable_only /* = false*/)
|
||||||
{
|
{
|
||||||
//get local area and get the resource from diff server
|
//get local area and get the resource from diff server
|
||||||
@@ -1455,16 +1475,6 @@ std::string AppConfig::version_check_url(bool stable_only/* = false*/) const
|
|||||||
return from_settings.empty() ? stable_only ? VERSION_CHECK_URL_STABLE : VERSION_CHECK_URL : from_settings;
|
return from_settings.empty() ? stable_only ? VERSION_CHECK_URL_STABLE : VERSION_CHECK_URL : from_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AppConfig::flutter_resource_update_url() const
|
|
||||||
{
|
|
||||||
return FLUTTER_UPDATE_URL;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string AppConfig::profile_update_url() const
|
|
||||||
{
|
|
||||||
return PROFILE_UPDATE_URL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AppConfig::exists()
|
bool AppConfig::exists()
|
||||||
{
|
{
|
||||||
return boost::filesystem::exists(config_path());
|
return boost::filesystem::exists(config_path());
|
||||||
|
|||||||
@@ -325,11 +325,8 @@ public:
|
|||||||
// This returns a hardcoded string unless it is overriden by "version_check_url" in the ini file.
|
// This returns a hardcoded string unless it is overriden by "version_check_url" in the ini file.
|
||||||
std::string version_check_url(bool stable_only = false) const;
|
std::string version_check_url(bool stable_only = false) const;
|
||||||
std::string get_version_upgrade_url(bool stable_only = false);
|
std::string get_version_upgrade_url(bool stable_only = false);
|
||||||
|
std::string get_preset_upgrade_url();
|
||||||
// Get the Orca profile update url.
|
std::string get_web_resource_upgrade_url();
|
||||||
std::string profile_update_url() const;
|
|
||||||
|
|
||||||
std::string flutter_resource_update_url() const;
|
|
||||||
|
|
||||||
// Returns the original Slic3r version found in the ini file before it was overwritten
|
// Returns the original Slic3r version found in the ini file before it was overwritten
|
||||||
// by the current version
|
// by the current version
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ void PresetUpdater::priv::set_download_prefs(AppConfig *app_config)
|
|||||||
{
|
{
|
||||||
version_check_url = app_config->version_check_url();
|
version_check_url = app_config->version_check_url();
|
||||||
|
|
||||||
auto profile_update_url = app_config->profile_update_url();
|
auto profile_update_url = app_config->get_preset_upgrade_url();
|
||||||
if (!profile_update_url.empty())
|
if (!profile_update_url.empty())
|
||||||
enabled_config_update = true;
|
enabled_config_update = true;
|
||||||
else
|
else
|
||||||
@@ -719,7 +719,7 @@ void PresetUpdater::priv::sync_update_flutter_resource(bool isAuto_check)
|
|||||||
|
|
||||||
AppConfig* app_config = GUI::wxGetApp().app_config;
|
AppConfig* app_config = GUI::wxGetApp().app_config;
|
||||||
|
|
||||||
auto preset_update_url = app_config->flutter_resource_update_url();
|
auto preset_update_url = app_config->get_web_resource_upgrade_url();
|
||||||
|
|
||||||
Http::get(preset_update_url)
|
Http::get(preset_update_url)
|
||||||
.on_error([cache_profile_path, isAuto_check](std::string body, std::string error, unsigned http_status) {
|
.on_error([cache_profile_path, isAuto_check](std::string body, std::string error, unsigned http_status) {
|
||||||
@@ -800,8 +800,7 @@ void PresetUpdater::priv::sync_config(bool isAuto_check)
|
|||||||
|
|
||||||
AppConfig *app_config = GUI::wxGetApp().app_config;
|
AppConfig *app_config = GUI::wxGetApp().app_config;
|
||||||
|
|
||||||
// auto profile_update_url = app_config->profile_update_url() + "/" + Snapmaker_VERSION;
|
auto profile_update_url = app_config->get_preset_upgrade_url();
|
||||||
auto profile_update_url = app_config->profile_update_url();
|
|
||||||
// parse the assets section and get the latest asset by comparing the name
|
// parse the assets section and get the latest asset by comparing the name
|
||||||
|
|
||||||
Http::get(profile_update_url)
|
Http::get(profile_update_url)
|
||||||
|
|||||||
Reference in New Issue
Block a user