Add persistent cookie storage for PrinterWebView on WebKitGTK (#13135)

This commit is contained in:
Ocraftyone
2026-04-13 02:07:40 -04:00
committed by GitHub
parent 3b701d316a
commit 4a8133dee1
2 changed files with 14 additions and 2 deletions

View File

@@ -15,6 +15,10 @@
#include <slic3r/GUI/Widgets/WebView.hpp>
#include <wx/webview.h>
#ifdef __linux__
#include <webkit2/webkit2.h>
#endif
namespace pt = boost::property_tree;
namespace Slic3r {
@@ -33,6 +37,14 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
return;
}
#ifdef __linux__
auto cookiesPath = boost::filesystem::path(data_dir() + "/cache/cookies.db");
auto wv = static_cast<WebKitWebView*>(m_browser->GetNativeBackend());
auto wv_ctx = webkit_web_view_get_context(wv);
auto cookieManager = webkit_web_context_get_cookie_manager(wv_ctx);
webkit_cookie_manager_set_persistent_storage(cookieManager, cookiesPath.c_str(), WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);
#endif
m_browser->Bind(wxEVT_WEBVIEW_ERROR, &PrinterWebView::OnError, this);
m_browser->Bind(wxEVT_WEBVIEW_LOADED, &PrinterWebView::OnLoaded, this);