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=
This commit is contained in:
Gustavo Trott 2024-10-14 14:37:32 -03:00
parent f3c03fbc44
commit 40c00f8739
3 changed files with 61 additions and 42 deletions

View File

@ -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,11 +431,10 @@ public class ParamsProcessorUtil {
return groups;
}
private ArrayList<PluginsManifest> processPluginsManifestsParams(Map<String, String> params) {
private ArrayList<PluginsManifest> processPluginsManifests(String pluginsManifestsParam) {
ArrayList<PluginsManifest> pluginsManifests = new ArrayList<PluginsManifest>();
String pluginsManifestParams = params.get(ApiParams.PLUGINS_MANIFESTS);
if (!StringUtils.isEmpty(pluginsManifestParams)) {
JsonElement pluginsManifestsJsonElement = new Gson().fromJson(pluginsManifestParams, JsonElement.class);
JsonElement pluginsManifestsJsonElement = new Gson().fromJson(pluginsManifestsParam, JsonElement.class);
if(pluginsManifestsJsonElement != null && pluginsManifestsJsonElement.isJsonArray()) {
JsonArray pluginsManifestsJson = pluginsManifestsJsonElement.getAsJsonArray();
@ -452,7 +452,6 @@ public class ParamsProcessorUtil {
}
}
}
}
return pluginsManifests;
}
@ -565,9 +564,6 @@ public class ParamsProcessorUtil {
listOfDisabledFeatures.replaceAll(String::trim);
listOfDisabledFeatures = new ArrayList<>(new HashSet<>(listOfDisabledFeatures));
// Process Plugin Manifest Urls
ArrayList<PluginsManifest> 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<String> 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<PluginsManifest> listOfPluginsManifests = new ArrayList<PluginsManifest>();
//Process plugins from config
if(defaultPluginsManifests != null && !defaultPluginsManifests.isEmpty()) {
ArrayList<PluginsManifest> pluginsManifestsFromConfig = processPluginsManifests(defaultPluginsManifests);
listOfPluginsManifests.addAll(pluginsManifestsFromConfig);
}
//Process plugins from /create param
String pluginsManifestsParam = params.get(ApiParams.PLUGINS_MANIFESTS);
if (!StringUtils.isEmpty(pluginsManifestsParam)) {
ArrayList<PluginsManifest> 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));
@ -1611,6 +1621,10 @@ public class ParamsProcessorUtil {
this.defaultDisabledFeatures = disabledFeatures;
}
public void setPluginsManifests(String pluginsManifests) {
this.defaultPluginsManifests = pluginsManifests;
}
public void setNotifyRecordingIsOn(Boolean notifyRecordingIsOn) {
this.defaultNotifyRecordingIsOn = notifyRecordingIsOn;
}

View File

@ -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=

View File

@ -201,6 +201,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<property name="defaultKeepEvents" value="${defaultKeepEvents}"/>
<property name="allowRevealOfBBBVersion" value="${allowRevealOfBBBVersion}"/>
<property name="allowOverrideClientSettingsOnCreateCall" value="${allowOverrideClientSettingsOnCreateCall}"/>
<property name="pluginsManifests" value="${pluginsManifests}"/>
</bean>
<bean id="presentationService" class="org.bigbluebutton.web.services.PresentationService">