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 defaultAllowModsToUnmuteUsers = false;
private boolean defaultAllowModsToEjectCameras = false; private boolean defaultAllowModsToEjectCameras = false;
private String defaultDisabledFeatures; private String defaultDisabledFeatures;
private String defaultPluginsManifests;
private boolean defaultNotifyRecordingIsOn = false; private boolean defaultNotifyRecordingIsOn = false;
private boolean defaultKeepEvents = false; private boolean defaultKeepEvents = false;
private Boolean useDefaultLogo; private Boolean useDefaultLogo;
@ -430,25 +431,23 @@ public class ParamsProcessorUtil {
return groups; return groups;
} }
private ArrayList<PluginsManifest> processPluginsManifestsParams(Map<String, String> params) { private ArrayList<PluginsManifest> processPluginsManifests(String pluginsManifestsParam) {
ArrayList<PluginsManifest> pluginsManifests = new ArrayList<PluginsManifest>(); 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);
if(pluginsManifestsJsonElement != null && pluginsManifestsJsonElement.isJsonArray()) { JsonElement pluginsManifestsJsonElement = new Gson().fromJson(pluginsManifestsParam, JsonElement.class);
JsonArray pluginsManifestsJson = pluginsManifestsJsonElement.getAsJsonArray();
for (JsonElement pluginsManifestJson : pluginsManifestsJson) { if(pluginsManifestsJsonElement != null && pluginsManifestsJsonElement.isJsonArray()) {
if(pluginsManifestJson.isJsonObject()) { JsonArray pluginsManifestsJson = pluginsManifestsJsonElement.getAsJsonArray();
JsonObject pluginsManifestJsonObj = pluginsManifestJson.getAsJsonObject(); for (JsonElement pluginsManifestJson : pluginsManifestsJson) {
if(pluginsManifestJsonObj.has("url")) { if(pluginsManifestJson.isJsonObject()) {
String url = pluginsManifestJsonObj.get("url").getAsString(); JsonObject pluginsManifestJsonObj = pluginsManifestJson.getAsJsonObject();
PluginsManifest newPlugin = new PluginsManifest(url); if(pluginsManifestJsonObj.has("url")) {
if(pluginsManifestJsonObj.has("checksum")) { String url = pluginsManifestJsonObj.get("url").getAsString();
newPlugin.setChecksum(pluginsManifestJsonObj.get("checksum").getAsString()); PluginsManifest newPlugin = new PluginsManifest(url);
} if(pluginsManifestJsonObj.has("checksum")) {
pluginsManifests.add(newPlugin); newPlugin.setChecksum(pluginsManifestJsonObj.get("checksum").getAsString());
} }
pluginsManifests.add(newPlugin);
} }
} }
} }
@ -565,9 +564,6 @@ public class ParamsProcessorUtil {
listOfDisabledFeatures.replaceAll(String::trim); listOfDisabledFeatures.replaceAll(String::trim);
listOfDisabledFeatures = new ArrayList<>(new HashSet<>(listOfDisabledFeatures)); 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) // 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<>(); ArrayList<String> listOfDisabledFeaturesExclude = new ArrayList<>();
if (!StringUtils.isEmpty(params.get(ApiParams.DISABLED_FEATURES_EXCLUDE))) { if (!StringUtils.isEmpty(params.get(ApiParams.DISABLED_FEATURES_EXCLUDE))) {
@ -578,6 +574,20 @@ public class ParamsProcessorUtil {
listOfDisabledFeatures.removeAll(Arrays.asList(disabledFeaturesExcludeParam.split(","))); 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 // Check if VirtualBackgrounds is disabled
if (!StringUtils.isEmpty(params.get(ApiParams.VIRTUAL_BACKGROUNDS_DISABLED))) { if (!StringUtils.isEmpty(params.get(ApiParams.VIRTUAL_BACKGROUNDS_DISABLED))) {
boolean virtualBackgroundsDisabled = Boolean.valueOf(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; this.defaultEndWhenNoModerator = val;
} }
public void setEndWhenNoModeratorDelayInMinutes(Integer value) { public void setEndWhenNoModeratorDelayInMinutes(Integer value) {
this.defaultEndWhenNoModeratorDelayInMinutes = value; this.defaultEndWhenNoModeratorDelayInMinutes = value;
} }
public void setDisabledFeatures(String disabledFeatures) { public void setDisabledFeatures(String disabledFeatures) {
this.defaultDisabledFeatures = disabledFeatures; this.defaultDisabledFeatures = disabledFeatures;
} }
public void setNotifyRecordingIsOn(Boolean notifyRecordingIsOn) { public void setPluginsManifests(String pluginsManifests) {
this.defaultNotifyRecordingIsOn = notifyRecordingIsOn; this.defaultPluginsManifests = pluginsManifests;
} }
public void setPresentationUploadExternalDescription(String presentationUploadExternalDescription) { public void setNotifyRecordingIsOn(Boolean notifyRecordingIsOn) {
this.defaultPresentationUploadExternalDescription = presentationUploadExternalDescription; this.defaultNotifyRecordingIsOn = notifyRecordingIsOn;
} }
public void setPresentationUploadExternalUrl(String presentationUploadExternalUrl) { public void setPresentationUploadExternalDescription(String presentationUploadExternalDescription) {
this.defaultPresentationUploadExternalUrl = presentationUploadExternalUrl; 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 : ""; this.bbbVersion = this.allowRevealOfBBBVersion ? version : "";
} }
public void setAllowRevealOfBBBVersion(Boolean allowVersion) { public void setAllowRevealOfBBBVersion(Boolean allowVersion) {
this.allowRevealOfBBBVersion = allowVersion; this.allowRevealOfBBBVersion = allowVersion;
} }
public void setAllowOverrideClientSettingsOnCreateCall(Boolean allowOverrideClientSettingsOnCreateCall) { public void setAllowOverrideClientSettingsOnCreateCall(Boolean allowOverrideClientSettingsOnCreateCall) {
this.allowOverrideClientSettingsOnCreateCall = allowOverrideClientSettingsOnCreateCall; this.allowOverrideClientSettingsOnCreateCall = allowOverrideClientSettingsOnCreateCall;
} }
} }

View File

@ -474,3 +474,7 @@ breakoutRoomsEnabled=true
# legacy, please use maxUserConcurrentAccesses instead # legacy, please use maxUserConcurrentAccesses instead
allowDuplicateExtUserid=true 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="defaultKeepEvents" value="${defaultKeepEvents}"/>
<property name="allowRevealOfBBBVersion" value="${allowRevealOfBBBVersion}"/> <property name="allowRevealOfBBBVersion" value="${allowRevealOfBBBVersion}"/>
<property name="allowOverrideClientSettingsOnCreateCall" value="${allowOverrideClientSettingsOnCreateCall}"/> <property name="allowOverrideClientSettingsOnCreateCall" value="${allowOverrideClientSettingsOnCreateCall}"/>
<property name="pluginsManifests" value="${pluginsManifests}"/>
</bean> </bean>
<bean id="presentationService" class="org.bigbluebutton.web.services.PresentationService"> <bean id="presentationService" class="org.bigbluebutton.web.services.PresentationService">