This commit is contained in:
bruckwubete
2018-06-29 10:08:58 -04:00
21 changed files with 463 additions and 46 deletions

View File

@ -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++;
}

View File

@ -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 {

View File

@ -155,7 +155,7 @@ class RoomsController < ApplicationController
def bring_to_room
if current_user
# Redirect authenticated users to their room.
redirect_to room_path(current_user.room)
redirect_to room_path(current_user.main_room)
else
# Redirect unauthenticated users to root.
redirect_to root_path

View File

@ -1,9 +1,7 @@
# frozen_string_literal: true
class SessionsController < ApplicationController
# GET /users/login
def new
end
LOGIN_FAILED = "Login failed due to invalid credentials. Are you sure you typed them correctly?"
# GET /users/logout
def destroy
@ -14,8 +12,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.try(:authenticate, session_params[:password])
login(user)
else
redirect_to root_path, notice: LOGIN_FAILED
end
end
@ -35,6 +35,9 @@ class SessionsController < ApplicationController
def omniauth
user = User.from_omniauth(request.env['omniauth.auth'])
login(user)
rescue => e
logger.error "Error authenticating via omniauth: #{e}"
redirect_to root_path
end
# POST /auth/failure

View File

@ -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
@ -98,7 +97,6 @@ class Room < ApplicationRecord
# Fetches all recordings for a room.
def recordings
res = bbb.get_recordings(meetingID: bbb_id)
# Format playbacks in a more pleasant way.
res[:recordings].each do |r|
next if r.key?(:error)
@ -143,13 +141,12 @@ class Room < ApplicationRecord
# Sets a BigBlueButtonApi object for interacting with the API.
def bbb
@bbb ||= BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8")
# @bbb ||= if Rails.configuration.loadbalanced_configuration
# lb_user = retrieve_loadbalanced_credentials(self.room.owner.provider)
# BigBlueButton::BigBlueButtonApi.new(remove_slash(lb_user["apiURL"]), lb_user["secret"], "0.8")
# else
# BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8")
# end
@bbb ||= if Rails.configuration.loadbalanced_configuration
lb_user = retrieve_loadbalanced_credentials(owner.provider)
BigBlueButton::BigBlueButtonApi.new(remove_slash(lb_user["apiURL"]), lb_user["secret"], "0.8")
else
BigBlueButton::BigBlueButtonApi.new(remove_slash(bbb_endpoint), bbb_secret, "0.8")
end
end
# Generates a uid for the room and BigBlueButton.
@ -176,7 +173,7 @@ class Room < ApplicationRecord
# Build the URI.
uri = encode_bbb_url(
Rails.configuration.loadbalancer_endpoint,
Rails.configuration.loadbalancer_endpoint + "getUser",
Rails.configuration.loadbalancer_secret,
name: provider
)

View File

@ -27,7 +27,7 @@
<i class="fas fa-exclamation-triangle"></i>
<p class="d-inline">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 %>

View File

@ -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 %>
<div class="background landing-section">
<div class="d-flex align-items-center" style="height: 100%;">
<div class="container text-center">

View File

@ -1,3 +1,3 @@
<div class="footer">
<footer class="footer page-footer">
<h5 class="text-center">Powered by <a target="_blank" href="http://bigbluebutton.org/">BigBlueButton</a>.</h5>
</div>
</footer>