Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt6 Webengine doesn't save cookies and caches #4484

Open
MeisterP opened this issue May 4, 2024 · 6 comments
Open

Qt6 Webengine doesn't save cookies and caches #4484

MeisterP opened this issue May 4, 2024 · 6 comments
Labels
QT6 Refactor Updating code to move to QT 6
Milestone

Comments

@MeisterP
Copy link
Contributor

MeisterP commented May 4, 2024

  • While working on a python chart accessing map tiles from a tile server, I've noticed that caching isn't working
  • Logins in webpage charts aren't remembered either.

Turns out, Webengine in Qt6 no longer creates a Default Profile and therefore neither caches nor cookies are stored.

https://forum.qt.io/topic/131277/qtwebengine-cannot-save-cache
https://doc-snapshots.qt.io/qt6-dev/qtwebengine-changes-qt6.html#default-profile

@liversedge
Copy link
Member

This is definitely a preference for us- would rather not introduce unneccesary vulnerabilities and attack surfaces.

@MeisterP
Copy link
Contributor Author

MeisterP commented May 4, 2024

This is definitely a preference for us- would rather not introduce unneccesary vulnerabilities and attack surfaces.

Fair enough. Should probably be mentioned when we switch to qt6 since the behavior of web page charts will change.

We should still check for regressions. To me it looks like we depend on the profile in a few places:

grep -r QWebEngineProfile
deprecated/OAuthManager.h:#include <QWebEngineProfile>
src/Cloud/OAuthDialog.h:#include <QWebEngineProfile>
src/Train/LiveMapWebPageWindow.cpp://#include <QWebEngineProfile>
src/Train/MeterWidget.cpp:#include <QWebEngineProfile>
src/Train/WebPageWindow.cpp:#include <QWebEngineProfile>
src/Train/WebPageWindow.cpp:    view->page()->profile()->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);

@amtriathlon
Copy link
Member

I agree this is a better behavior for OAuth, for the Web Page chart I think we could make it opt in, requiring explicit enable in chart config since cookies are useful for automatic login, for example to download original files from Garmin Connect.
No sure about the 3 maps and Python web chart.

@MeisterP
Copy link
Contributor Author

MeisterP commented May 9, 2024

No sure about the 3 maps and Python web chart.

I think having caching enabled for maps would be nice since we rely on volunteer driven projects like openstreetmap or opentopomap and their tile servers.
It would take some pressure off their infrastructure and it would just be a friendly thing to do.

Even though I've discovered the issue while working on a python chart, I think for those it doesn't actually matter and might not be worth the effort.

@liversedge
Copy link
Member

I think you are right- we should look to enable caching for the map.

@amtriathlon
Copy link
Member

amtriathlon commented May 9, 2024

Agree, we could create a global QWebEngineProfile to enable caching without persistent cookies for the maps using setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies).

For the WebChart to enable cache/cookies the QWebEngineProfile storage name must be unique, we could create a different one for each instance of the chart.

The QWebEngineProfile must be destroyed before exit, explicitly or via parenting.

@amtriathlon amtriathlon added the QT6 Refactor Updating code to move to QT 6 label May 9, 2024
@amtriathlon amtriathlon added this to the 3.7 milestone May 9, 2024
amtriathlon referenced this issue May 15, 2024
- Disable in-place name edition
- Use double click to edit perspective
To match the behavior of similar lists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QT6 Refactor Updating code to move to QT 6
Projects
None yet
Development

No branches or pull requests

3 participants