Skip to content

feat(desktop-api): add openInBrowser to IRocketChatDesktop#40300

Open
jeanfbrito wants to merge 1 commit intofeat/phishing-resistant-mfafrom
feat/desktop-api-open-in-browser
Open

feat(desktop-api): add openInBrowser to IRocketChatDesktop#40300
jeanfbrito wants to merge 1 commit intofeat/phishing-resistant-mfafrom
feat/desktop-api-open-in-browser

Conversation

@jeanfbrito
Copy link
Copy Markdown
Member

@jeanfbrito jeanfbrito commented Apr 24, 2026

Proposed changes

Declares an optional openInBrowser(url: string): void method on IRocketChatDesktop so the server frontend can ask the desktop (Electron) app to open a URL in the user's native browser instead of inside the Electron webview.

Implemented on the desktop side in RocketChat/Rocket.Chat.Electron#3310 — the preload validates http: / https: only and routes through the existing browserLauncher.openExternal path so the user's selected-browser setting is honored.

Optional modifier (openInBrowser?) keeps older desktop-app versions type-compatible; frontend callers must null-check.

Why this targets feat/phishing-resistant-mfa

Phishing-resistant MFA redirects users to external identity providers. When running inside the desktop app, those redirects should open in the system browser (so passkeys / platform authenticators resolve correctly) instead of the embedded webview.

This PR only declares the type so the MFA branch can begin using it in a follow-up commit — call-site integration is deliberately out of scope here.

Issue(s)

N/A — type-surface addition.

Steps to test or reproduce

  • yarn workspace @rocket.chat/desktop-api typecheck
  • yarn changeset status

Further comments

Changeset included. Depends on a @rocket.chat/desktop-api publish with this method before the MFA call site can compile without an any-cast, but the optional modifier means no consumer is forced to update immediately.

Summary by CodeRabbit

New Features

  • Added optional capability to open URLs in the system browser instead of within the application.

Declare optional window.RocketChatDesktop.openInBrowser(url: string)
method so frontend code can request the desktop app to open a URL
in the user's native browser instead of inside the Electron webview.

Optional modifier keeps older desktop-app versions type-compatible.
Implemented in Rocket.Chat.Electron#3310.
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Apr 24, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

🦋 Changeset detected

Latest commit: fe93b00

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 42 packages
Name Type
@rocket.chat/desktop-api Minor
@rocket.chat/meteor Patch
@rocket.chat/ui-voip Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/models Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch
@rocket.chat/ui-video-conf Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 618af8e0-72aa-433c-9978-a2b8e0ff1e8e

📥 Commits

Reviewing files that changed from the base of the PR and between 7294f3c and fe93b00.

📒 Files selected for processing (2)
  • .changeset/desktop-api-open-in-browser.md
  • packages/desktop-api/src/index.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • packages/desktop-api/src/index.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: smirk-dev
Repo: RocketChat/Rocket.Chat PR: 39625
File: apps/meteor/app/api/server/v1/push.ts:85-97
Timestamp: 2026-03-14T14:58:58.834Z
Learning: In RocketChat/Rocket.Chat, the `push.token` POST/DELETE endpoints in `apps/meteor/app/api/server/v1/push.ts` were already migrated to the chained router API pattern on `develop` prior to PR `#39625`. `cleanTokenResult` (which strips `authToken` and returns `PushTokenResult`) and `isPushTokenPOSTProps`/`isPushTokenDELETEProps` validators already exist on `develop`. PR `#39625` only migrates `push.get` and `push.info` to the chained pattern. Do not flag `cleanTokenResult` or `PushTokenResult` as newly introduced behavior-breaking changes when reviewing this PR.
📚 Learning: 2025-11-17T14:30:36.271Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 37491
File: packages/desktop-api/src/index.ts:17-27
Timestamp: 2025-11-17T14:30:36.271Z
Learning: In the Rocket.Chat desktop API (`packages/desktop-api/src/index.ts`), the `CustomNotificationOptions` type has an optional `id` field by design. Custom notifications dispatched without an ID cannot be closed programmatically using `closeCustomNotification`, and this is intentional.

Applied to files:

  • packages/desktop-api/src/index.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • packages/desktop-api/src/index.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • packages/desktop-api/src/index.ts
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.

Applied to files:

  • .changeset/desktop-api-open-in-browser.md
🔇 Additional comments (2)
packages/desktop-api/src/index.ts (1)

65-65: LGTM!

Optional signature is appropriate for backward compatibility with older desktop clients, and callers using window.RocketChatDesktop?.openInBrowser?.(url) (matching the existing pattern in useDesktopFavicon.ts) will degrade gracefully. The void return type is consistent with the other fire-and-forget IPC methods on this interface (openDocumentViewer, openInternalVideoChatWindow, writeTextToClipboard). Scheme validation (http/https only) is correctly deferred to the desktop preload rather than encoded in the type.

.changeset/desktop-api-open-in-browser.md (1)

1-5: LGTM!

minor bump is correct — this is a non-breaking additive change (the method is optional on the interface). The description clearly communicates intent and the MFA use case motivating the addition.


Walkthrough

Adds a new optional openInBrowser(url) method to the IRocketChatDesktop interface in the desktop-api package, enabling server-driven frontend flows to request opening URLs in the native browser. Includes accompanying changeset documentation for the minor release.

Changes

Cohort / File(s) Summary
Desktop API openInBrowser Method
.changeset/desktop-api-open-in-browser.md, packages/desktop-api/src/index.ts
Adds optional openInBrowser(url: string) method to IRocketChatDesktop interface, allowing implementations to open URLs in the native browser instead of the Electron webview. Supports scenarios like MFA redirects to external identity providers.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested labels

type: feature, area: authentication

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding the openInBrowser method to the IRocketChatDesktop interface.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

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

@coderabbitai coderabbitai Bot added type: feature Pull requests that introduces new feature area: authentication labels Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: authentication type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant