Skip to content

Commit ab5e274

Browse files
committed
feat: add preference to open full MakerWorld site in Online Models tab
Preferences > Online Models gains a "Open full MakerWorld site instead of the simplified Studio view" checkbox (config key makerworld_use_full_site). When enabled, the three URL construction paths in WebViewDialog.cpp omit the /studio/webview path segment and map model-detail links to /models/<id>, restoring access to comments, account management, and other full-site features that the restricted webview does not expose. Closes #10801
1 parent 2263815 commit ab5e274

2 files changed

Lines changed: 31 additions & 10 deletions

File tree

src/slic3r/GUI/Preferences.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,9 @@ wxWindow* PreferencesDialog::create_general_page()
14251425

14261426
auto item_show_history = create_item_checkbox(_L("Show history on the home page"), page, _L("Show history on the home page"), 50, "show_print_history");
14271427

1428+
auto item_makerworld_fullsite = create_item_checkbox(_L("Open full MakerWorld site instead of the simplified Studio view"), page,
1429+
_L("Load the full MakerWorld website in the Online Models tab instead of the restricted Studio webview."), 50, "makerworld_use_full_site");
1430+
14281431
std::vector<wxString> air_temp_timing_list = {_L("Reminder During Slicing"), _L("Automatic mode")};
14291432
std::vector<std::string> air_temp_timing_value_list = {"slicing", "auto"};
14301433

@@ -1527,15 +1530,17 @@ wxWindow* PreferencesDialog::create_general_page()
15271530
sizer_page->Add(item_associate_stl, 0, wxTOP, FromDIP(3));
15281531
sizer_page->Add(item_associate_step, 0, wxTOP, FromDIP(3));
15291532
#endif // _WIN32
1530-
auto item_title_modelmall = sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20));
1531-
auto item_item_modelmall = sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3));
1532-
auto item_item_show_history = sizer_page->Add(item_show_history, 0, wxTOP, FromDIP(3));
1533+
auto item_title_modelmall = sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20));
1534+
auto item_item_modelmall = sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3));
1535+
auto item_item_show_history = sizer_page->Add(item_show_history, 0, wxTOP, FromDIP(3));
1536+
auto item_item_mw_fullsite = sizer_page->Add(item_makerworld_fullsite, 0, wxTOP, FromDIP(3));
15331537

1534-
auto update_modelmall = [this, item_title_modelmall, item_item_modelmall, item_item_show_history](wxEvent &e) {
1538+
auto update_modelmall = [this, item_title_modelmall, item_item_modelmall, item_item_show_history, item_item_mw_fullsite](wxEvent &e) {
15351539
bool has_model_mall = wxGetApp().has_model_mall();
15361540
item_title_modelmall->Show(has_model_mall);
15371541
item_item_modelmall->Show(has_model_mall);
15381542
item_item_show_history->Show(has_model_mall);
1543+
item_item_mw_fullsite->Show(has_model_mall);
15391544
Layout();
15401545
Fit();
15411546
};

src/slic3r/GUI/WebViewDialog.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,11 @@ void WebViewPanel::SetMakerworldPageLoginStatus(bool login ,wxString ticket)
13031303

13041304
wxString language_code = wxString::FromUTF8(GetStudioLanguage()).BeforeFirst('_');
13051305

1306-
mw_currenturl = (boost::format("%1%%2%/studio/webview?from=bambustudio") % host % language_code.mb_str()).str();
1306+
bool full_site = wxGetApp().app_config->get("makerworld_use_full_site") == "1";
1307+
if (full_site)
1308+
mw_currenturl = (boost::format("%1%%2%/?from=bambustudio") % host % language_code.mb_str()).str();
1309+
else
1310+
mw_currenturl = (boost::format("%1%%2%/studio/webview?from=bambustudio") % host % language_code.mb_str()).str();
13071311
}
13081312
} else {
13091313
//std::cout << "The string does not match the pattern." << std::endl;
@@ -1946,7 +1950,11 @@ void WebViewPanel::OpenMakerworldSearchPage(std::string KeyWord)
19461950

19471951
wxString language_code = wxString::FromUTF8(GetStudioLanguage()).BeforeFirst('_');
19481952

1949-
m_online_LastUrl = (boost::format("%1%%2%/studio/webview/search?from=bambustudio&keyword=%3%&from_studio_home=true") % host % language_code.mb_str() % UrlEncode(KeyWord)).str();
1953+
bool full_site_search = wxGetApp().app_config->get("makerworld_use_full_site") == "1";
1954+
if (full_site_search)
1955+
m_online_LastUrl = (boost::format("%1%%2%/search?from=bambustudio&keyword=%3%&from_studio_home=true") % host % language_code.mb_str() % UrlEncode(KeyWord)).str();
1956+
else
1957+
m_online_LastUrl = (boost::format("%1%%2%/studio/webview/search?from=bambustudio&keyword=%3%&from_studio_home=true") % host % language_code.mb_str() % UrlEncode(KeyWord)).str();
19501958
SwitchWebContent("online");
19511959
//SwitchLeftMenu("online");
19521960
}
@@ -1957,10 +1965,18 @@ void WebViewPanel::SetMakerworldModelID(std::string ModelID)
19571965

19581966
wxString language_code = wxString::FromUTF8(GetStudioLanguage()).BeforeFirst('_');
19591967

1960-
if (ModelID != "")
1961-
m_online_LastUrl = (boost::format("%1%%2%/studio/webview?modelid=%3%&from=bambustudio") % host % language_code.mb_str() % ModelID).str();
1962-
else
1963-
m_online_LastUrl = (boost::format("%1%%2%/studio/webview?from=bambustudio") % host % language_code.mb_str()).str();
1968+
bool full_site_model = wxGetApp().app_config->get("makerworld_use_full_site") == "1";
1969+
if (ModelID != "") {
1970+
if (full_site_model)
1971+
m_online_LastUrl = (boost::format("%1%%2%/models/%3%?from=bambustudio") % host % language_code.mb_str() % ModelID).str();
1972+
else
1973+
m_online_LastUrl = (boost::format("%1%%2%/studio/webview?modelid=%3%&from=bambustudio") % host % language_code.mb_str() % ModelID).str();
1974+
} else {
1975+
if (full_site_model)
1976+
m_online_LastUrl = (boost::format("%1%%2%/?from=bambustudio") % host % language_code.mb_str()).str();
1977+
else
1978+
m_online_LastUrl = (boost::format("%1%%2%/studio/webview?from=bambustudio") % host % language_code.mb_str()).str();
1979+
}
19641980
}
19651981

19661982
void WebViewPanel::SetPrintHistoryTaskID(int TaskID)

0 commit comments

Comments
 (0)