Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BREAK] VideoConference #25570

Merged
merged 181 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from 179 commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
95c7b99
[NEW] [VideoConference] Direct call negotiation between clients (#25400)
pierre-lehnen-rc May 9, 2022
0823d56
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc May 9, 2022
403e8b8
Merge branch 'develop' into new/videoconf
dougfabris May 10, 2022
1360ae8
Merge branch 'develop' into new/videoconf
dougfabris May 10, 2022
c8f6516
[NEW] [VideoConference] System Messages (#25403)
pierre-lehnen-rc May 11, 2022
e1c1311
[NEW] Video Conference Model / Collection (#25458)
pierre-lehnen-rc May 11, 2022
8a9faec
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc May 11, 2022
9d29487
Merge branch 'new/videoconf' of github.com:RocketChat/Rocket.Chat int…
pierre-lehnen-rc May 11, 2022
7f34e2e
[NEW] [VideoConference] StartVideoConfModal Component (#25302)
dougfabris May 12, 2022
e2b5d15
Merge branch 'develop' into new/videoconf
dougfabris May 12, 2022
9e912b7
Merge branch 'develop' into new/videoconf
dougfabris May 16, 2022
a121764
Merge branch 'develop' into new/videoconf
dougfabris May 17, 2022
410a2c9
Merge branch 'develop' into new/videoconf
dougfabris May 19, 2022
93b49c9
chore: VideoConfButton & VideoConfController
dougfabris May 19, 2022
25b9a28
[NEW] [VideoConference] VideoConfPopup Component (#25474)
dougfabris May 19, 2022
7f5d55d
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc May 19, 2022
815bb4c
Merge branch 'new/videoconf' of github.com:RocketChat/Rocket.Chat int…
pierre-lehnen-rc May 19, 2022
84d800f
fix: popup loader
dougfabris May 19, 2022
c833f21
[NEW] [VideoConference] Join and Cancel Direct Call (#25489)
pierre-lehnen-rc May 19, 2022
4115266
[NEW] [VideoConference] JoinVideoConf Modal Component (#25492)
dougfabris May 19, 2022
f2b6db1
useIncomingCalls
pierre-lehnen-rc May 19, 2022
96f6033
Renamed hook
pierre-lehnen-rc May 19, 2022
9307152
[NEW] [VideoConference] Group Calls (#25528)
pierre-lehnen-rc May 20, 2022
8373005
hooks
pierre-lehnen-rc May 20, 2022
386b127
Merge branch 'develop' into new/videoconf
dougfabris May 20, 2022
98fbb6b
Basic videoconf join button
pierre-lehnen-rc May 23, 2022
d4be56a
Join buttons
pierre-lehnen-rc May 23, 2022
23baaf5
Reject Call hook
pierre-lehnen-rc May 23, 2022
2b651dd
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc May 24, 2022
8b3d219
Open call tab only when the other user accepts it
pierre-lehnen-rc May 24, 2022
a219519
Changes to messages
pierre-lehnen-rc May 25, 2022
b4b2184
group video conference title
pierre-lehnen-rc May 25, 2022
b6434c3
Merge branch 'develop' into new/videoconf
dougfabris May 25, 2022
4fba84e
[NEW] [VideoConference] JoinVideoConf Modal action integration (#25625)
dougfabris May 27, 2022
7d35e24
fix: useVideoConfControllers
dougfabris May 27, 2022
7c5b4ec
chore: add set preferences
dougfabris May 27, 2022
e4dede6
Merge branch 'develop' into new/videoconf
dougfabris May 27, 2022
665fe3b
Fallback join url
pierre-lehnen-rc May 27, 2022
777223a
User avatars
pierre-lehnen-rc May 30, 2022
fcd9810
fallback url
pierre-lehnen-rc May 30, 2022
d80a009
[NEW] [VideoConference] Load call urls from the apps-engine (#25623)
pierre-lehnen-rc May 31, 2022
cb9da15
Merge branch 'develop' into new/videoconf
dougfabris May 31, 2022
ee10c6f
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc Jun 2, 2022
8a29c79
Merge branch 'develop' into new/videoconf
dougfabris Jun 2, 2022
622d17e
Merge branch 'new/videoconf' of github.com:RocketChat/Rocket.Chat int…
pierre-lehnen-rc Jun 2, 2022
63304f6
[NEW] [VideoConference] VideoConf Call Sidebar (#25652)
dougfabris Jun 3, 2022
1b53023
Merge branch 'new/videoconf' of github.com:RocketChat/Rocket.Chat int…
pierre-lehnen-rc Jun 3, 2022
c551a2b
[NEW] [VideoConference] Apps-engine bridge (#25716)
pierre-lehnen-rc Jun 3, 2022
51ab02a
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc Jun 3, 2022
1e3cde8
[NEW] [VideoConference] New Endpoints (#25703)
pierre-lehnen-rc Jun 7, 2022
a577a7c
Merge branch 'develop' into new/videoconf
dougfabris Jun 7, 2022
43323cb
Fixed types
pierre-lehnen-rc Jun 8, 2022
b0df89e
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc Jun 8, 2022
832da28
Fixed import path
pierre-lehnen-rc Jun 8, 2022
d2925db
Merge branch 'develop' into new/videoconf
dougfabris Jun 9, 2022
e057d7f
[NEW] [VideoConference] Support for multiple active providers (#25796)
pierre-lehnen-rc Jun 9, 2022
cc9adbc
Removed BBB files
pierre-lehnen-rc Jun 9, 2022
96537ca
chore: update videoconf updates
dougfabris Jun 9, 2022
a8e8724
Fix setting url
pierre-lehnen-rc Jun 9, 2022
6f91d3a
Removed unused system messages, fixed some types and adjusted tabbar …
pierre-lehnen-rc Jun 10, 2022
167fcb8
Fixed LGTM alerts
pierre-lehnen-rc Jun 10, 2022
53b34c1
Adjusted settings
pierre-lehnen-rc Jun 10, 2022
ce0064f
[NEW] [VideoConference] VideoConf Context/Provider Improvements (#25792)
dougfabris Jun 10, 2022
158d0e4
Merge branch 'develop' into new/videoconf
dougfabris Jun 14, 2022
b4e9181
Merge branch 'develop' into new/videoconf
dougfabris Jun 15, 2022
d6963c4
fixed TS error
pierre-lehnen-rc Jun 15, 2022
eb25cce
Merge branch 'develop' into new/videoconf
dougfabris Jun 15, 2022
c3b7408
[NEW] [VideoConference] Allow apps to create new video conferences (#…
pierre-lehnen-rc Jun 16, 2022
a74f46b
[NEW] [VideoConference] Allow apps to end calls and add users (#25878)
pierre-lehnen-rc Jun 16, 2022
60f354b
[NEW] [VideoConference] Livechat Support (#25826)
pierre-lehnen-rc Jun 16, 2022
1d7aaa1
[NEW] [VideoConference] Split EE and CE features (#25899)
pierre-lehnen-rc Jun 16, 2022
35df119
Change to settings migration
pierre-lehnen-rc Jun 17, 2022
c0eec42
Update direct videoconference message and status when it is accepted
pierre-lehnen-rc Jun 17, 2022
cd0a495
Handle call ending
pierre-lehnen-rc Jun 17, 2022
25fb23d
Merge branch 'develop' into new/videoconf
dougfabris Jun 17, 2022
c86f259
chore: toolbox order
dougfabris Jun 17, 2022
8e92d53
[NEW] [Video Conference] Capabilities Endpoint (#25903)
pierre-lehnen-rc Jun 18, 2022
de65a80
[FIX] [Video Conference] Action Order (#25921)
pierre-lehnen-rc Jun 20, 2022
df28224
Merge branch 'develop' into new/videoconf
dougfabris Jun 20, 2022
88e1c67
chore: yarn install
dougfabris Jun 20, 2022
487e003
use-subscription
pierre-lehnen-rc Jun 20, 2022
6085df8
Include providerName on response of join and start endpoints
pierre-lehnen-rc Jun 20, 2022
edb5e42
[NEW] [VideoConference] Blocked action hook & Modal (#25803)
dougfabris Jun 20, 2022
515b728
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc Jun 20, 2022
9588624
Merge branch 'new/videoconf' of github.com:RocketChat/Rocket.Chat int…
pierre-lehnen-rc Jun 20, 2022
e50010d
chore: provider order
dougfabris Jun 20, 2022
ef8c387
Add `dev` script to `ui-video-conf`
tassoevan Jun 20, 2022
6c9568e
[NEW] [VideoConference] Join conference endpoint call (#25886)
dougfabris Jun 20, 2022
8f41a4b
[NEW] [Video Conference] Hide buttons for unused capabilities
pierre-lehnen-rc Jun 21, 2022
323fb2d
Merge branch 'new/videoconf' into new/video/hide-unused-buttons
pierre-lehnen-rc Jun 21, 2022
077c416
Renamed settings
pierre-lehnen-rc Jun 21, 2022
cd4a5cd
Removed url from join button
pierre-lehnen-rc Jun 21, 2022
66f6e2e
Merge branch 'new/videoconf' into new/video/hide-unused-buttons
pierre-lehnen-rc Jun 21, 2022
51ae7a0
LGTM
pierre-lehnen-rc Jun 21, 2022
eec5504
ts
pierre-lehnen-rc Jun 21, 2022
309e902
Ensure providerName is always stored in lowercase
pierre-lehnen-rc Jun 21, 2022
cc36029
[NEW] [VideoConference] Create Ephemeral messages when a video conf i…
pierre-lehnen-rc Jun 21, 2022
4fad383
error
pierre-lehnen-rc Jun 21, 2022
ea42dd8
Changed settings back
pierre-lehnen-rc Jun 21, 2022
a80da36
Merge branch 'new/video/mobile-errors' into new/videoconf
pierre-lehnen-rc Jun 21, 2022
2179b03
provider errors
pierre-lehnen-rc Jun 21, 2022
a20e14b
fixed provider names
pierre-lehnen-rc Jun 21, 2022
de37084
[NEW] [VideoConference] Expire Old Calls (#25900)
pierre-lehnen-rc Jun 22, 2022
4896684
Added declined and expired status
pierre-lehnen-rc Jun 22, 2022
204d203
Stop sorting by status.
pierre-lehnen-rc Jun 22, 2022
8b5de32
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 22, 2022
61983b1
Restored omnichannel setting
pierre-lehnen-rc Jun 22, 2022
362d023
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc Jun 22, 2022
e4c055f
[FIX] [VideoConference] Changed how the calling popup is brought up (…
pierre-lehnen-rc Jun 23, 2022
fae4bbe
Chore: Merge develop into new/videoconf (#25972)
pierre-lehnen-rc Jun 23, 2022
5375d18
[NEW] [VideoConference] Conferences List contextualBar (#25892)
dougfabris Jun 23, 2022
5d02230
Merge branch 'develop' into new/videoconf
dougfabris Jun 23, 2022
6dfe8d7
chore: provider order
dougfabris Jun 23, 2022
6c4683d
chore: missing import model
dougfabris Jun 23, 2022
37e2e10
Merge remote-tracking branch 'origin/new/video/hide-unused-buttons' i…
pierre-lehnen-rc Jun 23, 2022
b212163
Capabilities hook
pierre-lehnen-rc Jun 23, 2022
d728c2f
Ringing capabilities
pierre-lehnen-rc Jun 23, 2022
8cc1a23
useVideoConfPreferences
pierre-lehnen-rc Jun 23, 2022
c1845d1
chore: capabilities
dougfabris Jun 23, 2022
b0298ef
Check availability before showing start call popup
pierre-lehnen-rc Jun 23, 2022
3362255
new: useVideoConfWarning
dougfabris Jun 24, 2022
14c4eec
chore: missing tabbar menu item key
dougfabris Jun 24, 2022
794d577
Merge branch 'develop' into new/videoconf
pierre-lehnen-rc Jun 24, 2022
723f40a
[NEW] [VideoConference] Statistics (#25902)
pierre-lehnen-rc Jun 24, 2022
7f45512
unused condition
pierre-lehnen-rc Jun 24, 2022
6ce87d5
Fix and Translations to the warning modal.
pierre-lehnen-rc Jun 24, 2022
ad61542
Fixed history order
pierre-lehnen-rc Jun 24, 2022
cac2ef3
Fixed expiration cron job
pierre-lehnen-rc Jun 24, 2022
7b0f98e
fixed contextual bar title
pierre-lehnen-rc Jun 24, 2022
0bb7028
fixed react error on contextual bar avatar list
pierre-lehnen-rc Jun 24, 2022
2079338
Prevent users from joining calls that have already ended
pierre-lehnen-rc Jun 24, 2022
72a9174
Removed collection of old settings
pierre-lehnen-rc Jun 24, 2022
e75e2d4
Removed unused message type
pierre-lehnen-rc Jun 24, 2022
00b2524
Removed unused message model function
pierre-lehnen-rc Jun 24, 2022
cfdff3c
update VideoConfStartProps tests
pierre-lehnen-rc Jun 24, 2022
38c2c3a
Removed unused function
pierre-lehnen-rc Jun 24, 2022
8304a24
Use error constants on the backend too
pierre-lehnen-rc Jun 24, 2022
e3d2c98
fix: VideoConfBlockModal content
dougfabris Jun 24, 2022
a60c2d1
Review: fix useVideoConfWarning
ggazzo Jun 24, 2022
4fdb54c
Merge remote-tracking branch 'origin/develop' into new/videoconf
ggazzo Jun 24, 2022
361d329
Stop showing "Calling" popup for non-direct video conferences
pierre-lehnen-rc Jun 24, 2022
7bbf6c7
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 25, 2022
4cbc2f4
made the "direct" call type opt-in by the clients
pierre-lehnen-rc Jun 25, 2022
11f2e89
Register users who joined the call through a callback
pierre-lehnen-rc Jun 25, 2022
f2a6805
Ui test
pierre-lehnen-rc Jun 25, 2022
575699c
[NEW] [VideoConference] API Definition Tests (#26017)
pierre-lehnen-rc Jun 27, 2022
854551c
[NEW] [VideoConference] API Tests (#26018)
pierre-lehnen-rc Jun 27, 2022
7f36706
Throw an error when url generation fails
pierre-lehnen-rc Jun 27, 2022
d0631b5
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 27, 2022
c8c2140
[FIX] unregisterProvider not normalizing names
pierre-lehnen-rc Jun 27, 2022
0626d4b
Removed old test file
pierre-lehnen-rc Jun 27, 2022
9ebc2ff
Merge branch 'develop' into new/videoconf
dougfabris Jun 27, 2022
b753ae8
Changed sound file
pierre-lehnen-rc Jun 27, 2022
85d99f6
Merge remote-tracking branch 'origin/new/videoconf' into new/videoconf
pierre-lehnen-rc Jun 27, 2022
631cbfb
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 27, 2022
d84b532
new: check license on tabbar
dougfabris Jun 27, 2022
799bdef
Apps-engine version
pierre-lehnen-rc Jun 27, 2022
e33ba1e
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 27, 2022
cfa1048
ts fix
pierre-lehnen-rc Jun 28, 2022
a517b30
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 28, 2022
644cb24
fix: modal ui
dougfabris Jun 28, 2022
528c168
regression: videoconf list
dougfabris Jun 28, 2022
1cafc57
Merge remote-tracking branch 'origin/develop' into new/videoconf
dougfabris Jun 28, 2022
c5c12df
Merge branch 'develop' into new/videoconf
dougfabris Jun 28, 2022
13b2ee0
chore: useHasLicenseModule
dougfabris Jun 28, 2022
4eb31d6
chore: components tweaks
dougfabris Jun 28, 2022
e46bdd4
Add a join button to direct calls
pierre-lehnen-rc Jun 28, 2022
1155106
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 28, 2022
fef3bfc
merge error
pierre-lehnen-rc Jun 28, 2022
6de3991
Settings bridge
pierre-lehnen-rc Jun 29, 2022
ad1c6d8
i18n
pierre-lehnen-rc Jun 29, 2022
fba1d2c
Add join button to "Starting" messages
pierre-lehnen-rc Jun 29, 2022
b044244
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 29, 2022
21d2c75
Reorganized ringing functionality
pierre-lehnen-rc Jun 29, 2022
35d55de
Placeholder title
pierre-lehnen-rc Jun 29, 2022
9d0fe8f
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 29, 2022
8a1e97b
TesterApp path
pierre-lehnen-rc Jun 29, 2022
1e5cce4
i18n
pierre-lehnen-rc Jun 29, 2022
3ae737b
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jun 30, 2022
d815fbd
[NEW] [VideoConference] Call flow and UI improves (#26072)
dougfabris Jul 1, 2022
2a914e3
Merge remote-tracking branch 'origin/develop' into new/videoconf
pierre-lehnen-rc Jul 1, 2022
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
1 change: 1 addition & 0 deletions apps/meteor/.mocharc.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ module.exports = {
'tests/end-to-end/api/*.js',
'tests/end-to-end/api/*.ts',
'tests/end-to-end/apps/*.js',
'tests/end-to-end/apps/*.ts',
],
};
181 changes: 168 additions & 13 deletions apps/meteor/app/api/server/v1/videoConference.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,180 @@
import { Meteor } from 'meteor/meteor';
import type { VideoConference } from '@rocket.chat/core-typings';
import {
isVideoConfStartProps,
isVideoConfJoinProps,
isVideoConfCancelProps,
isVideoConfInfoProps,
isVideoConfListProps,
} from '@rocket.chat/rest-typings';

import { Rooms } from '../../../models/server';
import { API } from '../api';
import { canAccessRoomIdAsync } from '../../../authorization/server/functions/canAccessRoom';
import { VideoConf } from '../../../../server/sdk';
import { videoConfProviders } from '../../../../server/lib/videoConfProviders';
import { availabilityErrors } from '../../../../lib/videoConference/constants';

API.v1.addRoute(
'video-conference/jitsi.update-timeout',
{ authRequired: true },
'video-conference.start',
{ authRequired: true, validateParams: isVideoConfStartProps },
{
async post() {
const { roomId, title, allowRinging } = this.bodyParams;
const { userId } = this;
if (!userId || !(await canAccessRoomIdAsync(roomId, userId))) {
return API.v1.failure('invalid-params');
}

try {
const providerName = videoConfProviders.getActiveProvider();

if (!providerName) {
throw new Error(availabilityErrors.NOT_ACTIVE);
}

return API.v1.success({
data: {
...(await VideoConf.start(userId, roomId, { title, allowRinging: Boolean(allowRinging) })),
providerName,
},
});
} catch (e) {
return API.v1.failure(await VideoConf.diagnoseProvider(userId, roomId));
}
},
},
);

API.v1.addRoute(
'video-conference.join',
{ authRequired: true, validateParams: isVideoConfJoinProps },
{
async post() {
const { callId, state } = this.bodyParams;
const { userId } = this;

const call = await VideoConf.get(callId);
if (!call) {
return API.v1.failure('invalid-params');
}

if (!userId || !(await canAccessRoomIdAsync(call.rid, userId))) {
return API.v1.failure('invalid-params');
}

let url: string | undefined;

try {
url = await VideoConf.join(userId, callId, {
...(state?.cam !== undefined ? { cam: state.cam } : {}),
...(state?.mic !== undefined ? { mic: state.mic } : {}),
});
} catch (e) {
return API.v1.failure(await VideoConf.diagnoseProvider(userId, call.rid, call.providerName));
}

if (!url) {
return API.v1.failure('failed-to-get-url');
}

return API.v1.success({
url,
providerName: call.providerName,
});
},
},
);

API.v1.addRoute(
'video-conference.cancel',
{ authRequired: true, validateParams: isVideoConfCancelProps },
{
async post() {
const { callId } = this.bodyParams;
const { userId } = this;

const call = await VideoConf.get(callId);
if (!call) {
return API.v1.failure('invalid-params');
}

if (!userId || !(await canAccessRoomIdAsync(call.rid, userId))) {
return API.v1.failure('invalid-params');
}

await VideoConf.cancel(userId, callId);
return API.v1.success();
},
},
);

API.v1.addRoute(
'video-conference.info',
{ authRequired: true, validateParams: isVideoConfInfoProps },
{
post() {
const { roomId, joiningNow = true } = this.bodyParams;
if (!roomId) {
return API.v1.failure('The "roomId" parameter is required!');
async get() {
const { callId } = this.queryParams;
const { userId } = this;

const call = await VideoConf.get(callId);
if (!call) {
return API.v1.failure('invalid-params');
}

if (!userId || !(await canAccessRoomIdAsync(call.rid, userId))) {
return API.v1.failure('invalid-params');
}

const room = Rooms.findOneById(roomId, { fields: { _id: 1 } });
if (!room) {
return API.v1.failure('Room does not exist!');
const capabilities = await VideoConf.listProviderCapabilities(call.providerName);

return API.v1.success({
...(call as VideoConference),
capabilities,
});
},
},
);

API.v1.addRoute(
'video-conference.list',
{ authRequired: true, validateParams: isVideoConfListProps },
{
async get() {
const { roomId } = this.queryParams;
const { userId } = this;

const { offset, count } = this.getPaginationItems();

if (!userId || !(await canAccessRoomIdAsync(roomId, userId))) {
return API.v1.failure('invalid-params');
}

const jitsiTimeout = Meteor.runAsUser(this.userId, () => Meteor.call('jitsi:updateTimeout', roomId, Boolean(joiningNow)));
return API.v1.success({ jitsiTimeout });
const data = await VideoConf.list(roomId, { offset, count });

return API.v1.success(data);
},
},
);

API.v1.addRoute(
'video-conference.providers',
{ authRequired: true },
{
async get() {
const data = await VideoConf.listProviders();

return API.v1.success({ data });
},
},
);

API.v1.addRoute(
'video-conference.capabilities',
{ authRequired: true },
{
async get() {
const data = await VideoConf.listCapabilities();

return API.v1.success(data);
},
},
);
6 changes: 6 additions & 0 deletions apps/meteor/app/apps/server/bridges/bridges.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { AppLivechatBridge } from './livechat';
import { AppUploadBridge } from './uploads';
import { UiInteractionBridge } from './uiInteraction';
import { AppSchedulerBridge } from './scheduler';
import { AppVideoConferenceBridge } from './videoConferences';

export class RealAppBridges extends AppBridges {
constructor(orch) {
Expand All @@ -41,6 +42,7 @@ export class RealAppBridges extends AppBridges {
this._uiInteractionBridge = new UiInteractionBridge(orch);
this._schedulerBridge = new AppSchedulerBridge(orch);
this._cloudWorkspaceBridge = new AppCloudBridge(orch);
this._videoConfBridge = new AppVideoConferenceBridge(orch);
}

getCommandBridge() {
Expand Down Expand Up @@ -114,4 +116,8 @@ export class RealAppBridges extends AppBridges {
getCloudWorkspaceBridge() {
return this._cloudWorkspaceBridge;
}

getVideoConferenceBridge() {
return this._videoConfBridge;
}
}
70 changes: 70 additions & 0 deletions apps/meteor/app/apps/server/bridges/videoConferences.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { VideoConferenceBridge } from '@rocket.chat/apps-engine/server/bridges/VideoConferenceBridge';
import { AppVideoConference, VideoConference } from '@rocket.chat/apps-engine/definition/videoConferences';
import { IVideoConfProvider } from '@rocket.chat/apps-engine/definition/videoConfProviders';

import { VideoConf } from '../../../../server/sdk';
import { AppServerOrchestrator } from '../orchestrator';
import { videoConfProviders } from '../../../../server/lib/videoConfProviders';
import type { AppVideoConferencesConverter } from '../converters/videoConferences';

export class AppVideoConferenceBridge extends VideoConferenceBridge {
// eslint-disable-next-line no-empty-function
constructor(private readonly orch: AppServerOrchestrator) {
super();
}

protected async getById(callId: string, appId: string): Promise<VideoConference> {
this.orch.debugLog(`The App ${appId} is getting the video conference byId: "${callId}"`);

return this.orch.getConverters()?.get('videoConferences').convertById(callId);
}

protected async create(call: AppVideoConference, appId: string): Promise<string> {
this.orch.debugLog(`The App ${appId} is creating a video conference.`);

return (
await VideoConf.create({
type: 'videoconference',
...call,
})
).callId;
}

protected async update(call: VideoConference, appId: string): Promise<void> {
this.orch.debugLog(`The App ${appId} is updating a video conference.`);

const oldData = call._id && (await VideoConf.getUnfiltered(call._id));
if (!oldData) {
throw new Error('A video conference must exist to update.');
}

const data = (this.orch.getConverters()?.get('videoConferences') as AppVideoConferencesConverter).convertAppVideoConference(call);
await VideoConf.setProviderData(call._id, data.providerData);

for (const { _id, ts } of data.users) {
if (oldData.users.find((user) => user._id === _id)) {
continue;
}

VideoConf.addUser(call._id, _id, ts);
}

if (data.endedBy && data.endedBy._id !== oldData.endedBy?._id) {
await VideoConf.setEndedBy(call._id, data.endedBy._id);
} else if (data.endedAt) {
await VideoConf.setEndedAt(call._id, data.endedAt);
}

if (data.status > oldData.status) {
await VideoConf.setStatus(call._id, data.status);
}
}

protected async registerProvider(info: IVideoConfProvider): Promise<void> {
videoConfProviders.registerProvider(info.name, info.capabilities || {});
}

protected async unRegisterProvider(info: IVideoConfProvider): Promise<void> {
videoConfProviders.unRegisterProvider(info.name);
}
}
3 changes: 2 additions & 1 deletion apps/meteor/app/apps/server/converters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { AppMessagesConverter } from './messages';
import { AppRoomsConverter } from './rooms';
import { AppSettingsConverter } from './settings';
import { AppUsersConverter } from './users';
import { AppVideoConferencesConverter } from './videoConferences';

export { AppMessagesConverter, AppRoomsConverter, AppSettingsConverter, AppUsersConverter };
export { AppMessagesConverter, AppRoomsConverter, AppSettingsConverter, AppUsersConverter, AppVideoConferencesConverter };
36 changes: 36 additions & 0 deletions apps/meteor/app/apps/server/converters/videoConferences.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { VideoConference } from '@rocket.chat/apps-engine/definition/videoConferences';
import type { IVideoConference } from '@rocket.chat/core-typings';

import { VideoConf } from '../../../../server/sdk';
import type { AppServerOrchestrator } from '../orchestrator';

export class AppVideoConferencesConverter {
pierre-lehnen-rc marked this conversation as resolved.
Show resolved Hide resolved
// @ts-ignore
private orch: AppServerOrchestrator;

constructor(orch: AppServerOrchestrator) {
this.orch = orch;
}

async convertById(callId: string): Promise<VideoConference | undefined> {
const call = await VideoConf.getUnfiltered(callId);

return this.convertVideoConference(call);
}

convertVideoConference(call: IVideoConference | null): VideoConference | undefined {
if (!call) {
return;
}

return {
...call,
} as VideoConference;
}

convertAppVideoConference(call: VideoConference): IVideoConference {
return {
...call,
} as IVideoConference;
}
}
9 changes: 8 additions & 1 deletion apps/meteor/app/apps/server/orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import { AppsLogsModel, AppsModel, AppsPersistenceModel } from '../../models/ser
import { settings, settingsRegistry } from '../../settings/server';
import { RealAppBridges } from './bridges';
import { AppMethods, AppServerNotifier, AppsRestApi, AppUIKitInteractionApi } from './communication';
import { AppMessagesConverter, AppRoomsConverter, AppSettingsConverter, AppUsersConverter } from './converters';
import {
AppMessagesConverter,
AppRoomsConverter,
AppSettingsConverter,
AppUsersConverter,
AppVideoConferencesConverter,
} from './converters';
import { AppDepartmentsConverter } from './converters/departments';
import { AppUploadsConverter } from './converters/uploads';
import { AppVisitorsConverter } from './converters/visitors';
Expand Down Expand Up @@ -54,6 +60,7 @@ export class AppServerOrchestrator {
this._converters.set('visitors', new AppVisitorsConverter(this));
this._converters.set('departments', new AppDepartmentsConverter(this));
this._converters.set('uploads', new AppUploadsConverter(this));
this._converters.set('videoConferences', new AppVideoConferencesConverter(this));

this._bridges = new RealAppBridges(this);

Expand Down
Loading