Do not allow url ouside connect and backbutton back to loading in connect tab.

This commit is contained in:
David Kocik 2024-06-12 18:11:33 +02:00 committed by Lukas Matena
parent 31088cc139
commit 2e0cb6a9be
2 changed files with 12 additions and 1 deletions

View File

@ -642,7 +642,17 @@ void ConnectWebViewPanel::on_script_message(wxWebViewEvent& evt)
}
void ConnectWebViewPanel::on_navigation_request(wxWebViewEvent &evt)
{
//TODO Stop request out of connect
if (evt.GetURL() == m_default_url) {
m_reached_default_url = true;
return;
}
if (evt.GetURL() == (GUI::format_wxstr("file:///%1%/web/connection_failed.html", boost::filesystem::path(resources_dir()).generic_string()))) {
return;
}
if (m_reached_default_url && !evt.GetURL().StartsWith(m_default_url)) {
BOOST_LOG_TRIVIAL(info) << evt.GetURL() << " does not start with default url. Vetoing.";
evt.Veto();
}
}
void ConnectWebViewPanel::logout()
{

View File

@ -200,6 +200,7 @@ protected:
void run_script_bridge(const wxString& script) override {run_script(script); }
private:
void on_user_token(UserAccountSuccessEvent& e);
bool m_reached_default_url {false};
};
class PrinterWebViewPanel : public WebViewPanel