From 582ab30eb0c4acc499b4edb00035db277487c01f Mon Sep 17 00:00:00 2001 From: jfederico Date: Mon, 14 Aug 2017 20:23:54 +0000 Subject: [PATCH 01/11] Updated ruby version and some gems --- Gemfile | 2 +- Gemfile.lock | 239 +++++++++++++++++++++++++++++---------------------- 2 files changed, 135 insertions(+), 106 deletions(-) diff --git a/Gemfile b/Gemfile index fbdeab91..284d025d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '2.3.4' +ruby '2.4.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' diff --git a/Gemfile.lock b/Gemfile.lock index 6779b2fa..953d4701 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,39 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.0.0.1) - actionpack (= 5.0.0.1) - nio4r (~> 1.2) + actioncable (5.0.5) + actionpack (= 5.0.5) + nio4r (>= 1.2, < 3.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.0.1) - actionpack (= 5.0.0.1) - actionview (= 5.0.0.1) - activejob (= 5.0.0.1) + actionmailer (5.0.5) + actionpack (= 5.0.5) + actionview (= 5.0.5) + activejob (= 5.0.5) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.0.1) - actionview (= 5.0.0.1) - activesupport (= 5.0.0.1) + actionpack (5.0.5) + actionview (= 5.0.5) + activesupport (= 5.0.5) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.0.1) - activesupport (= 5.0.0.1) + actionview (5.0.5) + activesupport (= 5.0.5) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.0.1) - activesupport (= 5.0.0.1) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.0.5) + activesupport (= 5.0.5) globalid (>= 0.3.6) - activemodel (5.0.0.1) - activesupport (= 5.0.0.1) - activerecord (5.0.0.1) - activemodel (= 5.0.0.1) - activesupport (= 5.0.0.1) + activemodel (5.0.5) + activesupport (= 5.0.5) + activerecord (5.0.5) + activemodel (= 5.0.5) + activesupport (= 5.0.5) arel (~> 7.0) - activesupport (5.0.0.1) + activesupport (5.0.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -41,67 +41,73 @@ GEM arel (7.1.4) bigbluebutton-api-ruby (1.6.0) xml-simple (~> 1.1) + bindex (0.5.0) bootstrap-sass (3.3.0.0) sass (~> 3.2) bootstrap-social-rails (4.12.0) railties (>= 3.1) - builder (3.2.2) + builder (3.2.3) byebug (9.0.6) - climate_control (0.1.0) + climate_control (0.2.0) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) - coffee-rails (4.2.1) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.2.x) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) - concurrent-ruby (1.0.2) - debug_inspector (0.0.2) + coffee-script-source (1.12.2) + concurrent-ruby (1.0.5) + concurrent-ruby (1.0.5-java) docile (1.1.5) - dotenv (2.1.1) - dotenv-rails (2.1.1) - dotenv (= 2.1.1) - railties (>= 4.0, < 5.1) + dotenv (2.2.1) + dotenv-rails (2.2.1) + dotenv (= 2.2.1) + railties (>= 3.2, < 5.2) erubis (2.7.0) execjs (2.7.0) - faraday (0.9.2) + faraday (0.12.2) multipart-post (>= 1.2, < 3) - ffi (1.9.14) + ffi (1.9.18) + ffi (1.9.18-java) + ffi (1.9.18-x64-mingw32) + ffi (1.9.18-x86-mingw32) font-awesome-sass (4.7.0) sass (>= 3.2) - globalid (0.3.7) - activesupport (>= 4.1.0) - hashie (3.4.4) - http_accept_language (2.1.0) - i18n (0.7.0) - jbuilder (2.6.0) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) + globalid (0.4.0) + activesupport (>= 4.2.0) + hashie (3.5.6) + http_accept_language (2.1.1) + i18n (0.8.6) + jbuilder (2.7.0) + activesupport (>= 4.2.0) + multi_json (>= 1.2) jquery-datatables-rails (3.4.0) actionpack (>= 3.1) jquery-rails railties (>= 3.1) sass-rails - jquery-rails (4.2.1) + jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jquery-ui-rails (5.0.5) + jquery-ui-rails (6.0.1) railties (>= 3.2.16) - json (1.8.3) - jwt (1.5.4) + json (1.8.6) + json (1.8.6-java) + jwt (1.5.6) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - lograge (0.4.1) - actionpack (>= 4, < 5.1) - activesupport (>= 4, < 5.1) - railties (>= 4, < 5.1) + lograge (0.6.0) + actionpack (>= 4, < 5.2) + activesupport (>= 4, < 5.2) + railties (>= 4, < 5.2) + request_store (~> 1.0) loofah (2.0.3) nokogiri (>= 1.5.9) - mail (2.6.4) + mail (2.6.6) mime-types (>= 1.16, < 4) metaclass (0.0.4) method_source (0.8.2) @@ -109,20 +115,26 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mimemagic (0.3.0) - mini_portile2 (2.1.0) - minitest (5.9.1) + mini_portile2 (2.2.0) + minitest (5.10.3) mocha (1.2.1) metaclass (~> 0.0.1) multi_json (1.12.1) - multi_xml (0.5.5) + multi_xml (0.6.0) multipart-post (2.0.0) net-ldap (0.16.0) - nio4r (1.2.1) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) - oauth (0.5.1) - oauth2 (1.2.0) - faraday (>= 0.8, < 0.10) + nio4r (2.1.0) + nio4r (2.1.0-java) + nokogiri (1.8.0) + mini_portile2 (~> 2.2.0) + nokogiri (1.8.0-java) + nokogiri (1.8.0-x64-mingw32) + mini_portile2 (~> 2.2.0) + nokogiri (1.8.0-x86-mingw32) + mini_portile2 (~> 2.2.0) + oauth (0.5.3) + oauth2 (1.4.0) + faraday (>= 0.8, < 0.13) jwt (~> 1.0) multi_json (~> 1.3) multi_xml (~> 0.5) @@ -155,85 +167,101 @@ GEM cocaine (~> 0.5.5) mime-types mimemagic (= 0.3.0) - pg (0.19.0) - puma (3.6.0) + pg (0.21.0) + pg (0.21.0-x64-mingw32) + pg (0.21.0-x86-mingw32) + puma (3.9.1) + puma (3.9.1-java) pyu-ruby-sasl (0.0.3.3) - rack (2.0.1) + rack (2.0.3) rack-test (0.6.3) rack (>= 1.0) - rails (5.0.0.1) - actioncable (= 5.0.0.1) - actionmailer (= 5.0.0.1) - actionpack (= 5.0.0.1) - actionview (= 5.0.0.1) - activejob (= 5.0.0.1) - activemodel (= 5.0.0.1) - activerecord (= 5.0.0.1) - activesupport (= 5.0.0.1) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.0.1) + rails (5.0.5) + actioncable (= 5.0.5) + actionmailer (= 5.0.5) + actionpack (= 5.0.5) + actionview (= 5.0.5) + activejob (= 5.0.5) + activemodel (= 5.0.5) + activerecord (= 5.0.5) + activesupport (= 5.0.5) + bundler (>= 1.3.0) + railties (= 5.0.5) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.1) - activesupport (>= 4.2.0, < 6.0) - nokogiri (~> 1.6.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - rails-timeago (2.15.0) + rails-timeago (2.16.0) actionpack (>= 3.1) activesupport (>= 3.1) - railties (5.0.0.1) - actionpack (= 5.0.0.1) - activesupport (= 5.0.0.1) + railties (5.0.5) + actionpack (= 5.0.5) + activesupport (= 5.0.5) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (11.3.0) - rb-fsevent (0.9.7) - rb-inotify (0.9.7) - ffi (>= 0.5.0) + rake (12.0.0) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + request_store (1.3.2) rubyntlm (0.3.4) - sass (3.4.22) + sass (3.5.1) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - simplecov (0.13.0) + simplecov (0.15.0) docile (~> 1.1.0) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) - simplecov-html (0.10.0) - slack-notifier (2.1.0) - spring (2.0.0) + simplecov-html (0.10.2) + slack-notifier (2.3.1) + spring (2.0.2) activesupport (>= 4.2) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (3.7.0) + sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.0) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.12) - thor (0.19.1) - thread_safe (0.3.5) - tilt (2.0.5) + sqlite3 (1.3.13) + sqlite3 (1.3.13-x64-mingw32) + sqlite3 (1.3.13-x86-mingw32) + sqlite3 (1.3.13-x86-mswin32-60) + thor (0.19.4) + thread_safe (0.3.6) + thread_safe (0.3.6-java) + tilt (2.0.8) turbolinks (5.0.1) turbolinks-source (~> 5) - turbolinks-source (5.0.0) - tzinfo (1.2.2) + turbolinks-source (5.0.3) + tzinfo (1.2.3) thread_safe (~> 0.1) - uglifier (3.0.2) + tzinfo-data (1.2017.2) + tzinfo (>= 1.0.0) + uglifier (3.2.0) execjs (>= 0.3.0, < 3) - web-console (3.3.1) + web-console (3.5.1) actionview (>= 5.0) activemodel (>= 5.0) - debug_inspector + bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.6.4) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-driver (0.6.5-java) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) xml-simple (1.1.5) @@ -241,7 +269,11 @@ GEM activesupport PLATFORMS + java ruby + x64-mingw32 + x86-mingw32 + x86-mswin32 DEPENDENCIES bigbluebutton-api-ruby @@ -282,7 +314,4 @@ DEPENDENCIES yt (~> 0.28.0) RUBY VERSION - ruby 2.3.4p301 - -BUNDLED WITH - 1.14.6 + ruby 2.4.0p0 From ea5c78db4730151fdb66396b8d7d9697f864700b Mon Sep 17 00:00:00 2001 From: jfederico Date: Mon, 14 Aug 2017 20:26:43 +0000 Subject: [PATCH 02/11] Updated unified sample.env and setup default values to some variables --- app/controllers/bbb_controller.rb | 10 +-- app/lib/bbb_api.rb | 4 +- config/application.rb | 14 +-- config/initializers/slack.rb | 17 ++-- env | 124 -------------------------- sample.env | 142 ++++++++++++++++++++++++------ 6 files changed, 140 insertions(+), 171 deletions(-) delete mode 100644 env diff --git a/app/controllers/bbb_controller.rb b/app/controllers/bbb_controller.rb index e8c21be0..6134e320 100644 --- a/app/controllers/bbb_controller.rb +++ b/app/controllers/bbb_controller.rb @@ -205,7 +205,7 @@ class BbbController < ApplicationController if Rails.configuration.enable_youtube_uploading == false then uploadable = 'uploading_disabled' elsif current_user.provider != 'google' - uploadable = 'invalid_provider' + uploadable = 'invalid_provider' else uploadable = (Faraday.head(get_webcams_url(params[:rec_id])).status == 200 && current_user.provider == 'google').to_s end @@ -213,7 +213,7 @@ class BbbController < ApplicationController end def get_webcams_url(recording_id) - uri = URI.parse(ENV['BIGBLUEBUTTON_ENDPOINT']) + uri = URI.parse(Rails.configuration.bigbluebutton_endpoint) uri.scheme + '://' + uri.host + '/presentation/' + recording_id + '/video/webcams.webm' end @@ -291,10 +291,10 @@ class BbbController < ApplicationController actioncable_event('create', params[:id], params[:room_id]) elsif eventName == "meeting_destroyed_event" actioncable_event('destroy', params[:id], params[:room_id]) - + # Since the meeting is destroyed we have no way get the callback url to remove the meeting, so we must build it. remove_url = build_callback_url(params[:id], params[:room_id]) - + # Remove webhook for the meeting. webhook_remove(remove_url) elsif eventName == "user_joined_message" @@ -307,7 +307,7 @@ class BbbController < ApplicationController render head(:ok) && return end - + def build_callback_url(id, room_id) "#{request.base_url}#{relative_root}/rooms/#{room_id}/#{URI.encode(id)}/callback" end diff --git a/app/lib/bbb_api.rb b/app/lib/bbb_api.rb index 6c1ac21d..4f279e1c 100644 --- a/app/lib/bbb_api.rb +++ b/app/lib/bbb_api.rb @@ -20,11 +20,11 @@ module BbbApi META_HOOK_URL = "gl-webhooks-callback-url" def bbb_endpoint - Rails.configuration.bigbluebutton_endpoint || '' + Rails.configuration.bigbluebutton_endpoint end def bbb_secret - Rails.configuration.bigbluebutton_secret || '' + Rails.configuration.bigbluebutton_secret end def bbb diff --git a/config/application.rb b/config/application.rb index 506b8928..e44fd8b8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -37,13 +37,13 @@ module Greenlight config.i18n.fallbacks = {'en' => 'en-US'} # BigBlueButton - config.bigbluebutton_endpoint = ENV['BIGBLUEBUTTON_ENDPOINT'] - config.bigbluebutton_secret = ENV['BIGBLUEBUTTON_SECRET'] + config.bigbluebutton_endpoint = ENV['BIGBLUEBUTTON_ENDPOINT'] || 'http://test-install.blindsidenetworks.com/bigbluebutton/' + config.bigbluebutton_secret = ENV['BIGBLUEBUTTON_SECRET'] || '8cd8ef52e8e101574e400365b55e11a6' - config.use_webhooks = ENV['GREENLIGHT_USE_WEBHOOKS'] == "true" - config.mail_notifications = ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] == "true" - config.disable_guest_access = ENV['DISABLE_GUEST_ACCESS'] == "true" - config.enable_youtube_uploading = ENV['ENABLE_YOUTUBE_UPLOADING'] == "true" + config.use_webhooks = ENV['GREENLIGHT_USE_WEBHOOKS'] && ENV['GREENLIGHT_USE_WEBHOOKS'] == "true" + config.mail_notifications = ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] && ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] == "true" + config.disable_guest_access = ENV['DISABLE_GUEST_ACCESS'] && ENV['DISABLE_GUEST_ACCESS'] == "true" + config.enable_youtube_uploading = ENV['ENABLE_YOUTUBE_UPLOADING'] && ENV['ENABLE_YOUTUBE_UPLOADING'] == "true" # SMTP and action mailer if config.mail_notifications @@ -57,7 +57,7 @@ module Greenlight config.smtp_starttls_auto = ENV['SMTP_STARTTLS_AUTO'].nil? ? true : ENV['SMTP_STARTTLS_AUTO'] config.smtp_tls = ENV['SMTP_TLS'].nil? ? false : ENV['SMTP_TLS'] - config.action_mailer.default_url_options = { host: ENV['GREENLIGHT_DOMAIN'] } + config.action_mailer.default_url_options = { host: ENV['GREENLIGHT_DOMAIN'] || 'localhost' } config.action_mailer.delivery_method = :smtp config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true diff --git a/config/initializers/slack.rb b/config/initializers/slack.rb index 886933f6..057a3e65 100644 --- a/config/initializers/slack.rb +++ b/config/initializers/slack.rb @@ -23,14 +23,15 @@ rescue URI::InvalidURIError false end -if !ENV['SLACK_WEBHOOK'].nil? && !ENV['SLACK_WEBHOOK'].empty? && uri?(ENV['SLACK_WEBHOOK']) then - # Initialize the slack notifier. - Rails.application.config.slack_notifier = Slack::Notifier.new ENV['SLACK_WEBHOOK'] do - defaults channel: ENV['SLACK_CHANNEL'], - username: "BigBlueButton", - icon_url: 'https://avatars3.githubusercontent.com/u/230228?v=3&s=200' - end -else +if !ENV['SLACK_WEBHOOK'] || !ENV['SLACK_CHANNEL'] || !uri?(ENV['SLACK_WEBHOOK']) then # Initialize it to nil (slack not configured) Rails.application.config.slack_notifier = nil + return +end + +# Initialize the slack notifier. +Rails.application.config.slack_notifier = Slack::Notifier.new ENV['SLACK_WEBHOOK'] do + defaults channel: ENV['SLACK_CHANNEL'], + username: "BigBlueButton", + icon_url: 'https://avatars3.githubusercontent.com/u/230228?v=3&s=200' end diff --git a/env b/env deleted file mode 100644 index af1e2ef6..00000000 --- a/env +++ /dev/null @@ -1,124 +0,0 @@ -# Step 1 - Create a secret key for rails -# -# You can generate a secure one through the Greenlight docker image -# with with the command -# -# docker run --rm bigbluebutton/greenlight rake secret -# -SECRET_KEY_BASE= -# Step 2 - Enter credentials for your BigBlueButton Server -# -# The endpoint and secret from your bigbluebutton server. To get these values, run -# the following command on your BigBlueButton server -# -# bbb-conf --secret -# -# and uncomment the following two variables -#BIGBLUEBUTTON_ENDPOINT= -#BIGBLUEBUTTON_SECRET= - -# Twitter Login Provider (optional) -# -# You will need to register the app at https://apps.twitter.com/ -# For the callback URL use 'http:///auth/twitter/callback' -# Once registered copy the ID and Secret here -# -TWITTER_ID= -TWITTER_SECRET= - -# Google Login Provider (optional) -# -# You will need to register for at https://console.developers.google.com/apis/credentials -# Select Oauth client ID -> web application -# For the callback URL use 'http:///auth/google/callback' -# Once registered copy the ID and Secret here -# -# The GOOGLE_OAUTH2_HD variable is used to limit sign-in to a particular Google Apps hosted domain. This -# can be a string such as, 'domain.com'. If left blank, GreenLight will allow sign-in from all Google Apps hosted -# domains. -# -GOOGLE_OAUTH2_ID= -GOOGLE_OAUTH2_SECRET= -GOOGLE_OAUTH2_HD= - -# LDAP Login Provider (optional) -# -# You can enable LDAP authentication by providing values for the variables below. -# For information about setting up LDAP, see: -# http://docs.bigbluebutton.org/install/green-light.html#ldap-oauth -# -LDAP_SERVER= -LDAP_PORT= -LDAP_METHOD= -LDAP_UID= -LDAP_BASE= -LDAP_BIND_DN= -LDAP_PASSWORD= - -# If "true", GreenLight will register a webhook callback for each meeting -# created. This callback is called for all events that happen in the meeting, -# including the processing of its recording. These events are used to update -# the web page dynamically as things happen in the server. -# If not "true", the application will add a metadata to the meetings with this same -# callback URL. Scripts can then be added to BigBlueButton to call this callback -# URL and send specific events to GreenLight (e.g. a post publish script to warn -# the application when recordings are done). -GREENLIGHT_USE_WEBHOOKS=false - -# Enable uploading to Youtube (optional) -# -# When this is enabled, users will be able to directly upload their recordings -# to Youtube. If you plan to enable this, you should follow the steps outlined -# in our docs for setting up the Youtube data API. -# -# http://docs.bigbluebutton.org/install/green-light.html#8-enabling-uploading-to-youtube-optional -# -ENABLE_YOUTUBE_UPLOADING=false - -# Slack Integration (optional) -# -# You will need to register an incoming-webhook for your slack channel -# in order for GreenLight to post to it. You can do this by going -# to https://slack.com/apps/A0F7XDUAZ-incoming-webhooks, selecting your -# team and then selecting "Add Incoming WebHooks integration" on the -# desired channel. You will then need to paste the webhook below. -# -SLACK_WEBHOOK= -SLACK_CHANNEL= - -# Landing Background (optional) -# -# Supply a URL to an image to change the landing background. If no -# URL is provided GreenLight will use a default image. If you -# supply a path that does not lead to an image, no landing image -# will appear. -# -LANDING_BACKGROUND= - -# SMTP Mailer -# -GREENLIGHT_MAIL_NOTIFICATIONS=true -GREENLIGHT_DOMAIN=localhost-lxc.org -SMTP_FROM=youremail@gmail.com -SMTP_SERVER=smtp.gmail.com -SMTP_PORT=587 -SMTP_DOMAIN=gmail.com -SMTP_USERNAME=youremail@gmail.com -SMTP_PASSWORD=yourpassword -# SMTP_TLS=false -# SMTP_AUTH=login -# SMTP_STARTTLS_AUTO=true - -# Prefix for the application's root URL -# Useful for deploying the application to a subdirectory -# -# default is '/b' (recommended) -# -#RELATIVE_URL_ROOT=/b - -# Uncomment and set to 'true' to only allow users to create meetings when authenticated. -# Unauthenticated users are still able to join meetings through invites. -#DISABLE_GUEST_ACCESS=false - -# Comment this out to send logs to STDOUT in production instead of log/production.log . -DISABLE_RAILS_LOG_TO_STDOUT=true diff --git a/sample.env b/sample.env index 5d905b7b..b2afa132 100644 --- a/sample.env +++ b/sample.env @@ -1,11 +1,71 @@ -# This is a sample of the environment variables you will need for development +# This is a sample of the environment variables you will need # To use, copy this file to .env `cp sample.env .env` -RAILS_ENV=development -# BigBlueButton -BIGBLUEBUTTON_ENDPOINT= -BIGBLUEBUTTON_SECRET= +# For production only + +# RAILS_ENV=production + +# Create a secret key for rails +# +# You can generate a secure one through the Greenlight docker image +# with with the command +# +# docker run --rm bigbluebutton/greenlight rake secret +# +# SECRET_KEY_BASE= + + +# For either developent or production + +# Enter credentials for your BigBlueButton Server +# +# The endpoint and secret from your bigbluebutton server. To get these values, run +# the following command on your BigBlueButton server +# +# bbb-conf --secret +# +# and uncomment the following two variables +# BIGBLUEBUTTON_ENDPOINT=http://test-install.blindsidenetworks.com/bigbluebutton/ +# BIGBLUEBUTTON_SECRET=8cd8ef52e8e101574e400365b55e11a6 + +# Twitter Login Provider (optional) +# +# You will need to register the app at https://apps.twitter.com/ +# For the callback URL use 'http:///auth/twitter/callback' +# Once registered copy the ID and Secret here +# +# TWITTER_ID= +# TWITTER_SECRET= + +# Google Login Provider (optional) +# +# You will need to register for at https://console.developers.google.com/apis/credentials +# Select Oauth client ID -> web application +# For the callback URL use 'http:///auth/google/callback' +# Once registered copy the ID and Secret here +# +# The GOOGLE_OAUTH2_HD variable is used to limit sign-in to a particular Google Apps hosted domain. This +# can be a string such as, 'domain.com'. If left blank, GreenLight will allow sign-in from all Google Apps hosted +# domains. +# +# GOOGLE_OAUTH2_ID= +# GOOGLE_OAUTH2_SECRET= +# GOOGLE_OAUTH2_HD= + +# LDAP Login Provider (optional) +# +# You can enable LDAP authentication by providing values for the variables below. +# For information about setting up LDAP, see: +# http://docs.bigbluebutton.org/install/green-light.html#ldap-oauth +# +# LDAP_SERVER= +# LDAP_PORT= +# LDAP_METHOD= +# LDAP_UID= +# LDAP_BASE= +# LDAP_BIND_DN= +# LDAP_PASSWORD= # If "true", GreenLight will register a webhook callback for each meeting # created. This callback is called for all events that happen in the meeting, @@ -15,31 +75,63 @@ BIGBLUEBUTTON_SECRET= # callback URL. Scripts can then be added to BigBlueButton to call this callback # URL and send specific events to GreenLight (e.g. a post publish script to warn # the application when recordings are done). -GREENLIGHT_USE_WEBHOOKS=false +# GREENLIGHT_USE_WEBHOOKS=true -# The web site domain, needed for emails mostly -GREENLIGHT_DOMAIN=localhost +# Enable uploading to Youtube (optional) +# +# When this is enabled, users will be able to directly upload their recordings +# to Youtube. If you plan to enable this, you should follow the steps outlined +# in our docs for setting up the Youtube data API. +# +# http://docs.bigbluebutton.org/install/green-light.html#8-enabling-uploading-to-youtube-optional +# +# ENABLE_YOUTUBE_UPLOADING=false -# Enable email notifications -GREENLIGHT_MAIL_NOTIFICATIONS=true +# Slack Integration (optional) +# +# You will need to register an incoming-webhook for your slack channel +# in order for GreenLight to post to it. You can do this by going +# to https://slack.com/apps/A0F7XDUAZ-incoming-webhooks, selecting your +# team and then selecting "Add Incoming WebHooks integration" on the +# desired channel. You will then need to paste the webhook below. +# +# SLACK_WEBHOOK= +# SLACK_CHANNEL= -# Email configurations -SMTP_FROM=email@gmail.com -SMTP_SERVER=smtp.gmail.com -SMTP_DOMAIN=gmail.com -SMTP_PORT=587 -SMTP_USERNAME=email@gmail.com -SMTP_PASSWORD=my-secret-password +# Landing Background (optional) +# +# Supply a URL to an image to change the landing background. If no +# URL is provided GreenLight will use a default image. If you +# supply a path that does not lead to an image, no landing image +# will appear. +# +# LANDING_BACKGROUND= + +# SMTP Mailer (optional) +# +# GREENLIGHT_MAIL_NOTIFICATIONS=true +# In the format [localhost.localdomain] +# GREENLIGHT_DOMAIN=localhost +# SMTP_FROM=youremail@gmail.com +# SMTP_SERVER=smtp.gmail.com +# SMTP_PORT=587 +# SMTP_DOMAIN=gmail.com +# SMTP_USERNAME=youremail@gmail.com +# SMTP_PASSWORD=yourpassword # SMTP_TLS=false # SMTP_AUTH=login # SMTP_STARTTLS_AUTO=true -# OmniAuth -TWITTER_ID= -TWITTER_SECRET= -GOOGLE_OAUTH2_ID= -GOOGLE_OAUTH2_SECRET= +# Prefix for the application's root URL +# Useful for deploying the application to a subdirectory +# +# default is '/b' (recommended) +# +# RELATIVE_URL_ROOT=/b -# For production -SECRET_KEY_BASE= -HOSTNAME= +# Uncomment and set to 'true' to only allow users to create meetings when authenticated. +# Unauthenticated users are still able to join meetings through invites. +# DISABLE_GUEST_ACCESS=false + +# Comment this out to send logs to STDOUT in production instead of log/production.log . +DISABLE_RAILS_LOG_TO_STDOUT=true From 5a5693cb33a81e68d1653ab831aa1ec87c9021c0 Mon Sep 17 00:00:00 2001 From: jfederico Date: Mon, 14 Aug 2017 21:08:56 +0000 Subject: [PATCH 03/11] Added defaults for omniauth --- config/initializers/omniauth.rb | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 64b62eaf..3d33e756 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,24 +1,22 @@ Rails.application.config.providers = [:google, :twitter, :ldap] -Rails.application.config.omniauth_google = ENV['GOOGLE_OAUTH2_ID'].present? +Rails.application.config.omniauth_google = ENV['GOOGLE_OAUTH2_ID'].present? && ENV['GOOGLE_OAUTH2_SECRET'].present? -Rails.application.config.omniauth_twitter = ENV['TWITTER_ID'].present? +Rails.application.config.omniauth_twitter = ENV['TWITTER_ID'].present? && ENV['TWITTER_SECRET'].present? -Rails.application.config.omniauth_ldap = ENV['LDAP_SERVER'].present? +Rails.application.config.omniauth_ldap = ENV['LDAP_SERVER'].present? && ENV['LDAP_UID'].present? && ENV['LDAP_BASE'].present? && ENV['LDAP_BIND_DN'].present? && ENV['LDAP_PASSWORD'].present? Rails.application.config.middleware.use OmniAuth::Builder do provider :twitter, ENV['TWITTER_ID'], ENV['TWITTER_SECRET'] - provider :google_oauth2, - ENV['GOOGLE_OAUTH2_ID'], - ENV['GOOGLE_OAUTH2_SECRET'], - scope: ENV['ENABLE_YOUTUBE_UPLOADING'] == 'true' ? ['profile', 'email', 'youtube', 'youtube.upload'] : ['profile', 'email'] , - access_type: 'online', + provider :google_oauth2, ENV['GOOGLE_OAUTH2_ID'], ENV['GOOGLE_OAUTH2_SECRET'], + scope: ENV['ENABLE_YOUTUBE_UPLOADING'] && ENV['ENABLE_YOUTUBE_UPLOADING'] == "true" ? ['profile', 'email', 'youtube', 'youtube.upload'] : ['profile', 'email'] , + access_type: 'online', name: 'google', - hd: ENV['GOOGLE_OAUTH2_HD'].blank? ? nil : ENV['GOOGLE_OAUTH2_HD'] + hd: ENV['GOOGLE_OAUTH2_HD'] provider :ldap, host: ENV['LDAP_SERVER'], - port: ENV['LDAP_PORT'], - method: ENV['LDAP_METHOD'].present? ? ENV['LDAP_METHOD'].to_sym : :plain, + port: ENV['LDAP_PORT'] || '389', + method: (ENV['LDAP_METHOD'] || 'plain').to_sym, allow_username_or_email_login: true, uid: ENV['LDAP_UID'], base: ENV['LDAP_BASE'], @@ -37,10 +35,10 @@ OmniAuth.config.on_failure = Proc.new { |env| module OmniAuthLDAPExt def request_phase - + rel_root = ENV['RELATIVE_URL_ROOT'].present? ? ENV['RELATIVE_URL_ROOT'] : '/b' rel_root = '' if Rails.env == 'development' - + @callback_path = nil path = options[:callback_path] options[:callback_path] = "#{rel_root}/auth/ldap/callback" From 970670ba6fa2f7e1e87804afa7ba0f426ecc94af Mon Sep 17 00:00:00 2001 From: jfederico Date: Mon, 14 Aug 2017 21:31:01 +0000 Subject: [PATCH 04/11] Rework on landingController to reduce duplication --- app/controllers/landing_controller.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/controllers/landing_controller.rb b/app/controllers/landing_controller.rb index c3fddc0e..1fec0a5a 100644 --- a/app/controllers/landing_controller.rb +++ b/app/controllers/landing_controller.rb @@ -17,6 +17,8 @@ class LandingController < ApplicationController include BbbApi + helper_method :admin? + def index # If guest access is disabled, redirect the user to the guest landing and force login. redirect_to guest_path if Rails.configuration.disable_guest_access @@ -24,7 +26,7 @@ class LandingController < ApplicationController def resource if Rails.configuration.disable_guest_access && params[:resource] == 'meetings' - redirect_to guest_path + redirect_to guest_path else if params[:id].size > meeting_name_limit redirect_to root_url, flash: {danger: t('meeting_name_long')} @@ -39,7 +41,7 @@ class LandingController < ApplicationController end end end - + def guest # If someone tries to access the guest landing when guest access is enabled, just send them to root. redirect_to root_url unless Rails.configuration.disable_guest_access @@ -51,21 +53,13 @@ class LandingController < ApplicationController def wait_for_moderator WaitingList.add(params[:room_id], params[:name], params[:id]) - ActionCable.server.broadcast 'refresh_meetings', - method: 'waiting', - meeting: params[:id], - room: params[:room_id], - user: params[:name] + send_alert(params, 'waiting') render layout: false end def no_longer_waiting WaitingList.remove(params[:room_id], params[:name], params[:id]) - ActionCable.server.broadcast 'refresh_meetings', - method: 'no_longer_waiting', - meeting: params[:id], - room: params[:room_id], - user: params[:name] + send_alert(params, 'no_longer_waiting') end def session_status_refresh @@ -83,7 +77,6 @@ class LandingController < ApplicationController def admin? @user && @user == current_user end - helper_method :admin? def preferences @user = current_user @@ -124,4 +117,11 @@ class LandingController < ApplicationController render :action => 'rooms' end + def send_alert(params, method) + ActionCable.server.broadcast 'refresh_meetings', + method: method, + meeting: params[:id], + room: params[:room_id], + user: params[:name] + end end From f0321367f86fa997630a20aeefd4b729f67a0f84 Mon Sep 17 00:00:00 2001 From: jfederico Date: Tue, 15 Aug 2017 19:03:17 +0000 Subject: [PATCH 05/11] Fixed issue with circle-ci not able to use env variables --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 014df8c7..0ad4951c 100644 --- a/circle.yml +++ b/circle.yml @@ -14,4 +14,4 @@ deployment: test: pre: - - cp env .env + - cp sample.env .env From ad3c07d1dee8ac7e78fd68a4cd3abf7e4ac01982 Mon Sep 17 00:00:00 2001 From: jfederico Date: Tue, 15 Aug 2017 19:10:34 +0000 Subject: [PATCH 06/11] Fixed issues reported by Scrutinizer --- app/assets/javascripts/landing.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/landing.js b/app/assets/javascripts/landing.js index ae2fe3c5..0eadd02b 100644 --- a/app/assets/javascripts/landing.js +++ b/app/assets/javascripts/landing.js @@ -14,10 +14,12 @@ // You should have received a copy of the GNU Lesser General Public License along // with BigBlueButton; if not, see . +/** global: Meeting */ + (function() { var waitForModerator = function(url) { - localStorage.setItem("waitingName", $('.meeting-user-name').val()); + Window.localStorage.setItem("waitingName", $('.meeting-user-name').val()); $.post(url + "/wait", {name: $('.meeting-user-name').val()}, function(html) { $(".center-panel-wrapper").html(html); }); @@ -33,7 +35,7 @@ Meeting.clear(); var nameInput = $('.meeting-user-name'); if (!nameInput.val()) { - var lastName = localStorage.getItem('lastJoinedName'); + var lastName = Window.localStorage.getItem('lastJoinedName'); if (lastName !== 'undefined') { nameInput.val(lastName); } From 4d915b6c1fdc2e2499b87c43f8ed5f99ef2151f6 Mon Sep 17 00:00:00 2001 From: jfederico Date: Tue, 15 Aug 2017 19:12:24 +0000 Subject: [PATCH 07/11] Fixed issues reported by Scrutinizer --- app/assets/javascripts/landing.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/javascripts/landing.js b/app/assets/javascripts/landing.js index 0eadd02b..b2bcc9f0 100644 --- a/app/assets/javascripts/landing.js +++ b/app/assets/javascripts/landing.js @@ -15,6 +15,10 @@ // with BigBlueButton; if not, see . /** global: Meeting */ +/** global: PreviousMeetings */ +/** global: QRCode */ +/** global: Recordings */ +/** global: Turbolinks */ (function() { From f66f3d4dab6fadb47daf201af59fa76ba8caa753 Mon Sep 17 00:00:00 2001 From: jfederico Date: Tue, 15 Aug 2017 19:21:19 +0000 Subject: [PATCH 08/11] Fixed issues reported by Scrutinizer --- app/assets/javascripts/landing.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/landing.js b/app/assets/javascripts/landing.js index b2bcc9f0..0cce6676 100644 --- a/app/assets/javascripts/landing.js +++ b/app/assets/javascripts/landing.js @@ -23,7 +23,7 @@ (function() { var waitForModerator = function(url) { - Window.localStorage.setItem("waitingName", $('.meeting-user-name').val()); + window.localStorage.setItem("waitingName", $('.meeting-user-name').val()); $.post(url + "/wait", {name: $('.meeting-user-name').val()}, function(html) { $(".center-panel-wrapper").html(html); }); @@ -39,7 +39,7 @@ Meeting.clear(); var nameInput = $('.meeting-user-name'); if (!nameInput.val()) { - var lastName = Window.localStorage.getItem('lastJoinedName'); + var lastName = window.localStorage.getItem('lastJoinedName'); if (lastName !== 'undefined') { nameInput.val(lastName); } From 20830c0e72c724b3f20bbb86a6a78dc119fe50bd Mon Sep 17 00:00:00 2001 From: jfederico Date: Tue, 15 Aug 2017 19:44:53 +0000 Subject: [PATCH 09/11] Restored definition of helper --- app/controllers/landing_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/landing_controller.rb b/app/controllers/landing_controller.rb index 1fec0a5a..a6f6aa37 100644 --- a/app/controllers/landing_controller.rb +++ b/app/controllers/landing_controller.rb @@ -17,8 +17,6 @@ class LandingController < ApplicationController include BbbApi - helper_method :admin? - def index # If guest access is disabled, redirect the user to the guest landing and force login. redirect_to guest_path if Rails.configuration.disable_guest_access @@ -77,6 +75,7 @@ class LandingController < ApplicationController def admin? @user && @user == current_user end + helper_method :admin? def preferences @user = current_user From 4590725c798d807e55a0ad3454b4df8e230fcbb2 Mon Sep 17 00:00:00 2001 From: jfederico Date: Tue, 15 Aug 2017 20:33:19 +0000 Subject: [PATCH 10/11] A warning message is shown when the BBB server configured is the one that comes by default --- app/controllers/application_controller.rb | 10 ++++++++++ app/lib/bbb_api.rb | 2 +- app/views/shared/_center_panel.html.erb | 3 +++ config/application.rb | 7 +++++-- config/locales/en-us.yml | 1 + 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4cc52a0e..30566943 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -46,4 +46,14 @@ class ApplicationController < ActionController::Base USER_NAME_LIMIT end helper_method :user_name_limit + + def user_name_limit + USER_NAME_LIMIT + end + helper_method :user_name_limit + + def bigbluebutton_endpoint_default? + Rails.configuration.bigbluebutton_endpoint_default === Rails.configuration.bigbluebutton_endpoint + end + helper_method :bigbluebutton_endpoint_default? end diff --git a/app/lib/bbb_api.rb b/app/lib/bbb_api.rb index 4f279e1c..d0e3d89c 100644 --- a/app/lib/bbb_api.rb +++ b/app/lib/bbb_api.rb @@ -28,7 +28,7 @@ module BbbApi end def bbb - @bbb ||= BigBlueButton::BigBlueButtonApi.new(bbb_endpoint + "api", bbb_secret, "0.8", true) + @bbb ||= BigBlueButton::BigBlueButtonApi.new(bbb_endpoint + "api", bbb_secret, "0.8") end def bbb_meeting_id(id) diff --git a/app/views/shared/_center_panel.html.erb b/app/views/shared/_center_panel.html.erb index a83bd135..2b695326 100644 --- a/app/views/shared/_center_panel.html.erb +++ b/app/views/shared/_center_panel.html.erb @@ -18,6 +18,9 @@
+ <% if bigbluebutton_endpoint_default? %> +
<%= t('warning_bigbluebutton_endpoint_default') %>
+ <% end %>

<%= yield :title %>

diff --git a/config/application.rb b/config/application.rb index e44fd8b8..a2a05fb8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -37,9 +37,12 @@ module Greenlight config.i18n.fallbacks = {'en' => 'en-US'} # BigBlueButton - config.bigbluebutton_endpoint = ENV['BIGBLUEBUTTON_ENDPOINT'] || 'http://test-install.blindsidenetworks.com/bigbluebutton/' - config.bigbluebutton_secret = ENV['BIGBLUEBUTTON_SECRET'] || '8cd8ef52e8e101574e400365b55e11a6' + config.bigbluebutton_endpoint_default = 'http://test-install.blindsidenetworks.com/bigbluebutton/' + config.bigbluebutton_secret_default = '8cd8ef52e8e101574e400365b55e11a6' + config.bigbluebutton_endpoint = ENV['BIGBLUEBUTTON_ENDPOINT'] || config.bigbluebutton_endpoint_default + config.bigbluebutton_secret = ENV['BIGBLUEBUTTON_SECRET'] || config.bigbluebutton_secret_default + # Greelight specific config.use_webhooks = ENV['GREENLIGHT_USE_WEBHOOKS'] && ENV['GREENLIGHT_USE_WEBHOOKS'] == "true" config.mail_notifications = ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] && ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] == "true" config.disable_guest_access = ENV['DISABLE_GUEST_ACCESS'] && ENV['DISABLE_GUEST_ACCESS'] == "true" diff --git a/config/locales/en-us.yml b/config/locales/en-us.yml index c2c0fc36..c138193a 100644 --- a/config/locales/en-us.yml +++ b/config/locales/en-us.yml @@ -187,6 +187,7 @@ en-US: wait_for_mod_explanation: You will automatically join when the meeting starts watch: Watch 'yes': 'Yes' + warning_bigbluebutton_endpoint_default: This deployment of Greenlight is making use of the BigBlueButton testing server that comes pre-configured by default. It should be replaced. welcome_to_greenlight: Welcome to GreenLight! youtube_description: This recording was recorded with BigBlueButton. For more information check out %{url}. youtube_footer: this will upload all webcam and audio data From 4b7f104808dd7aef1e57ba388afa71538c9d85ac Mon Sep 17 00:00:00 2001 From: jfederico Date: Tue, 15 Aug 2017 20:37:26 +0000 Subject: [PATCH 11/11] Removed duplicated code introduced in previous commit --- app/controllers/application_controller.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 30566943..a8f61cfd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -47,13 +47,8 @@ class ApplicationController < ActionController::Base end helper_method :user_name_limit - def user_name_limit - USER_NAME_LIMIT - end - helper_method :user_name_limit - def bigbluebutton_endpoint_default? - Rails.configuration.bigbluebutton_endpoint_default === Rails.configuration.bigbluebutton_endpoint + Rails.configuration.bigbluebutton_endpoint_default == Rails.configuration.bigbluebutton_endpoint end helper_method :bigbluebutton_endpoint_default? end