Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support downloading from makerworld on Mac by default. #6867

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmake/modules/MacOSXBundleInfo.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
<array>
<string>orcaslicer</string>
</array>
</dict>
<dict>
<key>CFBundleURLName</key>
<string>BambuStudio Downloads</string>
<key>CFBundleURLSchemes</key>
<array>
<string>bambustudioopen</string>
</array>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ extern bool is_json_file(const std::string& path);
// Orca: custom protocal support utils
inline bool is_orca_open(const std::string& url) { return boost::starts_with(url, "orcaslicer://open"); }
inline bool is_prusaslicer_open(const std::string& url) { return boost::starts_with(url, "prusaslicer://open"); }
inline bool is_bambustudio_open(const std::string& url) { return boost::starts_with(url, "bambustudio://open"); }
inline bool is_bambustudio_open(const std::string& url) { return boost::starts_with(url, "bambustudio://open") || boost::starts_with(url, "bambustudioopen://"); }
inline bool is_cura_open(const std::string& url) { return boost::starts_with(url, "cura://open"); }
inline bool is_supported_open_protocol(const std::string& url) { return is_orca_open(url) || is_prusaslicer_open(url) || is_bambustudio_open(url) || is_cura_open(url); }
inline bool is_printables_link(const std::string& url) {
Expand Down
1 change: 1 addition & 0 deletions src/platform/osx/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<array>
<string>orcasliceropen</string>
<string>orcaslicer</string>
<string>bambustudioopen</string>
</array>
</dict>
</array>
Expand Down
3 changes: 2 additions & 1 deletion src/slic3r/GUI/Downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ void Downloader::start_download(const std::string& full_url)
// Orca: Replace PS workaround for "mysterious slash" with a more dynamic approach
// Windows seems to have fixed the issue and this provides backwards compatability for those it still affects
boost::regex re(R"(^(orcaslicer|prusaslicer|bambustudio|cura):\/\/open[\/]?\?file=)", boost::regbase::icase);
boost::regex re2(R"(^(bambustudioopen):\/\/)", boost::regex::icase);
boost::smatch results;

if (!boost::regex_search(full_url, results, re)) {
if (!boost::regex_search(full_url, results, re) && !boost::regex_search(full_url, results, re2)) {
BOOST_LOG_TRIVIAL(error) << "Could not start download due to wrong URL: " << full_url;
// Orca: show error
NotificationManager* ntf_mngr = wxGetApp().notification_manager();
Expand Down
3 changes: 2 additions & 1 deletion src/slic3r/GUI/InstanceCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ void OtherInstanceMessageHandler::handle_message(const std::string& message)
std::vector<boost::filesystem::path> paths;
std::vector<std::string> downloads;
boost::regex re(R"(^(orcaslicer|prusaslicer|cura|bambustudio):\/\/open[\/]?\?file=)", boost::regbase::icase);
boost::regex re2(R"(^(bambustudioopen):\/\/)", boost::regex::icase);
boost::smatch results;

// Skip the first argument, it is the path to the slicer executable.
Expand All @@ -510,7 +511,7 @@ void OtherInstanceMessageHandler::handle_message(const std::string& message)
boost::filesystem::path p = MessageHandlerInternal::get_path(*it);
if (! p.string().empty())
paths.emplace_back(p);
else if (boost::regex_search(*it, results, re))
else if (boost::regex_search(*it, results, re) || boost::regex_search(*it, results, re2))
downloads.emplace_back(*it);
}
if (! paths.empty()) {
Expand Down