diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 5e14d587a5..dfed529360 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -335,6 +335,23 @@ static std::shared_ptr get_orca_cloud_agent(NetworkAgent* return agent ? std::dynamic_pointer_cast(agent->get_cloud_agent()) : nullptr; } +// Full {web} page URL for a same-site OrcaCloud path, or empty when it cannot be built. An already +// open cloud pane is navigated straight to it, without re-running the session handoff. +static wxString cloud_page_url(NetworkAgent* agent, const std::string& path) +{ + if (path.empty()) + return {}; + auto orca = get_orca_cloud_agent(agent); + if (!orca) + return {}; + std::string base = orca->get_cloud_base_url(); + while (!base.empty() && base.back() == '/') + base.pop_back(); + if (base.empty()) + return {}; + return from_u8(base + path); +} + void start_ping_test() { return; @@ -5628,7 +5645,7 @@ void GUI_App::open_orca_cloud(const std::string& next) // The Home page is built lazily, so the tab switch may not have created it yet: ensure() builds // it if needed, matching what showing the tab does, rather than dropping the open request. if (WebViewPanel* home = WebViewPanel::ensure()) - home->set_cloud_mode(true, cloud_webview_handoff(m_cloud_open_path)); + home->set_cloud_mode(true, cloud_webview_handoff(m_cloud_open_path), cloud_page_url(m_agent, m_cloud_open_path)); }); } diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 1b60a98cf1..afd7a78f6d 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -468,8 +468,8 @@ public: #if wxUSE_WEBVIEW_EDGE void init_webview_runtime(); #endif - // Switches to the Home tab and opens the OrcaCloud pane beside the homepage; work is deferred - // internally. `next` is a same-site OrcaCloud path (empty = the page's default). + // Switches to the Home tab and opens the OrcaCloud pane beside the homepage on `next`, a + // same-site OrcaCloud path (empty = the page's default). Work is deferred internally. void open_orca_cloud(const std::string& next = std::string()); static unsigned get_colour_approx_luma(const wxColour& colour); static bool dark_mode(); diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index 2b2797e88a..d6fc4a7170 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -537,7 +537,7 @@ void WebViewPanel::cloud_signed_out(const wxString& signout_url) } } -void WebViewPanel::set_cloud_mode(bool on, const wxString& url) +void WebViewPanel::set_cloud_mode(bool on, const wxString& url, const wxString& page_url) { if (on) { // load_cloud_url records the origin from whatever it loads, including the plain cloud @@ -546,6 +546,10 @@ void WebViewPanel::set_cloud_mode(bool on, const wxString& url) create_cloud_browser(); m_cloud_seed_url = url; schedule_cloud_load(url.empty() ? wxString(kCloudUrl) : url); + } else if (!page_url.empty()) { + // The pane already holds a session, so an explicit page loads straight in; the handoff is + // only needed to establish one, not to reach an ordinary page. + load_cloud_url(page_url); } else if (!url.empty() && url != m_cloud_seed_url) { // Re-seed only when the Start URL actually changed — a login, an account switch or a // sign-out changes it; an ordinary re-open does not (guide §8). Reloading an unchanged diff --git a/src/slic3r/GUI/WebViewDialog.hpp b/src/slic3r/GUI/WebViewDialog.hpp index 07f719331a..4191360002 100644 --- a/src/slic3r/GUI/WebViewDialog.hpp +++ b/src/slic3r/GUI/WebViewDialog.hpp @@ -118,7 +118,10 @@ public: // Shows/hides the native OrcaCloud pane beside this homepage nav column. `url` is the // cloud Start URL ({web}/auth/handoff?next=…&user_id=…), which the page uses to decide // whether it already has a session; empty falls back to the plain cloud page. - void set_cloud_mode(bool on, const wxString& url = wxString()); + // `page_url` is a full {web} page URL: an already-open pane is navigated straight there, + // without re-running the handoff, which is what an explicit "open this page" wants. Empty + // keeps whatever page the pane holds. + void set_cloud_mode(bool on, const wxString& url = wxString(), const wxString& page_url = wxString()); // True while the OrcaCloud pane exists and is visible. bool cloud_mode_active() const { return m_cloud_browser && m_cloud_browser->IsShown(); }