Add PresentationUploadToken to handleExportPresentationWithAnnotationReqMsg
This commit is contained in:
parent
5e6dd1b74f
commit
87f51b1ba4
@ -268,6 +268,8 @@ class ReceivedJsonMsgHandlerActor(
|
||||
routeGenericMsg[AssignPresenterReqMsg](envelope, jsonNode)
|
||||
case MakePresentationWithAnnotationDownloadReqMsg.NAME =>
|
||||
routeGenericMsg[MakePresentationWithAnnotationDownloadReqMsg](envelope, jsonNode)
|
||||
case ExportPresentationWithAnnotationReqMsg.NAME =>
|
||||
routeGenericMsg[ExportPresentationWithAnnotationReqMsg](envelope, jsonNode)
|
||||
|
||||
// Presentation Pods
|
||||
case CreateNewPresentationPodPubMsg.NAME =>
|
||||
|
@ -500,7 +500,7 @@ class MeetingActor(
|
||||
case m: PreuploadedPresentationsSysPubMsg => presentationApp2x.handle(m, liveMeeting, msgBus)
|
||||
case m: AssignPresenterReqMsg => state = handlePresenterChange(m, state)
|
||||
case m: MakePresentationWithAnnotationDownloadReqMsg => handleMakePresentationWithAnnotationDownloadReqMsg(m, state, liveMeeting)
|
||||
case m: ExportPresentationWithAnnotationReqMsg => handleExportPresentationWithAnnotationReqMsg(liveMeeting)
|
||||
case m: ExportPresentationWithAnnotationReqMsg => handleExportPresentationWithAnnotationReqMsg(m, state, liveMeeting)
|
||||
|
||||
// Presentation Pods
|
||||
case m: CreateNewPresentationPodPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
@ -739,14 +739,21 @@ class MeetingActor(
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
|
||||
def buildPresentationUploadTokenSysPubMsg(parentId: String, userId: String, presentationUploadToken: String, filename: String): BbbCommonEnvCoreMsg = {
|
||||
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
|
||||
val envelope = BbbCoreEnvelope(PresentationUploadTokenSysPubMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(PresentationUploadTokenSysPubMsg.NAME, parentId, userId)
|
||||
val body = PresentationUploadTokenSysPubMsgBody("DEFAULT_PRESENTATION_POD", presentationUploadToken, filename, parentId)
|
||||
val event = PresentationUploadTokenSysPubMsg(header, body)
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
|
||||
def handleMakePresentationWithAnnotationDownloadReqMsg(m: MakePresentationWithAnnotationDownloadReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting): Unit = {
|
||||
|
||||
val presId: String = m.body.presId // Whiteboard ID
|
||||
val allPages: Boolean = m.body.allPages // Whether or not all pages of the presentation should be exported
|
||||
val pages: List[Int] = m.body.pages // Desired presentation pages for export
|
||||
|
||||
var whiteboardId: String = getMeetingInfoPresentationDetails().id // TODO: use presId from message instead, remove this
|
||||
|
||||
// Determine page amount
|
||||
val presentationPods: Vector[PresentationPod] = state.presentationPodManager.getAllPresentationPodsInMeeting()
|
||||
val currentPres = presentationPods.flatMap(_.getCurrentPresentation()).head
|
||||
@ -756,10 +763,10 @@ class MeetingActor(
|
||||
|
||||
var storeAnnotationPages = new Array[PresentationPageForExport](pagesRange.size)
|
||||
var resultingPage = 0
|
||||
for (pageNumber <- pagesRange) {
|
||||
// whiteboardId = s"${presId}/${pageNumber.toString}" // TODO: use this
|
||||
whiteboardId = s"${getMeetingInfoPresentationDetails().id}/${pageNumber.toString}"
|
||||
|
||||
for (pageNumber <- pagesRange) {
|
||||
|
||||
var whiteboardId = s"${presId}/${pageNumber.toString}"
|
||||
val presentationPage: PresentationPage = currentPres.pages(whiteboardId)
|
||||
val xOffset: Double = presentationPage.xOffset
|
||||
val yOffset: Double = presentationPage.yOffset
|
||||
@ -767,7 +774,7 @@ class MeetingActor(
|
||||
val heightRatio: Double = presentationPage.heightRatio
|
||||
val whiteboardHistory: Array[AnnotationVO] = liveMeeting.wbModel.getHistory(whiteboardId)
|
||||
|
||||
storeAnnotationPages(resultingPage) = new PresentationPageForExport(resultingPage + 1, xOffset, yOffset, widthRatio, heightRatio, whiteboardHistory)
|
||||
storeAnnotationPages(resultingPage) = new PresentationPageForExport(pageNumber, xOffset, yOffset, widthRatio, heightRatio, whiteboardHistory)
|
||||
resultingPage += 1
|
||||
}
|
||||
|
||||
@ -784,13 +791,53 @@ class MeetingActor(
|
||||
outGW.send(job)
|
||||
}
|
||||
|
||||
def handleExportPresentationWithAnnotationReqMsg(liveMeeting: LiveMeeting): Unit = {
|
||||
val jobType = "PresentationWithAnnotationExportJob"
|
||||
def handleExportPresentationWithAnnotationReqMsg(m: ExportPresentationWithAnnotationReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting): Unit = {
|
||||
|
||||
// 1) Insert Export Job to Redis
|
||||
val userId = m.header.userId
|
||||
val presId: String = getMeetingInfoPresentationDetails.id
|
||||
val parentMeetingId: String = m.body.parentMeetingId
|
||||
val allPages: Boolean = m.body.allPages
|
||||
|
||||
// 2) Export Annotations to Redis
|
||||
val presentationPods: Vector[PresentationPod] = state.presentationPodManager.getAllPresentationPodsInMeeting()
|
||||
val currentPres = presentationPods.flatMap(_.getCurrentPresentation()).head
|
||||
val currentPage: PresentationPage = PresentationInPod.getCurrentPage(currentPres).get
|
||||
|
||||
val pageCount = currentPres.pages.size
|
||||
val pagesRange: List[Int] = if (allPages) (1 to pageCount).toList else List(currentPage.num)
|
||||
|
||||
var storeAnnotationPages = new Array[PresentationPageForExport](pagesRange.size)
|
||||
var resultingPage = 0
|
||||
|
||||
for (pageNumber <- pagesRange) {
|
||||
|
||||
var whiteboardId = s"${presId}/${pageNumber.toString}"
|
||||
val presentationPage: PresentationPage = currentPres.pages(whiteboardId)
|
||||
val xOffset: Double = presentationPage.xOffset
|
||||
val yOffset: Double = presentationPage.yOffset
|
||||
val widthRatio: Double = presentationPage.widthRatio
|
||||
val heightRatio: Double = presentationPage.heightRatio
|
||||
val whiteboardHistory: Array[AnnotationVO] = liveMeeting.wbModel.getHistory(whiteboardId)
|
||||
|
||||
storeAnnotationPages(resultingPage) = new PresentationPageForExport(pageNumber, xOffset, yOffset, widthRatio, heightRatio, whiteboardHistory)
|
||||
resultingPage += 1
|
||||
}
|
||||
|
||||
val presentationUploadToken: String = PresentationPodsApp.generateToken("DEFAULT_PRESENTATION_POD", userId)
|
||||
|
||||
// Informs bbb-web about the token so that when we use it to upload the presentation, it is able to look it up in the list of tokens
|
||||
outGW.send(buildPresentationUploadTokenSysPubMsg(parentMeetingId, userId, presentationUploadToken, currentPres.name))
|
||||
|
||||
// 1) Send Annotations to Redis
|
||||
var annotations = new StoredAnnotations(presId, storeAnnotationPages)
|
||||
outGW.send(buildStoreAnnotationsInRedisSysMsg(annotations))
|
||||
|
||||
// 2) Insert Export Job in Redis
|
||||
val jobId = RandomStringGenerator.randomAlphanumericString(16)
|
||||
val jobType: String = "PresentationWithAnnotationExportJob"
|
||||
val presLocation = s"/var/bigbluebutton/${presId}"
|
||||
val exportJob = new ExportJob(jobId, jobType, presId, presLocation, allPages, storeAnnotationPages, parentMeetingId, presentationUploadToken)
|
||||
var job = buildStoreExportJobInRedisSysMsg(exportJob)
|
||||
outGW.send(job)
|
||||
}
|
||||
|
||||
def handleDeskShareGetDeskShareInfoRequest(msg: DeskShareGetDeskShareInfoRequest): Unit = {
|
||||
|
@ -8,6 +8,7 @@ export default function makePresentationWithAnnotationDownloadReqMsg() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'MakePresentationWithAnnotationDownloadReqMsg';
|
||||
const SECOND_EVENT_NAME = 'ExportPresentationWithAnnotationReqMsg';
|
||||
|
||||
try {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
@ -16,11 +17,16 @@ export default function makePresentationWithAnnotationDownloadReqMsg() {
|
||||
check(requesterUserId, String);
|
||||
|
||||
const payload = {
|
||||
presId: "placeholder-val",
|
||||
presId: "placeholder-pres-id",
|
||||
allPages: true,
|
||||
pages: [],
|
||||
};
|
||||
|
||||
const payload2 = {
|
||||
parentMeetingId: "placeholder-parent-meeting-id",
|
||||
allPages: false,
|
||||
};
|
||||
|
||||
Logger.warn('************');
|
||||
Logger.warn(CHANNEL)
|
||||
Logger.warn(EVENT_NAME)
|
||||
@ -28,7 +34,9 @@ export default function makePresentationWithAnnotationDownloadReqMsg() {
|
||||
Logger.warn(requesterUserId)
|
||||
Logger.warn('************');
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, SECOND_EVENT_NAME, meetingId, requesterUserId, payload2);
|
||||
|
||||
// return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
} catch (err) {
|
||||
Logger.error(`Exception while invoking method makePresentationWithAnnotationDownloadReqMsg ${err.stack}`);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user