tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
84.91k stars 2.56k forks source link

how can i tauri cookies and local storage are preserved? #6330

Open InfernalAzazel opened 1 year ago

InfernalAzazel commented 1 year ago

Is there anything like pywebview? It only needs to set private_mode=True to maintain a persistent session.

webview.start( private_mode=True)

图片

FabianLars commented 1 year ago

They are supposed to be persisted by default. Can you check if there are any files in ~/.local/share/<your bundle id>/? There should be 2 folders databases and localstorage, and a cookies file.

InfernalAzazel commented 1 year ago

Good morning, man, yes, it stores cookies, but surprisingly, they are all the same configuration. I can display bing normally using pywebview, but not tauri.

In addition, I want to ask if code can get the storage path of the cookie. I want to store the configuration of some items.

图片

FabianLars commented 1 year ago

but surprisingly, they are all the same configuration

I don't understand what you mean with this.

I can display bing normally using pywebview, but not tauri.

That could be because pywebview is based on chromium and tauri's webview is based on webkit (on linux) 🤔

In addition, I want to ask if code can get the storage path of the cookie. I want to store the configuration of some items.

On Linux you could use this path api https://tauri.app/v1/api/js/path#applocaldatadir

InfernalAzazel commented 1 year ago

Thank you very much for your help. pywebview is also webkit because I use gtk. In fact, I suspect that there is a problem with the storage method of tauri. There are many files saved by the same pywebview, and there are only two tauri.

FabianLars commented 1 year ago

The files on your screenshot aren't webkitgtk files though, that definitely looks like a chromium folder structure to me.

That said, this:

I suspect that there is a problem with the storage method of tauri.

could still be true!

Can you try the bing website in epiphany (also known as "gnome web")? It's a browser based on webkitgtk which we can use to double-check this.

InfernalAzazel commented 1 year ago

Dude, I uploaded the code for you, if you are interested, you can study it

Ubuntu: 20.04 lts

python: 3.10

https://github.com/InfernalAzazel/PYChatGPT.git

Open a terminal and enter your virtual environment

sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
cd PYChatGPT
pip install -r requirements.txt

tauri:

https://github.com/InfernalAzazel/ChatGPT.git

InfernalAzazel commented 1 year ago

Dude, I uploaded the code for you, if you are interested, you can study it

python:

The files on your screenshot aren't webkitgtk files though, that definitely looks like a chromium folder structure to me.

That said, this:

I suspect that there is a problem with the storage method of tauri.

could still be true!

Can you try the bing website in epiphany (also known as "gnome web")? It's a browser based on webkitgtk which we can use to double-check this.

Am I trying the Bing website in Epiphany tomorrow!

FabianLars commented 1 year ago

Alrighty, it indeed uses webkitgtk, but the files in your screenshot are still chromium files :D For reference here's my .pywebview folder after running your app: grafik

Also, for what it's worth, both the projects you linked show the same page for me, but it's a warning that i need to join the waitlist first (my microsoft account does not have access to it yet), so that probably does not mean much...

InfernalAzazel commented 1 year ago

Alrighty, it indeed uses webkitgtk, but the files in your screenshot are still chromium files :D For reference here's my .pywebview folder after running your app: grafik

Also, for what it's worth, both the projects you linked show the same page for me, but it's a warning that i need to join the waitlist first (my microsoft account does not have access to it yet), so that probably does not mean much...

Dude, do you have any other way to get in touch? For example, wechat or tg, I can lend you the account for testing. Or you follow the prompts to join the candidates and download the app, which takes about a day.

FabianLars commented 1 year ago

I joined the waitlist :)

InfernalAzazel commented 1 year ago

I joined the waitlist :) Then you need to download his app and log in to enter the candidate list. Refresh a few times and you can jump in the queue for a day. If you don’t jump in the queue and wait for more than a week, Microsoft is disgusting. I uninstalled