OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::PresetUpdater::priv Struct Reference
Collaboration diagram for Slic3r::PresetUpdater::priv:

Classes

struct  Resource

Public Member Functions

 priv ()
void set_download_prefs (AppConfig *app_config)
bool get_file (const std::string &url, const fs::path &target_path) const
bool extract_file (const fs::path &source_path, const fs::path &dest_path={})
void prune_tmp (const std::string &vendor_id) const
void sync_version () const
void parse_version_string (const std::string &body) const
void sync_resources (std::string http_url, std::map< std::string, Resource > &resources, bool check_patch=false, std::string current_version="", std::string changelog_file="")
void sync_vendor_config (const std::string &vendor_id)
void check_new_vendors (const std::set< std::string > &system_vendors, std::function< void(std::vector< std::string >, bool)> callback)
void sync_tooltip (std::string http_url, std::string language)
void sync_plugins (std::string http_url, std::string plugin_version)
void sync_printer_config (std::string http_url)
bool get_cached_plugins_version (std::string &cached_version, bool &force)
bool install_bundles_rsrc (const std::vector< std::string > &bundles, bool snapshot) const
void check_installed_vendor_profiles () const
Updates get_printer_config_updates (bool update=false) const
Updates get_config_updates (const Semver &old_slic3r_version) const
bool perform_updates (Updates &&updates, bool snapshot=true) const
void set_waiting_updates (Updates u)

Public Attributes

std::vector< Index > index_db
bool enabled_version_check
bool enabled_config_update
std::string version_check_url
fs::path cache_path
fs::path rsrc_path
fs::path vendor_path
bool cancel
std::thread thread
bool has_waiting_updates { false }
Updates waiting_updates
bool has_waiting_printer_updates { false }
Updates waiting_printer_updates
std::set< std::string > checked_vendors
std::unordered_map< std::string, std::string > vendor_changelogs
std::mutex vendor_changelogs_mutex
std::vector< std::thread > vendor_check_threads
std::atomic< bool > vendor_check_cancel {false}

Detailed Description


Class Documentation

◆ Slic3r::PresetUpdater::priv::Resource

struct Slic3r::PresetUpdater::priv::Resource
Collaboration diagram for Slic3r::PresetUpdater::priv::Resource:
Class Members
string cache_root
string description
bool force {false}
vector< string > sub_caches
string url
string version

Constructor & Destructor Documentation

◆ priv()

Slic3r::PresetUpdater::priv::priv ( )
285 : cache_path(fs::path(Slic3r::data_dir()) / "ota")
286 , rsrc_path(fs::path(resources_dir()) / "profiles")
288 , cancel(false)
289{
290 //BBS: refine preset updater logic
292 set_download_prefs(GUI::wxGetApp().app_config);
293 // Install indicies from resources. Only installs those that are either missing or older than in resources.
296 // Load indices from the cache directory.
297 //index_db = Index::load_db();
298}
#define PRESET_SYSTEM_DIR
Definition Preset.hpp:31
const std::string & data_dir()
Definition utils.cpp:365
const std::string & resources_dir()
Definition utils.cpp:296
fs::path rsrc_path
Definition PresetUpdater.cpp:226
Updates get_printer_config_updates(bool update=false) const
Definition PresetUpdater.cpp:1095
void check_installed_vendor_profiles() const
Definition PresetUpdater.cpp:1049
fs::path cache_path
Definition PresetUpdater.cpp:225
void set_download_prefs(AppConfig *app_config)
Definition PresetUpdater.cpp:301
bool enabled_version_check
Definition PresetUpdater.cpp:221
fs::path vendor_path
Definition PresetUpdater.cpp:227
bool perform_updates(Updates &&updates, bool snapshot=true) const
Definition PresetUpdater.cpp:1264
bool cancel
Definition PresetUpdater.cpp:229

References cache_path, cancel, check_installed_vendor_profiles(), Slic3r::data_dir(), enabled_version_check, get_printer_config_updates(), perform_updates(), PRESET_SYSTEM_DIR, Slic3r::resources_dir(), rsrc_path, set_download_prefs(), and vendor_path.

Here is the call graph for this function:

Member Function Documentation

◆ check_installed_vendor_profiles()

void Slic3r::PresetUpdater::priv::check_installed_vendor_profiles ( ) const
1050{
1051 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:Checking whether the profile from resource is newer";
1052
1053 AppConfig *app_config = GUI::wxGetApp().app_config;
1054
1055 const auto enabled_vendors = app_config->vendors();
1056
1057 std::set<std::string> bundles;
1058 // A vendor is named by its profile or, where the build ships preset caches
1059 // instead of the raw profile JSONs, by its cache alone.
1060 for (const std::string &vendor_name : vendor_names_in(rsrc_path)) {
1061 // enabled_vendors lists the vendors whose printer models the user picked, and
1062 // neither of these two is ever in it.
1063 const auto is_vendor_enabled = (vendor_name == PresetBundle::ORCA_DEFAULT_BUNDLE)
1064 || (vendor_name == PresetBundle::ORCA_FILAMENT_LIBRARY)
1065 || (enabled_vendors.find(vendor_name) != enabled_vendors.end());
1066 if (is_vendor_installed(vendor_name)) {
1067 if (is_vendor_enabled) {
1068 // Orca: whichever form of the vendor resources ships at the newer
1069 // version is the one installing lays down, and the one to judge
1070 // what is installed against.
1071 Semver resource_ver = resource_vendor_version(vendor_name);
1072 // Orca: a vendor installed as a preset cache has no profile
1073 // beside it; the version it was installed at is in the cache.
1074 Semver vendor_ver = installed_vendor_version(vendor_name);
1075
1076 if (vendor_ver < resource_ver) {
1077 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:found vendor " << vendor_name << " newer version "
1078 << resource_ver.to_string() << " from resource, old version " << vendor_ver.to_string();
1079 bundles.insert(vendor_name);
1080 }
1081 } else {
1082 // need to be removed because not installed
1083 remove_installed_vendor(vendor_name);
1084 }
1085 } else if (is_vendor_enabled) {
1086 bundles.insert(vendor_name);
1087 }
1088 }
1089
1090 if (bundles.size() > 0) {
1091 install_bundles_rsrc(std::vector(bundles.begin(), bundles.end()), false);
1092 }
1093}
static const char * ORCA_FILAMENT_LIBRARY
Definition PresetBundle.hpp:690
static const char * ORCA_DEFAULT_BUNDLE
Definition PresetBundle.hpp:686
Semver resource_vendor_version(const std::string &vendor)
Definition utils.cpp:2034
void remove_installed_vendor(const std::string &vendor)
Definition utils.cpp:1996
Semver installed_vendor_version(const std::string &vendor)
Definition utils.cpp:1983
bool is_vendor_installed(const std::string &vendor)
Definition utils.cpp:1973
std::set< std::string > vendor_names_in(const boost::filesystem::path &dir)
Definition utils.cpp:2005
bool install_bundles_rsrc(const std::vector< std::string > &bundles, bool snapshot) const
Definition PresetUpdater.cpp:1032

References Slic3r::PresetUpdater::install_bundles_rsrc(), Slic3r::installed_vendor_version(), Slic3r::is_vendor_installed(), Slic3r::PresetBundle::ORCA_DEFAULT_BUNDLE, Slic3r::PresetBundle::ORCA_FILAMENT_LIBRARY, Slic3r::remove_installed_vendor(), Slic3r::resource_vendor_version(), rsrc_path, Slic3r::Semver::to_string(), Slic3r::vendor_names_in(), and Slic3r::AppConfig::vendors().

Referenced by priv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_new_vendors()

void Slic3r::PresetUpdater::priv::check_new_vendors ( const std::set< std::string > & system_vendors,
std::function< void(std::vector< std::string >, bool)> callback )
1416{
1417 vendor_check_threads.emplace_back([this, system_vendors, callback]() {
1418 AppConfig* app_config = GUI::wxGetApp().app_config;
1419 std::string url = app_config->profile_update_url() + "/new?orcaslicer_version=" + Http::url_encode(SoftFever_VERSION);
1420
1421 auto check_cancel = [this](Http::Progress, bool& cancel_http) {
1423 cancel_http = true;
1424 };
1425
1426 json request_body = json::object();
1427 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] checking new vendors for:";
1428 for (const auto& vendor_id : system_vendors) {
1429 // Orca: installed_vendor_version() reads whichever form the vendor is
1430 // installed as - the .json profile or the .opc preset cache stamp -
1431 // so a cache-only vendor is not reported as version 0.0.0 and then
1432 // endlessly re-offered by the server.
1433 Semver installed_ver = installed_vendor_version(vendor_id);
1434 request_body[vendor_id] = installed_ver.to_string();
1435 BOOST_LOG_TRIVIAL(info) << vendor_id << " (installed version " << installed_ver.to_string() << ")";
1436 }
1437 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] new vendor check request url: " << url;
1438 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] new vendor check request body: " << request_body.dump(2);
1439
1440 json response_json;
1441 bool got_response = false;
1442
1443 auto post = Http::post(url);
1444
1445 post.timeout_connect(5);
1446 post.on_progress(check_cancel);
1447 post.header("Content-Type", "application/json");
1448 post.on_error([](std::string body, std::string error, unsigned http_status) {
1449 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] new vendor check HTTP error: " << error;
1450 })
1451 .on_complete([&response_json, &got_response](std::string body, unsigned http_status) {
1452 if (http_status != 200)
1453 return;
1454 try {
1455 json j = json::parse(body);
1456 if (j.is_object()) {
1457 response_json = std::move(j);
1458 got_response = true;
1459 }
1460 } catch (const std::exception& e) {
1461 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] new vendor check JSON parse failed: " << e.what();
1462 }
1463 });
1464
1465 post.set_post_body(request_body.dump());
1466 post.perform_sync();
1467
1469 return;
1470
1471 if (!got_response) {
1472 GUI::wxGetApp().CallAfter([callback]() { callback({}, false); });
1473 return;
1474 }
1475
1476 // Collect candidates before touching the filesystem or network again.
1477 struct NewVendorCandidate
1478 {
1479 std::string vendor_id;
1480 Semver version;
1481 std::string download_url;
1482 std::string changelog;
1483 };
1484 std::vector<NewVendorCandidate> candidates;
1485 for (auto it = response_json.begin(); it != response_json.end(); ++it) {
1486 const json& entry = it.value();
1487 if (!entry.is_object())
1488 continue;
1489 std::string download_url_str = entry.value("download_url", std::string());
1490 if (download_url_str.empty())
1491 continue;
1492
1493 NewVendorCandidate candidate;
1494 candidate.vendor_id = it.key();
1495 auto parsed_ver = Semver::parse(entry.value("version", std::string()));
1496 candidate.version = parsed_ver ? *parsed_ver : Semver();
1497 candidate.download_url = std::move(download_url_str);
1498 candidate.changelog = entry.value("changelog", std::string());
1499 candidates.push_back(std::move(candidate));
1500 }
1501
1502 if (candidates.empty()) {
1503 GUI::wxGetApp().CallAfter([callback]() { callback({}, false); });
1504 return;
1505 }
1506
1507 // Orca: the confirmation dialog must run on the UI thread; if confirmed, the actual
1508 // download/install work is dispatched back onto a new background thread from there,
1509 // same as check_vendor_update() does for a single vendor.
1510 GUI::wxGetApp().CallAfter([this, candidates, callback]() {
1511 std::vector<GUI::MsgUpdateConfig::Update> updates_msg;
1512 for (const auto& candidate : candidates)
1513 updates_msg.emplace_back(candidate.vendor_id, candidate.version, std::string(), candidate.changelog);
1514
1515 GUI::MsgUpdateConfig dlg(updates_msg);
1516 if (dlg.ShowModal() != wxID_OK) {
1517 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] user declined installing new vendors";
1518 callback({}, true);
1519 return;
1520 }
1521
1522 // Orca: the actual download runs on a background thread below (so it doesn't block the
1523 // UI), but that also means nothing visibly happens for the several seconds it can take
1524 // (longer still if a retry kicks in) — push a notification so it's clear work is
1525 // ongoing rather than looking hung.
1526 {
1527 std::string vendor_list;
1528 for (const auto& candidate : candidates) {
1529 if (!vendor_list.empty())
1530 vendor_list += ", ";
1531 vendor_list += candidate.vendor_id;
1532 }
1533 GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::format(
1534 // TRN %1% is a comma-separated list of vendor names.
1535 _L_PLURAL("Downloading new vendor profile: %1%...", "Downloading new vendor profiles: %1%...", candidates.size()),
1536 vendor_list));
1537 }
1538
1539 vendor_check_threads.emplace_back([this, candidates, callback]() {
1540 auto check_cancel = [this](Http::Progress, bool& cancel_http) {
1542 cancel_http = true;
1543 };
1544
1545 std::vector<std::string> new_vendor_ids;
1546 std::vector<std::string> failed_vendor_ids;
1547 auto cache_profile_path = cache_path / "profiles";
1548 fs::create_directories(cache_profile_path);
1549 boost::system::error_code ec;
1550
1551 for (const auto& candidate : candidates) {
1553 break;
1554
1555 const std::string& vendor_id = candidate.vendor_id;
1556 const std::string& download_url_str = candidate.download_url;
1557 std::string changelog = candidate.changelog;
1558
1559 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] downloading new vendor " << vendor_id << " version " << candidate.version.to_string();
1560
1561 // Clear only this vendor's cached data, same as sync_vendor_config().
1562 fs::remove_all(cache_profile_path / vendor_id, ec);
1563 fs::remove(cache_profile_path / (vendor_id + ".json"), ec);
1564
1565 fs::path download_file = cache_path / (vendor_id + TMP_EXTENSION);
1566 bool download_ok = false;
1567
1568 // Orca: same retry pattern as Plater.cpp's project download — a single-shot
1569 // 5s connect timeout against GitHub's redirect chain is prone to transient
1570 // failures (DNS/connect hiccups) that succeed a moment later, so retry a few
1571 // times before giving up rather than failing the whole vendor on one blip.
1572 int retry_count = 0;
1573 const int max_retries = 3;
1574 bool keep_trying = true;
1575 while (keep_trying && retry_count < max_retries) {
1576 retry_count++;
1577 Http::get(download_url_str)
1578 .timeout_connect(5)
1579 .on_progress(check_cancel)
1580 .on_error([&vendor_id, &retry_count](std::string body, std::string error, unsigned http_status) {
1581 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] download failed for new vendor " << vendor_id
1582 << " (attempt " << retry_count << "/" << max_retries << "): " << error;
1583 })
1584 .on_complete([&](std::string body, unsigned http_status) {
1585 if (http_status != 200)
1586 return;
1587 fs::fstream file(download_file, std::ios::out | std::ios::binary | std::ios::trunc);
1588 if (!file.good())
1589 return;
1590 file.write(body.c_str(), body.size());
1591 file.close();
1592 if (file.good())
1593 download_ok = true;
1594 })
1595 .perform_sync();
1596
1597 keep_trying = !download_ok && !(cancel || vendor_check_cancel);
1598 }
1599
1600 if (!download_ok || cancel || vendor_check_cancel) {
1601 if (!download_ok)
1602 failed_vendor_ids.push_back(vendor_id);
1603 continue;
1604 }
1605
1606 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] extracting new vendor " << vendor_id;
1607 if (!extract_file(download_file, cache_profile_path)) {
1608 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] extraction failed for new vendor " << vendor_id;
1609 fs::remove(download_file, ec);
1610 failed_vendor_ids.push_back(vendor_id);
1611 continue;
1612 }
1613 fs::remove(download_file, ec);
1614
1615 const fs::path cached_vendor_json = cache_profile_path / (vendor_id + ".json");
1616 const fs::path cached_vendor_folder = cache_profile_path / vendor_id;
1617 if (!fs::is_regular_file(cached_vendor_json) || !fs::is_directory(cached_vendor_folder) ||
1618 fs::is_empty(cached_vendor_folder)) {
1619 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] rejected new vendor " << vendor_id << ": expected " << vendor_id
1620 << ".json and a non-empty " << vendor_id << " directory";
1621 fs::remove_all(cached_vendor_folder, ec);
1622 fs::remove(cached_vendor_json, ec);
1623 failed_vendor_ids.push_back(vendor_id);
1624 continue;
1625 }
1626
1627 {
1628 std::lock_guard<std::mutex> lock(vendor_changelogs_mutex);
1629 vendor_changelogs[vendor_id] = std::move(changelog);
1630 }
1631
1632 new_vendor_ids.push_back(vendor_id);
1633 }
1634
1635 if (!new_vendor_ids.empty()) {
1636 // Orca: the user already confirmed via the dialog above, so install right away
1637 // instead of routing through check_config_updates_from_updater(), which only
1638 // queues a passive notification (meant for the silent background per-vendor
1639 // check) requiring yet another click + confirmation before anything is copied
1640 // into data_dir()/system.
1641 GUI::wxGetApp().CallAfter([this, new_vendor_ids] {
1642 AppConfig* app_config = GUI::wxGetApp().app_config;
1643 Updates updates = get_config_updates(app_config->orig_version());
1644
1645 // Only install the vendors just confirmed; leave any other unrelated
1646 // pending cached update (from a background sync_vendor_config()) alone,
1647 // still gated behind its own notification/confirmation.
1648 std::set<std::string> confirmed(new_vendor_ids.begin(), new_vendor_ids.end());
1649 Updates filtered;
1650 for (auto& update : updates.updates)
1651 if (confirmed.count(update.vendor))
1652 filtered.updates.push_back(std::move(update));
1653
1654 if (filtered.updates.empty()) {
1655 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] new vendors cached but no updates detected";
1656 return;
1657 }
1658
1659 if (!perform_updates(std::move(filtered)) || !reload_configs_update_gui()) {
1660 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] failed to install new vendors";
1661 return;
1662 }
1663
1664 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] new vendors installed";
1665 for (const auto& vendor_id : new_vendor_ids) {
1666 Semver cur_ver = GUI::wxGetApp().preset_bundle->get_vendor_profile_version(vendor_id);
1667 GUI::wxGetApp().plater()->get_notification_manager()->push_notification(
1670 Slic3r::format(_u8L("Configuration package: %1% updated to %2%"), vendor_id, cur_ver.to_string()));
1671 }
1672 });
1673 }
1674
1675 if (!failed_vendor_ids.empty()) {
1676 GUI::wxGetApp().CallAfter([failed_vendor_ids] {
1677 std::string vendor_list;
1678 for (const auto& vendor_id : failed_vendor_ids) {
1679 if (!vendor_list.empty())
1680 vendor_list += ", ";
1681 vendor_list += vendor_id;
1682 }
1683 GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::format(
1684 // TRN %1% is a comma-separated list of vendor names.
1685 _L_PLURAL("Failed to download vendor profile: %1%", "Failed to download vendor profiles: %1%", failed_vendor_ids.size()),
1686 vendor_list));
1687 });
1688 }
1689
1690 GUI::wxGetApp().CallAfter([callback, new_vendor_ids]() { callback(new_vendor_ids, false); });
1691 });
1692 });
1693 });
1694}
@ ImportantNotificationLevel
Definition NotificationManager.hpp:222
Http & on_error(ErrorFn fn)
Definition Http.cpp:770
Http & timeout_connect(long timeout)
Definition Http.cpp:562
static std::string url_encode(const std::string &str)
Definition Http.cpp:969
static Http post(std::string url)
Definition Http.cpp:891
static Http get(std::string url)
Definition Http.cpp:886
Http & on_progress(ProgressFn fn)
Definition Http.cpp:776
@ PresetUpdateFinished
Definition NotificationManager.hpp:88
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:36
nlohmann::json json
Definition AssembleList.cpp:42
static bool reload_configs_update_gui()
Definition PresetUpdater.cpp:1708
static const char * TMP_EXTENSION
Definition PresetUpdater.cpp:76
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:45
@ lock
Definition GLGizmoEmboss.cpp:209
#define _u8L(s)
Definition I18N.hpp:11
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:96
bool extract_file(const fs::path &source_path, const fs::path &dest_path={})
Definition PresetUpdater.cpp:351
std::unordered_map< std::string, std::string > vendor_changelogs
Definition PresetUpdater.cpp:241
std::vector< std::thread > vendor_check_threads
Definition PresetUpdater.cpp:243
std::mutex vendor_changelogs_mutex
Definition PresetUpdater.cpp:242
std::atomic< bool > vendor_check_cancel
Definition PresetUpdater.cpp:244
Updates get_config_updates(const Semver &old_slic3r_version) const
Definition PresetUpdater.cpp:1146

References _L_PLURAL, _u8L, cache_path, cancel, extract_file(), Slic3r::format(), Slic3r::GUI::format(), Slic3r::Http::get(), get_config_updates(), Slic3r::GUI::NotificationManager::ImportantNotificationLevel, Slic3r::installed_vendor_version(), Slic3r::Http::on_error(), Slic3r::Http::on_progress(), Slic3r::AppConfig::orig_version(), perform_updates(), Slic3r::Http::post(), Slic3r::GUI::PresetUpdateFinished, Slic3r::AppConfig::profile_update_url(), Slic3r::reload_configs_update_gui(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::Http::timeout_connect(), Slic3r::TMP_EXTENSION, Slic3r::Semver::to_string(), Slic3r::Updates::updates, Slic3r::Http::url_encode(), vendor_changelogs, vendor_changelogs_mutex, vendor_check_cancel, and vendor_check_threads.

Here is the call graph for this function:

◆ extract_file()

bool Slic3r::PresetUpdater::priv::extract_file ( const fs::path & source_path,
const fs::path & dest_path = {} )
352{
353 const std::string parent_path = (!dest_path.empty() ? dest_path : source_path.parent_path()).string();
354 return extract_archive_confined(source_path.string(), parent_path);
355}
bool extract_archive_confined(const std::string &zip_path_utf8, const std::string &dest_dir)
Definition miniz_extension.cpp:172

References Slic3r::extract_archive_confined().

Referenced by check_new_vendors(), sync_resources(), and sync_vendor_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_cached_plugins_version()

bool Slic3r::PresetUpdater::priv::get_cached_plugins_version ( std::string & cached_version,
bool & force )
798{
799 // The OTA plugin cache lives in its own ota/plugins subfolder; the update dialog
800 // (Plater::priv::update_plugin_when_launch) reads the changelog from the same place.
801 auto cache_folder = cache_path / "plugins";
802 std::string network_library, player_library, live555_library;
803 bool has_plugins = false;
804
805#if defined(_MSC_VER) || defined(_WIN32)
806 network_library = cache_folder.string() + "/bambu_networking.dll";
807 player_library = cache_folder.string() + "/BambuSource.dll";
808 live555_library = cache_folder.string() + "/live555.dll";
809#elif defined(__WXMAC__)
810 network_library = cache_folder.string() + "/libbambu_networking.dylib";
811 player_library = cache_folder.string() + "/libBambuSource.dylib";
812 live555_library = cache_folder.string() + "/liblive555.dylib";
813#else
814 network_library = cache_folder.string() + "/libbambu_networking.so";
815 player_library = cache_folder.string() + "/libBambuSource.so";
816 live555_library = cache_folder.string() + "/liblive555.so";
817#endif
818
819 std::string changelog_file = cache_folder.string() + "/network_plugins.json";
820 if (boost::filesystem::exists(network_library)
821 && boost::filesystem::exists(player_library)
822 && boost::filesystem::exists(live555_library)
823 && boost::filesystem::exists(changelog_file))
824 {
825 has_plugins = true;
826 try {
827 boost::nowide::ifstream ifs(changelog_file);
828 json j;
829 ifs >> j;
830
831 if (j.contains("version"))
832 cached_version = j["version"];
833 if (j.contains("force"))
834 force = j["force"];
835
836 BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": cached_version = "<<cached_version<<", force = " << force;
837 }
838 catch(nlohmann::detail::parse_error &err) {
839 BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<changelog_file<<" got a nlohmann::detail::parse_error, reason = " << err.what();
840 //throw ConfigurationError(format("Failed loading json file \"%1%\": %2%", file_path, err.what()));
841 }
842 }
843
844 return has_plugins;
845}

References cache_path.

Referenced by sync_plugins().

Here is the caller graph for this function:

◆ get_config_updates()

Updates Slic3r::PresetUpdater::priv::get_config_updates ( const Semver & old_slic3r_version) const
1147{
1148 Updates updates;
1149
1150 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:Checking for cached configuration updates...";
1151 auto cache_profile_path = cache_path / "profiles";
1152 if (!fs::exists(cache_profile_path))
1153 return updates;
1154
1155 // Orca (PR #130): vendor changelogs are captured in memory during
1156 // sync_vendor_config()/check_new_vendors(), not written beside the cache.
1157 std::unordered_map<std::string, std::string> changelogs;
1158 {
1159 std::lock_guard<std::mutex> lock(vendor_changelogs_mutex);
1160 changelogs = vendor_changelogs;
1161 }
1162
1163 for (auto &dir_entry : boost::filesystem::directory_iterator(cache_profile_path)) {
1164 const auto &path = dir_entry.path();
1165 std::string file_path = path.string();
1166 const bool is_opc_file = boost::iequals(path.extension().string(), ".opc");
1167 if (!is_json_file(file_path) && !is_opc_file)
1168 continue;
1169
1170 const std::string vendor_name = path.stem().string();
1171 auto print_in_cache = (cache_profile_path / vendor_name / PRESET_PRINT_NAME);
1172 auto filament_in_cache = (cache_profile_path / vendor_name / PRESET_FILAMENT_NAME);
1173 auto machine_in_cache = (cache_profile_path / vendor_name / PRESET_PRINTER_NAME);
1174
1175 // Orca (PR #130): a JSON cache entry is only meaningful next to a non-empty
1176 // <vendor>/ preset directory; a stray or half-downloaded <vendor>.json is
1177 // skipped. An .opc cache is a single self-contained file (validated below),
1178 // so this check does not apply to it.
1179 if (!is_opc_file) {
1180 const auto vendor_folder_in_cache = cache_profile_path / vendor_name;
1181 if (!fs::is_regular_file(path) || !fs::is_directory(vendor_folder_in_cache) ||
1182 fs::is_empty(vendor_folder_in_cache)) {
1183 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater]:ignoring invalid cached update for "
1184 << vendor_name << ": expected " << vendor_name
1185 << ".json and a non-empty " << vendor_name << " directory";
1186 continue;
1187 }
1188 }
1189
1190 if (is_vendor_installed(vendor_name)
1191 || is_opc_file
1192 || fs::exists(print_in_cache)
1193 || fs::exists(filament_in_cache)
1194 || fs::exists(machine_in_cache)) {
1195 // Orca: a vendor installed as a preset cache carries its version there.
1196 Semver vendor_ver = installed_vendor_version(vendor_name);
1197
1198 Semver cache_ver;
1199 std::string description;
1200 bool force_update = false;
1201 if (is_opc_file) {
1202 cache_ver = VendorCacheFile::usable_version(file_path, vendor_name);
1203 if (!cache_ver.valid()) {
1204 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater]:ignoring unreadable vendor cache " << file_path;
1205 continue;
1206 }
1207 }
1208 else {
1209 std::map<std::string, std::string> key_values;
1210 std::vector<std::string> keys(3);
1211 keys[0] = BBL_JSON_KEY_VERSION;
1212 keys[1] = BBL_JSON_KEY_DESCRIPTION;
1213 keys[2] = BBL_JSON_KEY_FORCE_UPDATE;
1214 get_values_from_json(file_path, keys, key_values);
1215 description = key_values[BBL_JSON_KEY_DESCRIPTION];
1216 if (key_values.find(BBL_JSON_KEY_FORCE_UPDATE) != key_values.end())
1217 force_update = (key_values[BBL_JSON_KEY_FORCE_UPDATE] == "1")?true:false;
1218 auto config_version = Semver::parse(key_values[BBL_JSON_KEY_VERSION]);
1219 if (config_version)
1220 cache_ver = *config_version;
1221 }
1222
1223 // Orca (PR #130): changelog for this vendor was captured in memory at sync time.
1224 const auto changelog_it = changelogs.find(vendor_name);
1225 std::string changelog = changelog_it != changelogs.end() ? changelog_it->second : std::string();
1226
1227 if (vendor_ver < cache_ver) {
1228 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:need to update settings from " << vendor_ver.to_string()
1229 << " to newer version " << cache_ver.to_string() << ", app version " << SLIC3R_VERSION;
1230 Version version;
1231 version.config_version = cache_ver;
1232 version.comment = description;
1233 if (is_opc_file) {
1234 // A cache contains the vendor profile and all presets.
1235 // Install it directly; Update::install removes any
1236 // superseded JSON representation.
1237 auto &update = updates.updates.emplace_back(
1238 std::move(file_path), vendor_path / (vendor_name + ".opc"),
1239 std::move(version), vendor_name, changelog, "", force_update, false);
1240 update.is_opc = true;
1241 }
1242 else {
1243 // JSON profile and its preset directory are installed
1244 // separately, as before.
1245 updates.updates.emplace_back(std::move(file_path),
1246 vendor_path / (vendor_name + ".json"), std::move(version),
1247 vendor_name, changelog, "", force_update, false);
1248 updates.updates.emplace_back(cache_profile_path / vendor_name,
1249 vendor_path / vendor_name, Version(), vendor_name,
1250 "", "", force_update, true);
1251 }
1252 } else {
1253 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:cached settings for " << vendor_name
1254 << " are not newer than installed version, installed " << vendor_ver.to_string()
1255 << ", cached " << cache_ver.to_string();
1256 }
1257 }
1258 }
1259
1260 return updates;
1261}
#define BBL_JSON_KEY_DESCRIPTION
Definition Preset.hpp:59
#define BBL_JSON_KEY_VERSION
Definition Preset.hpp:55
#define BBL_JSON_KEY_FORCE_UPDATE
Definition Preset.hpp:60
#define PRESET_PRINTER_NAME
Definition Preset.hpp:35
#define PRESET_PRINT_NAME
Definition Preset.hpp:34
#define PRESET_FILAMENT_NAME
Definition Preset.hpp:33
static boost::optional< Semver > parse(const std::string &str)
Definition Semver.hpp:63
static Semver usable_version(const std::string &path, const std::string &expected_vendor_name)
Definition PresetCacheFormat.cpp:553
@ Version
Definition PluginSort.hpp:22
bool is_json_file(const std::string &path)
Definition utils.cpp:1214
int get_values_from_json(std::string file_path, std::vector< std::string > &keys, std::map< std::string, std::string > &key_values)
Definition Preset.cpp:223
Semver config_version
Definition Version.hpp:20
std::string comment
Definition Version.hpp:28

References BBL_JSON_KEY_DESCRIPTION, BBL_JSON_KEY_FORCE_UPDATE, BBL_JSON_KEY_VERSION, cache_path, Slic3r::GUI::Config::Version::comment, Slic3r::GUI::Config::Version::config_version, Slic3r::get_values_from_json(), Slic3r::installed_vendor_version(), Slic3r::is_json_file(), Slic3r::is_vendor_installed(), Slic3r::Semver::parse(), PRESET_FILAMENT_NAME, PRESET_PRINT_NAME, PRESET_PRINTER_NAME, Slic3r::Semver::to_string(), Slic3r::Updates::updates, Slic3r::VendorCacheFile::usable_version(), Slic3r::Semver::valid(), vendor_changelogs, vendor_changelogs_mutex, and vendor_path.

Referenced by check_new_vendors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_file()

bool Slic3r::PresetUpdater::priv::get_file ( const std::string & url,
const fs::path & target_path ) const
315{
316 bool res = false;
317 fs::path tmp_path = target_path;
318 tmp_path += format(".%1%%2%", get_current_pid(), TMP_EXTENSION);
319
320 BOOST_LOG_TRIVIAL(info) << format("[BBS Updater]download file `%1%`, stored to `%2%`, tmp path `%3%`",
321 url,
322 target_path.string(),
323 tmp_path.string());
324
326 .on_progress([this](Slic3r::Http::Progress, bool &cancel_http) {
327 if (cancel) {
328 cancel_http = true;
329 }
330 })
331 .on_error([&](std::string body, std::string error, unsigned http_status) {
332 (void)body;
333 BOOST_LOG_TRIVIAL(error) << format("[BBS Updater]getting: `%1%`: http status %2%, %3%",
334 url,
335 http_status,
336 error);
337 })
338 .on_complete([&](std::string body, unsigned /* http_status */) {
339 fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc);
340 file.write(body.c_str(), body.size());
341 file.close();
342 fs::rename(tmp_path, target_path);
343 res = true;
344 })
345 .perform_sync();
346
347 return res;
348}
unsigned get_current_pid()
Definition utils.cpp:1480

References cancel, Slic3r::format(), Slic3r::Http::get(), Slic3r::get_current_pid(), Slic3r::Http::on_progress(), and Slic3r::TMP_EXTENSION.

Referenced by sync_resources().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_printer_config_updates()

Updates Slic3r::PresetUpdater::priv::get_printer_config_updates ( bool update = false) const
1096{
1097 std::string data_dir_str = data_dir();
1098 boost::filesystem::path data_dir_path(data_dir_str);
1099 boost::filesystem::path resc_dir_path(resources_dir());
1100 auto config_folder = data_dir_path / "printers";
1101 auto resc_folder = (update ? cache_path : resc_dir_path) / "printers";
1102 std::string curr_version;
1103 std::string resc_version;
1104 try {
1105 Slic3r::load_string_file(resc_folder / "version.txt", resc_version);
1106 boost::algorithm::trim(resc_version);
1107 } catch (...) {}
1108 try {
1109 Slic3r::load_string_file(config_folder / "version.txt", curr_version);
1110 boost::algorithm::trim(curr_version);
1111 } catch (...) {}
1112
1113 if (!curr_version.empty()) {
1114 Semver curr_ver = curr_version;
1115 Semver resc_ver = resc_version;
1116
1117 bool version_match = ((resc_ver.maj() == curr_ver.maj()) && (resc_ver.min() == curr_ver.min()));
1118
1119 if (!version_match || (curr_ver < resc_ver)) {
1120 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:found newer version " << resc_version << " from resource, old version " << curr_version;
1121 } else {
1122 return {};
1123 }
1124 }
1125 Updates updates;
1126 Version version;
1127 version.config_version = resc_version;
1128 std::string change_log;
1129 if (update) {
1130 std::string changelog_file = (resc_folder / "printer.json").string();
1131 try {
1132 boost::nowide::ifstream ifs(changelog_file);
1133 json j;
1134 ifs >> j;
1135 version.comment = j["description"];
1136 } catch (...) {}
1137 }
1138 updates.updates.emplace_back(std::move(resc_folder), std::move(config_folder), version, "bbl", change_log, version.comment, false, true);
1139 return updates;
1140}
void load_string_file(const boost::filesystem::path &p, std::string &str)
Definition utils.cpp:2164

References cache_path, Slic3r::GUI::Config::Version::comment, Slic3r::GUI::Config::Version::config_version, Slic3r::data_dir(), Slic3r::load_string_file(), Slic3r::Semver::maj(), Slic3r::Semver::min(), Slic3r::resources_dir(), and Slic3r::Updates::updates.

Referenced by priv(), and sync_printer_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ install_bundles_rsrc()

bool Slic3r::PresetUpdater::priv::install_bundles_rsrc ( const std::vector< std::string > & bundles,
bool snapshot ) const
1033{
1034 // Use the Core library function to install bundles
1035 // This function is now in libslic3r so both Core and GUI can use it
1037 BOOST_LOG_TRIVIAL(error) << "Failed to install bundles from resources";
1038 return false;
1039 }
1040
1041 // Snapshot logic is currently commented out in perform_updates, so we don't need to handle it here
1042 // If snapshot logic is needed in the future, it can be added here
1043
1044 return true;
1045}
bool install_vendor_bundles_from_resources(const std::vector< std::string > &bundle_names, const std::string &resource_subdir, const std::string &data_subdir)
Definition utils.cpp:2041

References Slic3r::install_vendor_bundles_from_resources().

Here is the call graph for this function:

◆ parse_version_string()

void Slic3r::PresetUpdater::priv::parse_version_string ( const std::string & body) const
397{
398#if 0
399 // release version
400 std::string version;
401 const auto first_nl_pos = body.find_first_of("\n\r");
402 if (first_nl_pos != std::string::npos)
403 version = body.substr(0, first_nl_pos);
404 else
405 version = body;
406 boost::optional<Semver> release_version = Semver::parse(version);
407 if (!release_version) {
408 BOOST_LOG_TRIVIAL(error) << format("Received invalid contents from `%1%`: Not a correct semver: `%2%`", SLIC3R_APP_NAME, version);
409 return;
410 }
411 BOOST_LOG_TRIVIAL(info) << format("Got %1% online version: `%2%`. Sending to GUI thread...", SLIC3R_APP_NAME, version);
412 wxCommandEvent* evt = new wxCommandEvent(EVT_SLIC3R_VERSION_ONLINE);
413 evt->SetString(GUI::from_u8(version));
414 GUI::wxGetApp().QueueEvent(evt);
415
416 // alpha / beta version
417 std::vector<std::string> prerelease_versions;
418 size_t nexn_nl_pos = first_nl_pos;
419 while (nexn_nl_pos != std::string::npos && body.size() > nexn_nl_pos + 1) {
420 const auto last_nl_pos = nexn_nl_pos;
421 nexn_nl_pos = body.find_first_of("\n\r", last_nl_pos + 1);
422 std::string line;
423 if (nexn_nl_pos == std::string::npos)
424 line = body.substr(last_nl_pos + 1);
425 else
426 line = body.substr(last_nl_pos + 1, nexn_nl_pos - last_nl_pos - 1);
427
428 // alpha
429 if (line.substr(0, 6) == "alpha=") {
430 version = line.substr(6);
431 if (!Semver::parse(version)) {
432 BOOST_LOG_TRIVIAL(error) << format("Received invalid contents for alpha release from `%1%`: Not a correct semver: `%2%`", SLIC3R_APP_NAME, version);
433 return;
434 }
435 prerelease_versions.emplace_back(version);
436 // beta
437 }
438 else if (line.substr(0, 5) == "beta=") {
439 version = line.substr(5);
440 if (!Semver::parse(version)) {
441 BOOST_LOG_TRIVIAL(error) << format("Received invalid contents for beta release from `%1%`: Not a correct semver: `%2%`", SLIC3R_APP_NAME, version);
442 return;
443 }
444 prerelease_versions.emplace_back(version);
445 }
446 }
447 // find recent version that is newer than last full release.
448 boost::optional<Semver> recent_version;
449 for (const std::string& ver_string : prerelease_versions) {
450 boost::optional<Semver> ver = Semver::parse(ver_string);
451 if (ver && *release_version < *ver && ((recent_version && *recent_version < *ver) || !recent_version)) {
452 recent_version = ver;
453 version = ver_string;
454 }
455 }
456 if (recent_version) {
457 BOOST_LOG_TRIVIAL(info) << format("Got %1% online version: `%2%`. Sending to GUI thread...", SLIC3R_APP_NAME, version);
458 wxCommandEvent* evt = new wxCommandEvent(EVT_SLIC3R_EXPERIMENTAL_VERSION_ONLINE);
459 evt->SetString(GUI::from_u8(version));
460 GUI::wxGetApp().QueueEvent(evt);
461 }
462#endif
463 return;
464}
wxString from_u8(const std::string &str)
Definition GUI.cpp:544

References Slic3r::format(), Slic3r::GUI::from_u8(), and Slic3r::Semver::parse().

Referenced by sync_version().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ perform_updates()

bool Slic3r::PresetUpdater::priv::perform_updates ( Updates && updates,
bool snapshot = true ) const
1265{
1266 //std::string vendor_path;
1267 //std::string vendor_name;
1268 if (updates.incompats.size() > 0) {
1269 //if (snapshot) {
1270 // BOOST_LOG_TRIVIAL(info) << "Taking a snapshot...";
1271 // if (! GUI::Config::take_config_snapshot_cancel_on_error(*GUI::wxGetApp().app_config, Snapshot::SNAPSHOT_DOWNGRADE, "",
1272 // _u8L("Continue and install configuration updates?")))
1273 // return false;
1274 //}
1275 BOOST_LOG_TRIVIAL(info) << format("[Orca Updater]:Deleting %1% incompatible bundles", updates.incompats.size());
1276
1277 for (auto &incompat : updates.incompats) {
1278 BOOST_LOG_TRIVIAL(info) << '\t' << incompat;
1279 incompat.remove();
1280 }
1281 } else if (updates.updates.size() > 0) {
1282 //if (snapshot) {
1283 // BOOST_LOG_TRIVIAL(info) << "Taking a snapshot...";
1284 // if (! GUI::Config::take_config_snapshot_cancel_on_error(*GUI::wxGetApp().app_config, Snapshot::SNAPSHOT_UPGRADE, "",
1285 // _u8L("Continue and install configuration updates?")))
1286 // return false;
1287 //}
1288
1289 BOOST_LOG_TRIVIAL(info) << format("[Orca Updater]:Performing %1% updates", updates.updates.size());
1290
1291 for (const auto &update : updates.updates) {
1292 BOOST_LOG_TRIVIAL(info) << '\t' << update;
1293
1294 update.install();
1295 //if (!update.is_directory) {
1296 // vendor_path = update.source.parent_path().string();
1297 // vendor_name = update.vendor;
1298 //}
1299 }
1300
1301 //if (!vendor_path.empty()) {
1302 // PresetBundle bundle;
1303 // // Throw when parsing invalid configuration. Only valid configuration is supposed to be provided over the air.
1304 // bundle.load_vendor_configs_from_json(vendor_path, vendor_name, PresetBundle::LoadConfigBundleAttribute::LoadSystem, ForwardCompatibilitySubstitutionRule::Disable);
1305
1306 // BOOST_LOG_TRIVIAL(info) << format("Deleting %1% conflicting presets", bundle.prints.size() + bundle.filaments.size() + bundle.printers.size());
1307
1308 // auto preset_remover = [](const Preset& preset) {
1309 // BOOST_LOG_TRIVIAL(info) << '\t' << preset.file;
1310 // fs::remove(preset.file);
1311 // };
1312
1313 // for (const auto &preset : bundle.prints) { preset_remover(preset); }
1314 // for (const auto &preset : bundle.filaments) { preset_remover(preset); }
1315 // for (const auto &preset : bundle.printers) { preset_remover(preset); }
1316 //}
1317 }
1318
1319 return true;
1320}

References Slic3r::format().

Referenced by priv(), and check_new_vendors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prune_tmp()

void Slic3r::PresetUpdater::priv::prune_tmp ( const std::string & vendor_id) const
359{
360 boost::system::error_code ec;
361 const fs::path tmp_path = cache_path / (vendor_id + TMP_EXTENSION);
362 fs::remove(tmp_path, ec);
363 if (ec)
364 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater]failed to remove " << tmp_path.string() << ": " << ec.message();
365}

References cache_path, and Slic3r::TMP_EXTENSION.

◆ set_download_prefs()

void Slic3r::PresetUpdater::priv::set_download_prefs ( AppConfig * app_config)
302{
303 version_check_url = app_config->version_check_url();
304
305 auto profile_update_url = app_config->profile_update_url();
306 if (!profile_update_url.empty() && app_config->get_bool("enable_ota"))
308 else
309 enabled_config_update = false;
310}
bool enabled_config_update
Definition PresetUpdater.cpp:222
std::string version_check_url
Definition PresetUpdater.cpp:223

References enabled_config_update, Slic3r::AppConfig::get_bool(), Slic3r::AppConfig::profile_update_url(), Slic3r::AppConfig::version_check_url(), and version_check_url.

Referenced by priv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_waiting_updates()

void Slic3r::PresetUpdater::priv::set_waiting_updates ( Updates u)
1323{
1324 waiting_updates = u;
1325 has_waiting_updates = true;
1326}
bool has_waiting_updates
Definition PresetUpdater.cpp:232
Updates waiting_updates
Definition PresetUpdater.cpp:233

References has_waiting_updates, and waiting_updates.

◆ sync_plugins()

void Slic3r::PresetUpdater::priv::sync_plugins ( std::string http_url,
std::string plugin_version )
848{
849 if (plugin_version == "00.00.00.00") {
850 BOOST_LOG_TRIVIAL(info) << "non need to sync plugins for there is no plugins currently.";
851 return;
852 }
853 std::string curr_version = GUI::wxGetApp().use_legacy_network_plugin() ? BAMBU_NETWORK_AGENT_VERSION_LEGACY : get_latest_network_version();
854 std::string using_version = curr_version.substr(0, 9) + "00";
855 auto cache_plugin_folder = cache_path / "plugins";
856
857 // Orca: drop leftovers from the old flat ota/ cache layout (pre ota/plugins) so the
858 // stale files cannot linger forever after this layout migration.
859 {
860#if defined(_MSC_VER) || defined(_WIN32)
861 const char* legacy_names[] = {"bambu_networking.dll", "BambuSource.dll", "live555.dll", "network_plugins.json"};
862#elif defined(__WXMAC__)
863 const char* legacy_names[] = {"libbambu_networking.dylib", "libBambuSource.dylib", "liblive555.dylib", "network_plugins.json"};
864#else
865 const char* legacy_names[] = {"libbambu_networking.so", "libBambuSource.so", "liblive555.so", "network_plugins.json"};
866#endif
867 for (const char* name : legacy_names) {
868 boost::system::error_code ec;
869 auto legacy_file = cache_path / name;
870 if (boost::filesystem::exists(legacy_file, ec))
871 boost::filesystem::remove(legacy_file, ec);
872 }
873 }
874
875 std::string cached_version;
876 bool force_upgrade = false;
877 get_cached_plugins_version(cached_version, force_upgrade);
878 if (!cached_version.empty()) {
879 bool need_delete_cache = false;
880 Semver current_semver = curr_version;
881 Semver cached_semver = cached_version;
882
883 int curent_patch_cc = current_semver.patch()/100;
884 int cached_patch_cc = cached_semver.patch()/100;
885 int curent_patch_dd = current_semver.patch()%100;
886 int cached_patch_dd = cached_semver.patch()%100;
887 if ((cached_semver.maj() != current_semver.maj())
888 || (cached_semver.min() != current_semver.min())
889 || (curent_patch_cc != cached_patch_cc))
890 {
891 need_delete_cache = true;
892 BOOST_LOG_TRIVIAL(info) << boost::format("cached plugins version %1% not match with current %2%")%cached_version%curr_version;
893 }
894 else if (cached_patch_dd <= curent_patch_dd) {
895 need_delete_cache = true;
896 BOOST_LOG_TRIVIAL(info) << boost::format("cached plugins version %1% not newer than current %2%")%cached_version%curr_version;
897 }
898 else {
899 BOOST_LOG_TRIVIAL(info) << boost::format("cached plugins version %1% newer than current %2%")%cached_version%curr_version;
900 plugin_version = cached_version;
901 }
902
903 if (need_delete_cache) {
904 BOOST_LOG_TRIVIAL(info) << "[remove_old_networking_plugins] remove the plugins directory " << cache_plugin_folder.string();
905 try {
906 fs::remove_all(cache_plugin_folder);
907 } catch (...) {
908 BOOST_LOG_TRIVIAL(error) << "Failed removing the plugins directory " << cache_plugin_folder.string();
909 }
910 }
911 }
912
913#if defined(__WINDOWS__)
914 if (GUI::wxGetApp().is_running_on_arm64() && !GUI::wxGetApp().use_legacy_network_plugin()) {
915 //set to arm64 for plugins
916 std::map<std::string, std::string> current_headers = Slic3r::Http::get_extra_headers();
917 current_headers["X-BBL-OS-Type"] = "windows_arm";
918
919 Slic3r::Http::set_extra_headers(current_headers);
920 BOOST_LOG_TRIVIAL(info) << boost::format("set X-BBL-OS-Type to windows_arm");
921 }
922#endif
923 try {
924 std::map<std::string, Resource> resources
925 {
926 {"slicer/plugins/cloud", { using_version, "", "", false, cache_plugin_folder.string()}}
927 };
928 sync_resources(http_url, resources, true, plugin_version, "network_plugins.json");
929 }
930 catch (std::exception& e) {
931 BOOST_LOG_TRIVIAL(warning) << format("[Orca Updater] sync_plugins: %1%", e.what());
932 }
933#if defined(__WINDOWS__)
934 if (GUI::wxGetApp().is_running_on_arm64() && !GUI::wxGetApp().use_legacy_network_plugin()) {
935 //set back
936 std::map<std::string, std::string> current_headers = Slic3r::Http::get_extra_headers();
937 current_headers["X-BBL-OS-Type"] = "windows";
938
939 Slic3r::Http::set_extra_headers(current_headers);
940 BOOST_LOG_TRIVIAL(info) << boost::format("set X-BBL-OS-Type back to windows");
941 }
942#endif
943
944 bool result = get_cached_plugins_version(cached_version, force_upgrade);
945 if (result) {
946 BOOST_LOG_TRIVIAL(info) << format("[Orca Updater] found new plugins: %1%, prompt to update, force_upgrade %2%", cached_version, force_upgrade);
947 if (force_upgrade) {
948 auto app_config = GUI::wxGetApp().app_config;
949 if (!app_config)
950 GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::NotificationType::BBLPluginUpdateAvailable);
951 else
952 app_config->set("update_network_plugin", "true");
953 }
954 else
955 GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::NotificationType::BBLPluginUpdateAvailable);
956 }
957}
#define BAMBU_NETWORK_AGENT_VERSION_LEGACY
Definition AppConfig.hpp:65
static std::map< std::string, std::string > get_extra_headers()
Definition Http.cpp:937
static void set_extra_headers(std::map< std::string, std::string > headers)
Definition Http.cpp:931
@ BBLPluginUpdateAvailable
Definition NotificationManager.hpp:175
const char * get_latest_network_version()
Definition bambu_networking.hpp:443
bool get_cached_plugins_version(std::string &cached_version, bool &force)
Definition PresetUpdater.cpp:797
void sync_resources(std::string http_url, std::map< std::string, Resource > &resources, bool check_patch=false, std::string current_version="", std::string changelog_file="")
Definition PresetUpdater.cpp:469

References BAMBU_NETWORK_AGENT_VERSION_LEGACY, Slic3r::GUI::BBLPluginUpdateAvailable, cache_path, Slic3r::format(), get_cached_plugins_version(), Slic3r::Http::get_extra_headers(), Slic3r::get_latest_network_version(), Slic3r::Semver::maj(), Slic3r::Semver::min(), Slic3r::Semver::patch(), Slic3r::Http::set_extra_headers(), and sync_resources().

Here is the call graph for this function:

◆ sync_printer_config()

void Slic3r::PresetUpdater::priv::sync_printer_config ( std::string http_url)
960{
961 std::string curr_version = SLIC3R_VERSION;
962 std::string using_version = curr_version.substr(0, 6) + "00.00";
963
964 std::string cached_version;
965 std::string data_dir_str = data_dir();
966 boost::filesystem::path data_dir_path(data_dir_str);
967 auto config_folder = data_dir_path / "printers";
968 auto cache_folder = data_dir_path / "ota" / "printers";
969
970 try {
971 auto version_file = config_folder / "version.txt";
972 if (fs::exists(version_file)) {
973 Slic3r::load_string_file(version_file, curr_version);
974 boost::algorithm::trim(curr_version);
975 }
976 } catch (...) {}
977 try {
978 auto version_file = cache_folder / "version.txt";
979 if (fs::exists(version_file)) {
980 Slic3r::load_string_file(version_file, cached_version);
981 boost::algorithm::trim(cached_version);
982 }
983 } catch (...) {}
984 if (!cached_version.empty()) {
985 bool need_delete_cache = false;
986 Semver current_semver = curr_version;
987 Semver cached_semver = cached_version;
988
989 if ((cached_semver.maj() != current_semver.maj()) || (cached_semver.min() != current_semver.min())) {
990 need_delete_cache = true;
991 BOOST_LOG_TRIVIAL(info) << boost::format("cached printer config version %1% not match with current %2%") % cached_version % curr_version;
992 } else if (cached_semver.patch() <= current_semver.patch()) {
993 need_delete_cache = true;
994 BOOST_LOG_TRIVIAL(info) << boost::format("cached printer config version %1% not newer than current %2%") % cached_version % curr_version;
995 } else {
996 using_version = cached_version;
997 }
998
999 if (need_delete_cache) {
1000 boost::system::error_code ec;
1001 boost::filesystem::remove_all(cache_folder, ec);
1002 cached_version = curr_version;
1003 }
1004 }
1005
1006 try {
1007 std::map<std::string, Resource> resources{{"slicer/printer/bbl", {using_version, "", "", false, cache_folder.string()}}};
1008 sync_resources(http_url, resources, false, cached_version, "printer.json");
1009 } catch (std::exception &e) {
1010 BOOST_LOG_TRIVIAL(warning) << format("[Orca Updater] sync_printer_config: %1%", e.what());
1011 }
1012
1013 bool result = false;
1014 try {
1015 auto version_file = cache_folder / "version.txt";
1016 if (fs::exists(version_file)) {
1017 Slic3r::load_string_file(version_file, cached_version);
1018 boost::algorithm::trim(cached_version);
1019 result = true;
1020 }
1021 } catch (...) {}
1022 if (result) {
1023 BOOST_LOG_TRIVIAL(info) << format("[Orca Updater] found new printer config: %1%, prompt to update", cached_version);
1025 if (waiting_printer_updates.updates.size() > 0) {
1027 GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::NotificationType::BBLPrinterConfigUpdateAvailable);
1028 }
1029 }
1030}
@ BBLPrinterConfigUpdateAvailable
Definition NotificationManager.hpp:177
bool has_waiting_printer_updates
Definition PresetUpdater.cpp:234
Updates waiting_printer_updates
Definition PresetUpdater.cpp:235

References Slic3r::GUI::BBLPrinterConfigUpdateAvailable, Slic3r::data_dir(), Slic3r::format(), get_printer_config_updates(), has_waiting_printer_updates, Slic3r::load_string_file(), Slic3r::Semver::maj(), Slic3r::Semver::min(), Slic3r::Semver::patch(), sync_resources(), and waiting_printer_updates.

Here is the call graph for this function:

◆ sync_resources()

void Slic3r::PresetUpdater::priv::sync_resources ( std::string http_url,
std::map< std::string, Resource > & resources,
bool check_patch = false,
std::string current_version = "",
std::string changelog_file = "" )
470{
471 std::map<std::string, Resource> resource_list;
472
473 BOOST_LOG_TRIVIAL(info) << boost::format("[Orca Updater]: sync_resources get preferred setting version for app version %1%, url: %2%, current_version_str %3%, check_patch %4%")%SLIC3R_APP_NAME%http_url%current_version_str%check_patch;
474
475 std::string query_params = "?";
476 bool first = true;
477 for (auto resource_it : resources) {
478 if (cancel) { return; }
479 auto resource_name = resource_it.first;
480 boost::to_lower(resource_name);
481 std::string query_resource = (boost::format("%1%=%2%")
482 % resource_name % resource_it.second.version).str();
483 if (!first) query_params += "&";
484 query_params += query_resource;
485 first = false;
486 }
487
488 std::string url = http_url;
489 url += query_params;
491 BOOST_LOG_TRIVIAL(info) << boost::format("[Orca Updater]: sync_resources request_url: %1%")%url;
492 http.on_progress([this](Slic3r::Http::Progress, bool &cancel_http) {
493 if (cancel) {
494 cancel_http = true;
495 }
496 })
497 .on_complete([&resource_list, resources](std::string body, unsigned) {
498 try {
499 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]: request_resources, body=" << body;
500
501 json j = json::parse(body);
502 std::string message = j["message"].get<std::string>();
503
504 if (message == "success") {
505 json resource = j.at("resources");
506 if (resource.is_array()) {
507 for (auto iter = resource.begin(); iter != resource.end(); iter++) {
508 std::string version;
509 std::string url;
510 std::string resource;
511 std::string description;
512 bool force_upgrade = false;
513 for (auto sub_iter = iter.value().begin(); sub_iter != iter.value().end(); sub_iter++) {
514 if (boost::iequals(sub_iter.key(), "type")) {
515 resource = sub_iter.value();
516 BOOST_LOG_TRIVIAL(trace) << "[Orca Updater]: get version of settings's type, " << sub_iter.value();
517 } else if (boost::iequals(sub_iter.key(), "version")) {
518 version = sub_iter.value();
519 } else if (boost::iequals(sub_iter.key(), "description")) {
520 description = sub_iter.value();
521 } else if (boost::iequals(sub_iter.key(), "url")) {
522 url = sub_iter.value();
523 }
524 else if (boost::iequals(sub_iter.key(), "force_update")) {
525 force_upgrade = sub_iter.value();
526 }
527 }
528 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]: get type " << resource << ", version " << version << ", url " << url<<", force_update "<<force_upgrade;
529
530 resource_list.emplace(resource, Resource{version, description, url, force_upgrade});
531 }
532 }
533 } else {
534 BOOST_LOG_TRIVIAL(error) << "[Orca Updater]: get version of settings failed, body=" << body;
535 }
536 } catch (std::exception &e) {
537 BOOST_LOG_TRIVIAL(error) << (boost::format("[Orca Updater]: get version of settings failed, exception=%1% body=%2%") % e.what() % body).str();
538 } catch (...) {
539 BOOST_LOG_TRIVIAL(error) << "[Orca Updater]: get version of settings failed, body=" << body;
540 }
541 })
542 .on_error([&](std::string body, std::string error, unsigned status) {
543 BOOST_LOG_TRIVIAL(error) << boost::format("[Orca Updater]: status=%1%, error=%2%, body=%3%") % status % error % body;
544 })
545 .perform_sync();
546
547 for (auto & resource_it : resources) {
548 if (cancel) { return; }
549
550 auto resource = resource_it.second;
551 std::string resource_name = resource_it.first;
552 boost::to_lower(resource_name);
553 auto resource_update = resource_list.find(resource_name);
554 if (resource_update == resource_list.end()) {
555 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]Vendor " << resource_name << " can not get setting versions online";
556 continue;
557 }
558 Semver online_version = resource_update->second.version;
559 // Semver current_version = get_version_from_json(vendor_root_config.string());
560 Semver current_version = current_version_str.empty()?resource.version:current_version_str;
561 bool version_match = ((online_version.maj() == current_version.maj()) && (online_version.min() == current_version.min()));
562 if (version_match && check_patch) {
563 int online_cc_patch = online_version.patch()/100;
564 int current_cc_patch = current_version.patch()/100;
565 if (online_cc_patch != current_cc_patch) {
566 version_match = false;
567 BOOST_LOG_TRIVIAL(warning) << boost::format("[Orca Updater]: online patch CC not match: online_cc_patch=%1%, current_cc_patch=%2%") % online_cc_patch % current_cc_patch;
568 }
569 }
570 if (version_match && (current_version < online_version)) {
571 if (cancel) { return; }
572
573 // need to download the online files
574 fs::path cache_path(resource.cache_root);
575 std::string online_url = resource_update->second.url;
576 std::string cache_file_path = (fs::temp_directory_path() / (fs::unique_path().string() + TMP_EXTENSION)).string();
577 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]Downloading resource: " << resource_name << ", version " << online_version.to_string();
578 if (!get_file(online_url, cache_file_path)) {
579 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater]download resource " << resource_name << " failed, url: " << online_url;
580 continue;
581 }
582 if (cancel) { return; }
583
584 // remove previous files before
585 if (resource.sub_caches.empty()) {
586 if (fs::exists(cache_path)) {
587 fs::remove_all(cache_path);
588 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]remove cache path " << cache_path.string();
589 }
590 } else {
591 for (auto sub : resource.sub_caches) {
592 if (fs::exists(cache_path / sub)) {
593 fs::remove_all(cache_path / sub);
594 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]remove cache path " << (cache_path / sub).string();
595 }
596 }
597 }
598 // extract the file downloaded
599 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]start to unzip the downloaded file " << cache_file_path << " to "<<cache_path;
600 fs::create_directories(cache_path);
601 if (!extract_file(cache_file_path, cache_path)) {
602 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater]extract resource " << resource_it.first << " failed, path: " << cache_file_path;
603 continue;
604 }
605 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]finished unzip the downloaded file " << cache_file_path;
606
607 // save the description to disk
608 if (changelog_file.empty())
609 changelog_file = (cache_path / "changelog.json").string();
610 else
611 changelog_file = (cache_path / changelog_file).string();
612
613 try {
614 json j;
615 //record the headers
616 j["version"] = resource_update->second.version;
617 j["description"] = resource_update->second.description;
618 j["force"] = resource_update->second.force;
619
620 boost::nowide::ofstream c;
621 c.open(changelog_file, std::ios::out | std::ios::trunc);
622 c << j.dump(1, '\t') << std::endl;
623 c.close();
624 }
625 catch(std::exception &err) {
626 BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": save to "<<changelog_file<<" got a generic exception, reason = " << err.what();
627 }
628
629 resource_it.second = resource_update->second;
630 }
631 else {
632 BOOST_LOG_TRIVIAL(warning) << boost::format("[Orca Updater]: online version=%1%, current_version=%2%, no need to download") % online_version.to_string() % current_version.to_string();
633 }
634 }
635}
void trace(unsigned int level, const char *message)
Definition utils.cpp:247
@ http
Definition IPrinterAgent.hpp:64
@ Http
Definition PluginAuditManager.hpp:49
bool get_file(const std::string &url, const fs::path &target_path) const
Definition PresetUpdater.cpp:314
Definition PresetUpdater.cpp:247

References cache_path, cancel, extract_file(), Slic3r::Http::get(), get_file(), Slic3r::http, Slic3r::Semver::maj(), Slic3r::Semver::min(), Slic3r::Semver::patch(), Slic3r::TMP_EXTENSION, Slic3r::Semver::to_string(), and Slic3r::trace().

Referenced by sync_plugins(), sync_printer_config(), and sync_tooltip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sync_tooltip()

void Slic3r::PresetUpdater::priv::sync_tooltip ( std::string http_url,
std::string language )
767{
768 try {
769 std::string common_version = "00.00.00.00";
770 std::string language_version = "00.00.00.00";
771 fs::path cache_root = fs::path(data_dir()) / "resources/tooltip";
772 try {
773 auto vf = cache_root / "common" / "version";
774 if (fs::exists(vf)) Slic3r::load_string_file(vf, common_version);
775 vf = cache_root / language / "version";
776 if (fs::exists(vf)) Slic3r::load_string_file(vf, language_version);
777 } catch (...) {}
778 std::map<std::string, Resource> resources
779 {
780 {"slicer/tooltip/common", { common_version, "", "", false, (cache_root / "common").string() }},
781 {"slicer/tooltip/" + language, { language_version, "", "", false, (cache_root / language).string() }}
782 };
783 sync_resources(http_url, resources);
784 for (auto &r : resources) {
785 if (!r.second.url.empty()) {
787 break;
788 }
789 }
790 }
791 catch (std::exception& e) {
792 BOOST_LOG_TRIVIAL(warning) << format("[Orca Updater] sync_tooltip: %1%", e.what());
793 }
794}
static void Reload()
Definition MarkdownTip.cpp:324

References Slic3r::data_dir(), Slic3r::format(), Slic3r::load_string_file(), Slic3r::GUI::MarkdownTip::Reload(), and sync_resources().

Here is the call graph for this function:

◆ sync_vendor_config()

void Slic3r::PresetUpdater::priv::sync_vendor_config ( const std::string & vendor_id)
639{
640 if (!enabled_config_update) return;
641
642 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] checking vendor update for " << vendor_id;
643
644 auto check_cancel = [this](Http::Progress, bool &cancel_http) {
645 if (cancel || vendor_check_cancel) cancel_http = true;
646 };
647
648 AppConfig *app_config = GUI::wxGetApp().app_config;
649 std::string url = app_config->profile_update_url()
650 + "?vendor=" + Http::url_encode(vendor_id)
651 + "&orca_version=" + Http::url_encode(SoftFever_VERSION);
652
653 std::string online_version_str; // this represents the PROFILE VERSION, not ORCA VERSION
654 std::string download_url_str;
655 std::string changelog;
656
657 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] fetching vendor update status from " << url;
658
659 Http::get(url)
661 .on_progress(check_cancel)
662 .on_error([&vendor_id](std::string body, std::string error, unsigned http_status) {
663 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] vendor check HTTP error for "
664 << vendor_id << ": " << error;
665 })
666 .on_complete([&](std::string body, unsigned http_status) {
667 if (http_status != 200) return;
668 try {
669 json j = json::parse(body);
670 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] url: " << url << " returned:" << body;
671
672 if (j.contains("vendor_version") && j.contains("download_url")) {
673 online_version_str = j["vendor_version"].get<std::string>();
674 download_url_str = j["download_url"].get<std::string>();
675 changelog = j.value("changelog", std::string());
676 }
677 } catch (const std::exception& e) {
678 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] vendor check JSON parse failed: " << e.what();
679 }
680 })
681 .perform_sync();
682
683 if (cancel || vendor_check_cancel) return;
684 if (online_version_str.empty() || download_url_str.empty()) {
685 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] no update available for vendor " << vendor_id;
686 return;
687 }
688
689 if (cancel || vendor_check_cancel) return;
690
691 // Clear only this vendor's cached data
692 auto cache_profile_path = cache_path / "profiles";
693 fs::create_directories(cache_profile_path);
694 boost::system::error_code ec;
695 fs::remove_all(cache_profile_path / vendor_id, ec);
696 fs::remove(cache_profile_path / (vendor_id + ".json"), ec);
697 // Orca: the OPC cache is the vendor's whole installation in one file; clear it too.
698 fs::remove(cache_profile_path / (vendor_id + ".opc"), ec);
699 // Best-effort cleanup of the legacy on-disk changelog written by older builds
700 // (changelogs are now kept in memory - see vendor_changelogs).
701 fs::remove(cache_profile_path / (vendor_id + ".changelog"), ec);
702
703 // Download the zip
704 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] downloading update for " << vendor_id
705 << " version " << online_version_str;
706 fs::path download_file = cache_path / (vendor_id + TMP_EXTENSION);
707 bool download_ok = false;
708
709 Http::get(download_url_str)
711 .on_progress(check_cancel)
712 .on_error([&vendor_id](std::string body, std::string error, unsigned http_status) {
713 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] download failed for " << vendor_id << ": " << error;
714 })
715 .on_complete([&](std::string body, unsigned http_status) {
716 if (http_status != 200) return;
717 fs::fstream file(download_file, std::ios::out | std::ios::binary | std::ios::trunc);
718 if (!file.good()) return;
719 file.write(body.c_str(), body.size());
720 file.close();
721 if (file.good())
722 download_ok = true;
723 })
724 .perform_sync();
725
726 if (!download_ok || cancel || vendor_check_cancel) return;
727
728 // Extract vendor profile bundles under ota/profiles. The downloaded zip contains
729 // either the vendor json/folder or the vendor cache at its root.
730 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] extracting update for " << vendor_id;
731 if (!extract_file(download_file, cache_profile_path)) {
732 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] extraction failed for " << vendor_id;
733 return;
734 }
735 fs::remove(download_file, ec);
736
737 if (cancel || vendor_check_cancel) return;
738
739 const fs::path cached_vendor_json = cache_profile_path / (vendor_id + ".json");
740 const fs::path cached_vendor_folder = cache_profile_path / vendor_id;
741
742 const fs::path cached_vendor_opc = cache_profile_path / (vendor_id + ".opc");
743
744 bool is_json_update = fs::is_regular_file(cached_vendor_json) && fs::is_directory(cached_vendor_folder) && !fs::is_empty(cached_vendor_folder);
745 bool is_opc_update = fs::is_regular_file(cached_vendor_opc);
746 if (!is_json_update && !is_opc_update) {
747 BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] rejected update for " << vendor_id
748 << ": expected " << vendor_id << ".json and a non-empty "
749 << vendor_id << " directory, or OPC update format.";
750 fs::remove_all(cached_vendor_folder, ec);
751 fs::remove(cached_vendor_json, ec);
752 return;
753 }
754
755 {
756 std::lock_guard<std::mutex> lock(vendor_changelogs_mutex);
757 vendor_changelogs[vendor_id] = std::move(changelog);
758 }
759
760 BOOST_LOG_TRIVIAL(info) << "[Orca Updater] vendor " << vendor_id << " update cached, notifying UI";
761 GUI::wxGetApp().CallAfter([] {
762 GUI::wxGetApp().check_config_updates_from_updater();
763 });
764}

References cache_path, cancel, enabled_config_update, extract_file(), Slic3r::Http::get(), Slic3r::Http::on_error(), Slic3r::Http::on_progress(), Slic3r::AppConfig::profile_update_url(), Slic3r::Http::timeout_connect(), Slic3r::TMP_EXTENSION, Slic3r::Http::url_encode(), vendor_changelogs, vendor_changelogs_mutex, and vendor_check_cancel.

Here is the call graph for this function:

◆ sync_version()

void Slic3r::PresetUpdater::priv::sync_version ( ) const
370{
371 if (! enabled_version_check) { return; }
372
373#if 0
376 .on_progress([this](Http::Progress, bool &cancel) {
377 cancel = this->cancel;
378 })
379 .on_error([&](std::string body, std::string error, unsigned http_status) {
380 (void)body;
381 BOOST_LOG_TRIVIAL(error) << format("Error getting: `%1%`: HTTP %2%, %3%",
383 http_status,
384 error);
385 })
386 .on_complete([&](std::string body, unsigned /* http_status */) {
387 boost::trim(body);
389 })
390 .perform_sync();
391#endif
392}
Http & size_limit(size_t sizeLimit)
Definition Http.cpp:576
static constexpr const int SLIC3R_VERSION_BODY_MAX
Definition PresetUpdater.hpp:19
void parse_version_string(const std::string &body) const
Definition PresetUpdater.cpp:396

References cancel, enabled_version_check, Slic3r::format(), Slic3r::Http::get(), Slic3r::Http::on_progress(), parse_version_string(), Slic3r::Http::size_limit(), Slic3r::SLIC3R_VERSION_BODY_MAX, and version_check_url.

Here is the call graph for this function:

Member Data Documentation

◆ cache_path

◆ cancel

bool Slic3r::PresetUpdater::priv::cancel

◆ checked_vendors

std::set<std::string> Slic3r::PresetUpdater::priv::checked_vendors

◆ enabled_config_update

bool Slic3r::PresetUpdater::priv::enabled_config_update

◆ enabled_version_check

bool Slic3r::PresetUpdater::priv::enabled_version_check

Referenced by priv(), and sync_version().

◆ has_waiting_printer_updates

bool Slic3r::PresetUpdater::priv::has_waiting_printer_updates { false }
234{ false };

Referenced by sync_printer_config().

◆ has_waiting_updates

bool Slic3r::PresetUpdater::priv::has_waiting_updates { false }
232{ false };

Referenced by set_waiting_updates().

◆ index_db

std::vector<Index> Slic3r::PresetUpdater::priv::index_db

◆ rsrc_path

fs::path Slic3r::PresetUpdater::priv::rsrc_path

◆ thread

std::thread Slic3r::PresetUpdater::priv::thread

◆ vendor_changelogs

std::unordered_map<std::string, std::string> Slic3r::PresetUpdater::priv::vendor_changelogs

◆ vendor_changelogs_mutex

std::mutex Slic3r::PresetUpdater::priv::vendor_changelogs_mutex
mutable

◆ vendor_check_cancel

std::atomic<bool> Slic3r::PresetUpdater::priv::vendor_check_cancel {false}
244{false};

Referenced by check_new_vendors(), and sync_vendor_config().

◆ vendor_check_threads

std::vector<std::thread> Slic3r::PresetUpdater::priv::vendor_check_threads

Referenced by check_new_vendors().

◆ vendor_path

fs::path Slic3r::PresetUpdater::priv::vendor_path

Referenced by priv(), and get_config_updates().

◆ version_check_url

std::string Slic3r::PresetUpdater::priv::version_check_url

Referenced by set_download_prefs(), and sync_version().

◆ waiting_printer_updates

Updates Slic3r::PresetUpdater::priv::waiting_printer_updates

Referenced by sync_printer_config().

◆ waiting_updates

Updates Slic3r::PresetUpdater::priv::waiting_updates

Referenced by set_waiting_updates().


The documentation for this struct was generated from the following file: