diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala index 965d43e9ea1a6398a57edc70820342d01b72acf0..cf079dc83c8b4ee48f7ceb960ba2cec983b2b7ed 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala @@ -17,6 +17,7 @@ class PresentationPodHdlrs(implicit val context: ActorContext) with PresentationConversionUpdatePubMsgHdlr with PresentationPageGeneratedPubMsgHdlr with PresentationPageCountErrorPubMsgHdlr + with PresentationUploadedFileTooLargeErrorPubMsgHdlr with PresentationUploadTokenReqMsgHdlr with ResizeAndMovePagePubMsgHdlr with SyncGetPresentationPodsMsgHdlr diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationUploadTokenReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationUploadTokenReqMsgHdlr.scala index 2894b415c990bb49c768f671cddec0c596905d24..9ced41b3234d0e23b89fab1a726724822f0797c8 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationUploadTokenReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationUploadTokenReqMsgHdlr.scala @@ -43,7 +43,7 @@ trait PresentationUploadTokenReqMsgHdlr extends RightsManagementTrait { val envelope = BbbCoreEnvelope(PresentationUploadTokenSysPubMsg.NAME, routing) val header = BbbClientMsgHeader(PresentationUploadTokenSysPubMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId) - val body = PresentationUploadTokenSysPubMsgBody(msg.body.podId, token, msg.body.filename) + val body = PresentationUploadTokenSysPubMsgBody(msg.body.podId, token, msg.body.filename, liveMeeting.props.meetingProp.intId) val event = PresentationUploadTokenSysPubMsg(header, body) val msgEvent = BbbCommonEnvCoreMsg(envelope, event) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationUploadedFileTooLargeErrorPubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationUploadedFileTooLargeErrorPubMsgHdlr.scala new file mode 100644 index 0000000000000000000000000000000000000000..54b2bf421b73a8f80a28bb43ac50257c9c97a4a1 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationUploadedFileTooLargeErrorPubMsgHdlr.scala @@ -0,0 +1,36 @@ +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.running.LiveMeeting + +trait PresentationUploadedFileTooLargeErrorPubMsgHdlr { + this: PresentationPodHdlrs => + + def handle( + msg: PresentationUploadedFileTooLargeErrorSysPubMsg, state: MeetingState2x, + liveMeeting: LiveMeeting, bus: MessageBus + ): MeetingState2x = { + + def broadcastEvent(msg: PresentationUploadedFileTooLargeErrorSysPubMsg): Unit = { + val routing = Routing.addMsgToClientRouting( + MessageTypes.BROADCAST_TO_MEETING, + liveMeeting.props.meetingProp.intId, msg.header.userId + ) + val envelope = BbbCoreEnvelope(PresentationUploadedFileTooLargeErrorEvtMsg.NAME, routing) + val header = BbbClientMsgHeader( + PresentationUploadedFileTooLargeErrorEvtMsg.NAME, + liveMeeting.props.meetingProp.intId, msg.header.userId + ) + + val body = PresentationUploadedFileTooLargeErrorEvtMsgBody(msg.body.podId, msg.body.messageKey, msg.body.code, msg.body.presentationName, msg.body.presentationToken, msg.body.fileSize, msg.body.maxFileSize) + val event = PresentationUploadedFileTooLargeErrorEvtMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + bus.outGW.send(msgEvent) + } + + broadcastEvent(msg) + state + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index fcb3dcf9251aa78d8738bec997a0ce7eb68d6504..fb9e3862dcb8b28ceaf5ea50fc7f21143df0ab20 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -234,6 +234,8 @@ class ReceivedJsonMsgHandlerActor( routeGenericMsg[GetAllPresentationPodsReqMsg](envelope, jsonNode) case PreuploadedPresentationsSysPubMsg.NAME => routeGenericMsg[PreuploadedPresentationsSysPubMsg](envelope, jsonNode) + case PresentationUploadedFileTooLargeErrorSysPubMsg.NAME => + routeGenericMsg[PresentationUploadedFileTooLargeErrorSysPubMsg](envelope, jsonNode) case PresentationConversionUpdateSysPubMsg.NAME => routeGenericMsg[PresentationConversionUpdateSysPubMsg](envelope, jsonNode) case PresentationPageCountErrorSysPubMsg.NAME => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index e72b3f4bf89556dcd2d7384e55987019809c15ce..cf707d2dd6d9961dc3252dd739eff608440feac1 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -411,49 +411,50 @@ class MeetingActor( case m: ChangeLockSettingsInMeetingCmdMsg => handleSetLockSettings(m) updateUserLastActivity(m.body.setBy) - case m: LockUserInMeetingCmdMsg => handleLockUserInMeetingCmdMsg(m) - case m: LockUsersInMeetingCmdMsg => handleLockUsersInMeetingCmdMsg(m) - case m: GetLockSettingsReqMsg => handleGetLockSettingsReqMsg(m) + case m: LockUserInMeetingCmdMsg => handleLockUserInMeetingCmdMsg(m) + case m: LockUsersInMeetingCmdMsg => handleLockUsersInMeetingCmdMsg(m) + case m: GetLockSettingsReqMsg => handleGetLockSettingsReqMsg(m) // Presentation - case m: PreuploadedPresentationsSysPubMsg => presentationApp2x.handle(m, liveMeeting, msgBus) - case m: AssignPresenterReqMsg => state = handlePresenterChange(m, state) + case m: PreuploadedPresentationsSysPubMsg => presentationApp2x.handle(m, liveMeeting, msgBus) + case m: AssignPresenterReqMsg => state = handlePresenterChange(m, state) // Presentation Pods - case m: CreateNewPresentationPodPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: RemovePresentationPodPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: GetAllPresentationPodsReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: SetCurrentPresentationPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: PresentationConversionCompletedSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: PdfConversionInvalidErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: SetCurrentPagePubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: SetPresenterInPodReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: RemovePresentationPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: SetPresentationDownloadablePubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: PresentationConversionUpdateSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: PresentationPageGeneratedSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: PresentationPageCountErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: PresentationUploadTokenReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: ResizeAndMovePagePubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: PresentationPageConvertedSysMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: PresentationPageConversionStartedSysMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) - case m: PresentationConversionEndedSysMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: CreateNewPresentationPodPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: RemovePresentationPodPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: GetAllPresentationPodsReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: SetCurrentPresentationPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationConversionCompletedSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PdfConversionInvalidErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: SetCurrentPagePubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: SetPresenterInPodReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: RemovePresentationPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: SetPresentationDownloadablePubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationConversionUpdateSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationUploadedFileTooLargeErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationPageGeneratedSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationPageCountErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationUploadTokenReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: ResizeAndMovePagePubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationPageConvertedSysMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationPageConversionStartedSysMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationConversionEndedSysMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) // Caption - case m: EditCaptionHistoryPubMsg => captionApp2x.handle(m, liveMeeting, msgBus) - case m: UpdateCaptionOwnerPubMsg => captionApp2x.handle(m, liveMeeting, msgBus) - case m: SendCaptionHistoryReqMsg => captionApp2x.handle(m, liveMeeting, msgBus) + case m: EditCaptionHistoryPubMsg => captionApp2x.handle(m, liveMeeting, msgBus) + case m: UpdateCaptionOwnerPubMsg => captionApp2x.handle(m, liveMeeting, msgBus) + case m: SendCaptionHistoryReqMsg => captionApp2x.handle(m, liveMeeting, msgBus) // Guests - case m: GetGuestsWaitingApprovalReqMsg => handleGetGuestsWaitingApprovalReqMsg(m) - case m: SetGuestPolicyCmdMsg => handleSetGuestPolicyMsg(m) - case m: SetGuestLobbyMessageCmdMsg => handleSetGuestLobbyMessageMsg(m) - case m: GuestsWaitingApprovedMsg => handleGuestsWaitingApprovedMsg(m) - case m: GuestWaitingLeftMsg => handleGuestWaitingLeftMsg(m) - case m: GetGuestPolicyReqMsg => handleGetGuestPolicyReqMsg(m) + case m: GetGuestsWaitingApprovalReqMsg => handleGetGuestsWaitingApprovalReqMsg(m) + case m: SetGuestPolicyCmdMsg => handleSetGuestPolicyMsg(m) + case m: SetGuestLobbyMessageCmdMsg => handleSetGuestLobbyMessageMsg(m) + case m: GuestsWaitingApprovedMsg => handleGuestsWaitingApprovedMsg(m) + case m: GuestWaitingLeftMsg => handleGuestWaitingLeftMsg(m) + case m: GetGuestPolicyReqMsg => handleGetGuestPolicyReqMsg(m) // Chat - case m: GetChatHistoryReqMsg => chatApp2x.handle(m, liveMeeting, msgBus) + case m: GetChatHistoryReqMsg => chatApp2x.handle(m, liveMeeting, msgBus) case m: SendPublicMessagePubMsg => chatApp2x.handle(m, liveMeeting, msgBus) updateUserLastActivity(m.body.message.fromUserId) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala index 608f9c2d8436ae3ba2dda5b9bece331c8dc5a9d5..7b7c1e4d819923370958efabce1fc074889c4b13 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala @@ -120,6 +120,8 @@ class AnalyticsActor extends Actor with ActorLogging { case m: PresentationConversionUpdateEvtMsgBody => logMessage(msg) case m: PresentationPageCountErrorSysPubMsg => logMessage(msg) case m: PresentationPageCountErrorEvtMsg => logMessage(msg) + case m: PresentationUploadedFileTooLargeErrorSysPubMsg => logMessage(msg) + case m: PresentationUploadedFileTooLargeErrorEvtMsg => logMessage(msg) // Group Chats case m: SendGroupChatMessageMsg => logMessage(msg) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala index 75623c81b32e7c7dbd0550a57031170602d82925..7c28a700410ccab4910db687100573303fc25043 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala @@ -147,6 +147,21 @@ case class PresentationConversionEndedSysMsgBody( presName: String ) +object PresentationUploadedFileTooLargeErrorSysPubMsg { val NAME = "PresentationUploadedFileTooLargeErrorSysPubMsg" } +case class PresentationUploadedFileTooLargeErrorSysPubMsg( + header: BbbClientMsgHeader, + body: PresentationUploadedFileTooLargeErrorSysPubMsgBody +) extends StandardMsg +case class PresentationUploadedFileTooLargeErrorSysPubMsgBody( + podId: String, + messageKey: String, + code: String, + presentationName: String, + presentationToken: String, + fileSize: Int, + maxFileSize: Int +) + // ------------ bbb-common-web to akka-apps ------------ // ------------ akka-apps to client ------------ @@ -198,6 +213,10 @@ case class PresentationPageConvertedEventMsgBody( page: PresentationPageVO ) +object PresentationUploadedFileTooLargeErrorEvtMsg { val NAME = "PresentationUploadedFileTooLargeErrorEvtMsg" } +case class PresentationUploadedFileTooLargeErrorEvtMsg(header: BbbClientMsgHeader, body: PresentationUploadedFileTooLargeErrorEvtMsgBody) extends BbbCoreMsg +case class PresentationUploadedFileTooLargeErrorEvtMsgBody(podId: String, messageKey: String, code: String, presentationName: String, presentationToken: String, fileSize: Int, maxFileSize: Int) + object PresentationConversionRequestReceivedEventMsg { val NAME = "PresentationConversionRequestReceivedEventMsg" } case class PresentationConversionRequestReceivedEventMsg( header: BbbClientMsgHeader, @@ -281,5 +300,5 @@ case class SyncGetPresentationPodsRespMsgBody(pods: Vector[PresentationPodVO]) // ------------ akka-apps to bbb-common-web ------------ object PresentationUploadTokenSysPubMsg { val NAME = "PresentationUploadTokenSysPubMsg" } case class PresentationUploadTokenSysPubMsg(header: BbbClientMsgHeader, body: PresentationUploadTokenSysPubMsgBody) extends BbbCoreMsg -case class PresentationUploadTokenSysPubMsgBody(podId: String, authzToken: String, filename: String) +case class PresentationUploadTokenSysPubMsgBody(podId: String, authzToken: String, filename: String, meetingId: String) // ------------ akka-apps to bbb-common-web ------------ diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java index bf495f2b8d73d04d6bd45735f47643bc5ed1536e..3adb52b1adfd46d0c6ae77186a3d2a43fb9898db 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java @@ -86,6 +86,7 @@ import org.bigbluebutton.api2.IBbbWebApiGWApp; import org.bigbluebutton.api2.domain.UploadedTrack; import org.bigbluebutton.common2.redis.RedisStorageService; import org.bigbluebutton.presentation.PresentationUrlDownloadService; +import org.bigbluebutton.presentation.imp.SwfSlidesGenerationProgressNotifier; import org.bigbluebutton.web.services.WaitingGuestCleanupTimerTask; import org.bigbluebutton.web.services.UserCleanupTimerTask; import org.bigbluebutton.web.services.EnteredUserCleanupTimerTask; @@ -120,6 +121,7 @@ public class MeetingService implements MessageListener { private RedisStorageService storeService; private CallbackUrlService callbackUrlService; private HTML5LoadBalancingService html5LoadBalancingService; + private SwfSlidesGenerationProgressNotifier notifier; private long usersTimeout; private long enteredUsersTimeout; @@ -314,6 +316,18 @@ public class MeetingService implements MessageListener { return valid; } + public PresentationUploadToken getPresentationUploadToken(String authzToken) { + if(uploadAuthzTokens.containsKey(authzToken)) { + return uploadAuthzTokens.get(authzToken); + } else { + return null; + } + } + + public void sendPresentationUploadMaxFilesizeMessage(PresentationUploadToken presUploadToken, int uploadedFileSize, int maxUploadFileSize) { + notifier.sendUploadFileTooLargeMessage(presUploadToken, uploadedFileSize, maxUploadFileSize); + } + private void removeUserSessions(String meetingId) { Iterator<Map.Entry<String, UserSession>> iterator = sessions.entrySet().iterator(); while (iterator.hasNext()) { @@ -1241,4 +1255,9 @@ public class MeetingService implements MessageListener { public void setEnteredUsersTimeout(long value) { enteredUsersTimeout = value; } + + public void setSwfSlidesGenerationProgressNotifier(SwfSlidesGenerationProgressNotifier notifier) { + this.notifier = notifier; + } + } diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/PresentationUploadToken.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/PresentationUploadToken.java index 02113e7f5d156ded66b9b4dbfc8897d1cf237f93..c88c291b4c2308007da2b92266f5a862870e5f6e 100644 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/PresentationUploadToken.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/PresentationUploadToken.java @@ -4,10 +4,12 @@ public class PresentationUploadToken implements IMessage { public final String podId; public final String authzToken; public final String filename; + public final String meetingId; - public PresentationUploadToken(String podId, String authzToken, String filename) { + public PresentationUploadToken(String podId, String authzToken, String filename, String meetingId) { this.podId = podId; this.authzToken = authzToken; this.filename = filename; + this.meetingId = meetingId; } } diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/ConversionMessageConstants.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/ConversionMessageConstants.java index 5c4618a982f42404332c4d6ea6c299c2969d0a3c..de348d4a708425a612a8abeae786e9c3ed6feeb8 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/ConversionMessageConstants.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/ConversionMessageConstants.java @@ -23,6 +23,7 @@ public class ConversionMessageConstants { public static final String OFFICE_DOC_CONVERSION_SUCCESS_KEY = "OFFICE_DOC_CONVERSION_SUCCESS"; public static final String OFFICE_DOC_CONVERSION_FAILED_KEY = "OFFICE_DOC_CONVERSION_FAILED"; public static final String OFFICE_DOC_CONVERSION_INVALID_KEY = "OFFICE_DOC_CONVERSION_INVALID"; + public static final String FILE_TOO_LARGE = "FILE_TOO_LARGE"; public static final String SUPPORTED_DOCUMENT_KEY = "SUPPORTED_DOCUMENT"; public static final String UNSUPPORTED_DOCUMENT_KEY = "UNSUPPORTED_DOCUMENT"; public static final String PAGE_COUNT_FAILED_KEY = "PAGE_COUNT_FAILED"; diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SwfSlidesGenerationProgressNotifier.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SwfSlidesGenerationProgressNotifier.java index 00206efb1286dbf7de620050efd59fd7dd888847..ad0852c0bb63f5bb3532dbae1bf47e52db92ecd0 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SwfSlidesGenerationProgressNotifier.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SwfSlidesGenerationProgressNotifier.java @@ -18,14 +18,12 @@ package org.bigbluebutton.presentation.imp; +import org.bigbluebutton.api.messaging.messages.PresentationUploadToken; import org.bigbluebutton.api2.IBbbWebApiGWApp; import org.bigbluebutton.presentation.ConversionMessageConstants; import org.bigbluebutton.presentation.GeneratedSlidesInfoHelper; import org.bigbluebutton.presentation.UploadedPresentation; -import org.bigbluebutton.presentation.messages.DocPageCompletedProgress; -import org.bigbluebutton.presentation.messages.DocPageGeneratedProgress; -import org.bigbluebutton.presentation.messages.IDocConversionMsg; -import org.bigbluebutton.presentation.messages.OfficeDocConversionProgress; +import org.bigbluebutton.presentation.messages.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,6 +39,17 @@ public class SwfSlidesGenerationProgressNotifier { messagingService.sendDocConversionMsg(msg); } + public void sendUploadFileTooLargeMessage(PresentationUploadToken pres, int uploadedFileSize, int maxUploadFileSize) { + UploadFileTooLargeMessage progress = new UploadFileTooLargeMessage( + pres.podId, + pres.meetingId, + pres.filename, + pres.authzToken, + ConversionMessageConstants.FILE_TOO_LARGE, + uploadedFileSize, + maxUploadFileSize); + messagingService.sendDocConversionMsg(progress); + } public void sendConversionUpdateMessage(int slidesCompleted, UploadedPresentation pres, int pageGenerated) { DocPageGeneratedProgress progress = new DocPageGeneratedProgress(pres.getPodId(), diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/UploadFileTooLargeMessage.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/UploadFileTooLargeMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..b6af2fd0ebcd868c7506eed2369933eb019de728 --- /dev/null +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/UploadFileTooLargeMessage.java @@ -0,0 +1,27 @@ +package org.bigbluebutton.presentation.messages; + +public class UploadFileTooLargeMessage implements IDocConversionMsg { + public final String podId; + public final String meetingId; + public final String filename; + public final String authzToken; + public final String key; + public final Integer uploadedFileSize; + public final Integer maxUploadFileSize; + + public UploadFileTooLargeMessage(String podId, + String meetingId, + String filename, + String authzToken, + String key, + Integer uploadedFileSize, + Integer maxUploadFileSize) { + this.podId = podId; + this.meetingId = meetingId; + this.filename = filename; + this.authzToken = authzToken; + this.key = key; + this.uploadedFileSize = uploadedFileSize; + this.maxUploadFileSize = maxUploadFileSize; + } +} diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala index 56056a58c345cd126451d3fd7e7382fdfc1da747..8d720d60dd83f27d36627600d62392ef6e0f5b97 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala @@ -312,6 +312,9 @@ class BbbWebApiGWApp( } else if (msg.isInstanceOf[DocPageConversionStarted]) { val event = MsgBuilder.buildPresentationPageConversionStartedSysMsg(msg.asInstanceOf[DocPageConversionStarted]) msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event)) + } else if (msg.isInstanceOf[UploadFileTooLargeMessage]) { + val event = MsgBuilder.buildPresentationUploadedFileTooLargeErrorSysMsg(msg.asInstanceOf[UploadFileTooLargeMessage]) + msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event)) } } diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala index 945cce0b8a443427eba81f60d574f5dadf52ca29..1c41d22ff1ee6d86e86ce6d737fab60c22ea9f48 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala @@ -280,4 +280,17 @@ object MsgBuilder { val req = DeletedRecordingSysMsg(header, body) BbbCommonEnvCoreMsg(envelope, req) } + + def buildPresentationUploadedFileTooLargeErrorSysMsg(msg: UploadFileTooLargeMessage): BbbCommonEnvCoreMsg = { + val routing = collection.immutable.HashMap("sender" -> "bbb-web") + val envelope = BbbCoreEnvelope(PresentationUploadedFileTooLargeErrorSysPubMsg.NAME, routing) + val header = BbbClientMsgHeader(PresentationUploadedFileTooLargeErrorSysPubMsg.NAME, msg.meetingId, msg.authzToken) + + val body = PresentationUploadedFileTooLargeErrorSysPubMsgBody(podId = msg.podId, messageKey = msg.key, + code = msg.key, presentationName = msg.filename, presentationToken = msg.authzToken, fileSize = msg.uploadedFileSize.intValue(), maxFileSize = msg.maxUploadFileSize) + + val req = PresentationUploadedFileTooLargeErrorSysPubMsg(header, body) + BbbCommonEnvCoreMsg(envelope, req) + } + } diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala index ac25f7610c30f77572dcbb1baec069bd9c3fe104..d42b2e82a70f4d7e9330ac9df3719e45c1da401b 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala @@ -159,7 +159,7 @@ class OldMeetingMsgHdlrActor(val olgMsgGW: OldMessageReceivedGW) } def handlePresentationUploadTokenSysPubMsg(msg: PresentationUploadTokenSysPubMsg): Unit = { - olgMsgGW.handle(new PresentationUploadToken(msg.body.podId, msg.body.authzToken, msg.body.filename)) + olgMsgGW.handle(new PresentationUploadToken(msg.body.podId, msg.body.authzToken, msg.body.filename, msg.body.meetingId)) } def handleGuestsWaitingApprovedEvtMsg(msg: GuestsWaitingApprovedEvtMsg): Unit = { diff --git a/bigbluebutton-web/bbb-web.nginx b/bigbluebutton-web/bbb-web.nginx index 57d34ebbe4e7270ace3b9eec34728a9ea7212b48..8bf440303c8a46207fb018debbe8279675a60e35 100755 --- a/bigbluebutton-web/bbb-web.nginx +++ b/bigbluebutton-web/bbb-web.nginx @@ -20,8 +20,8 @@ # Workaround IE refusal to set cookies in iframe add_header P3P 'CP="No P3P policy available"'; - # Allow 30M uploaded presentation document. - client_max_body_size 30m; + # high limit for presentation as bbb-web will reject upload if larger than configured + client_max_body_size 1000m; client_body_buffer_size 128k; proxy_connect_timeout 90; @@ -38,7 +38,10 @@ proxy_request_buffering off; # Send a sub-request to allow bbb-web to refuse before loading - auth_request /bigbluebutton/presentation/checkPresentation; + # If file is larger than configured bbb-web will return with code 403 and Header: x-file-too-large = 1 + auth_request /bigbluebutton/presentation/checkPresentation; + error_page 403 = @error403; + auth_request_set $file_too_large_header $upstream_http_x_file_too_large; } @@ -66,8 +69,8 @@ proxy_set_header Content-Length ""; proxy_set_header X-Original-Content-Length $http_content_length; - # Allow 30M uploaded presentation document. - client_max_body_size 30m; + # high limit for presentation as bbb-web will reject upload if larger than configured + client_max_body_size 1000m; client_body_buffer_size 128k; proxy_pass_request_body off; @@ -138,3 +141,11 @@ } } + + location @error403 { + if ($file_too_large_header = '1') { + return 413; + } + + return 403; + } diff --git a/bigbluebutton-web/grails-app/conf/spring/resources.xml b/bigbluebutton-web/grails-app/conf/spring/resources.xml index f0af4672950fb897892b2d2de4684a462cded25d..e8986bdc9144aeab605f094234edbf3f269e5888 100755 --- a/bigbluebutton-web/grails-app/conf/spring/resources.xml +++ b/bigbluebutton-web/grails-app/conf/spring/resources.xml @@ -56,6 +56,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <property name="callbackUrlService" ref="callbackUrlService"/> <property name="usersTimeout" value="${usersTimeout}"/> <property name="enteredUsersTimeout" value="${enteredUsersTimeout}"/> + <property name="swfSlidesGenerationProgressNotifier" ref="swfSlidesGenerationProgressNotifier"/> </bean> <bean id="oldMessageReceivedGW" class="org.bigbluebutton.api2.bus.OldMessageReceivedGW"> diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy index a65a6b3ce2fea87b2d33cea4bb30f1adbbd74f11..b2e82ce2c73c6a364e20bbe7f89df4bbf4474c02 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy @@ -19,6 +19,7 @@ package org.bigbluebutton.web.controllers import grails.converters.* +import org.bigbluebutton.api.messaging.messages.PresentationUploadToken import org.grails.web.mime.DefaultMimeUtility import org.bigbluebutton.api.ParamsProcessorUtil; @@ -62,8 +63,14 @@ class PresentationController { response.outputStream << 'upload-success'; } else { log.debug "NO SUCCESS \n" + + //Send upload error message + PresentationUploadToken presUploadToken = meetingService.getPresentationUploadToken(presentationToken); + meetingService.sendPresentationUploadMaxFilesizeMessage(presUploadToken, originalContentLength, maxUploadFileSize as int); + response.setStatus(404); response.addHeader("Cache-Control", "no-cache") + response.addHeader("x-file-too-large", "1") response.contentType = 'plain/text' response.outputStream << 'file-empty'; }