From 40c00f8739b45ffb581fc78b0fd99dd2365749b0 Mon Sep 17 00:00:00 2001 From: Gustavo Trott Date: Mon, 14 Oct 2024 14:37:32 -0300 Subject: [PATCH] Introduces a config `pluginsManifests` to bigbluebutton.properties. e.g pluginsManifests=[{url: "https://plugin_manifest.json"}] it will be merged with the parameters received through /create?pluginsManifests= --- .../api/ParamsProcessorUtil.java | 98 +++++++++++-------- .../grails-app/conf/bigbluebutton.properties | 4 + .../grails-app/conf/spring/resources.xml | 1 + 3 files changed, 61 insertions(+), 42 deletions(-) diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java index aa663b8358..848eb06743 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java @@ -102,6 +102,7 @@ public class ParamsProcessorUtil { private boolean defaultAllowModsToUnmuteUsers = false; private boolean defaultAllowModsToEjectCameras = false; private String defaultDisabledFeatures; + private String defaultPluginsManifests; private boolean defaultNotifyRecordingIsOn = false; private boolean defaultKeepEvents = false; private Boolean useDefaultLogo; @@ -430,25 +431,23 @@ public class ParamsProcessorUtil { return groups; } - private ArrayList processPluginsManifestsParams(Map params) { + private ArrayList processPluginsManifests(String pluginsManifestsParam) { ArrayList pluginsManifests = new ArrayList(); - String pluginsManifestParams = params.get(ApiParams.PLUGINS_MANIFESTS); - if (!StringUtils.isEmpty(pluginsManifestParams)) { - JsonElement pluginsManifestsJsonElement = new Gson().fromJson(pluginsManifestParams, JsonElement.class); - if(pluginsManifestsJsonElement != null && pluginsManifestsJsonElement.isJsonArray()) { - JsonArray pluginsManifestsJson = pluginsManifestsJsonElement.getAsJsonArray(); - for (JsonElement pluginsManifestJson : pluginsManifestsJson) { - if(pluginsManifestJson.isJsonObject()) { - JsonObject pluginsManifestJsonObj = pluginsManifestJson.getAsJsonObject(); - if(pluginsManifestJsonObj.has("url")) { - String url = pluginsManifestJsonObj.get("url").getAsString(); - PluginsManifest newPlugin = new PluginsManifest(url); - if(pluginsManifestJsonObj.has("checksum")) { - newPlugin.setChecksum(pluginsManifestJsonObj.get("checksum").getAsString()); - } - pluginsManifests.add(newPlugin); + JsonElement pluginsManifestsJsonElement = new Gson().fromJson(pluginsManifestsParam, JsonElement.class); + + if(pluginsManifestsJsonElement != null && pluginsManifestsJsonElement.isJsonArray()) { + JsonArray pluginsManifestsJson = pluginsManifestsJsonElement.getAsJsonArray(); + for (JsonElement pluginsManifestJson : pluginsManifestsJson) { + if(pluginsManifestJson.isJsonObject()) { + JsonObject pluginsManifestJsonObj = pluginsManifestJson.getAsJsonObject(); + if(pluginsManifestJsonObj.has("url")) { + String url = pluginsManifestJsonObj.get("url").getAsString(); + PluginsManifest newPlugin = new PluginsManifest(url); + if(pluginsManifestJsonObj.has("checksum")) { + newPlugin.setChecksum(pluginsManifestJsonObj.get("checksum").getAsString()); } + pluginsManifests.add(newPlugin); } } } @@ -565,9 +564,6 @@ public class ParamsProcessorUtil { listOfDisabledFeatures.replaceAll(String::trim); listOfDisabledFeatures = new ArrayList<>(new HashSet<>(listOfDisabledFeatures)); - // Process Plugin Manifest Urls - ArrayList listOfPluginsManifests = processPluginsManifestsParams(params); - // Check Disabled Features Exclude list -- passed as a CREATE parameter to cancel the disabling (typically from bbb-web's properties file) ArrayList listOfDisabledFeaturesExclude = new ArrayList<>(); if (!StringUtils.isEmpty(params.get(ApiParams.DISABLED_FEATURES_EXCLUDE))) { @@ -578,6 +574,20 @@ public class ParamsProcessorUtil { listOfDisabledFeatures.removeAll(Arrays.asList(disabledFeaturesExcludeParam.split(","))); } + // Parse Plugins Manifests from config and param + ArrayList listOfPluginsManifests = new ArrayList(); + //Process plugins from config + if(defaultPluginsManifests != null && !defaultPluginsManifests.isEmpty()) { + ArrayList pluginsManifestsFromConfig = processPluginsManifests(defaultPluginsManifests); + listOfPluginsManifests.addAll(pluginsManifestsFromConfig); + } + //Process plugins from /create param + String pluginsManifestsParam = params.get(ApiParams.PLUGINS_MANIFESTS); + if (!StringUtils.isEmpty(pluginsManifestsParam)) { + ArrayList pluginsManifestsFromParam = processPluginsManifests(pluginsManifestsParam); + listOfPluginsManifests.addAll(pluginsManifestsFromParam); + } + // Check if VirtualBackgrounds is disabled if (!StringUtils.isEmpty(params.get(ApiParams.VIRTUAL_BACKGROUNDS_DISABLED))) { boolean virtualBackgroundsDisabled = Boolean.valueOf(params.get(ApiParams.VIRTUAL_BACKGROUNDS_DISABLED)); @@ -1603,36 +1613,40 @@ public class ParamsProcessorUtil { this.defaultEndWhenNoModerator = val; } - public void setEndWhenNoModeratorDelayInMinutes(Integer value) { - this.defaultEndWhenNoModeratorDelayInMinutes = value; - } + public void setEndWhenNoModeratorDelayInMinutes(Integer value) { + this.defaultEndWhenNoModeratorDelayInMinutes = value; + } - public void setDisabledFeatures(String disabledFeatures) { - this.defaultDisabledFeatures = disabledFeatures; - } + public void setDisabledFeatures(String disabledFeatures) { + this.defaultDisabledFeatures = disabledFeatures; + } - public void setNotifyRecordingIsOn(Boolean notifyRecordingIsOn) { - this.defaultNotifyRecordingIsOn = notifyRecordingIsOn; - } + public void setPluginsManifests(String pluginsManifests) { + this.defaultPluginsManifests = pluginsManifests; + } - public void setPresentationUploadExternalDescription(String presentationUploadExternalDescription) { - this.defaultPresentationUploadExternalDescription = presentationUploadExternalDescription; - } + public void setNotifyRecordingIsOn(Boolean notifyRecordingIsOn) { + this.defaultNotifyRecordingIsOn = notifyRecordingIsOn; + } - public void setPresentationUploadExternalUrl(String presentationUploadExternalUrl) { - this.defaultPresentationUploadExternalUrl = presentationUploadExternalUrl; - } + public void setPresentationUploadExternalDescription(String presentationUploadExternalDescription) { + this.defaultPresentationUploadExternalDescription = presentationUploadExternalDescription; + } - public void setBbbVersion(String version) { + public void setPresentationUploadExternalUrl(String presentationUploadExternalUrl) { + this.defaultPresentationUploadExternalUrl = presentationUploadExternalUrl; + } + + public void setBbbVersion(String version) { this.bbbVersion = this.allowRevealOfBBBVersion ? version : ""; - } + } - public void setAllowRevealOfBBBVersion(Boolean allowVersion) { - this.allowRevealOfBBBVersion = allowVersion; - } + public void setAllowRevealOfBBBVersion(Boolean allowVersion) { + this.allowRevealOfBBBVersion = allowVersion; + } - public void setAllowOverrideClientSettingsOnCreateCall(Boolean allowOverrideClientSettingsOnCreateCall) { - this.allowOverrideClientSettingsOnCreateCall = allowOverrideClientSettingsOnCreateCall; - } + public void setAllowOverrideClientSettingsOnCreateCall(Boolean allowOverrideClientSettingsOnCreateCall) { + this.allowOverrideClientSettingsOnCreateCall = allowOverrideClientSettingsOnCreateCall; + } } diff --git a/bigbluebutton-web/grails-app/conf/bigbluebutton.properties b/bigbluebutton-web/grails-app/conf/bigbluebutton.properties index c66a5c181a..e08f124865 100644 --- a/bigbluebutton-web/grails-app/conf/bigbluebutton.properties +++ b/bigbluebutton-web/grails-app/conf/bigbluebutton.properties @@ -474,3 +474,7 @@ breakoutRoomsEnabled=true # legacy, please use maxUserConcurrentAccesses instead allowDuplicateExtUserid=true + +# list of plugins manifests (json array) +# e.g: [{url: "https://plugin_manifest.json"}] +pluginsManifests= diff --git a/bigbluebutton-web/grails-app/conf/spring/resources.xml b/bigbluebutton-web/grails-app/conf/spring/resources.xml index f16003fe1b..e20befdf55 100755 --- a/bigbluebutton-web/grails-app/conf/spring/resources.xml +++ b/bigbluebutton-web/grails-app/conf/spring/resources.xml @@ -201,6 +201,7 @@ with BigBlueButton; if not, see . +