From 232a0dfc004f5d5d89add7fc8e5c46d282f0f656 Mon Sep 17 00:00:00 2001 From: rafafp Date: Fri, 12 Jan 2018 15:23:52 -0200 Subject: [PATCH 1/3] Adding a config variable to enable the playback url authentication --- .env.development | 3 +++ config/initializers/bigbluebutton_rails.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/.env.development b/.env.development index 891b3893e..5a3f515c3 100644 --- a/.env.development +++ b/.env.development @@ -40,3 +40,6 @@ MCONF_EMAIL_TRACK_CLICKED=true # MCONF_OMNIAUTH_FACEBOOK_KEY='yourfacebookkey' # MCONF_OMNIAUTH_GOOGLE_SECRET='yourgooglesecret' # MCONF_OMNIAUTH_FACEBOOK_SECRET='yourfacebooksecret' + +# Flag to use authentication on playback url +# MCONF_PLAYBACK_URL_AUTH='true' diff --git a/config/initializers/bigbluebutton_rails.rb b/config/initializers/bigbluebutton_rails.rb index 8c5de72ec..3b7187b8b 100644 --- a/config/initializers/bigbluebutton_rails.rb +++ b/config/initializers/bigbluebutton_rails.rb @@ -6,6 +6,7 @@ BigbluebuttonRails.configure do |config| config.guest_support = true + config.playback_url_authentication = ENV['MCONF_PLAYBACK_URL_AUTH'] == 'true' # Set the invitation URL to the full URL of the room config.get_invitation_url = Proc.new do |room| From f74776c0839972d845a6dfe29ab7db136aa5f673 Mon Sep 17 00:00:00 2001 From: Leonardo Crauss Daronco Date: Thu, 22 Feb 2018 11:07:04 -0300 Subject: [PATCH 2/3] Update bigbluebutton_rails, adds playback authentication --- .env.development | 2 +- Gemfile.lock | 2 +- config/application.rb | 3 +++ config/initializers/bigbluebutton_rails.rb | 2 +- .../20171114142537_bigbluebutton_rails_to230.rb | 2 ++ db/schema.rb | 11 ++++++----- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.env.development b/.env.development index 5a3f515c3..c87c5dc64 100644 --- a/.env.development +++ b/.env.development @@ -42,4 +42,4 @@ MCONF_EMAIL_TRACK_CLICKED=true # MCONF_OMNIAUTH_FACEBOOK_SECRET='yourfacebooksecret' # Flag to use authentication on playback url -# MCONF_PLAYBACK_URL_AUTH='true' +# MCONF_PLAYBACK_URL_AUTH=true diff --git a/Gemfile.lock b/Gemfile.lock index 746c43261..41a6596ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ GIT GIT remote: https://github.com/mconf/bigbluebutton_rails.git - revision: 820bfeb38ca23de2a89b6cc37f850d626f67e527 + revision: fedfa6010a660e31e81cc27197063b4d60f6f0a5 branch: master specs: bigbluebutton_rails (2.2.0) diff --git a/config/application.rb b/config/application.rb index 9aaa0ddb5..4d14bc7c8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -126,6 +126,9 @@ class Application < Rails::Application # Set if to false to use the old model based on the `record` flag on the `create` API call. config.per_user_record_permissions = ENV['MCONF_PER_USER_RECORD_PERMISSIONS'] == 'true' + # Authenticate playback URLs for recordings + config.playback_url_authentication = ENV['MCONF_PLAYBACK_URL_AUTH'] == 'true' + # Themes: configure assets paths here! # config.assets.paths << Rails.root.join("app", "assets", "themes", "my-theme", "stylesheets") # config.assets.paths << Rails.root.join("app", "assets", "themes", "my-theme", "images") diff --git a/config/initializers/bigbluebutton_rails.rb b/config/initializers/bigbluebutton_rails.rb index 3b7187b8b..ae3b5b435 100644 --- a/config/initializers/bigbluebutton_rails.rb +++ b/config/initializers/bigbluebutton_rails.rb @@ -6,7 +6,7 @@ BigbluebuttonRails.configure do |config| config.guest_support = true - config.playback_url_authentication = ENV['MCONF_PLAYBACK_URL_AUTH'] == 'true' + config.playback_url_authentication = true #Rails.application.config.playback_url_authentication # Set the invitation URL to the full URL of the room config.get_invitation_url = Proc.new do |room| diff --git a/db/migrate/20171114142537_bigbluebutton_rails_to230.rb b/db/migrate/20171114142537_bigbluebutton_rails_to230.rb index 1706c25d1..4a73143d5 100644 --- a/db/migrate/20171114142537_bigbluebutton_rails_to230.rb +++ b/db/migrate/20171114142537_bigbluebutton_rails_to230.rb @@ -2,10 +2,12 @@ class BigbluebuttonRailsTo230 < ActiveRecord::Migration def up rename_column :bigbluebutton_rooms, :param, :slug rename_column :bigbluebutton_servers, :param, :slug + add_column :bigbluebutton_recordings, :recording_users, :text end def down rename_column :bigbluebutton_servers, :slug, :param rename_column :bigbluebutton_rooms, :slug, :param + remove_column :bigbluebutton_recordings, :recording_users end end diff --git a/db/schema.rb b/db/schema.rb index 10e6047e2..98414ab31 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -120,15 +120,16 @@ t.string "recordid" t.string "meetingid" t.string "name" - t.boolean "published", default: false - t.boolean "available", default: true + t.boolean "published", default: false + t.boolean "available", default: true t.datetime "created_at" t.datetime "updated_at" t.text "description" t.integer "meeting_id" - t.integer "size", limit: 8, default: 0 - t.decimal "start_time", precision: 14, scale: 0 - t.decimal "end_time", precision: 14, scale: 0 + t.integer "size", limit: 8, default: 0 + t.decimal "start_time", precision: 14, scale: 0 + t.decimal "end_time", precision: 14, scale: 0 + t.text "recording_users" end add_index "bigbluebutton_recordings", ["recordid"], name: "index_bigbluebutton_recordings_on_recordid", unique: true, using: :btree From 483f6e3863ab109442a7a0be9785e9e46cfdc835 Mon Sep 17 00:00:00 2001 From: Leonardo Crauss Daronco Date: Thu, 22 Feb 2018 17:44:49 -0300 Subject: [PATCH 3/3] Update bigbluebutton_rails and show recordings in an iframe --- .env.development | 2 + .env.production | 2 + Gemfile.lock | 2 +- .../custom_bigbluebutton_recordings/play.scss | 10 +++ ...tom_bigbluebutton_recordings_controller.rb | 11 ++- ...tom_bigbluebutton_playback_types_helper.rb | 4 +- app/views/layouts/application.html.haml | 89 +++++++------------ app/views/layouts/base.html.haml | 29 ++++++ config/application.rb | 2 + config/initializers/bigbluebutton_rails.rb | 3 +- ...0171114142537_bigbluebutton_rails_to230.rb | 2 + db/schema.rb | 5 +- spec/factories/bigbluebutton_playback_type.rb | 1 + ...igbluebutton_playback_types_helper_spec.rb | 16 ++-- 14 files changed, 109 insertions(+), 69 deletions(-) create mode 100644 app/assets/stylesheets/app/custom_bigbluebutton_recordings/play.scss create mode 100644 app/views/layouts/base.html.haml diff --git a/.env.development b/.env.development index c87c5dc64..23c3df52a 100644 --- a/.env.development +++ b/.env.development @@ -43,3 +43,5 @@ MCONF_EMAIL_TRACK_CLICKED=true # Flag to use authentication on playback url # MCONF_PLAYBACK_URL_AUTH=true +# Show playback pages in an iframe instead of redirecting +# MCONF_PLAYBACK_IFRAME=true diff --git a/.env.production b/.env.production index 15e9562b7..63e2c8e30 100644 --- a/.env.production +++ b/.env.production @@ -3,3 +3,5 @@ MCONF_DATABASE_PROD_USERNAME='root' MCONF_DATABASE_PROD_PASSWORD='' MCONF_EMAIL_TRACK_OPENED=true MCONF_EMAIL_TRACK_CLICKED=true +MCONF_PLAYBACK_URL_AUTH=false +MCONF_PLAYBACK_IFRAME=true diff --git a/Gemfile.lock b/Gemfile.lock index 41a6596ed..b0fe83d85 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ GIT GIT remote: https://github.com/mconf/bigbluebutton_rails.git - revision: fedfa6010a660e31e81cc27197063b4d60f6f0a5 + revision: 80e517e2c029af4d385308f5ce47174271b30bfa branch: master specs: bigbluebutton_rails (2.2.0) diff --git a/app/assets/stylesheets/app/custom_bigbluebutton_recordings/play.scss b/app/assets/stylesheets/app/custom_bigbluebutton_recordings/play.scss new file mode 100644 index 000000000..e9d2dd00f --- /dev/null +++ b/app/assets/stylesheets/app/custom_bigbluebutton_recordings/play.scss @@ -0,0 +1,10 @@ +@import "compass/css3"; +@import "definitions"; + +@import "app/shared/recording_list"; + +body.custom_bigbluebutton_recordings.play { + padding: 0; + margin: 0; + overflow: hidden; +} \ No newline at end of file diff --git a/app/controllers/custom_bigbluebutton_recordings_controller.rb b/app/controllers/custom_bigbluebutton_recordings_controller.rb index c5f9b1fc5..9d4565b19 100644 --- a/app/controllers/custom_bigbluebutton_recordings_controller.rb +++ b/app/controllers/custom_bigbluebutton_recordings_controller.rb @@ -12,7 +12,16 @@ class CustomBigbluebuttonRecordingsController < Bigbluebutton::RecordingsControl load_and_authorize_resource :find_by => :recordid, :class => "BigbluebuttonRecording" - layout "manage" + layout :determine_layout + + def determine_layout + case params[:action].to_sym + when :play + 'base' + else + 'manage' + end + end # TODO: #1087 redirect back after updating the desc of a recording diff --git a/app/helpers/custom_bigbluebutton_playback_types_helper.rb b/app/helpers/custom_bigbluebutton_playback_types_helper.rb index ff4d28630..6f3aac731 100644 --- a/app/helpers/custom_bigbluebutton_playback_types_helper.rb +++ b/app/helpers/custom_bigbluebutton_playback_types_helper.rb @@ -12,7 +12,7 @@ module CustomBigbluebuttonPlaybackTypesHelper def link_to_playback(recording, playback, options={}) link_params = { type: playback.format_type } - if playback.identifier == 'presentation_video' + if playback.downloadable? name = if recording.description.blank? recording.name else @@ -20,9 +20,7 @@ def link_to_playback(recording, playback, options={}) end options.merge!(download: name.parameterize('_')) link_params.merge!(name: name.parameterize('_')) - end - if ['presentation_video', 'presentation_export'].include?(playback.identifier) playback_icon = icon_rec_download else playback_icon = icon_rec_play diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 14b2250bb..6c0edd4d4 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,66 +1,45 @@ -!!! Strict -%html{:lang => I18n.locale.to_s} +-# Default layout += content_for :base_content do + - if sidenav_visible? + #sidenav= render :partial => "layouts/sidenav" - %head - %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-type"} - %title= content_for?(:title) ? yield(:title) : current_site.name - = theme_favico - = csrf_meta_tag + - cls_sidenav = sidenav_visible? ? 'with-sidenav' : 'without-sidenav' + #site{ class: cls_sidenav } + #navbar + = render :partial => 'layouts/navbar' - = stylesheet_link_tag "application_print", :media => "print" - = stylesheet_link_tag "application", :media => "screen, projection" - = stylesheet_link_tag_for_controller :media => "screen, projection" - = stylesheet_link_tag "_development" unless Rails.env == "production" - = stylesheet_link_tag "https://fonts.googleapis.com/css?family=Roboto:300,400,700,900", rel: "stylesheet" - = yield :stylesheets + - if content_for?(:content_notification) + #content-notification + = yield :content_notification - = yield :headers + #content - %body{:class => "#{controller_name_for_view} #{params[:action]} #{layout_name} #{theme_class}"} - - if sidenav_visible? - #sidenav= render :partial => "layouts/sidenav" + - if content_for?(:sidebar) || content_for?(:sidebar_menu) + #sidebar + = yield :sidebar + - if content_for?(:sidebar_menu) + #sidebar-menu + = yield :sidebar_menu - - cls_sidenav = sidenav_visible? ? 'with-sidenav' : 'without-sidenav' - #site{ class: cls_sidenav } - #navbar - = render :partial => 'layouts/navbar' + #content-middle - - if content_for?(:content_notification) - #content-notification - = yield :content_notification + -# an internal menu for the page to navigate through sub-pages + - if content_for?(:page_menu) + #page-menu + = yield :page_menu - #content + -# a list of actions for this page (e.g. destroy resource) + - if content_for?(:page_actions) + #page-actions + = yield :page_actions - - if content_for?(:sidebar) || content_for?(:sidebar_menu) - #sidebar - = yield :sidebar - - if content_for?(:sidebar_menu) - #sidebar-menu - = yield :sidebar_menu + -# the actual page content + = yield - #content-middle + #footer-pusher - -# an internal menu for the page to navigate through sub-pages - - if content_for?(:page_menu) - #page-menu - = yield :page_menu + = render :partial => "layouts/footer" + = render :partial => "layouts/analytics" + = render :partial => "layouts/notifications" - -# a list of actions for this page (e.g. destroy resource) - - if content_for?(:page_actions) - #page-actions - = yield :page_actions - - -# the actual page content - = yield - - #footer-pusher - - = render :partial => "layouts/footer" - = render :partial => "layouts/analytics" - = render :partial => "layouts/notifications" - - -# Javascript placed at the end of the document so the pages load faster - = javascript_include_tag "application" - = render :partial => 'layouts/javascript_locales' - = javascript_include_tag_for_controller - = yield :javascripts += render :file => 'layouts/base' diff --git a/app/views/layouts/base.html.haml b/app/views/layouts/base.html.haml new file mode 100644 index 000000000..5cba2086c --- /dev/null +++ b/app/views/layouts/base.html.haml @@ -0,0 +1,29 @@ +!!! Strict +%html{:lang => I18n.locale.to_s} + + %head + %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-type"} + %title= content_for?(:title) ? yield(:title) : current_site.name + = theme_favico + = csrf_meta_tag + + = stylesheet_link_tag "application_print", :media => "print" + = stylesheet_link_tag "application", :media => "screen, projection" + = stylesheet_link_tag_for_controller :media => "screen, projection" + = stylesheet_link_tag "_development" unless Rails.env == "production" + = stylesheet_link_tag "https://fonts.googleapis.com/css?family=Roboto:300,400,700,900", rel: "stylesheet" + = yield :stylesheets + + = yield :headers + + %body{:class => "#{controller_name_for_view} #{params[:action]} #{layout_name} #{theme_class}"} + - if content_for?(:base_content) + = yield :base_content + - else + = yield + + -# Javascript placed at the end of the document so the pages load faster + = javascript_include_tag "application" + = render :partial => 'layouts/javascript_locales' + = javascript_include_tag_for_controller + = yield :javascripts diff --git a/config/application.rb b/config/application.rb index 4d14bc7c8..2a54c50cd 100644 --- a/config/application.rb +++ b/config/application.rb @@ -128,6 +128,8 @@ class Application < Rails::Application # Authenticate playback URLs for recordings config.playback_url_authentication = ENV['MCONF_PLAYBACK_URL_AUTH'] == 'true' + # Show the playback in an iframe. If false, redirects the user to the playback page. + config.playback_iframe = ENV['MCONF_PLAYBACK_IFRAME'] == 'true' # Themes: configure assets paths here! # config.assets.paths << Rails.root.join("app", "assets", "themes", "my-theme", "stylesheets") diff --git a/config/initializers/bigbluebutton_rails.rb b/config/initializers/bigbluebutton_rails.rb index ae3b5b435..3f9e5407f 100644 --- a/config/initializers/bigbluebutton_rails.rb +++ b/config/initializers/bigbluebutton_rails.rb @@ -6,7 +6,8 @@ BigbluebuttonRails.configure do |config| config.guest_support = true - config.playback_url_authentication = true #Rails.application.config.playback_url_authentication + config.playback_url_authentication = Rails.application.config.playback_url_authentication + config.playback_iframe = Rails.application.config.playback_iframe # Set the invitation URL to the full URL of the room config.get_invitation_url = Proc.new do |room| diff --git a/db/migrate/20171114142537_bigbluebutton_rails_to230.rb b/db/migrate/20171114142537_bigbluebutton_rails_to230.rb index 4a73143d5..11e0b8b52 100644 --- a/db/migrate/20171114142537_bigbluebutton_rails_to230.rb +++ b/db/migrate/20171114142537_bigbluebutton_rails_to230.rb @@ -3,9 +3,11 @@ def up rename_column :bigbluebutton_rooms, :param, :slug rename_column :bigbluebutton_servers, :param, :slug add_column :bigbluebutton_recordings, :recording_users, :text + add_column :bigbluebutton_playback_types, :downloadable, :boolean, default: false end def down + remove_column :bigbluebutton_playback_types, :downloadable rename_column :bigbluebutton_servers, :slug, :param rename_column :bigbluebutton_rooms, :slug, :param remove_column :bigbluebutton_recordings, :recording_users diff --git a/db/schema.rb b/db/schema.rb index 98414ab31..1121889ff 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -108,10 +108,11 @@ create_table "bigbluebutton_playback_types", force: true do |t| t.string "identifier" - t.boolean "visible", default: false - t.boolean "default", default: false + t.boolean "visible", default: false + t.boolean "default", default: false t.datetime "created_at" t.datetime "updated_at" + t.boolean "downloadable", default: false end create_table "bigbluebutton_recordings", force: true do |t| diff --git a/spec/factories/bigbluebutton_playback_type.rb b/spec/factories/bigbluebutton_playback_type.rb index ba883cbf3..a9f0f5c41 100644 --- a/spec/factories/bigbluebutton_playback_type.rb +++ b/spec/factories/bigbluebutton_playback_type.rb @@ -9,5 +9,6 @@ pbt.sequence(:identifier) { |n| "#{Forgery(:name).first_name.downcase}-#{n}" } pbt.visible true pbt.default false + pbt.downloadable false end end diff --git a/spec/helpers/custom_bigbluebutton_playback_types_helper_spec.rb b/spec/helpers/custom_bigbluebutton_playback_types_helper_spec.rb index 7ba93012f..b3356c305 100644 --- a/spec/helpers/custom_bigbluebutton_playback_types_helper_spec.rb +++ b/spec/helpers/custom_bigbluebutton_playback_types_helper_spec.rb @@ -13,8 +13,8 @@ describe "#link_to_playback" do let(:recording) { FactoryGirl.create(:bigbluebutton_recording) } let(:presentation) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation") } - let(:presentation_export) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation_export") } - let(:presentation_video) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation_video") } + let(:presentation_export) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation_export", downloadable: true) } + let(:presentation_video) { FactoryGirl.create(:bigbluebutton_playback_type, identifier: "presentation_video", downloadable: true) } context "when the identifier was presentation" do let(:playback) { FactoryGirl.create(:bigbluebutton_playback_format, playback_type: presentation) } @@ -27,10 +27,14 @@ it("returns the correctly link") { should eq(link) } end - context "when the identifier was presentation_export" do + context "when the identifier is presentation_export" do let(:playback) { FactoryGirl.create(:bigbluebutton_playback_format, playback_type: presentation_export) } - let!(:link) { - link_to icon_rec_download, play_bigbluebutton_recording_path(recording, type: presentation_export.identifier), options_for_tooltip(t("bigbluebutton_rails.playback_types.presentation_export.tip")) + let(:name) { 'my_recording' } + let(:link) { + link_to icon_rec_download, play_bigbluebutton_recording_path(recording, { type: presentation_export.identifier, name: name }), options_for_tooltip(t("bigbluebutton_rails.playback_types.presentation_export.tip"), { download: name }) + } + before { + recording.update_attributes(description: 'my recording') } subject { link_to_playback(recording, playback) } @@ -38,7 +42,7 @@ it("returns the correctly link") { should eq(link) } end - context "when the identifier was presentation_video" do + context "when the identifier is presentation_video" do let(:playback) { FactoryGirl.create(:bigbluebutton_playback_format, playback_type: presentation_video) } subject { link_to_playback(recording, playback) }