Skip to content

Commit

Permalink
1.change the useragent from "BBL-Slicer" to "SM-Slicer"
Browse files Browse the repository at this point in the history
2.add the default filament of j1
3.fix the default filament selected when choosing the nozzle
  • Loading branch information
womendoushihaoyin committed Sep 29, 2024
1 parent 61663f8 commit ab9a4db
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion resources/profiles/Snapmaker/machine/Snapmaker J1.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"model_id": "199828459",
"bed_model": "Snapmaker J1_bed.stl",
"bed_texture": "Snapmaker J1_texture.svg",
"nozzle_diameter": "0.2;0.4;0.6;0.8"
"nozzle_diameter": "0.2;0.4;0.6;0.8",
"default_materials": "PolyLite J1 PLA;PolyTerra J1 PLA;Snapmaker J1 ABS;Snapmaker J1 ABS Benchy;Snapmaker J1 ASA;Snapmaker J1 PA-CF;Snapmaker J1 PET;Snapmaker J1 PETG;Snapmaker J1 PETG-CF;Snapmaker J1 PLA;Snapmaker J1 PLA Eco;Snapmaker J1 PLA Matte;Snapmaker J1 PLA Metal;Snapmaker J1 PLA Silk;Snapmaker J1 PLA-CF;Snapmaker J1 PVA;Snapmaker J1 TPE;Snapmaker J1 TPU;Snapmaker J1 TPU High-Flow"
}
2 changes: 1 addition & 1 deletion resources/web/guide/22/22.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ function ChooseDefaultFilament()
let OneFF=OneNode.getElementsByTagName("input")[0];
$(OneFF).prop("checked",false);

let filamentList=OneFF.getAttribute("filalist");
let filamentList=GetFilamentShortname(OneFF.getAttribute("filalist"));
//alert(filamentList);
let filamentArray=filamentList.split(';')

Expand Down
2 changes: 1 addition & 1 deletion resources/web/guide/js/globalapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function clearCookie(name) {
/*--------Studio WX Message-------*/
function IsInSlicer()
{
let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') );
let bMatch=navigator.userAgent.match( RegExp('SM-Slicer','i') );

return bMatch;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/web/homepage/js/globalapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function clearCookie(name) {
/*--------Studio WX Message-------*/
function IsInSlicer()
{
let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') );
let bMatch=navigator.userAgent.match( RegExp('SM-Slicer','i') );

return bMatch;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/web/include/globalapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function clearCookie(name) {
/*--------Studio WX Message-------*/
function IsInSlicer()
{
let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') );
let bMatch=navigator.userAgent.match( RegExp('SM-Slicer','i') );

return bMatch;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/web/login/js/globalapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function clearCookie(name) {
/*--------Studio WX Message-------*/
function IsInSlicer()
{
let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') );
let bMatch=navigator.userAgent.match( RegExp('SM-Slicer','i') );

return bMatch;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/PresetBundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static std::vector<std::string> s_project_options {
const char* PresetBundle::SM_BUNDLE = "Snapmaker";
const char* PresetBundle::SM_DEFAULT_PRINTER_MODEL = "Snapmaker J1 (0.4 nozzle)";
const char* PresetBundle::SM_DEFAULT_PRINTER_VARIANT = "0.4";
const char* PresetBundle::SM_DEFAULT_FILAMENT = "Snapmaker ABS";
const char* PresetBundle::SM_DEFAULT_FILAMENT = "Snapmaker J1 ABS";

PresetBundle::PresetBundle()
: prints(Preset::TYPE_PRINT, Preset::print_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()))
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/WebGuideDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class GuideFrame : public DPIDialog
wxString m_javascript;
wxString m_response_js;

wxString m_bbl_user_agent;
wxString m_sm_user_agent;
std::string m_editing_filament_id;
};

Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/WebUserLoginDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ZUserLogin::ZUserLogin() : wxDialog((wxWindow *) (wxGetApp().mainframe), wxID_AN

BOOST_LOG_TRIVIAL(info) << "login url = " << TargetUrl.ToStdString();

m_bbl_user_agent = wxString::Format("BBL-Slicer/v%s", SLIC3R_VERSION);
m_sm_user_agent = wxString::Format("SM-Slicer/v%s", SLIC3R_VERSION);

// set the frame icon

Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/WebUserLoginDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ZUserLogin : public wxDialog
wxString m_javascript;
wxString m_response_js;

wxString m_bbl_user_agent;
wxString m_sm_user_agent;

DECLARE_EVENT_TABLE()
};
Expand Down
6 changes: 3 additions & 3 deletions src/slic3r/GUI/Widgets/WebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
if (webView) {
webView->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
#ifdef __WIN32__
webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s (%s) Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
webView->SetUserAgent(wxString::Format("SM-Slicer/v%s (%s) Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52", SLIC3R_VERSION,
Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light"));
webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
Expand All @@ -279,7 +279,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
// And the memory: file system
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION,
webView->SetUserAgent(wxString::Format("SM-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION,
Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light"));
#endif
#ifdef __WXMAC__
Expand Down Expand Up @@ -383,7 +383,7 @@ void WebView::RecreateAll()
{
auto dark = Slic3r::GUI::wxGetApp().dark_mode();
for (auto webView : g_webviews) {
webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION,
webView->SetUserAgent(wxString::Format("SM-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION,
dark ? "dark" : "light"));
webView->Reload();
}
Expand Down

0 comments on commit ab9a4db

Please sign in to comment.