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

@ -194,6 +194,10 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
host_line.append_widget(print_host_test);
m_optgroup->append_line(host_line);
option = m_optgroup->get_option("print_host_webui");
option.opt.width = Field::def_width_wider();
m_optgroup->append_single_option_line(option);
m_optgroup->append_single_option_line("printhost_authorization_type");
option = m_optgroup->get_option("printhost_apikey");
@ -254,7 +258,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
auto txt = new wxStaticText(parent, wxID_ANY, from_u8((boost::format("%1%\n\t%2%") % info % ca_file_hint).str()));
txt->SetFont(wxGetApp().normal_font());
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(txt, 1, wxEXPAND);
sizer->Add(txt, 1, wxEXPAND|wxALIGN_LEFT);
return sizer;
};
m_optgroup->append_line(line);

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);