forked from External/greenlight
		
	fixes for html5 support
This commit is contained in:
		
							
								
								
									
										3
									
								
								Gemfile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Gemfile
									
									
									
									
									
								
							@@ -89,3 +89,6 @@ gem 'yt', '~> 0.28.0'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Simple HTTP client.
 | 
					# Simple HTTP client.
 | 
				
			||||||
gem 'faraday'
 | 
					gem 'faraday'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# For device detection to determine BigBlueButton client.
 | 
				
			||||||
 | 
					gem 'browser'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,6 +46,7 @@ GEM
 | 
				
			|||||||
      sass (~> 3.2)
 | 
					      sass (~> 3.2)
 | 
				
			||||||
    bootstrap-social-rails (4.12.0)
 | 
					    bootstrap-social-rails (4.12.0)
 | 
				
			||||||
      railties (>= 3.1)
 | 
					      railties (>= 3.1)
 | 
				
			||||||
 | 
					    browser (2.5.1)
 | 
				
			||||||
    builder (3.2.3)
 | 
					    builder (3.2.3)
 | 
				
			||||||
    byebug (9.0.6)
 | 
					    byebug (9.0.6)
 | 
				
			||||||
    climate_control (0.2.0)
 | 
					    climate_control (0.2.0)
 | 
				
			||||||
@@ -279,6 +280,7 @@ DEPENDENCIES
 | 
				
			|||||||
  bigbluebutton-api-ruby
 | 
					  bigbluebutton-api-ruby
 | 
				
			||||||
  bootstrap-sass (= 3.3.0.0)
 | 
					  bootstrap-sass (= 3.3.0.0)
 | 
				
			||||||
  bootstrap-social-rails (~> 4.12)
 | 
					  bootstrap-social-rails (~> 4.12)
 | 
				
			||||||
 | 
					  browser
 | 
				
			||||||
  byebug
 | 
					  byebug
 | 
				
			||||||
  coffee-rails (~> 4.2)
 | 
					  coffee-rails (~> 4.2)
 | 
				
			||||||
  dotenv-rails
 | 
					  dotenv-rails
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,8 @@
 | 
				
			|||||||
              body: I18n.user_waiting_body.replace(/%{user}/, data.user).replace(/%{meeting}/, '"'+data.meeting_name+'"')
 | 
					              body: I18n.user_waiting_body.replace(/%{user}/, data.user).replace(/%{meeting}/, '"'+data.meeting_name+'"')
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					        } else if(data.action === 'unable_to_join') {
 | 
				
			||||||
 | 
					          showAlert(I18n.unable_to_join_mobile, 6000)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,7 @@
 | 
				
			|||||||
          jqxhr.done(function(data) {
 | 
					          jqxhr.done(function(data) {
 | 
				
			||||||
            if (data.messageKey === 'wait_for_moderator') {
 | 
					            if (data.messageKey === 'wait_for_moderator') {
 | 
				
			||||||
              waitForModerator(Meeting.getInstance().getURL());
 | 
					              waitForModerator(Meeting.getInstance().getURL());
 | 
				
			||||||
            } else {
 | 
					            } else if (data.messageKey === 'ok') {
 | 
				
			||||||
              $(location).attr("href", data.response.join_url);
 | 
					              $(location).attr("href", data.response.join_url);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -93,6 +93,9 @@ class BbbController < ApplicationController
 | 
				
			|||||||
        if bbb_res[:returncode] && current_user == user
 | 
					        if bbb_res[:returncode] && current_user == user
 | 
				
			||||||
          JoinMeetingJob.perform_later(user, params[:id], base_url)
 | 
					          JoinMeetingJob.perform_later(user, params[:id], base_url)
 | 
				
			||||||
          WaitingList.empty(options[:room_owner], options[:meeting_name])
 | 
					          WaitingList.empty(options[:room_owner], options[:meeting_name])
 | 
				
			||||||
 | 
					        # the user can't join because they are on mobile and HTML5 is not enabled.
 | 
				
			||||||
 | 
					        elsif bbb_res[:messageKey] == 'unable_to_join'
 | 
				
			||||||
 | 
					          NotifyUserCantJoinJob.perform_later(user.encrypted_id, params[:id], params[:name])
 | 
				
			||||||
        # user will be waiting for a moderator
 | 
					        # user will be waiting for a moderator
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
          NotifyUserWaitingJob.perform_later(user.encrypted_id, params[:id], params[:name])
 | 
					          NotifyUserWaitingJob.perform_later(user.encrypted_id, params[:id], params[:name])
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,4 +16,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
module LandingHelper
 | 
					module LandingHelper
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def html5_enabled?
 | 
				
			||||||
 | 
					    Rails.configuration.html5_enabled
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										24
									
								
								app/jobs/notify_user_cant_join_job.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								app/jobs/notify_user_cant_join_job.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Copyright (c) 2016 BigBlueButton Inc. and by respective authors (see below).
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# This program is free software; you can redistribute it and/or modify it under the
 | 
				
			||||||
 | 
					# terms of the GNU Lesser General Public License as published by the Free Software
 | 
				
			||||||
 | 
					# Foundation; either version 3.0 of the License, or (at your option) any later
 | 
				
			||||||
 | 
					# version.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
				
			||||||
 | 
					# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 | 
				
			||||||
 | 
					# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# You should have received a copy of the GNU Lesser General Public License along
 | 
				
			||||||
 | 
					# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class NotifyUserCantJoinJob < ApplicationJob
 | 
				
			||||||
 | 
					  queue_as :default
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def perform(room, meeting, user)
 | 
				
			||||||
 | 
					    payload = { action: 'unable_to_join', user: user, meeting_name: meeting }
 | 
				
			||||||
 | 
					    ActionCable.server.broadcast "#{room}-#{meeting}_meeting_updates_channel", payload
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@@ -52,6 +52,18 @@ module BbbApi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if !bbb
 | 
					    if !bbb
 | 
				
			||||||
      return call_invalid_res
 | 
					      return call_invalid_res
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      # Verify HTML5 is running.
 | 
				
			||||||
 | 
					      html5_running = Rails.configuration.html5_enabled
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      # Determine if the user is on mobile.
 | 
				
			||||||
 | 
					      browser = Browser.new(request.user_agent)
 | 
				
			||||||
 | 
					      mobile = browser.device.tablet?
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					      # If the user is on mobile and the BigBlueButton server isn't running the HTML5 client,
 | 
				
			||||||
 | 
					      # they can't join or create meetings.
 | 
				
			||||||
 | 
					      if mobile and !html5_running then
 | 
				
			||||||
 | 
					        return unable_to_join_res
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        meeting_id = bbb_meeting_id(meeting_token)
 | 
					        meeting_id = bbb_meeting_id(meeting_token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -125,44 +137,27 @@ module BbbApi
 | 
				
			|||||||
          use_html5 = current_user.use_html5
 | 
					          use_html5 = current_user.use_html5
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
      # Verify HTML5 is running.
 | 
					 | 
				
			||||||
      html5_running = Faraday.get(bbb_endpoint.gsub('bigbluebutton/', 'html5client/check')).status == 200
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
      # Determine if the user is on mobile.
 | 
					 | 
				
			||||||
      mobile = session[:mobile_param].nil? ? session[:mobile_param] == "1" : request.user_agent =~ /Mobile|webOS/
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
      can_join = true
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
        # Restrict client if needed.
 | 
					        # Restrict client if needed.
 | 
				
			||||||
        if mobile && html5_running
 | 
					        if mobile && html5_running
 | 
				
			||||||
          # Must use HTML5 because they are on mobile.
 | 
					          # Must use HTML5 because they are on mobile.
 | 
				
			||||||
          use_html5 = true
 | 
					          use_html5 = true
 | 
				
			||||||
      elsif mobile && !html5_running
 | 
					 | 
				
			||||||
        # The user cannot join.
 | 
					 | 
				
			||||||
        can_join = false
 | 
					 | 
				
			||||||
        elsif !mobile && !html5_running
 | 
					        elsif !mobile && !html5_running
 | 
				
			||||||
          # HTML5 is not running, so must use Flash.
 | 
					          # HTML5 is not running, so must use Flash.
 | 
				
			||||||
          use_html5 = false
 | 
					          use_html5 = false
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
          
 | 
					          
 | 
				
			||||||
        # Generate the join URL.
 | 
					        # Generate the join URL.
 | 
				
			||||||
      if can_join
 | 
					 | 
				
			||||||
        if use_html5
 | 
					        if use_html5
 | 
				
			||||||
          clientURL = bbb_endpoint.gsub('bigbluebutton/', 'html5client/join')
 | 
					          clientURL = bbb_endpoint.gsub('bigbluebutton/', 'html5client/join')
 | 
				
			||||||
          join_url = bbb.join_meeting_url(meeting_id, full_name, password, {clientURL: clientURL})
 | 
					          join_url = bbb.join_meeting_url(meeting_id, full_name, password, {clientURL: clientURL})
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
          join_url = bbb.join_meeting_url(meeting_id, full_name, password)
 | 
					          join_url = bbb.join_meeting_url(meeting_id, full_name, password)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
        # This still creates the meeting, just doesn't let them join.
 | 
					 | 
				
			||||||
        # TODO: Notify the user that the join failed.
 | 
					 | 
				
			||||||
        #ActionCable.server.broadcast "#{current_user.encrypted_id}-#{meeting_id}_meeting_updates_channel",
 | 
					 | 
				
			||||||
        #  action: 'mobile_html5_join_fail'  
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return success_join_res(join_url)
 | 
					        return success_join_res(join_url)
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def bbb_get_meeting_info(id)
 | 
					  def bbb_get_meeting_info(id)
 | 
				
			||||||
    meeting_id = bbb_meeting_id(id)
 | 
					    meeting_id = bbb_meeting_id(id)
 | 
				
			||||||
@@ -344,6 +339,15 @@ module BbbApi
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  def unable_to_join_res
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      returncode: false,
 | 
				
			||||||
 | 
					      messageKey: "unable_to_join",
 | 
				
			||||||
 | 
					      message: "Unable to join.",
 | 
				
			||||||
 | 
					      status: :ok
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def wait_moderator_res
 | 
					  def wait_moderator_res
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      returncode: false,
 | 
					      returncode: false,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,10 +35,14 @@
 | 
				
			|||||||
        <br>
 | 
					        <br>
 | 
				
			||||||
        <div class="html5-check">
 | 
					        <div class="html5-check">
 | 
				
			||||||
          <h3><%= t('prefered_client') %></h3>
 | 
					          <h3><%= t('prefered_client') %></h3>
 | 
				
			||||||
 | 
					          <% if html5_enabled? %>
 | 
				
			||||||
            <p><%= t('currently_joining_with', client: @user.use_html5 ? t('client_html5') : t('client_flash')) %></p>
 | 
					            <p><%= t('currently_joining_with', client: @user.use_html5 ? t('client_html5') : t('client_flash')) %></p>
 | 
				
			||||||
            <%= form_for @user do |f| %>
 | 
					            <%= form_for @user do |f| %>
 | 
				
			||||||
              <%= f.submit t('switch_clients'), class: 'btn btn-info' %>
 | 
					              <%= f.submit t('switch_clients'), class: 'btn btn-info' %>
 | 
				
			||||||
            <% end %>
 | 
					            <% end %>
 | 
				
			||||||
 | 
					          <% else %>
 | 
				
			||||||
 | 
					            <p><%= t('html5_not_enabled') %></p>
 | 
				
			||||||
 | 
					          <% end %>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      <% else %>
 | 
					      <% else %>
 | 
				
			||||||
        <h3><%= t('preferences_logged') %></h3>
 | 
					        <h3><%= t('preferences_logged') %></h3>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								config/initializers/html5_client.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								config/initializers/html5_client.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Copyright (c) 2016 BigBlueButton Inc. and by respective authors (see below).
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# This program is free software; you can redistribute it and/or modify it under the
 | 
				
			||||||
 | 
					# terms of the GNU Lesser General Public License as published by the Free Software
 | 
				
			||||||
 | 
					# Foundation; either version 3.0 of the License, or (at your option) any later
 | 
				
			||||||
 | 
					# version.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
				
			||||||
 | 
					# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 | 
				
			||||||
 | 
					# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# You should have received a copy of the GNU Lesser General Public License along
 | 
				
			||||||
 | 
					# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Send a request to check if the HTML5 client is enabled on the BigBlueButton server.
 | 
				
			||||||
 | 
					res = Faraday.get(Rails.configuration.bigbluebutton_endpoint.gsub('bigbluebutton/', 'html5client/check'))
 | 
				
			||||||
 | 
					Rails.application.config.html5_enabled = res.status == 200
 | 
				
			||||||
@@ -70,6 +70,7 @@ en-US:
 | 
				
			|||||||
    recording_unpublished: Recording was unpublished
 | 
					    recording_unpublished: Recording was unpublished
 | 
				
			||||||
    share: Share
 | 
					    share: Share
 | 
				
			||||||
    successful_upload: Recording successfully uploaded to Youtube!
 | 
					    successful_upload: Recording successfully uploaded to Youtube!
 | 
				
			||||||
 | 
					    unable_to_join_mobile: This BigBlueButton server does not use the HTML5 client, which means you are unable to join on mobile.
 | 
				
			||||||
    unpublish_recording: Hide recording
 | 
					    unpublish_recording: Hide recording
 | 
				
			||||||
    unlisted: Unlisted
 | 
					    unlisted: Unlisted
 | 
				
			||||||
    unpublished: No one
 | 
					    unpublished: No one
 | 
				
			||||||
@@ -80,7 +81,7 @@ en-US:
 | 
				
			|||||||
  client_flash: Flash
 | 
					  client_flash: Flash
 | 
				
			||||||
  copied: Copied
 | 
					  copied: Copied
 | 
				
			||||||
  copy_error: Use Ctrl-c to copy
 | 
					  copy_error: Use Ctrl-c to copy
 | 
				
			||||||
  currently_joining_with: Currently joining with %{client} client.
 | 
					  currently_joining_with: Currently prefering the %{client} client.
 | 
				
			||||||
  create_your_session: Create your own meeting
 | 
					  create_your_session: Create your own meeting
 | 
				
			||||||
  date_recorded: Date
 | 
					  date_recorded: Date
 | 
				
			||||||
  disallowed_characters_msg: Characters not allowed in meeting name $&,
 | 
					  disallowed_characters_msg: Characters not allowed in meeting name $&,
 | 
				
			||||||
@@ -97,6 +98,7 @@ en-US:
 | 
				
			|||||||
  hi_all: Hi Everyone
 | 
					  hi_all: Hi Everyone
 | 
				
			||||||
  home_page: Home page
 | 
					  home_page: Home page
 | 
				
			||||||
  home_title: Welcome to BigBlueButton
 | 
					  home_title: Welcome to BigBlueButton
 | 
				
			||||||
 | 
					  html5_not_enabled: This server is not HTML5 enabled, so you must use the Flash client.
 | 
				
			||||||
  invalid_file: You may only upload an image file (jpg, gif, png).
 | 
					  invalid_file: You may only upload an image file (jpg, gif, png).
 | 
				
			||||||
  invalid_login: Invalid log in credentials.
 | 
					  invalid_login: Invalid log in credentials.
 | 
				
			||||||
  invite: Invite
 | 
					  invite: Invite
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user