support different URL for web ui

#451
This commit is contained in:
SoftFever 2023-03-14 21:32:56 +08:00
parent da57260101
commit 06d81098f3
5 changed files with 24 additions and 7 deletions

View file

@ -1035,13 +1035,14 @@ void Sidebar::update_all_preset_comboboxes()
connection_btn->Show();
ams_btn->Hide();
p_mainframe->set_print_button_to_default(MainFrame::PrintSelectType::eSendGcode);
wxString host_url = preset_bundle.printers.get_edited_preset().config.opt_string("print_host");
if(!host_url.empty())
auto cfg = preset_bundle.printers.get_edited_preset().config;
wxString url = cfg.opt_string("print_host_webui").empty() ? cfg.opt_string("print_host") : cfg.opt_string("print_host_webui");
if(!url.empty())
{
if(!host_url.Lower().starts_with("http"))
host_url = wxString::Format("http://%s",host_url);
if(!url.Lower().starts_with("http"))
url = wxString::Format("http://%s",url);
p_mainframe->load_printer_url(host_url);
p_mainframe->load_printer_url(url);
}
m_bed_type_list->SelectAndNotify(btPEI-1);