Repository navigation
Persist WebKit cookies so the Linux login survives restarts - #1205
Open
creat3dworld wants to merge 1 commit into
Open
creat3dworld wants to merge 1 commit into
creat3dworld wants to merge 1 commit into
Conversation
|
Tested this on Linux and the login now survives restarts.
Not tested: the Flatpak build, and whether the cookie database survives an upgrade of the webkit package. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #984
Also covers #925 and #226 (same root cause — see below).
Root cause
WebKitGTK uses an in-memory cookie store unless persistent storage is explicitly configured. After a successful login the local-storage entries are committed, but no persistent WebKit cookie database is created for the auth web view, so on the next start the embedded web view reports the user as offline and removes both entries + emits a web logout event. This fork has no
webkit_cookie_manager_set_persistent_storagecall anywhere (verified by grep — zero matches in src/).Fix
In
src/slic3r/GUI/Widgets/WebView.cpp(the shared web-view factory used by the Home/Device/auth pages): (a) declare the WebKit cookie-manager C functions in the existing Linuxextern "C"block (following the file's existing pattern of declaringwebkit_web_view_run_javascriptwithout including the full WebKitGTK headers), plus theWebKitCookiePersistentStorageenum (SQLITE = 1); (b) new static helperenable_persistent_cookie_storage(wxWebView*)that gets the nativeWebKitWebViewbackend, itsWebKitWebContext, and the cookie manager, createsdata_dir()/cache/if needed, and enables SQLite persistent storage atdata_dir()/cache/cookies.db(same path upstream uses); (c) call it right afterwebView->Create(...)in the Linux branch of the web-view factory, so it applies to every web view the app creates (Home, Device, auth, preprint) — not only the auth view.#925 (login not remembered on Linux Mint) and #226 are the same WebKitGTK in-memory cookie store issue, fixed by this patch. No separate patch needed for them.
Based on the v2.4.1 tag. Upstream main has moved 25 commits ahead of v2.4.1; this branch is based on v2.4.1, and the files it touches were not changed on main since v2.4.1, so it should merge cleanly.
Verification: the patch was verified to apply cleanly to a fresh v2.4.1 copy (dry-run + byte-compare). It was NOT compile-tested — this VM has no build toolchain for OrcaSlicer. Real verification: on Linux, log in, close the app, reopen, confirm a
cookies.dbexists under the data dir and the session is still valid (no re-login).