Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for default presentations #965

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/controllers/bigbluebutton_api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ def create
# Read the body if POST
body = request.post? ? request.body.read : ''

# Override body with default presentations if empty
body = generate_default_presentations unless body != ''

# Send a GET/POST request to the server
response = get_post_req(uri, body, **bbb_req_timeout(server))
rescue BBBError
Expand Down
16 changes: 16 additions & 0 deletions app/controllers/concerns/api_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,19 @@ def add_additional_params(action, bbb_params)
final_params
end
end

def generate_default_presentations
return '' if Rails.configuration.x.default_presentations.empty?
doc = Nokogiri::XML('<modules></modules>')
module_pres = Nokogiri::XML::Node.new("module", doc)
module_pres['name'] = "presentation"

Rails.configuration.x.default_presentations.each { |x|
document = Nokogiri::XML::Node.new("document", doc)
document['url'] = x[0]
document['filename'] = x[1]
module_pres << document
}
doc.root << module_pres
doc.to_xml
end
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ class Application < Rails::Application

config.i18n.default_locale = ENV.fetch('DEFAULT_LOCALE', 'en')

config.x.default_presentations = ENV.fetch('DEFAULT_PRESENTATIONS', '').split(",").collect { |x| x.split('->') }

# Comma separated list of create params that can be overridden by the client
config.x.default_create_params = ENV.fetch('DEFAULT_CREATE_PARAMS', '')
.split(',').to_h { |param| param.split('=', 2) }.symbolize_keys
Expand Down
1 change: 1 addition & 0 deletions docs/configuration-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ These variables are used by the service startup scripts in the Docker images, bu
* `OVERRIDE_CREATE_PARAMS`: Sets a list of params on the create call that CANNOT be overridden by the client/requester. Should be in the format 'OVERRIDE_CREATE_PARAMS=param1=param1value,param2=param2value'
* `DEFAULT_JOIN_PARAMS`: Sets a list of default params on the join call that CAN be overridden by the client/requester. Should be in the format 'DEFAULT_JOIN_PARAMS=param1=param1value,param2=param2value'
* `OVERRIDE_JOIN_PARAMS`: Sets a list of params on the create call that CANNOT be overridden by the client/requester. Should be in the format 'OVERRIDE_JOIN_PARAMS=param1=param1value,param2=param2value'
* `DEFAULT_PRESENTATIONS`: Sets a list of default presentations on the create call. Will only trigger when a GET-request is used, otherwise the supplied body will be used. Should be in the format 'DEFAULT_PRESENTATIONS=http://presurl->presname.pdf,http://presurl2->presname2.pdf'
* `GET_RECORDINGS_API_FILTERED`: Prevent get_recordings api from returning all recordings when recordID is not specified in the request, by setting value to 'true'. Defaults to false.
* `PREPARED_STATEMENT`: Enable/Disable Active Record prepared statements feature, can be disabled by setting the value as `false`. Defaults to `true`.
* `DB_CONNECTION_RETRY_COUNT`: The number of times db connection retries will be attempted, in case of a db connection failure. Defaults to `3`.
Expand Down