feat: expose wry permission handler API in tauri#14865
Open
F0RLE wants to merge 1 commit intotauri-apps:devfrom
Open
feat: expose wry permission handler API in tauri#14865F0RLE wants to merge 1 commit intotauri-apps:devfrom
F0RLE wants to merge 1 commit intotauri-apps:devfrom
Conversation
Contributor
Package Changes Through 5662578There are 9 changes which include tauri with minor, @tauri-apps/cli with minor, tauri-cli with minor, tauri-utils with patch, tauri-build with patch, tauri-macos-sign with patch, tauri-bundler with minor, tauri-runtime-wry with minor, tauri-runtime with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
Author
|
This PR depends on tauri-apps/wry#1654. CI will fail until that PR is merged and a new wry version is released. |
5662578 to
3a3f629
Compare
Exposes the with_permission_handler API from wry through Tauri's public interface, allowing Tauri applications to programmatically handle webview permission requests. New public types in auri-runtime: - PermissionKind - 17 variants matching wry's API, with Hash and Display. Display uses kebab-case (e.g. display-capture, pointer-lock). - PermissionResponse - Allow, Deny, Default (default), Prompt. With Hash. WebviewBuilder::on_permission_request accepts a closure called whenever the webview requests a browser permission (media, geolocation, etc.). Platform support mirrors wry: - Windows (WebView2): Full coverage of all 12 permission kinds. - macOS / iOS (WKWebView): Camera and microphone, secure Default behavior. - Linux (WebKitGTK): UserMedia, Geolocation, Notifications, PointerLock. DisplayCapture fallback for WebKitGTK < 2.42. - Android: Experimental support via JNI bridge. Signed-off-by: F0RLE <lrshka.klim7766@gmail.com>
5db0f39 to
7bc20f4
Compare
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.
Summary
This PR exposes the
wrypermission handler API through Tauri's public interface, enabling applications to programmatically handle permission requests from the webview.Motivation
Currently, certain web APIs like
getDisplayMedia()on Linux (via WebKitGTK) fail because they require an explicit permission grant that cannot be handled by the default webview behavior. This results in "NotAllowedError" or "Screen sharing was cancelled" errors.By exposing
on_permission_request, developers can intercept these requests and provide the necessaryAlloworDenyresponse programmatically. This is essential for building screen sharing, video conferencing, and other permission-sensitive features in Tauri apps.Changes
PermissionKind(mirroringwry) andPermissionResponseenums. AddedDisplayCaptureto support screen sharing.create_webview, mapping runtime types towrytypes.on_permission_requestmethod toWebviewBuilderandWebviewWindowBuilderas a public API.Dependencies
This PR depends on the changes in tauri-apps/wry#1654.
Example Usage