[issue-16734] - patch for error handling
This commit is contained in:
parent
9fb2c32384
commit
421717a817
@ -0,0 +1,43 @@
|
||||
package org.bigbluebutton.core.apps.presentationpod
|
||||
|
||||
import org.bigbluebutton.common2.msgs.{ BbbClientMsgHeader, BbbCommonEnvCoreMsg, BbbCoreEnvelope, MessageTypes, PresentationAreaDisabledErrorSysPubMsg, PresentationAreaDisabledErrorEvtMsg, PresentationAreaDisabledErrorEvtMsgBody, Routing }
|
||||
import org.bigbluebutton.core.bus.MessageBus
|
||||
import org.bigbluebutton.core.domain.MeetingState2x
|
||||
import org.bigbluebutton.core.running.LiveMeeting
|
||||
|
||||
trait PresentationAreaDisabledErrorPubMsgHdlr {
|
||||
|
||||
this: PresentationPodHdlrs =>
|
||||
|
||||
def handle(
|
||||
msg: PresentationAreaDisabledErrorSysPubMsg, state: MeetingState2x,
|
||||
liveMeeting: LiveMeeting, bus: MessageBus
|
||||
): MeetingState2x = {
|
||||
|
||||
def broadcastEvent(msg: PresentationAreaDisabledErrorSysPubMsg): Unit = {
|
||||
|
||||
val routing = Routing.addMsgToClientRouting(
|
||||
MessageTypes.BROADCAST_TO_MEETING,
|
||||
liveMeeting.props.meetingProp.intId, msg.header.userId
|
||||
)
|
||||
val envelope = BbbCoreEnvelope(PresentationAreaDisabledErrorEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(
|
||||
PresentationAreaDisabledErrorEvtMsg.NAME,
|
||||
liveMeeting.props.meetingProp.intId, msg.header.userId
|
||||
)
|
||||
|
||||
val body = PresentationAreaDisabledErrorEvtMsgBody(
|
||||
msg.body.meetingId,
|
||||
msg.body.presentationName, msg.body.temporaryPresentationId, msg.body.messageKey,
|
||||
msg.body.message
|
||||
)
|
||||
|
||||
val event = PresentationAreaDisabledErrorEvtMsg(header, body)
|
||||
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
|
||||
bus.outGW.send(msgEvent)
|
||||
}
|
||||
|
||||
broadcastEvent(msg)
|
||||
state
|
||||
}
|
||||
}
|
@ -27,7 +27,8 @@ class PresentationPodHdlrs(implicit val context: ActorContext)
|
||||
with PresentationPageConversionStartedSysMsgHdlr
|
||||
with PresentationConversionEndedSysMsgHdlr
|
||||
with PresentationUploadedFileTimeoutErrorPubMsgHdlr
|
||||
with PresentationHasInvalidMimeTypeErrorPubMsgHdlr {
|
||||
with PresentationHasInvalidMimeTypeErrorPubMsgHdlr
|
||||
with PresentationAreaDisabledErrorPubMsgHdlr {
|
||||
|
||||
val log = Logging(context.system, getClass)
|
||||
}
|
||||
|
@ -290,6 +290,8 @@ class ReceivedJsonMsgHandlerActor(
|
||||
routeGenericMsg[PresentationUploadedFileTooLargeErrorSysPubMsg](envelope, jsonNode)
|
||||
case PresentationHasInvalidMimeTypeErrorSysPubMsg.NAME =>
|
||||
routeGenericMsg[PresentationHasInvalidMimeTypeErrorSysPubMsg](envelope, jsonNode)
|
||||
case PresentationAreaDisabledErrorSysPubMsg.NAME =>
|
||||
routeGenericMsg[PresentationAreaDisabledErrorSysPubMsg](envelope, jsonNode)
|
||||
case PresentationUploadedFileTimeoutErrorSysPubMsg.NAME =>
|
||||
routeGenericMsg[PresentationUploadedFileTimeoutErrorSysPubMsg](envelope, jsonNode)
|
||||
case PresentationConversionUpdateSysPubMsg.NAME =>
|
||||
|
@ -523,6 +523,7 @@ class MeetingActor(
|
||||
case m: PresentationConversionUpdateSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: PresentationUploadedFileTooLargeErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: PresentationHasInvalidMimeTypeErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: PresentationAreaDisabledErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: PresentationUploadedFileTimeoutErrorSysPubMsg => 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)
|
||||
|
@ -183,6 +183,20 @@ case class PresentationHasInvalidMimeTypeErrorSysPubMsgBody(
|
||||
)
|
||||
|
||||
|
||||
object PresentationAreaDisabledErrorSysPubMsg { val NAME = "PresentationAreaDisabledErrorSysPubMsg" }
|
||||
case class PresentationAreaDisabledErrorSysPubMsg(
|
||||
header: BbbClientMsgHeader,
|
||||
body: PresentationAreaDisabledErrorSysPubMsgBody
|
||||
) extends StandardMsg
|
||||
case class PresentationAreaDisabledErrorSysPubMsgBody(
|
||||
meetingId: String,
|
||||
presentationName: String,
|
||||
temporaryPresentationId: String,
|
||||
messageKey: String,
|
||||
message: String,
|
||||
)
|
||||
|
||||
|
||||
object PresentationUploadedFileTimeoutErrorSysPubMsg { val NAME = "PresentationUploadedFileTimeoutErrorSysPubMsg" }
|
||||
case class PresentationUploadedFileTimeoutErrorSysPubMsg(
|
||||
header: BbbClientMsgHeader,
|
||||
@ -261,6 +275,13 @@ case class PresentationHasInvalidMimeTypeErrorEvtMsgBody(podId: String, meetingI
|
||||
messageKey: String, fileMime: String, fileExtension: String,
|
||||
)
|
||||
|
||||
object PresentationAreaDisabledErrorEvtMsg { val NAME = "PresentationAreaDisabledErrorEvtMsg" }
|
||||
case class PresentationAreaDisabledErrorEvtMsg(header: BbbClientMsgHeader, body: PresentationAreaDisabledErrorEvtMsgBody) extends BbbCoreMsg
|
||||
case class PresentationAreaDisabledErrorEvtMsgBody( meetingId: String, presentationName: String,
|
||||
temporaryPresentationId: String, messageKey: String,
|
||||
message: String,
|
||||
)
|
||||
|
||||
object PresentationUploadedFileTimeoutErrorEvtMsg { val NAME = "PresentationUploadedFileTimeoutErrorEvtMsg" }
|
||||
case class PresentationUploadedFileTimeoutErrorEvtMsg(header: BbbClientMsgHeader, body: PresentationUploadedFileTimeoutErrorEvtMsgBody) extends BbbCoreMsg
|
||||
case class PresentationUploadedFileTimeoutErrorEvtMsgBody(podId: String, meetingId: String, presentationName: String,
|
||||
|
@ -20,17 +20,8 @@ package org.bigbluebutton.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
@ -549,6 +540,11 @@ public class MeetingService implements MessageListener {
|
||||
return recordingService.isRecordingExist(recordId);
|
||||
}
|
||||
|
||||
public boolean isMeetingWithDisabledPresentationArea(String meetingId) {
|
||||
Meeting m = getMeeting(meetingId);
|
||||
return m.getDisabledFeatures().contains("presentationArea");
|
||||
}
|
||||
|
||||
public String getRecordings2x(List<String> idList, List<String> states, Map<String, String> metadataFilters, String offset, String limit) {
|
||||
Pageable pageable = null;
|
||||
int o = -1;
|
||||
|
@ -1063,11 +1063,6 @@ public class ParamsProcessorUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isMeetingWithDisabledPresentationArea() {
|
||||
ArrayList<String> listOfDisabledFeatures = new ArrayList(Arrays.asList(defaultDisabledFeatures.split(",")));
|
||||
return listOfDisabledFeatures.contains("presentationArea");
|
||||
}
|
||||
|
||||
public boolean isPostChecksumSame(String apiCall, Map<String, String[]> params) {
|
||||
if (StringUtils.isEmpty(securitySalt)) {
|
||||
log.warn("Security is disabled in this service. Make sure this is intentional.");
|
||||
|
@ -22,4 +22,6 @@ package org.bigbluebutton.presentation;
|
||||
public interface DocumentConversionService {
|
||||
void processDocument(UploadedPresentation pres);
|
||||
void sendDocConversionFailedOnMimeType(UploadedPresentation pres, String fileMime, String fileExtension);
|
||||
void sendDocConversionFailedOnDisabledPresentationArea(String temporaryPresentationId, String presFilename,
|
||||
String meetingId, String messageKey, String message);
|
||||
}
|
||||
|
@ -136,6 +136,12 @@ public class DocumentConversionServiceImp implements DocumentConversionService {
|
||||
notifier.sendInvalidMimeTypeMessage(pres, fileMime, fileExtension);
|
||||
}
|
||||
|
||||
public void sendDocConversionFailedOnDisabledPresentationArea(
|
||||
String temporaryPresentationId, String filename, String meetingId,
|
||||
String messageKey, String message) {
|
||||
notifier.sendPresentationAreaDisabledMessage(temporaryPresentationId, filename, meetingId, messageKey, message);
|
||||
}
|
||||
|
||||
private void sendDocConversionRequestReceived(UploadedPresentation pres) {
|
||||
if (! pres.isConversionStarted()) {
|
||||
Map<String, Object> logData = new HashMap<String, Object>();
|
||||
|
@ -64,6 +64,16 @@ public class SlidesGenerationProgressNotifier {
|
||||
);
|
||||
messagingService.sendDocConversionMsg(invalidMimeType);
|
||||
}
|
||||
public void sendPresentationAreaDisabledMessage(String temporaryPresentationId,
|
||||
String filename, String meetingId,
|
||||
String messageKey, String message) {
|
||||
PresentationAreaDisabled presentationAreaDisabled = new PresentationAreaDisabled(
|
||||
temporaryPresentationId,
|
||||
filename, meetingId,
|
||||
messageKey, message
|
||||
);
|
||||
messagingService.sendDocConversionMsg(presentationAreaDisabled);
|
||||
}
|
||||
public void sendUploadFileTimedout(UploadedPresentation pres, int page) {
|
||||
UploadFileTimedoutMessage errorMessage = new UploadFileTimedoutMessage(
|
||||
pres.getPodId(),
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.bigbluebutton.presentation.messages;
|
||||
|
||||
public class PresentationAreaDisabled implements IDocConversionMsg{
|
||||
|
||||
public final String meetingId;
|
||||
public final String temporaryPresentationId;
|
||||
public final String filename;
|
||||
public final String messageKey;
|
||||
public final String message;
|
||||
|
||||
public PresentationAreaDisabled( String temporaryPresentationId,
|
||||
String filename, String meetingId,
|
||||
String messageKey, String message) {
|
||||
this.meetingId = meetingId;
|
||||
this.temporaryPresentationId = temporaryPresentationId;
|
||||
this.filename = filename;
|
||||
this.message = message;
|
||||
this.messageKey = messageKey;
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -350,6 +350,9 @@ class BbbWebApiGWApp(
|
||||
} else if (msg.isInstanceOf[DocInvalidMimeType]) {
|
||||
val event = MsgBuilder.buildPresentationHasInvalidMimeType(msg.asInstanceOf[DocInvalidMimeType])
|
||||
msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event))
|
||||
} else if (msg.isInstanceOf[PresentationAreaDisabled]) {
|
||||
val event = MsgBuilder.buildPresentationAreaDisabled(msg.asInstanceOf[PresentationAreaDisabled])
|
||||
msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,6 +298,21 @@ object MsgBuilder {
|
||||
BbbCommonEnvCoreMsg(envelope, req)
|
||||
}
|
||||
|
||||
def buildPresentationAreaDisabled(msg: PresentationAreaDisabled): BbbCommonEnvCoreMsg = {
|
||||
val routing = collection.immutable.HashMap("sender" -> "bbb-web")
|
||||
val envelope = BbbCoreEnvelope(PresentationAreaDisabledErrorSysPubMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(PresentationAreaDisabledErrorSysPubMsg.NAME, msg.meetingId, "not-used")
|
||||
|
||||
val body = PresentationAreaDisabledErrorSysPubMsgBody(
|
||||
presentationName = msg.filename,
|
||||
temporaryPresentationId = msg.temporaryPresentationId, meetingId = msg.meetingId,
|
||||
messageKey = msg.messageKey, message = msg.message
|
||||
)
|
||||
|
||||
val req = PresentationAreaDisabledErrorSysPubMsg(header, body)
|
||||
BbbCommonEnvCoreMsg(envelope, req)
|
||||
}
|
||||
|
||||
def buildPresentationUploadedFileTimedoutErrorSysMsg(msg: UploadFileTimedoutMessage): BbbCommonEnvCoreMsg = {
|
||||
val routing = collection.immutable.HashMap("sender" -> "bbb-web")
|
||||
val envelope = BbbCoreEnvelope(PresentationUploadedFileTimeoutErrorSysPubMsg.NAME, routing)
|
||||
|
@ -12,6 +12,7 @@ RedisPubSub.on('PresentationPageGeneratedEvtMsg', handlePresentationConversionUp
|
||||
RedisPubSub.on('PresentationPageCountErrorEvtMsg', handlePresentationConversionUpdate);
|
||||
RedisPubSub.on('PresentationUploadedFileTimeoutErrorEvtMsg', handlePresentationConversionUpdate);
|
||||
RedisPubSub.on('PresentationHasInvalidMimeTypeErrorEvtMsg', handlePresentationConversionUpdate);
|
||||
RedisPubSub.on('PresentationAreaDisabledErrorEvtMsg', handlePresentationConversionUpdate);
|
||||
RedisPubSub.on('PresentationConversionUpdateEvtMsg', handlePresentationConversionUpdate);
|
||||
RedisPubSub.on('PresentationUploadedFileTooLargeErrorEvtMsg', handlePresentationConversionUpdate);
|
||||
RedisPubSub.on('PresentationConversionCompletedEvtMsg', handlePresentationAdded);
|
||||
|
@ -14,6 +14,7 @@ const GENERATED_SLIDE_KEY = 'GENERATED_SLIDE';
|
||||
const FILE_TOO_LARGE_KEY = 'FILE_TOO_LARGE';
|
||||
const CONVERSION_TIMEOUT_KEY = "CONVERSION_TIMEOUT";
|
||||
const IVALID_MIME_TYPE_KEY = "IVALID_MIME_TYPE";
|
||||
const PRESENTATION_AREA_DISABLED_KEY = "PRESENTATION_AREA_DISABLED";
|
||||
const NO_CONTENT = '204';
|
||||
// const GENERATING_THUMBNAIL_KEY = 'GENERATING_THUMBNAIL';
|
||||
// const GENERATED_THUMBNAIL_KEY = 'GENERATED_THUMBNAIL';
|
||||
@ -32,7 +33,7 @@ export default function handlePresentationConversionUpdate({ body }, meetingId)
|
||||
|
||||
check(meetingId, String);
|
||||
check(presentationId, Match.Maybe(String));
|
||||
check(podId, String);
|
||||
check(podId, Match.Maybe(String));
|
||||
check(status, String);
|
||||
check(temporaryPresentationId, Match.Maybe(String));
|
||||
|
||||
@ -56,6 +57,9 @@ export default function handlePresentationConversionUpdate({ body }, meetingId)
|
||||
statusModifier['conversion.error'] = true;
|
||||
statusModifier['conversion.fileMime'] = body.fileMime;
|
||||
statusModifier['conversion.fileExtension'] = body.fileExtension;
|
||||
case PRESENTATION_AREA_DISABLED_KEY:
|
||||
statusModifier['conversion.error'] = true;
|
||||
statusModifier['conversion.message'] = body.message;
|
||||
case OFFICE_DOC_CONVERSION_INVALID_KEY:
|
||||
case PAGE_COUNT_FAILED_KEY:
|
||||
case PAGE_COUNT_EXCEEDED_KEY:
|
||||
|
@ -61,6 +61,10 @@ const intlMessages = defineMessages({
|
||||
id: 'app.presentationUploder.conversion.invalidMimeType',
|
||||
description: 'warns user that the file\'s mime type is not supported or it doesn\'t match the extension',
|
||||
},
|
||||
PRESENTATION_AREA_DISABLED: {
|
||||
id: 'app.presentationUploder.conversion.presentationAreaDisabled',
|
||||
description: 'warns user that the presentation area is disabled and therefore nothing can be uploaded',
|
||||
},
|
||||
PAGE_COUNT_EXCEEDED: {
|
||||
id: 'app.presentationUploder.conversion.pageCountExceeded',
|
||||
description: 'warns the user that the conversion failed because of the page count',
|
||||
@ -159,6 +163,8 @@ function renderPresentationItemStatus(item, intl) {
|
||||
constraint['0'] = item.conversion.fileExtension;
|
||||
constraint['1'] = item.conversion.fileMime;
|
||||
break;
|
||||
case 'PRESENTATION_AREA_DISABLED':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -281,6 +281,7 @@
|
||||
"app.presentationUploder.conversion.generatingSvg": "Generating SVG images ...",
|
||||
"app.presentationUploder.conversion.pageCountExceeded": "Number of pages exceeded maximum of {0}",
|
||||
"app.presentationUploder.conversion.invalidMimeType": "Invalid format detected (extension={0}, content type={1})",
|
||||
"app.presentationUploder.conversion.presentationAreaDisabled": "Presentation area is disabled",
|
||||
"app.presentationUploder.conversion.conversionTimeout": "Slide {0} could not be processed within {1} attempts.",
|
||||
"app.presentationUploder.conversion.officeDocConversionInvalid": "Failed to process office document. Please upload a PDF instead.",
|
||||
"app.presentationUploder.conversion.officeDocConversionFailed": "Failed to process office document. Please upload a PDF instead.",
|
||||
|
@ -108,14 +108,6 @@ class PresentationController {
|
||||
return
|
||||
}
|
||||
|
||||
if (paramsProcessorUtil.isMeetingWithDisabledPresentationArea()) {
|
||||
log.error "This meeting has presentationArea as a disabledFeature, it is not possible to upload anything"
|
||||
response.addHeader("Cache-Control", "no-cache")
|
||||
response.contentType = 'plain/text'
|
||||
response.outputStream << 'presentation area in disabled features'
|
||||
return
|
||||
}
|
||||
|
||||
def meetingId = params.conference
|
||||
if (Util.isMeetingIdValidFormat(meetingId)) {
|
||||
def meeting = meetingService.getNotEndedMeetingWithId(meetingId)
|
||||
@ -168,6 +160,18 @@ class PresentationController {
|
||||
uploadFailed = true
|
||||
}
|
||||
|
||||
if (meetingService.isMeetingWithDisabledPresentationArea(meetingId)) {
|
||||
log.error "\n\n\n\n\n\n\nThis meeting has presentationArea as a disabledFeature, it is not possible to upload anything"
|
||||
presentationService.sendDocConversionFailedOnDisabledPresentationArea(
|
||||
temporaryPresentationId, presFilename, meetingId, "PRESENTATION_AREA_DISABLED",
|
||||
"Presentation area is disabled for this meeting"
|
||||
)
|
||||
response.addHeader("Cache-Control", "no-cache")
|
||||
response.contentType = 'plain/text'
|
||||
response.outputStream << 'presentation area in disabled features'
|
||||
return
|
||||
}
|
||||
|
||||
if (presFilename == "" || filenameExt == "") {
|
||||
log.debug("Upload failed. Invalid filename " + presOrigFilename)
|
||||
uploadFailReasons.add("invalid_filename")
|
||||
|
@ -96,6 +96,13 @@ class PresentationService {
|
||||
documentConversionService.sendDocConversionFailedOnMimeType(pres, fileMime, fileExtension)
|
||||
}
|
||||
|
||||
def sendDocConversionFailedOnDisabledPresentationArea(String temporaryPresentationId,
|
||||
String filename, String meetingId,
|
||||
String messageKey, String message) {
|
||||
documentConversionService.sendDocConversionFailedOnDisabledPresentationArea(
|
||||
temporaryPresentationId, filename, meetingId, messageKey, message)
|
||||
}
|
||||
|
||||
def showSvgImage(String conf, String room, String presentationName, String id) {
|
||||
new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar + "svgs" + File.separatorChar + "slide${id}.svg")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user