From f0ab2924db895facd9ecb9a14c73a96c643e3d05 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Wed, 27 Jun 2018 17:53:11 -0400 Subject: [PATCH 1/4] allow client to be determined by server --- app/models/room.rb | 1 - config/initializers/html5.rb | 8 -------- spec/models/room_spec.rb | 3 +-- 3 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 config/initializers/html5.rb diff --git a/app/models/room.rb b/app/models/room.rb index 52bf5262..a83f4eed 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -74,7 +74,6 @@ class Room < ApplicationRecord # Generate the join URL. join_opts = {} join_opts[:userID] = uid if uid - join_opts[:joinViaHtml5] = true if Rails.configuration.html5_enabled bbb.join_meeting_url(bbb_id, name, password, join_opts) end diff --git a/config/initializers/html5.rb b/config/initializers/html5.rb deleted file mode 100644 index 635767a5..00000000 --- a/config/initializers/html5.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# Send a request to check if the HTML5 client is enabled on the BigBlueButton server. -uri = URI.parse(Rails.configuration.bigbluebutton_endpoint.gsub('bigbluebutton/api', 'html5client/check')) -res = Net::HTTP.get_response(uri) - -# Set the HTML5 status. -Rails.application.config.html5_enabled = (res.code.to_i == 200) diff --git a/spec/models/room_spec.rb b/spec/models/room_spec.rb index 12f0df90..6cb8a7d6 100644 --- a/spec/models/room_spec.rb +++ b/spec/models/room_spec.rb @@ -78,11 +78,10 @@ describe Room, type: :model do endpoint = Rails.configuration.bigbluebutton_endpoint secret = Rails.configuration.bigbluebutton_secret fullname = "fullName=Example" - html = Rails.configuration.html5_enabled ? "&joinViaHtml5=true" : "" meeting_id = "&meetingID=#{@room.bbb_id}" password = "&password=testpass" - query = fullname + html + meeting_id + password + query = fullname + meeting_id + password checksum_string = "join#{query + secret}" checksum = OpenSSL::Digest.digest('sha1', checksum_string).unpack("H*").first From d9c5d378108d48a0cc3a291b22185ed5b2d469ff Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Thu, 28 Jun 2018 09:35:36 -0400 Subject: [PATCH 2/4] correctly handle failed login --- app/controllers/sessions_controller.rb | 7 ++++++- app/views/main/index.html.erb | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 8f9b0028..30cdb006 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,6 +1,9 @@ # frozen_string_literal: true class SessionsController < ApplicationController + + LOGIN_FAILED = "Login failed due to invalid credentials. Are you sure you typed them correctly?" + # GET /users/login def new end @@ -14,8 +17,10 @@ class SessionsController < ApplicationController # POST /users/login def create user = User.find_by(email: session_params[:email]) - if user.&authenticate(session_params[:password]) + if user&.authenticate(session_params[:password]) login(user) + else + redirect_to root_path, notice: LOGIN_FAILED end end diff --git a/app/views/main/index.html.erb b/app/views/main/index.html.erb index 07e7646a..5ce4ab45 100644 --- a/app/views/main/index.html.erb +++ b/app/views/main/index.html.erb @@ -1,3 +1,11 @@ +<% unless flash.empty? %> + <%= render "shared/error_banner" do %> + <% flash.each do |key, value| %> + <%= content_tag :div, value, class: "flash #{key} d-inline" %> + <% end %> + <% end %> +<% end %> +
From c802e4806a455e5a0056ffb824e38422d4fce8d9 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Thu, 28 Jun 2018 10:39:39 -0400 Subject: [PATCH 3/4] fix waiting to join retry logic --- app/assets/javascripts/wait.js | 8 +++++--- app/controllers/sessions_controller.rb | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/wait.js b/app/assets/javascripts/wait.js index b07588d5..2d5ad36d 100644 --- a/app/assets/javascripts/wait.js +++ b/app/assets/javascripts/wait.js @@ -10,7 +10,9 @@ $(document).on("turbolinks:load", function(){ uid: $(".background").attr("room") }, { received: function(data){ - if(data.action = "started"){ request_to_join_meeting(); } + if(data.action = "started"){ + request_to_join_meeting(); + } } }); } @@ -29,8 +31,8 @@ var request_to_join_meeting = function(){ 'Content-Type': 'application/x-www-form-urlencoded', 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') }, - error: function(){ - // The meeting is still booting (going slowly), retry shortly. + success: function(){ + // Enqueue another trial just incase they didn't actually join. if(join_attempts < 4){ setTimeout(request_to_join_meeting, 10000); } join_attempts++; } diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 30cdb006..585a1a88 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -17,7 +17,7 @@ class SessionsController < ApplicationController # POST /users/login def create user = User.find_by(email: session_params[:email]) - if user&.authenticate(session_params[:password]) + if user.try(:authenticate, session_params[:password]) login(user) else redirect_to root_path, notice: LOGIN_FAILED From 0b9fdb371e82f862fd12ec101cb8b7b4dbc3fae7 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Thu, 28 Jun 2018 11:21:02 -0400 Subject: [PATCH 4/4] fix footer and update links --- README.md | 2 +- app/assets/stylesheets/application.scss | 8 +++++--- app/views/layouts/application.html.erb | 2 +- app/views/shared/_footer.html.erb | 4 ++-- sample.env | 10 ++++++---- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index edbd4e26..ce64bb4d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Greenlight is a simple front-end interface for your BigBlueButton server. At it' * Invite others to your room using a simple URL. * View recordings and share them with others. -Furthermore, Greenlight is completely configurable. This means you can turn on/off features to make Greenlight fit your specific use case. For more information on Greenlight and it's features, see our [documentation](http://docs.bigbluebutton.org/install/green-light.html). +Furthermore, Greenlight is completely configurable. This means you can turn on/off features to make Greenlight fit your specific use case. For more information on Greenlight and it's features, see our [documentation](http://docs.bigbluebutton.org/install/greenlight.html). For a overview of how GreenLight works, checkout our [Introduction to Greenlight Video](https://youtu.be/yGX3JCv7OVM). diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index ff08b86a..dcce13e7 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -26,7 +26,7 @@ $background-color: #F5F7FB; $error-background-color: #EFE6E6; -$footer-height: 80px; +$footer-height: 65px; html, body { width: 100%; @@ -45,9 +45,11 @@ a { } .footer { + position: fixed; + height: $footer-height; width: 100%; - position: abolute; - bottom: 0px; + bottom: 0; + z-index: 5; } .table-responsive { diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 0883f47a..b814347d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -27,7 +27,7 @@

This deployment is using a pre-configured testing server, you should replace this with your own. - For details, see the <%= link_to "documentation", "http://docs.bigbluebutton.org/install/green-light.html#installing-greenlight", target: "_blank" %>. + For details, see the <%= link_to "documentation", "http://docs.bigbluebutton.org/install/greenlight.html#installing-greenlight", target: "_blank" %>. <% end %> <% end %> diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index 987f1fef..686d95ec 100644 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -1,3 +1,3 @@ -

+ diff --git a/sample.env b/sample.env index d60f565f..26973ac0 100644 --- a/sample.env +++ b/sample.env @@ -20,7 +20,7 @@ BIGBLUEBUTTON_SECRET= # # For in-depth steps on setting up a Google Login Provider, see: # -# http://docs.bigbluebutton.org/install/green-light.html#google-oauth +# http://docs.bigbluebutton.org/install/greenlight.html#google-oauth2 # # 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 @@ -33,14 +33,16 @@ GOOGLE_OAUTH2_HD= # # For in-depth steps on setting up a Twitter Login Provider, see: # -# http://docs.bigbluebutton.org/install/green-light.html#twitter-oauth +# http://docs.bigbluebutton.org/install/greenlight.html#twitter-oauth2 # TWITTER_ID= TWITTER_SECRET= # Set this to true if you want GreenLight to support user signup and login without -# Omniauth. This will allow users to create an account at www.hostname.com/signup -# and use that account to fully interact with GreenLight. +# Omniauth. For more information, see: +# +# http://docs.bigbluebutton.org/install/greenlight.html#in-application-greenlight +# ALLOW_GREENLIGHT_ACCOUNTS=true # Prefix for the applications root URL.