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].
Ref [#209] (merged).
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).
Download results now include download identifiers and URLs.
Bug Fixes
Improved menu activation validation, focus restoration, keyboard navigation, and fallback behavior.
Security
Supersedes [#210], which GitHub closed when [#209]'s branch (its merge base) was deleted and could not be reopened after the rebase onto main. All review history for this work lives there; every finding from those rounds is addressed at this head.
Originally posted by: kristofferR
@codex review
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: chatgpt-codex-connector[bot]
Codex Review: Didn't find any major issues. Keep them coming!
Reviewed commit:
64cdf2c12dℹ️ 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: coderabbitai[bot]
📝 Walkthrough
## Walkthrough The PR replaces raw native authorization with signed per-window actions, adds opaque download completion tracking, hardens native and fallback context menus, adds macOS clipboard and sharing flows, and introduces sanitized media-capture diagnostics in the MCP bridge. ### Changes **Authenticated native actions** |Layer / File(s)|Summary| |---|---| |**Signed action contracts and state**`inject/src/types.d.ts`, `src-tauri/src/lib.rs`, `src-tauri/src/settings.rs`, `src-tauri/src/window.rs`|Native requests and responses use HMAC signatures, timestamps, nonces, replay checks, and authenticated callbacks.| |**Authenticated download completion**
`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`|Downloads use opaque IDs and completion state. Completion events require signatures and resolve to `{ id, url }`.| |**Native and fallback context menus**
`inject/src/messenger/features/context-menu.ts`, `inject/src/messenger/lib/menu-integrity.ts`, `src-tauri/src/menu.rs`, `src-tauri/src/macos/*`, `src-tauri/inject/messenger.js`|Menu payloads, trusted events, geometry, image copying, sharing, focus handling, and fallback activation are validated.| **Media-capture diagnostics** |Layer / File(s)|Summary| |---|---| |**Capture probe commands**
`src-tauri/inject/mcp-bridge.js`|The MCP bridge reports media capabilities, permission states, capture outcomes, elapsed time, and display-capture expiration without exposing streams or device data.| **Estimated code review effort:** 5 (Critical) | ~120 minutes ### Sequence Diagram(s) :::mermaid sequenceDiagram participant Page participant InjectedBridge participant TauriBackend participant DownloadTracker participant NativeMenu Page->>InjectedBridge: request download or context-menu action InjectedBridge->>TauriBackend: send signed request TauriBackend->>DownloadTracker: reserve or complete opaque download ID TauriBackend->>NativeMenu: present validated native action NativeMenu-->>TauriBackend: selected action TauriBackend-->>InjectedBridge: signed result or completion event InjectedBridge-->>Page: return authenticated metadata **Possibly related PRs** - [[kristofferR/Carrier#1](https://github.com/kristofferR/Carrier/issues/1)](https://github.com/kristofferR/Carrier/pull/1): Earlier native context-menu and media download/copy handling. - [[kristofferR/Carrier#65](https://github.com/kristofferR/Carrier/issues/65)](https://github.com/kristofferR/Carrier/pull/65): Earlier changes to download tracking and native menu modules. - [[kristofferR/Carrier#70](https://github.com/kristofferR/Carrier/issues/70)](https://github.com/kristofferR/Carrier/pull/70): Earlier typed context-menu and bridge changes extended by this PR.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 73.95% 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 | | :------------------------: | :------- | :---------------------------------------------------------------------------------------------------------------- | | 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. | | 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. |✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
- [ ] Create stacked PR - [ ] Commit on current branch🛠️ Fix failing CI checks 💡
- [ ] 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: 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: kristofferR
@codex review
Originally posted by: kristofferR
@coderabbitai review
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 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
@codex review
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
@codex review
Originally posted by: chatgpt-codex-connector[bot]
Codex Review: Didn't find any major issues. Breezy!
Reviewed commit:
c2c4e9b24aℹ️ 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
@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