diff options
author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-03-03 23:15:23 +0100 |
---|---|---|
committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-03-03 23:15:23 +0100 |
commit | ce8ad7026ef9ad4596c4033d1c368ec77cd8c78b (patch) | |
tree | 454e54f797ca51edab1e96fb219baf7385191290 /src/main.cpp | |
parent | eb629f8fa6f7edd3ba9f3e76146d71f62dafff57 (diff) |
permission manager: add permanent permissions
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 9c6b3c4..e40f387 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,16 @@ #include "tray.hpp" #include "webwindow.hpp" +const QWebEnginePage::Feature features[] = { + QWebEnginePage::Feature::MouseLock, + QWebEnginePage::Feature::Notifications, + QWebEnginePage::Feature::Notifications, + QWebEnginePage::Feature::DesktopVideoCapture, + QWebEnginePage::Feature::DesktopAudioVideoCapture, + QWebEnginePage::Feature::MediaAudioCapture, + QWebEnginePage::Feature::MediaVideoCapture, +}; + QString extract_url(const QStringList arguments) { @@ -34,6 +44,10 @@ main(int argc, char **argv) Tray tray; bool start_hidden = not app.arguments().contains("--open-at-startup"); + for (auto feature : features) { + tray.set_permission(feature, webwindow.permissions().get(feature)); + } + webwindow.connect_icon_changed([&](auto icon) { tray.setIcon(icon); tray.show(); @@ -47,8 +61,9 @@ main(int argc, char **argv) tray.connect_toggle([&]() { webwindow.toggle_visibility(); }); tray.connect_quit([&]() { webwindow.quit(); }); - tray.connect_permission_changed( - [&](auto feature, auto value) { webwindow.set_feature(feature, value); }); + tray.connect_permission_changed([&](auto feature, auto value) { + webwindow.permissions().set(feature, value); + }); tray.connect_reset_cookies([&]() { webwindow.reset_cookies(); }); webwindow.show(); |