diff --git a/app/assets/stylesheets/main/landing.scss b/app/assets/stylesheets/main/landing.scss
index b68180d3..d8a63cf8 100644
--- a/app/assets/stylesheets/main/landing.scss
+++ b/app/assets/stylesheets/main/landing.scss
@@ -19,7 +19,7 @@
width: 100px;
}
-.previously-joined {
+.previously-joined, .actives {
list-style-type: none;
margin:auto;
width: 200px;
diff --git a/app/channels/refresh_meetings_channel.rb b/app/channels/refresh_meetings_channel.rb
new file mode 100644
index 00000000..ebb973ff
--- /dev/null
+++ b/app/channels/refresh_meetings_channel.rb
@@ -0,0 +1,21 @@
+# 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 .
+
+class RefreshMeetingsChannel < ApplicationCable::Channel
+ def subscribed
+ stream_from "refresh_meetings"
+ end
+end
diff --git a/app/controllers/bbb_controller.rb b/app/controllers/bbb_controller.rb
index 6b47975b..dc2350e1 100644
--- a/app/controllers/bbb_controller.rb
+++ b/app/controllers/bbb_controller.rb
@@ -111,8 +111,8 @@ class BbbController < ApplicationController
head(:ok) && return unless validate_checksum
begin
- data = JSON.parse(read_body(request))
- treat_callback_event(data["event"])
+ data = JSON.parse(params['event'])
+ treat_callback_event(data)
rescue Exception => e
logger.error "Error parsing webhook data. Data: #{data}, exception: #{e.inspect}"
@@ -242,6 +242,15 @@ class BbbController < ApplicationController
else
logger.error "Bad format for event #{event}, won't process"
end
+ elsif eventName == "meeting_created_message"
+ # Fire an Actioncable event that updates _previously_joined for the client.
+ actioncable_event('create', params['id'])
+ elsif eventName == "meeting_destroyed_event"
+ actioncable_event('destroy', params['id'])
+ elsif eventName == "user_joined_message"
+ actioncable_event('join', params['id'], event['payload']['user']['role'])
+ elsif eventName == "user_left_message"
+ actioncable_event('leave', params['id'], event['payload']['user']['role'])
else
logger.info "Callback event will not be treated. Event name: #{eventName}"
end
@@ -249,15 +258,31 @@ class BbbController < ApplicationController
render head(:ok) && return
end
+ def actioncable_event(method, id, role = 'none')
+ ActionCable.server.broadcast 'refresh_meetings',
+ method: method,
+ meeting: id,
+ role: role
+ end
+
# Validates the checksum received in a callback call.
# If the checksum doesn't match, renders an ok and aborts execution.
def validate_checksum
secret = ENV['BIGBLUEBUTTON_SECRET']
checksum = params["checksum"]
- data = read_body(request)
+
+ # Decode and break the body into parts.
+ parts = URI.decode_www_form(read_body(request))
+
+ # Convert the data into the correct checksum format, replace ruby hash arrows.
+ converted_data = {parts[0][0]=>parts[0][1],parts[1][0]=>parts[1][1].to_i}.to_s.gsub!('=>', ':')
+
+ # Manually remove the space between the two elements.
+ converted_data[converted_data.rindex("timestamp") - 2] = ''
+
callback_url = uri_remove_param(request.original_url, "checksum")
- checksum_str = "#{callback_url}#{data}#{secret}"
+ checksum_str = "#{callback_url}#{converted_data}#{secret}"
calculated_checksum = Digest::SHA1.hexdigest(checksum_str)
if calculated_checksum != checksum
diff --git a/app/controllers/landing_controller.rb b/app/controllers/landing_controller.rb
index bcc83bd1..4f67eec3 100644
--- a/app/controllers/landing_controller.rb
+++ b/app/controllers/landing_controller.rb
@@ -34,6 +34,10 @@ class LandingController < ApplicationController
end
end
+ def send_data
+ render json: bbb.get_meetings
+ end
+
def wait_for_moderator
render layout: false
end
diff --git a/app/views/landing/_previously_joined.html.erb b/app/views/landing/_previously_joined.html.erb
index 77470322..67cd04d0 100644
--- a/app/views/landing/_previously_joined.html.erb
+++ b/app/views/landing/_previously_joined.html.erb
@@ -13,9 +13,142 @@
# with BigBlueButton; if not, see .
%>
-
-
-
<%= t('previous_meetings') %>
-
+<% if current_user %>
+
+
+
+
+
<%= t('previous_meetings') %>
+
+
+
+
+
+
<%= t('active_meetings') %>
+
+
+
+
-
+<% end %>
+
+
diff --git a/config/locales/en-us.yml b/config/locales/en-us.yml
index 4dc9358a..d5a8b7dd 100644
--- a/config/locales/en-us.yml
+++ b/config/locales/en-us.yml
@@ -37,6 +37,7 @@
en-US:
actions: Actions
+ active_meetings: (active meetings)
admin_room_title: Welcome %{user}
are_you: Are you %{name}?
are_you_sure: Are you sure?
diff --git a/config/routes.rb b/config/routes.rb
index 833311c3..e4204cad 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -48,6 +48,7 @@ Rails.application.routes.draw do
post '/:room_id/:id/callback', to: 'bbb#callback', :constraints => {:id => disallow_slash, :room_id => disallow_slash}
# routes shared between meetings and rooms
+ get '/(:room_id)/request', to: 'landing#send_data', :defaults => { :format => 'xml' }
get '/(:room_id)/:id/join', to: 'bbb#join', defaults: {room_id: nil, format: 'json'}, :constraints => {:id => disallow_slash, :room_id => disallow_slash}
get '/(:room_id)/:id', to: 'landing#resource', as: :meeting_room, defaults: {room_id: nil}, :constraints => {:id => disallow_slash, :room_id => disallow_slash}
end