Skip to content

Conversation

amrbashir
Copy link
Member

@amrbashir amrbashir commented Oct 28, 2024

@amrbashir amrbashir requested a review from a team as a code owner October 28, 2024 14:54
Copy link
Contributor

github-actions bot commented Oct 28, 2024

Package Changes Through 3d8ce8e

There are 2 changes which include http with patch, http-js with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.23 2.0.24
api-example-js 2.0.19 2.0.20
http 2.4.2 2.4.3
http-js 2.4.2 2.4.3

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@amrbashir amrbashir changed the title enhance(http): persist cookies on disk feat(http): persist cookies on disk Oct 28, 2024
let cache_dir = app.path().app_cache_dir()?;
std::fs::create_dir_all(&cache_dir)?;

let path = cache_dir.join("Cookies");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI. I have been testing this and this part seems to break when the "Cookies" did not previously exist.

I changed it so it starts with an empty array in case the file is new:

let path = cache_dir.join("Cookies");
let file_exists = path.exists();
let mut file = File::options()
    .create(true)
    .append(true)
    .read(true)
    .open(&path)?;

if !file_exists {
    // Initialize the file with an empty array
    use std::io::Write;
    file.write_all(b"[]")?;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

lucasfernog
lucasfernog previously approved these changes Mar 16, 2025
@lucasfernog lucasfernog merged commit 9ebbfb2 into v2 Mar 17, 2025
52 of 147 checks passed
@lucasfernog lucasfernog deleted the feat/http/persist-cookies branch March 17, 2025 10:26
powell-newin pushed a commit to powell-newin/plugins-workspace that referenced this pull request Mar 18, 2025
* enhance(http): persist cookies on disk

closes tauri-apps/tauri#11518

* clippy

* inline reqwest_cookie_store to fix clippy

* clippy

* Update .changes/persist-cookies.md

* Update plugins/http/src/reqwest_cookie_store.rs

* update example

* fallback to empty store if failed to load

* fix example

* persist cookies immediately

* clone

* lint

* .cookies filename

* prevent race condition

---------

Co-authored-by: Lucas Nogueira <[email protected]>
gezihuzi pushed a commit to Hypobenthos/plugins-workspace that referenced this pull request Jun 22, 2025
* enhance(http): persist cookies on disk

closes tauri-apps/tauri#11518

* clippy

* inline reqwest_cookie_store to fix clippy

* clippy

* Update .changes/persist-cookies.md

* Update plugins/http/src/reqwest_cookie_store.rs

* update example

* fallback to empty store if failed to load

* fix example

* persist cookies immediately

* clone

* lint

* .cookies filename

* prevent race condition

---------

Co-authored-by: Lucas Nogueira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants