Files
readest/apps/readest-app/src-tauri/plugins/tauri-plugin-native-bridge/permissions/autogenerated/reference.md
T
Huang Xin 17749f7cc7 feat(send): mobile URL clipping via native-bridge plugin (#4252)
iOS and Android now run the same Web-URL clip flow as desktop. Paste
an article URL, the native side opens a full-screen WKWebView /
WebView with the same Chrome UA + fingerprint mask + "Saving to
Readest" overlay as the desktop hidden window, waits for load +
settle, captures `document.documentElement.outerHTML` via the
platform's `evaluateJavaScript`, and returns it through the existing
`convertToEpub` pipeline.

JS surface stays `invoke('clip_url', { url, options })` — no changes
in `library/page.tsx` or `send/page.tsx`. The platform branch lives
entirely in `clip_url.rs`.

Why not Tauri's `Window::add_child`

`add_child` is gated `#[cfg(any(test, all(desktop, feature =
"unstable")))]` in tauri 2.10. No public API for attaching a second
webview to the main window on mobile, so the clip flow can't be a
`#[cfg(mobile)]` branch of the existing `WebviewWindowBuilder` shape
— it needs native code. Extend `tauri-plugin-native-bridge` rather
than create a separate plugin: the Swift / Kotlin scaffolding +
Tauri IPC are already there.

Layout

- `src-tauri/src/clip_url.rs` — desktop branch unchanged; new
  `#[cfg(mobile)]` `clip_url` command routes through
  `app.native_bridge().clip_url(request)`. Shared `ClipOptions`
  struct exposes its fields `pub` so the mobile branch can map into
  the plugin's `ClipUrlRequest`.
- `plugins/tauri-plugin-native-bridge/src/models.rs` — `ClipUrlRequest`
  + `ClipUrlResponse` mirroring `ClipOptions` field-for-field so the
  payload travels untouched from JS through to Swift/Kotlin.
- `plugins/tauri-plugin-native-bridge/src/{desktop,mobile}.rs` — desktop
  returns an error (desktop has its own path); mobile dispatches via
  `run_mobile_plugin("clip_url", payload)`.
- `ios/Sources/ClipUrlController.swift` — `UIViewController` hosting
  `WKWebView` with the loading overlay drawn as native UIKit views
  (not an injected user script, so the page's own hydration can't
  wipe the spinner). 30 s hard timeout + 3 s settle window after
  `didFinish`, same as desktop. Fingerprint mask injected as
  `WKUserScript` at `.atDocumentStart`.
- `android/src/main/java/ClipUrlController.kt` — full-screen Dialog
  hosting a `WebView`, mirrors the iOS controller's behaviour. JSON-
  decodes the `evaluateJavascript` callback (raw return value is a
  JSON-encoded string).
- `NativeBridgePlugin.{swift,kt}` — new `clip_url` method that parses
  args via `invoke.parseArgs`, presents the controller, resolves the
  invoke with `{ html }` on success or `invoke.reject` on failure.
  Same rejection vocabulary as desktop (`"Invalid URL"`, `"Page took
  too long to load"`, etc.) so the calling JS doesn't need a
  platform branch.
- `build.rs` — adds `clip_url` to the plugin's `COMMANDS` array.

Notes

- The Swift overlay reserves the iOS safe-area-edge-to-edge so notch /
  Dynamic Island devices don't see the underlying app peek through
  during the brief capture window.
- The Android overlay's spinner tint follows the foreground theme
  colour at 85 % alpha — same idea as the iOS controller.
- `WKWebView`'s JS keeps running while the controller is presented;
  no off-screen / `isHidden` trick that would let iOS throttle the
  page mid-capture.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 16:00:53 +02:00

13 KiB

Default Permission

Default permissions for the plugin

This default permission set includes the following:

  • allow-auth-with-safari
  • allow-auth-with-custom-tab
  • allow-copy-uri-to-path
  • allow-use-background-audio
  • allow-install-package
  • allow-set-system-ui-visibility
  • allow-get-status-bar-height
  • allow-get-sys-fonts-list
  • allow-intercept-keys
  • allow-lock-screen-orientation
  • allow-iap-is-available
  • allow-iap-initialize
  • allow-iap-fetch-products
  • allow-iap-purchase-product
  • allow-iap-restore-purchases
  • allow-get-system-color-scheme
  • allow-get-safe-area-insets
  • allow-get-screen-brightness
  • allow-set-screen-brightness
  • allow-get-external-sdcard-path
  • allow-open-external-url
  • allow-show-lookup-popover
  • allow-select-directory
  • allow-get-storefront-region-code
  • allow-request-manage-storage-permission
  • allow-register-listener
  • allow-remove-listener
  • allow-check-permissions
  • allow-request-permissions
  • allow-checkPermissions
  • allow-requestPermissions
  • allow-set-sync-passphrase
  • allow-get-sync-passphrase
  • allow-clear-sync-passphrase
  • allow-is-sync-keychain-available

Permission Table

Identifier Description

native-bridge:allow-auth-with-custom-tab

Enables the auth_with_custom_tab command without any pre-configured scope.

native-bridge:deny-auth-with-custom-tab

Denies the auth_with_custom_tab command without any pre-configured scope.

native-bridge:allow-auth-with-safari

Enables the auth_with_safari command without any pre-configured scope.

native-bridge:deny-auth-with-safari

Denies the auth_with_safari command without any pre-configured scope.

native-bridge:allow-check-permissions

Enables the check-permissions command without any pre-configured scope.

native-bridge:deny-check-permissions

Denies the check-permissions command without any pre-configured scope.

native-bridge:allow-checkPermissions

Enables the checkPermissions command without any pre-configured scope.

native-bridge:deny-checkPermissions

Denies the checkPermissions command without any pre-configured scope.

native-bridge:allow-check-permissions

Enables the check_permissions command without any pre-configured scope.

native-bridge:deny-check-permissions

Denies the check_permissions command without any pre-configured scope.

native-bridge:allow-clear-sync-passphrase

Enables the clear_sync_passphrase command without any pre-configured scope.

native-bridge:deny-clear-sync-passphrase

Denies the clear_sync_passphrase command without any pre-configured scope.

native-bridge:allow-clip-url

Enables the clip_url command without any pre-configured scope.

native-bridge:deny-clip-url

Denies the clip_url command without any pre-configured scope.

native-bridge:allow-copy-uri-to-path

Enables the copy_uri_to_path command without any pre-configured scope.

native-bridge:deny-copy-uri-to-path

Denies the copy_uri_to_path command without any pre-configured scope.

native-bridge:allow-get-external-sdcard-path

Enables the get_external_sdcard_path command without any pre-configured scope.

native-bridge:deny-get-external-sdcard-path

Denies the get_external_sdcard_path command without any pre-configured scope.

native-bridge:allow-get-safe-area-insets

Enables the get_safe_area_insets command without any pre-configured scope.

native-bridge:deny-get-safe-area-insets

Denies the get_safe_area_insets command without any pre-configured scope.

native-bridge:allow-get-screen-brightness

Enables the get_screen_brightness command without any pre-configured scope.

native-bridge:deny-get-screen-brightness

Denies the get_screen_brightness command without any pre-configured scope.

native-bridge:allow-get-status-bar-height

Enables the get_status_bar_height command without any pre-configured scope.

native-bridge:deny-get-status-bar-height

Denies the get_status_bar_height command without any pre-configured scope.

native-bridge:allow-get-storefront-region-code

Enables the get_storefront_region_code command without any pre-configured scope.

native-bridge:deny-get-storefront-region-code

Denies the get_storefront_region_code command without any pre-configured scope.

native-bridge:allow-get-sync-passphrase

Enables the get_sync_passphrase command without any pre-configured scope.

native-bridge:deny-get-sync-passphrase

Denies the get_sync_passphrase command without any pre-configured scope.

native-bridge:allow-get-sys-fonts-list

Enables the get_sys_fonts_list command without any pre-configured scope.

native-bridge:deny-get-sys-fonts-list

Denies the get_sys_fonts_list command without any pre-configured scope.

native-bridge:allow-get-system-color-scheme

Enables the get_system_color_scheme command without any pre-configured scope.

native-bridge:deny-get-system-color-scheme

Denies the get_system_color_scheme command without any pre-configured scope.

native-bridge:allow-iap-fetch-products

Enables the iap_fetch_products command without any pre-configured scope.

native-bridge:deny-iap-fetch-products

Denies the iap_fetch_products command without any pre-configured scope.

native-bridge:allow-iap-initialize

Enables the iap_initialize command without any pre-configured scope.

native-bridge:deny-iap-initialize

Denies the iap_initialize command without any pre-configured scope.

native-bridge:allow-iap-is-available

Enables the iap_is_available command without any pre-configured scope.

native-bridge:deny-iap-is-available

Denies the iap_is_available command without any pre-configured scope.

native-bridge:allow-iap-purchase-product

Enables the iap_purchase_product command without any pre-configured scope.

native-bridge:deny-iap-purchase-product

Denies the iap_purchase_product command without any pre-configured scope.

native-bridge:allow-iap-restore-purchases

Enables the iap_restore_purchases command without any pre-configured scope.

native-bridge:deny-iap-restore-purchases

Denies the iap_restore_purchases command without any pre-configured scope.

native-bridge:allow-install-package

Enables the install_package command without any pre-configured scope.

native-bridge:deny-install-package

Denies the install_package command without any pre-configured scope.

native-bridge:allow-intercept-keys

Enables the intercept_keys command without any pre-configured scope.

native-bridge:deny-intercept-keys

Denies the intercept_keys command without any pre-configured scope.

native-bridge:allow-is-sync-keychain-available

Enables the is_sync_keychain_available command without any pre-configured scope.

native-bridge:deny-is-sync-keychain-available

Denies the is_sync_keychain_available command without any pre-configured scope.

native-bridge:allow-lock-screen-orientation

Enables the lock_screen_orientation command without any pre-configured scope.

native-bridge:deny-lock-screen-orientation

Denies the lock_screen_orientation command without any pre-configured scope.

native-bridge:allow-open-external-url

Enables the open_external_url command without any pre-configured scope.

native-bridge:deny-open-external-url

Denies the open_external_url command without any pre-configured scope.

native-bridge:allow-register-listener

Enables the register_listener command without any pre-configured scope.

native-bridge:deny-register-listener

Denies the register_listener command without any pre-configured scope.

native-bridge:allow-remove-listener

Enables the remove_listener command without any pre-configured scope.

native-bridge:deny-remove-listener

Denies the remove_listener command without any pre-configured scope.

native-bridge:allow-request-permissions

Enables the request-permissions command without any pre-configured scope.

native-bridge:deny-request-permissions

Denies the request-permissions command without any pre-configured scope.

native-bridge:allow-requestPermissions

Enables the requestPermissions command without any pre-configured scope.

native-bridge:deny-requestPermissions

Denies the requestPermissions command without any pre-configured scope.

native-bridge:allow-request-manage-storage-permission

Enables the request_manage_storage_permission command without any pre-configured scope.

native-bridge:deny-request-manage-storage-permission

Denies the request_manage_storage_permission command without any pre-configured scope.

native-bridge:allow-request-permissions

Enables the request_permissions command without any pre-configured scope.

native-bridge:deny-request-permissions

Denies the request_permissions command without any pre-configured scope.

native-bridge:allow-select-directory

Enables the select_directory command without any pre-configured scope.

native-bridge:deny-select-directory

Denies the select_directory command without any pre-configured scope.

native-bridge:allow-set-screen-brightness

Enables the set_screen_brightness command without any pre-configured scope.

native-bridge:deny-set-screen-brightness

Denies the set_screen_brightness command without any pre-configured scope.

native-bridge:allow-set-sync-passphrase

Enables the set_sync_passphrase command without any pre-configured scope.

native-bridge:deny-set-sync-passphrase

Denies the set_sync_passphrase command without any pre-configured scope.

native-bridge:allow-set-system-ui-visibility

Enables the set_system_ui_visibility command without any pre-configured scope.

native-bridge:deny-set-system-ui-visibility

Denies the set_system_ui_visibility command without any pre-configured scope.

native-bridge:allow-show-lookup-popover

Enables the show_lookup_popover command without any pre-configured scope.

native-bridge:deny-show-lookup-popover

Denies the show_lookup_popover command without any pre-configured scope.

native-bridge:allow-use-background-audio

Enables the use_background_audio command without any pre-configured scope.

native-bridge:deny-use-background-audio

Denies the use_background_audio command without any pre-configured scope.