forked from External/greenlight
		
	recording management
This commit is contained in:
		@@ -3,6 +3,8 @@ class RoomsController < ApplicationController
 | 
				
			|||||||
  before_action :find_room, except: :create
 | 
					  before_action :find_room, except: :create
 | 
				
			||||||
  before_action :verify_room_ownership, only: [:start, :destroy, :home]
 | 
					  before_action :verify_room_ownership, only: [:start, :destroy, :home]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  META_LISTED = "gl-listed"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # POST /r
 | 
					  # POST /r
 | 
				
			||||||
  def create
 | 
					  def create
 | 
				
			||||||
    room = Room.new(name: room_params[:name])
 | 
					    room = Room.new(name: room_params[:name])
 | 
				
			||||||
@@ -90,11 +92,16 @@ class RoomsController < ApplicationController
 | 
				
			|||||||
    redirect_to @room    
 | 
					    redirect_to @room    
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # PATCH /r/:room_uid/:record_id
 | 
					  # POST /r/:room_uid/:record_id
 | 
				
			||||||
  def update_recording
 | 
					  def update_recording
 | 
				
			||||||
    bbb.publish_recordings(params[:record_id], params[:publish])
 | 
					    meta = {
 | 
				
			||||||
 | 
					      "meta_#{META_LISTED}": (params[:state] == "public")
 | 
				
			||||||
    
 | 
					    }
 | 
				
			||||||
 | 
					    puts '-------------'
 | 
				
			||||||
 | 
					    puts params[:record_id]
 | 
				
			||||||
 | 
					    res = @room.update_recording(params[:record_id], meta)
 | 
				
			||||||
 | 
					    puts res
 | 
				
			||||||
 | 
					    redirect_to @room if res[:updated]
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # DELETE /r/:room_uid/:record_id
 | 
					  # DELETE /r/:room_uid/:record_id
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,8 @@ class Room < ApplicationRecord
 | 
				
			|||||||
      logoutURL: options[:meeting_logout_url] || '',
 | 
					      logoutURL: options[:meeting_logout_url] || '',
 | 
				
			||||||
      moderatorPW: random_password(12),
 | 
					      moderatorPW: random_password(12),
 | 
				
			||||||
      attendeePW: random_password(12),
 | 
					      attendeePW: random_password(12),
 | 
				
			||||||
      moderatorOnlyMessage: options[:moderator_message]
 | 
					      moderatorOnlyMessage: options[:moderator_message],
 | 
				
			||||||
 | 
					      "meta_gl-listed": false
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Increment room sessions.
 | 
					    # Increment room sessions.
 | 
				
			||||||
@@ -81,11 +82,11 @@ class Room < ApplicationRecord
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Generate the join URL.
 | 
					    # Generate the join URL.
 | 
				
			||||||
    if uid
 | 
					    join_opts = {}
 | 
				
			||||||
      bbb.join_meeting_url(bbb_id, name, password, {userID: uid})
 | 
					    join_opts.merge!({userID: uid}) if uid
 | 
				
			||||||
    else
 | 
					    join_opts.merge!({joinViaHtml5: true}) if Rails.configuration.html5_enabled
 | 
				
			||||||
      bbb.join_meeting_url(bbb_id, name, password)
 | 
					    
 | 
				
			||||||
    end
 | 
					    bbb.join_meeting_url(bbb_id, name, password, join_opts)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Notify waiting users that a meeting has started.
 | 
					  # Notify waiting users that a meeting has started.
 | 
				
			||||||
@@ -129,6 +130,12 @@ class Room < ApplicationRecord
 | 
				
			|||||||
    res[:recordings]
 | 
					    res[:recordings]
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def update_recording(record_id, meta)
 | 
				
			||||||
 | 
					    meta.merge!({recordID: record_id})
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					    bbb.send_api_request("updateRecordings", meta)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Deletes a recording from a room.
 | 
					  # Deletes a recording from a room.
 | 
				
			||||||
  def delete_recording(record_id)
 | 
					  def delete_recording(record_id)
 | 
				
			||||||
    res = bbb.delete_recordings(record_id)
 | 
					    res = bbb.delete_recordings(record_id)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,7 @@
 | 
				
			|||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <div class="col-lg-3 col-sm-12 bottom-div mt-5">
 | 
					      <div class="col-lg-3 col-sm-12 bottom-div mt-5">
 | 
				
			||||||
        <% if @is_running %>
 | 
					        <% if @is_running %>
 | 
				
			||||||
          <div class="btn btn-success btn-block px-7 start-button float-right">In Progress</div>
 | 
					          <%= button_to "Join", room_path(@room), class: "btn btn-primary btn-block px-7 start-button float-right" %>
 | 
				
			||||||
        <% else %>
 | 
					        <% else %>
 | 
				
			||||||
          <%= button_to "Start", start_room_path(@room), class: "btn btn-primary btn-block px-7 start-button float-right" %>
 | 
					          <%= button_to "Start", start_room_path(@room), class: "btn btn-primary btn-block px-7 start-button float-right" %>
 | 
				
			||||||
        <% end %>
 | 
					        <% end %>
 | 
				
			||||||
@@ -55,6 +55,7 @@
 | 
				
			|||||||
var invite_url;
 | 
					var invite_url;
 | 
				
			||||||
var copy = $('#copy');
 | 
					var copy = $('#copy');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Handle copy button.
 | 
				
			||||||
copy.on('click', function(){
 | 
					copy.on('click', function(){
 | 
				
			||||||
  var inviteURL = $('#invite-url');
 | 
					  var inviteURL = $('#invite-url');
 | 
				
			||||||
  inviteURL.select();
 | 
					  inviteURL.select();
 | 
				
			||||||
@@ -70,4 +71,15 @@ copy.on('click', function(){
 | 
				
			|||||||
    }, 2000)
 | 
					    }, 2000)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Handle recording emails.
 | 
				
			||||||
 | 
					$('.email-link').each(function(){
 | 
				
			||||||
 | 
					  $(this).click(function(){
 | 
				
			||||||
 | 
					    var subject = $(".username").text() + " has invited you to view a recording.";
 | 
				
			||||||
 | 
					    var body = "To view the recording, follow the link below:\n\n" + $(this).attr("data-pres-link");
 | 
				
			||||||
 | 
					    var footer = "\n\nThis e-mail is auto-generated by BigBlueButton.\nBigBlueButton is an open source web conferencing system. For more information on BigBlueButton, see https://bigbluebutton.org/."
 | 
				
			||||||
 | 
					    var win = window.open("mailto:?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(body) + encodeURIComponent(footer), '_blank');
 | 
				
			||||||
 | 
					    win.focus();
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@
 | 
				
			|||||||
								<span class="avatar" style="background-image: url(<%= current_user.image %>)"></span>
 | 
													<span class="avatar" style="background-image: url(<%= current_user.image %>)"></span>
 | 
				
			||||||
							<% end %>
 | 
												<% end %>
 | 
				
			||||||
							<span class="ml-2 d-none d-lg-block">
 | 
												<span class="ml-2 d-none d-lg-block">
 | 
				
			||||||
								<span class="text-default"><%= current_user.name %></span>
 | 
													<span class="text-default username"><%= current_user.name %></span>
 | 
				
			||||||
							</span>
 | 
												</span>
 | 
				
			||||||
						</a>
 | 
											</a>
 | 
				
			||||||
						<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow" x-placement="bottom-end" style="position: absolute; transform: translate3d(-56px, 32px, 0px); top: 0px; left: 0px; will-change: transform;">
 | 
											<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow" x-placement="bottom-end" style="position: absolute; transform: translate3d(-56px, 32px, 0px); top: 0px; left: 0px; will-change: transform;">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,12 +27,16 @@
 | 
				
			|||||||
  </td>
 | 
					  </td>
 | 
				
			||||||
  <td class="text-left">
 | 
					  <td class="text-left">
 | 
				
			||||||
    <div class="dropdown">
 | 
					    <div class="dropdown">
 | 
				
			||||||
 | 
					      <% if recording[:metadata]["gl-listed"] %>
 | 
				
			||||||
        <button class="btn btn-sm btn-secondary dropdown-toggle" data-toggle="dropdown"><i class="dropdown-icon fe fe-globe px-2"></i> Public</button>
 | 
					        <button class="btn btn-sm btn-secondary dropdown-toggle" data-toggle="dropdown"><i class="dropdown-icon fe fe-globe px-2"></i> Public</button>
 | 
				
			||||||
 | 
					      <% else %>
 | 
				
			||||||
 | 
					        <button class="btn btn-sm btn-secondary dropdown-toggle" data-toggle="dropdown"><i class="dropdown-icon fe fe-link px-2"></i> Unlisted</button>
 | 
				
			||||||
 | 
					      <% end %>
 | 
				
			||||||
      <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
 | 
					      <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
 | 
				
			||||||
        <%= button_to update_recording_path(@room, record_id: recording[:recordID]), method: :patch, class: "dropdown-item" do %>
 | 
					        <%= button_to update_recording_path(@room, record_id: recording[:recordID], state: "public"), class: "dropdown-item" do %>
 | 
				
			||||||
          <i class="dropdown-icon fe fe-globe"></i> Public
 | 
					          <i class="dropdown-icon fe fe-globe"></i> Public
 | 
				
			||||||
        <% end %>
 | 
					        <% end %>
 | 
				
			||||||
        <%= button_to update_recording_path(@room, record_id: recording[:recordID]), method: :patch, class: "dropdown-item" do %>
 | 
					        <%= button_to update_recording_path(@room, record_id: recording[:recordID], state: "unlisted"), class: "dropdown-item" do %>
 | 
				
			||||||
          <i class="dropdown-icon fe fe-link"></i> Unlisted
 | 
					          <i class="dropdown-icon fe fe-link"></i> Unlisted
 | 
				
			||||||
        <% end %>
 | 
					        <% end %>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
@@ -46,8 +50,8 @@
 | 
				
			|||||||
  <td class="text-center">
 | 
					  <td class="text-center">
 | 
				
			||||||
    <div class="item-action dropdown">
 | 
					    <div class="item-action dropdown">
 | 
				
			||||||
      <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
 | 
					      <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
 | 
				
			||||||
      <div class="dropdown-menu dropdown-menu-right" x-placement="bottom-end" style="position: absolute; transform: translate3d(-181px, -156px, 0px); top: 0px; left: 0px; will-change: transform;">
 | 
					      <div class="dropdown-menu dropdown-menu-right">
 | 
				
			||||||
        <a href="javascript:void(0)" class="dropdown-item"><i class="dropdown-icon far fa-envelope"></i> Email Recording</a>
 | 
					        <a class="dropdown-item email-link" data-pres-link="<%= p[:url] %>"><i class="dropdown-icon far fa-envelope"></i> Email Recording</a>
 | 
				
			||||||
        <div class="dropdown-divider"></div>
 | 
					        <div class="dropdown-divider"></div>
 | 
				
			||||||
        <%= button_to delete_recording_path(@room, record_id: recording[:recordID]), method: :delete, class: "dropdown-item" do %>
 | 
					        <%= button_to delete_recording_path(@room, record_id: recording[:recordID]), method: :delete, class: "dropdown-item" do %>
 | 
				
			||||||
          <i class="dropdown-icon far fa-trash-alt"></i> Delete
 | 
					          <i class="dropdown-icon far fa-trash-alt"></i> Delete
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								config/initializers/html5.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								config/initializers/html5.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					# 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)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user