Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/pexip-auth-credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ When a Pexip video call is opened from the Rocket.Chat Electron desktop app, the
│ └── Opens Pexip in a dedicated video call window │
├──────────────────────────────────────────────────────────┤
│ Pexip Page (inside video call window) │
│ └── Calls window.videoCallWindow.getAuthCredentials() │
│ └── Calls window.RocketChatDesktop.getAuthCredentials() │
│ → Returns { userId, authToken, serverUrl } │
│ └── Uses credentials to authenticate the RC iframe │
└──────────────────────────────────────────────────────────┘
```

## API

### `window.videoCallWindow.getAuthCredentials()`
### `window.RocketChatDesktop.getAuthCredentials()`

Returns a Promise that resolves to the user's credentials or `null`.

Expand Down
6 changes: 5 additions & 1 deletion src/servers/main/preloadCoverage.main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,9 +669,13 @@ describe('preload modules coverage (node env)', () => {
});
require('../../videoCallWindow/preload/index');
const api = exposeInMainWorld.mock.calls.find(
([name]) => name === 'videoCallWindow'
([name]) => name === 'RocketChatDesktop'
)?.[1];
expect(api).toBeDefined();
expect(exposeInMainWorld).not.toHaveBeenCalledWith(
'videoCallWindow',
expect.anything()
);
api.openInMainWindow('/channel/general');
api.openInMainWindow('https://evil.example');
api.openInMainWindow('//host');
Expand Down
2 changes: 1 addition & 1 deletion src/videoCallWindow/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const isRelativeRoute = (path: unknown): path is string =>
!path.startsWith('/\\');

// Expose any necessary APIs to the webview content
contextBridge.exposeInMainWorld('videoCallWindow', {
contextBridge.exposeInMainWorld('RocketChatDesktop', {
// Navigate the main app window to an in-app route and bring it to the front.
// `path` is a server-relative route, e.g. "/channel/general".
openInMainWindow: (path: string) => {
Expand Down