Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v2.7.x-release' into issue-17894
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonlsouza committed May 26, 2023
2 parents 01246a6 + 4948731 commit 06c0fab
Show file tree
Hide file tree
Showing 274 changed files with 5,379 additions and 1,892 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/automated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ jobs:
- name: Install BBB
run: |
sudo sh -c '
cd /root/ && wget -q https://ubuntu.bigbluebutton.org/bbb-install-2.6.sh -O bbb-install.sh
cat bbb-install.sh | sed "s|> /etc/apt/sources.list.d/bigbluebutton.list||g" | bash -s -- -v focal-26-dev -s bbb-ci.test -j -d /certs/
cd /root/ && wget -q https://raw.githubusercontent.com/bigbluebutton/bbb-install/v2.7.x-release/bbb-install.sh -O bbb-install.sh
cat bbb-install.sh | sed "s|> /etc/apt/sources.list.d/bigbluebutton.list||g" | bash -s -- -v focal-27-dev -s bbb-ci.test -j -d /certs/
bbb-conf --salt bbbci
echo "NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/bbb-dev/bbb-dev-ca.crt" >> /usr/share/meteor/bundle/bbb-html5-with-roles.conf
sed -i "s/\"minify\": true,/\"minify\": false,/" /usr/share/etherpad-lite/settings.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ object ScreenshareModel {
def getHasAudio(status: ScreenshareModel): Boolean = {
status.hasAudio
}

def setContentType(status: ScreenshareModel, contentType: String): Unit = {
status.contentType = contentType
}

def getContentType(status: ScreenshareModel): String = {
status.contentType
}
}

class ScreenshareModel {
Expand All @@ -103,4 +111,5 @@ class ScreenshareModel {
private var screenshareConf: String = ""
private var timestamp: String = ""
private var hasAudio = false
private var contentType = "camera"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.running.LiveMeeting
import org.bigbluebutton.core.util.RandomStringGenerator
import org.bigbluebutton.core.models.{ PresentationPod, PresentationPage, PresentationInPod }
import org.bigbluebutton.core.models.{ PresentationInPod, PresentationPage, PresentationPod }

import java.io.File

trait PresentationWithAnnotationsMsgHdlr extends RightsManagementTrait {
trait MakePresentationDownloadReqMsgHdlr extends RightsManagementTrait {
this: PresentationPodHdlrs =>

object JobTypes {
Expand Down Expand Up @@ -40,20 +41,20 @@ trait PresentationWithAnnotationsMsgHdlr extends RightsManagementTrait {
BbbCommonEnvCoreMsg(envelope, event)
}

def buildNewPresAnnFileAvailable(fileURI: String, presId: String): NewPresAnnFileAvailableMsg = {
val header = BbbClientMsgHeader(NewPresAnnFileAvailableMsg.NAME, "not-used", "not-used")
val body = NewPresAnnFileAvailableMsgBody(fileURI, presId)
def buildNewPresFileAvailable(fileURI: String, presId: String, typeOfExport: String): NewPresFileAvailableMsg = {
val header = BbbClientMsgHeader(NewPresFileAvailableMsg.NAME, "not-used", "not-used")
val body = NewPresFileAvailableMsgBody(fileURI, presId, typeOfExport)

NewPresAnnFileAvailableMsg(header, body)
NewPresFileAvailableMsg(header, body)
}

def buildBroadcastNewPresAnnFileAvailable(newPresAnnFileAvailableMsg: NewPresAnnFileAvailableMsg, liveMeeting: LiveMeeting): BbbCommonEnvCoreMsg = {
def buildBroadcastNewPresFileAvailable(newPresFileAvailableMsg: NewPresFileAvailableMsg, liveMeeting: LiveMeeting): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, "not-used")
val envelope = BbbCoreEnvelope(PresentationPageConvertedEventMsg.NAME, routing)
val header = BbbClientMsgHeader(NewPresAnnFileAvailableEvtMsg.NAME, liveMeeting.props.meetingProp.intId, "not-used")
val body = NewPresAnnFileAvailableEvtMsgBody(fileURI = newPresAnnFileAvailableMsg.body.fileURI, presId = newPresAnnFileAvailableMsg.body.presId)
val event = NewPresAnnFileAvailableEvtMsg(header, body)

val header = BbbClientMsgHeader(NewPresFileAvailableEvtMsg.NAME, liveMeeting.props.meetingProp.intId, "not-used")
val body = NewPresFileAvailableEvtMsgBody(fileURI = newPresFileAvailableMsg.body.fileURI, presId = newPresFileAvailableMsg.body.presId,
typeOfExport = newPresFileAvailableMsg.body.typeOfExport)
val event = NewPresFileAvailableEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}

Expand Down Expand Up @@ -112,7 +113,7 @@ trait PresentationWithAnnotationsMsgHdlr extends RightsManagementTrait {
}
}

def handle(m: MakePresentationWithAnnotationDownloadReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def handle(m: MakePresentationDownloadReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {

val meetingId = liveMeeting.props.meetingProp.intId
val userId = m.header.userId
Expand Down Expand Up @@ -146,24 +147,28 @@ trait PresentationWithAnnotationsMsgHdlr extends RightsManagementTrait {
val storeAnnotationPages: List[PresentationPageForExport] = getPresentationPagesForExport(pagesRange, pageCount, presId, currentPres, liveMeeting);

val annotationCount: Int = storeAnnotationPages.map(_.annotations.size).sum
val isOriginalPresentationType = m.body.typeOfExport == "Original"

if (annotationCount > 0) {
if (!isOriginalPresentationType && annotationCount > 0) {
// Send Export Job to Redis
val job = buildStoreExportJobInRedisSysMsg(exportJob, liveMeeting)
bus.outGW.send(job)

// Send Annotations to Redis
val annotations = StoredAnnotations(jobId, presId, storeAnnotationPages)
bus.outGW.send(buildStoreAnnotationsInRedisSysMsg(annotations, liveMeeting))
} else {
} else if (!isOriginalPresentationType && annotationCount == 0) {
log.error("There are no annotations for presentation with Id {}... Ignoring", presId)
} else if (isOriginalPresentationType) {
// Return existing uploaded file directly
val filename = currentPres.get.name
val convertedFileName = currentPres.get.filenameConverted
val filename = if (convertedFileName == "") currentPres.get.name else convertedFileName
val presFilenameExt = filename.split("\\.").last

PresentationSender.broadcastSetPresentationDownloadableEvtMsg(bus, meetingId, "DEFAULT_PRESENTATION_POD", "not-used", presId, true, filename)

val fileURI = List("bigbluebutton", "presentation", "download", meetingId, s"${presId}?presFilename=${presId}.${presFilenameExt}").mkString(File.separator, File.separator, "")
val event = buildNewPresAnnFileAvailable(fileURI, presId)
val fileURI = List("bigbluebutton", "presentation", "download", meetingId, s"${presId}?presFilename=${presId}.${presFilenameExt}&filename=${filename}").mkString(File.separator, File.separator, "")
val event = buildNewPresFileAvailable(fileURI, presId, m.body.typeOfExport)

handle(event, liveMeeting, bus)
}
Expand Down Expand Up @@ -221,9 +226,9 @@ trait PresentationWithAnnotationsMsgHdlr extends RightsManagementTrait {
}
}

def handle(m: NewPresAnnFileAvailableMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
log.info("Received NewPresAnnFileAvailableMsg meetingId={} presId={} fileUrl={}", liveMeeting.props.meetingProp.intId, m.body.presId, m.body.fileURI)
bus.outGW.send(buildBroadcastNewPresAnnFileAvailable(m, liveMeeting))
def handle(m: NewPresFileAvailableMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
log.info("Received NewPresFileAvailableMsg meetingId={} presId={} fileUrl={}", liveMeeting.props.meetingProp.intId, m.body.presId, m.body.fileURI)
bus.outGW.send(buildBroadcastNewPresFileAvailable(m, liveMeeting))
}

def handle(m: CaptureSharedNotesReqInternalMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.bigbluebutton.core.apps.presentationpod
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.PresentationInPod
import org.bigbluebutton.core.running.LiveMeeting

trait PresentationConversionCompletedSysPubMsgHdlr {
Expand All @@ -21,16 +22,16 @@ trait PresentationConversionCompletedSysPubMsgHdlr {
pod <- PresentationPodsApp.getPresentationPod(state, msg.body.podId)
pres <- pod.getPresentation(msg.body.presentation.id)
} yield {
val presVO = PresentationPodsApp.translatePresentationToPresentationVO(pres, temporaryPresentationId)

val presVO = PresentationPodsApp.translatePresentationToPresentationVO(pres, temporaryPresentationId,
msg.body.presentation.isInitialPresentation, msg.body.presentation.filenameConverted)
PresentationSender.broadcastPresentationConversionCompletedEvtMsg(
bus,
meetingId,
pod.id,
msg.header.userId,
msg.body.messageKey,
msg.body.code,
presVO
presVO,
)
PresentationSender.broadcastSetPresentationDownloadableEvtMsg(
bus,
Expand All @@ -42,8 +43,10 @@ trait PresentationConversionCompletedSysPubMsgHdlr {
pres.name
)

val presWithConvertedName = PresentationInPod(pres.id, pres.name, pres.current, pres.pages,
pres.downloadable, pres.removable, msg.body.presentation.filenameConverted)
var pods = state.presentationPodManager.addPod(pod)
pods = pods.addPresentationToPod(pod.id, pres)
pods = pods.addPresentationToPod(pod.id, presWithConvertedName)

state.update(pods)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PresentationPodHdlrs(implicit val context: ActorContext)
with PresentationPageCountErrorPubMsgHdlr
with PresentationUploadedFileTooLargeErrorPubMsgHdlr
with PresentationUploadTokenReqMsgHdlr
with PresentationWithAnnotationsMsgHdlr
with MakePresentationDownloadReqMsgHdlr
with ResizeAndMovePagePubMsgHdlr
with SyncGetPresentationPodsMsgHdlr
with RemovePresentationPodPubMsgHdlr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object PresentationPodsApp {
}

PresentationVO(p.id, "", p.name, p.current,
pages.toVector, p.downloadable, p.removable)
pages.toVector, p.downloadable, p.removable, false, "")
}

PresentationPodVO(pod.id, pod.currentPresenter, presentationVOs.toVector)
Expand All @@ -73,7 +73,8 @@ object PresentationPodsApp {
state.update(podManager)
}

def translatePresentationToPresentationVO(pres: PresentationInPod, temporaryPresentationId: String): PresentationVO = {
def translatePresentationToPresentationVO(pres: PresentationInPod, temporaryPresentationId: String,
isInitialPresentation: Boolean, filenameConverted: String): PresentationVO = {
val pages = pres.pages.values.map { page =>
PageVO(
id = page.id,
Expand All @@ -88,7 +89,8 @@ object PresentationPodsApp {
heightRatio = page.heightRatio
)
}
PresentationVO(pres.id, temporaryPresentationId, pres.name, pres.current, pages.toVector, pres.downloadable, pres.removable)
PresentationVO(pres.id, temporaryPresentationId, pres.name, pres.current, pages.toVector, pres.downloadable,
pres.removable, isInitialPresentation, filenameConverted)
}

def setCurrentPresentationInPod(state: MeetingState2x, podId: String, nextCurrentPresId: String): Option[PresentationPod] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object PresentationSender {
podId: String, userId: String,
presentationId: String,
downloadable: Boolean,
presFilename: String
presFilename: String,
): Unit = {
val routing = Routing.addMsgToClientRouting(
MessageTypes.BROADCAST_TO_MEETING,
Expand All @@ -30,7 +30,7 @@ object PresentationSender {
bus: MessageBus,
meetingId: String,
podId: String, userId: String, messageKey: String,
code: String, presentation: PresentationVO
code: String, presentation: PresentationVO,
): Unit = {
val routing = Routing.addMsgToClientRouting(
MessageTypes.BROADCAST_TO_MEETING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ trait GetScreenshareStatusReqMsgHdlr {
val vidHeight = ScreenshareModel.getScreenshareVideoHeight(liveMeeting.screenshareModel)
val timestamp = ScreenshareModel.getTimestamp(liveMeeting.screenshareModel)
val hasAudio = ScreenshareModel.getHasAudio(liveMeeting.screenshareModel)
val contentType = ScreenshareModel.getContentType(liveMeeting.screenshareModel)

val body = ScreenshareRtmpBroadcastStartedEvtMsgBody(voiceConf, screenshareConf,
stream, vidWidth, vidHeight, timestamp, hasAudio)
stream, vidWidth, vidHeight, timestamp, hasAudio, contentType)
val event = ScreenshareRtmpBroadcastStartedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait ScreenshareRtmpBroadcastStartedVoiceConfEvtMsgHdlr {

def handle(msg: ScreenshareRtmpBroadcastStartedVoiceConfEvtMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def broadcastEvent(voiceConf: String, screenshareConf: String, stream: String, vidWidth: Int, vidHeight: Int,
timestamp: String, hasAudio: Boolean): BbbCommonEnvCoreMsg = {
timestamp: String, hasAudio: Boolean, contentType: String): BbbCommonEnvCoreMsg = {

val routing = Routing.addMsgToClientRouting(
MessageTypes.BROADCAST_TO_MEETING,
Expand All @@ -23,7 +23,7 @@ trait ScreenshareRtmpBroadcastStartedVoiceConfEvtMsgHdlr {
)

val body = ScreenshareRtmpBroadcastStartedEvtMsgBody(voiceConf, screenshareConf,
stream, vidWidth, vidHeight, timestamp, hasAudio)
stream, vidWidth, vidHeight, timestamp, hasAudio, contentType)
val event = ScreenshareRtmpBroadcastStartedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
Expand All @@ -45,12 +45,13 @@ trait ScreenshareRtmpBroadcastStartedVoiceConfEvtMsgHdlr {
ScreenshareModel.setScreenshareConf(liveMeeting.screenshareModel, msg.body.screenshareConf)
ScreenshareModel.setTimestamp(liveMeeting.screenshareModel, msg.body.timestamp)
ScreenshareModel.setHasAudio(liveMeeting.screenshareModel, msg.body.hasAudio)
ScreenshareModel.setContentType(liveMeeting.screenshareModel, msg.body.contentType)

log.info("START broadcast ALLOWED when isBroadcastingRTMP=false")

// Notify viewers in the meeting that there's an rtmp stream to view
val msgEvent = broadcastEvent(msg.body.voiceConf, msg.body.screenshareConf, msg.body.stream,
msg.body.vidWidth, msg.body.vidHeight, msg.body.timestamp, msg.body.hasAudio)
msg.body.vidWidth, msg.body.vidHeight, msg.body.timestamp, msg.body.hasAudio, msg.body.contentType)
bus.outGW.send(msgEvent)
} else {
log.info("START broadcast NOT ALLOWED when isBroadcastingRTMP=true")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ trait SyncGetScreenshareInfoRespMsgHdlr {
ScreenshareModel.getScreenshareVideoWidth(liveMeeting.screenshareModel),
ScreenshareModel.getScreenshareVideoHeight(liveMeeting.screenshareModel),
ScreenshareModel.getTimestamp(liveMeeting.screenshareModel),
ScreenshareModel.getHasAudio(liveMeeting.screenshareModel)
ScreenshareModel.getHasAudio(liveMeeting.screenshareModel),
ScreenshareModel.getContentType(liveMeeting.screenshareModel)
)
val event = SyncGetScreenshareInfoRespMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.bigbluebutton.core.apps.users

import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.models.Users2x
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting, OutMsgRouter }
import org.bigbluebutton.core.apps.{ PermissionCheck, RightsManagementTrait }

trait ClearAllUsersEmojiCmdMsgHdlr extends RightsManagementTrait {
this: BaseMeetingActor =>

val liveMeeting: LiveMeeting
val outGW: OutMsgRouter

def handleClearAllUsersEmojiCmdMsg(msg: ClearAllUsersEmojiCmdMsg) {
val isUserModerator = !permissionFailed(
PermissionCheck.MOD_LEVEL,
PermissionCheck.VIEWER_LEVEL,
liveMeeting.users2x,
msg.header.userId
)

if (isUserModerator) {
for {
user <- Users2x.findAll(liveMeeting.users2x)
if user.emoji.equals("raiseHand") || user.emoji.equals("away") || user.emoji.equals("notAway")
} yield {
Users2x.setEmojiStatus(liveMeeting.users2x, user.intId, "none")
}
sendClearedAllUsersEmojiEvtMsg(outGW, liveMeeting.props.meetingProp.intId, msg.header.userId)
} else {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission to clear users reactions."
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, outGW, liveMeeting)
}
}

def sendClearedAllUsersEmojiEvtMsg(outGW: OutMsgRouter, meetingId: String, userId: String): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(ClearedAllUsersEmojiEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(ClearedAllUsersEmojiEvtMsg.NAME, meetingId, userId)
val body = ClearedAllUsersEmojiEvtMsgBody()
val event = ClearedAllUsersEmojiEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.bigbluebutton.core.apps.users

import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.models.Users2x
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting, OutMsgRouter }
import org.bigbluebutton.core.apps.{ RightsManagementTrait }

trait UserReactionTimeExpiredCmdMsgHdlr extends RightsManagementTrait {
this: BaseMeetingActor =>

val liveMeeting: LiveMeeting

def handleUserReactionTimeExpiredCmdMsg(msg: UserReactionTimeExpiredCmdMsg) {
val isNodeUser = msg.header.userId.equals("nodeJSapp")

val currentEmojiState = Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId).get.emoji

if (isNodeUser && (!currentEmojiState.equals("raiseHand") && !currentEmojiState.equals("away") && !currentEmojiState.equals("notAway"))) {
Users2x.setEmojiStatus(liveMeeting.users2x, msg.body.userId, "none")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ trait UsersApp2x
with LockUserInMeetingCmdMsgHdlr
with LockUsersInMeetingCmdMsgHdlr
with GetLockSettingsReqMsgHdlr
with ChangeUserEmojiCmdMsgHdlr {
with ChangeUserEmojiCmdMsgHdlr
with ClearAllUsersEmojiCmdMsgHdlr
with UserReactionTimeExpiredCmdMsgHdlr {

this: MeetingActor =>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ case class PresentationInPod(
pages: scala.collection.immutable.Map[String, PresentationPage],
downloadable: Boolean,
removable: Boolean,
filenameConverted: String = "",
)

object PresentationPod {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ object RegisteredUsers {
u
}

def updateUserJoin(users: RegisteredUsers, user: RegisteredUser): RegisteredUser = {
val u = user.copy(joined = true)
def updateUserJoin(users: RegisteredUsers, user: RegisteredUser, joined: Boolean): RegisteredUser = {
val u = user.copy(joined = joined)
users.save(u)
u
}
Expand Down

0 comments on commit 06c0fab

Please sign in to comment.