forked from External/greenlight
add HTML5 support
This commit is contained in:
parent
40ee86a6a4
commit
da07eb749f
|
@ -19,13 +19,19 @@ class UsersController < ActionController::Base
|
|||
# For updating a users background image.
|
||||
def update
|
||||
|
||||
# Make sure they actually select a file.
|
||||
if params[:user] then
|
||||
if params[:commit] == t('upload')
|
||||
# Make sure they actually select a file.
|
||||
if params[:user] then
|
||||
@user = User.find(params[:id])
|
||||
@user.assign_attributes(background: user_params[:background])
|
||||
flash[:danger] = t('invalid_file') unless @user.save
|
||||
else
|
||||
flash[:danger] = t('no_file')
|
||||
end
|
||||
elsif params[:commit] == t('switch_clients')
|
||||
# Switch the users default client.
|
||||
@user = User.find(params[:id])
|
||||
@user.assign_attributes(background: user_params[:background])
|
||||
flash[:danger] = t('invalid_file') unless @user.save
|
||||
else
|
||||
flash[:danger] = t('no_file')
|
||||
@user.update_attributes(use_html5: !@user.use_html5)
|
||||
end
|
||||
|
||||
# Reload the page to apply changes and show flash messages.
|
||||
|
|
|
@ -80,6 +80,7 @@ module BbbApi
|
|||
"meta_#{BbbApi::META_LISTED}": false,
|
||||
"meta_#{BbbApi::META_TOKEN}": meeting_token
|
||||
}
|
||||
|
||||
meeting_options.merge!(
|
||||
{ "meta_#{BbbApi::META_HOOK_URL}": options[:hook_url] }
|
||||
) if options[:hook_url]
|
||||
|
@ -116,7 +117,31 @@ module BbbApi
|
|||
else
|
||||
password = bbb_meeting_info[:attendeePW]
|
||||
end
|
||||
join_url = bbb.join_meeting_url(meeting_id, full_name, password )
|
||||
|
||||
# Determine which client to join as.
|
||||
if current_user.nil?
|
||||
use_html5 = Rails.configuration.use_html5_by_default
|
||||
else
|
||||
use_html5 = current_user.use_html5 == true
|
||||
end
|
||||
|
||||
# If the user wants to use HTML5, verfiy it's running.
|
||||
if use_html5
|
||||
html5_check = Faraday.get bbb_endpoint.gsub('bigbluebutton/', 'html5client/check')
|
||||
# If HTML5 is not running, must use Flash.
|
||||
unless html5_check.status == 200
|
||||
use_html5 = false
|
||||
end
|
||||
end
|
||||
|
||||
# Generate the join URL.
|
||||
if use_html5
|
||||
clientURL = bbb_endpoint.gsub('bigbluebutton/', 'html5client/join')
|
||||
join_url = bbb.join_meeting_url(meeting_id, full_name, password, {clientURL: clientURL})
|
||||
else
|
||||
join_url = bbb.join_meeting_url(meeting_id, full_name, password)
|
||||
end
|
||||
|
||||
return success_join_res(join_url)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
<% if @user %>
|
||||
<div class="upload-form">
|
||||
<h3><%= t('background_image') %></h3>
|
||||
<p> <%= t('background_image') + ": " + (@user.background_file_name || '') %> </p>
|
||||
<%= form_for @user, :html => { :multipart => true } do |f| %>
|
||||
<div class="form-group">
|
||||
|
@ -31,6 +32,14 @@
|
|||
<%= f.submit t('upload'), class: 'btn btn-info' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<br>
|
||||
<div class="html5-check">
|
||||
<h3><%= t('prefered_client') %></h3>
|
||||
<p><%= t('currently_joining_with', client: @user.use_html5 ? t('client_html5') : t('client_flash')) %></p>
|
||||
<%= form_for @user do |f| %>
|
||||
<%= f.submit t('switch_clients'), class: 'btn btn-info' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<h3><%= t('preferences_logged') %></h3>
|
||||
<% end %>
|
||||
|
|
|
@ -48,6 +48,7 @@ module Greenlight
|
|||
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"
|
||||
config.enable_qrcode_generation = ENV['ENABLE_QRCODE_GENERATION'] && ENV['ENABLE_QRCODE_GENERATION'] == "true"
|
||||
config.use_html5_by_default = ENV['USE_HTML5_BY_DEFAULT'] == "true"
|
||||
|
||||
# SMTP and action mailer
|
||||
if config.mail_notifications
|
||||
|
|
|
@ -76,8 +76,11 @@ en-US:
|
|||
upload_youtube: Youtube
|
||||
user_waiting_body: "%{user} is waiting to join %{meeting}!"
|
||||
user_waiting_title: A user is waiting
|
||||
client_html5: HTML5
|
||||
client_flash: Flash
|
||||
copied: Copied
|
||||
copy_error: Use Ctrl-c to copy
|
||||
currently_joining_with: Currently joining with %{client} client.
|
||||
create_your_session: Create your own meeting
|
||||
date_recorded: Date
|
||||
disallowed_characters_msg: Characters not allowed in meeting name $&,
|
||||
|
@ -157,6 +160,7 @@ en-US:
|
|||
past_recordings: Past Recordings
|
||||
preferences: Preferences
|
||||
preferences_logged: You must be logged in to edit preferences.
|
||||
prefered_client: Prefered Client
|
||||
presentation: Presentation
|
||||
previous_meetings: (previous meetings)
|
||||
qrcode:
|
||||
|
@ -176,6 +180,7 @@ en-US:
|
|||
start: Start
|
||||
start_join: Start
|
||||
start_meeting: Start meeting
|
||||
switch_clients: Switch Clients
|
||||
test_mailer:
|
||||
test_email:
|
||||
subject: Test Email
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddUseHtml5ToUsers < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :users, :use_html5, :boolean, default: false
|
||||
end
|
||||
end
|
13
db/schema.rb
13
db/schema.rb
|
@ -10,22 +10,23 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170518190442) do
|
||||
ActiveRecord::Schema.define(version: 20170928183010) do
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "provider", null: false
|
||||
t.string "uid", null: false
|
||||
t.string "provider", null: false
|
||||
t.string "uid", null: false
|
||||
t.string "name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "username"
|
||||
t.string "encrypted_id", null: false
|
||||
t.string "encrypted_id", null: false
|
||||
t.string "email"
|
||||
t.string "background_file_name"
|
||||
t.string "background_content_type"
|
||||
t.integer "background_file_size"
|
||||
t.datetime "background_updated_at"
|
||||
t.string "token"
|
||||
t.boolean "use_html5", default: true
|
||||
t.index ["email"], name: "index_users_on_email", unique: true
|
||||
t.index ["encrypted_id"], name: "index_users_on_encrypted_id", unique: true
|
||||
t.index ["provider", "uid"], name: "index_users_on_provider_and_uid", unique: true
|
||||
|
|
11
sample.env
11
sample.env
|
@ -23,6 +23,17 @@ SECRET_KEY_BASE=
|
|||
# BIGBLUEBUTTON_ENDPOINT=
|
||||
# BIGBLUEBUTTON_SECRET=
|
||||
|
||||
# Set default client (optional)
|
||||
#
|
||||
# By default, GreenLight will join users to a BigBlueButton session using the Flash
|
||||
# client. By setting USE_HTML5_BY_DEFAULT to true, you can configure GreenLight to
|
||||
# use the HTML5 client by default. GreenLight will only use the default for
|
||||
# non-authenticated users. Users who have authenticated are able to set their
|
||||
# prefered client under preferences. Also note that if the HTML5 client is not
|
||||
# running on a BigBlueButton server, all clients will be joined using Flash
|
||||
# regardless on any settings.
|
||||
USE_HTML5_BY_DEFAULT=false
|
||||
|
||||
# Twitter Login Provider (optional)
|
||||
#
|
||||
# You will need to register the app at https://apps.twitter.com/
|
||||
|
|
Loading…
Reference in New Issue