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).
Added media-capture diagnostics for microphone, camera, video-call, and screen-sharing permissions and outcomes.
Bug Fixes
Originally posted by: kristofferR
@coderabbitai review
Originally posted by: kristofferR
@codex review
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.Originally posted by: coderabbitai[bot]
📝 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 helpto get the list of available commands.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".
Ticket changed by: kristofferR
Ticket changed by: kristofferR
Originally posted by: kristofferR
@coderabbitai review
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.Originally posted by: kristofferR
@coderabbitai review
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.Originally posted by: kristofferR
@coderabbitai review
Originally posted by: kristofferR
@codex review
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.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".
Originally posted by: kristofferR
@codex review
Originally posted by: kristofferR
@codex review
Originally posted by: kristofferR
@codex review
Originally posted by: kristofferR
@coderabbitai review
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.Originally posted by: kristofferR
@codex review
Originally posted by: kristofferR
@codex review
Originally posted by: kristofferR
@codex review
Originally posted by: kristofferR
@codex review
Originally posted by: kristofferR
@codex review