Menu ▾ ▴

#210 Add Share to the media context menu on macOS

closed
nobody
None
2026-08-07
2026-08-06
Anonymous
No

Originally created by: kristofferR

Carrier had no way to hand Messenger media to the macOS share sheet (AirDrop, Messages, Notes, …).

Right-clicking an image or video now offers Share… (macOS only). It saves the media through the existing trusted download flow — the sheet needs a real file — then shows NSSharingServicePicker anchored at the click point, in the correct window.

Trust model is unchanged from reveal-download: the page-side closure holds the per-window credential, and the native listener resolves the file exclusively through the trusted download map populated by on_download, so the remote page can never point the sheet at an arbitrary path. The anchor position travels as viewport fractions and is clamped native-side.

Note that sharing also leaves the file in ~/Downloads, since that is the trusted path media takes to disk.

Also adds dev-only (mcp feature) media-capture probes to the MCP bridge: API presence, camera / microphone / camera+microphone capture classifications, the OS permission state, and a display-capture probe in both gesture-free and armed-click forms. They report outcomes, error names, and elapsed milliseconds only — never streams, frames, or device labels. These are what produced the evidence in [#209].

Stacked on [#209]; retarget to main once that merges.

Validated with the full local gate plus cargo clippy --target aarch64-apple-darwin -- -D warnings. The picker itself still needs a real-Mac smoke test (right-click → Share… → AirDrop).

Summary by CodeRabbit

  • New Features
  • Added macOS “Share…” support for downloaded images and videos.
  • Added native context-menu actions for supported media and links, including image copying.
  • Added media-capture diagnostics for microphone, camera, video-call, and screen-sharing permissions and outcomes.

  • Bug Fixes

  • Improved context-menu security by rejecting untrusted or invalid interactions.
  • Prevented incomplete downloads from appearing as available to share.
  • Added clearer feedback when sharing fails.
  • Improved keyboard activation, focus restoration, pointer handling, and image-copy reliability.
  • Added safeguards for large image transfers.

Related

Tickets: #209
Tickets: #218

Discussion

1 2 3 > >> (Page 1 of 3)
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: coderabbitai[bot]

    ⚠️ Action not completed Review rate limited. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: coderabbitai[bot]

    Review Change Stack

    [!WARNING]

    Review limit reached

    @kristofferR, you've reached your PR review limit, so we couldn't start this review.

    Next review available in: 35 minutes

    You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.


    How can I continue?

    After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

    To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.


    How do review limits work?

    CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

    For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

    Please refer docs for additional details.


    Review details


    ⚙️ Run configuration

    Configuration used: Path: .coderabbit.yaml

    Review profile: ASSERTIVE

    Plan: Pro Plus

    Run ID: 28abcb12-ce7a-4dab-8cb9-57d5f302d99a


    📥 Commits

    Reviewing files that changed from the base of the PR and between [baa866] and dfe0fe7122c761abe66613a7b056783deb685138.


    📒 Files selected for processing (9)

    • inject/src/messenger/features/context-menu.ts
    • inject/src/messenger/lib/download-completion.test.ts
    • inject/src/types.d.ts
    • src-tauri/inject/messenger.js
    • src-tauri/src/download.rs
    • src-tauri/src/lib.rs
    • src-tauri/src/menu.rs
    • src-tauri/src/settings.rs
    • src-tauri/src/window.rs

    [!NOTE]

    Reviews paused

    It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

    Use the following commands to manage reviews:
    - @coderabbitai resume to resume automatic reviews.
    - @coderabbitai review to trigger a single review.

    Use the checkboxes below for quick actions:
    - [ ] ▶️ Resume reviews
    - [ ] 🔍 Trigger review

    📝 Walkthrough ## Walkthrough The change adds HMAC-signed macOS media actions, completed-download tracking, hardened context menus, native sharing and pasteboard support, and MCP media-capture diagnostics. ### Changes **macOS media actions** |Layer / File(s)|Summary| |---|---| |**Signed action authorization**
    `src-tauri/Cargo.toml`, `src-tauri/src/lib.rs`, `src-tauri/src/window.rs`, `src-tauri/src/settings.rs`, `inject/src/types.d.ts`|Window bridges use HMAC-signed requests. Rust validates signatures, nonces, window ownership, replay, and authenticated result events.| |**Download completion tracking**
    `src-tauri/src/download.rs`, `src-tauri/src/window.rs`, `inject/src/messenger/lib/download-completion.ts`, `inject/src/messenger/features/context-menu.ts`, `src-tauri/inject/messenger.js`|Recent downloads remain unavailable until completion. Authenticated completion events return download IDs and URLs.| |**Media menu and bridge contract**
    `inject/src/messenger/features/context-menu.ts`, `inject/src/types.d.ts`, `src-tauri/inject/messenger.js`|Image and video menus add macOS sharing and native-copy actions. Bridges pass coordinates, actions, optional values, and signed results.| |**Native context-menu validation and dispatch**
    `src-tauri/src/menu.rs`, `src-tauri/src/settings.rs`, `src-tauri/src/lib.rs`, `src-tauri/src/macos/*`|macOS menus validate item shapes, values, and action identifiers. Valid activation dispatches a window-bound context-action event. Native sharing and pasteboard operations report authenticated results.| |**Context-menu event hardening**
    `inject/src/messenger/features/context-menu.ts`, `src-tauri/inject/messenger.js`, `inject/src/messenger/lib/*`|Captured native methods, closed shadow roots, trusted-event checks, and pointer geometry validation protect menu activation. Keyboard activation and focus restoration remain supported.| **Media-capture diagnostics** |Layer / File(s)|Summary| |---|---| |**Capture probe commands**
    `src-tauri/inject/mcp-bridge.js`|MCP commands report media availability, permission states, capture outcomes, elapsed time, and sanitized errors. Display capture supports activation-armed and no-gesture probes.| **Estimated code review effort:** 5 (Critical) | ~100 minutes ### Sequence Diagram(s) :::mermaid sequenceDiagram participant MessengerContextMenu participant SignedBridge participant RustActionHandler participant DownloadStore participant NativeSharePicker MessengerContextMenu->>SignedBridge: Request signed media action SignedBridge->>RustActionHandler: Send nonce and signature RustActionHandler->>DownloadStore: Validate completed download RustActionHandler->>NativeSharePicker: Present saved file at coordinates NativeSharePicker-->>RustActionHandler: Return presentation result RustActionHandler-->>SignedBridge: Emit signed result **Possibly related PRs** - [[kristofferR/Carrier#1](https://github.com/kristofferR/Carrier/issues/1)](https://github.com/kristofferR/Carrier/pull/1): Shares the Messenger media context-menu implementation extended by this change. - [[kristofferR/Carrier#65](https://github.com/kristofferR/Carrier/issues/65)](https://github.com/kristofferR/Carrier/pull/65): Shares the download, menu, window, and macOS module code extended by this change. - [[kristofferR/Carrier#142](https://github.com/kristofferR/Carrier/issues/142)](https://github.com/kristofferR/Carrier/pull/142): Shares the authenticated download-completion flow extended by this change.
    🚥 Pre-merge checks | ✅ 4 | ❌ 1 ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 63.46% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
    ✅ Passed checks (4 passed) | Check name | Status | Explanation | | :------------------------: | :------- | :---------------------------------------------------------------------------------------------------------------- | | Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. | | Title check | ✅ Passed | The title clearly and concisely describes the primary change: adding a macOS Share option to media context menus. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
    ✨ Finishing Touches 💡 1
    📝 Generate docstrings 💡 - [ ] Create stacked PR - [ ] Commit on current branch
    🧪 Generate unit tests (beta) - [ ] Create PR with unit tests - [ ] Commit unit tests in branch `feat/macos-share-sheet`

    Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

    ❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

    Comment @coderabbitai help to get the list of available commands.

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: chatgpt-codex-connector[bot]

    Codex Review: Didn't find any major issues. Hooray!

    Reviewed commit: 4710d47543

    ℹ️ About Codex in GitHub
    [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
     
  • Anonymous

    Anonymous - 2026-08-06

    Ticket changed by: kristofferR

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2026-08-06

    Ticket changed by: kristofferR

    • status: closed --> open
     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: coderabbitai[bot]

    ⚠️ Action not completed Review rate limited. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: coderabbitai[bot]

    ✅ Action performed Review finished. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: coderabbitai[bot]

    ⚠️ Action not completed Review rate limited. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: chatgpt-codex-connector[bot]

    Codex Review: Didn't find any major issues. Already looking forward to the next diff.

    Reviewed commit: b309e624f4

    ℹ️ About Codex in GitHub
    [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: coderabbitai[bot]

    ⚠️ Action not completed Review rate limited. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: kristofferR

    @codex review

     
1 2 3 > >> (Page 1 of 3)

Log in to post a comment.