Pass createTime as part of the join call (#2488)

This commit is contained in:
Ahmad Farhat 2021-01-27 19:48:39 -05:00 committed by GitHub
parent 6ee92c839b
commit 062525d2d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 5 deletions

View File

@ -54,6 +54,7 @@ module BbbServer
join_opts = {} join_opts = {}
join_opts[:userID] = uid if uid join_opts[:userID] = uid if uid
join_opts[:join_via_html5] = true join_opts[:join_via_html5] = true
join_opts[:createTime] = room.last_session.to_datetime.strftime("%Q")
bbb_server.join_meeting_url(room.bbb_id, name, password, join_opts) bbb_server.join_meeting_url(room.bbb_id, name, password, join_opts)
end end
@ -88,7 +89,7 @@ module BbbServer
end end
unless meeting[:messageKey] == 'duplicateWarning' unless meeting[:messageKey] == 'duplicateWarning'
room.update_attributes(sessions: room.sessions + 1, last_session: DateTime.now) room.update_attributes(sessions: room.sessions + 1, last_session: DateTime.strptime(meeting[:createTime].to_s, "%Q"))
end end
rescue BigBlueButton::BigBlueButtonException => e rescue BigBlueButton::BigBlueButtonException => e
puts "BigBlueButton failed on create: #{e.key}: #{e.message}" puts "BigBlueButton failed on create: #{e.key}: #{e.message}"

View File

@ -43,7 +43,8 @@ describe BbbServer do
context "#start_session" do context "#start_session" do
it "should update latest session info" do it "should update latest session info" do
allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:create_meeting).and_return( allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:create_meeting).and_return(
messageKey: "" messageKey: "",
createTime: "1611793449622"
) )
expect do expect do
@ -57,17 +58,22 @@ describe BbbServer do
context "#join_path" do context "#join_path" do
it "should return correct join URL for user" do it "should return correct join URL for user" do
allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:get_meeting_info).and_return( allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:get_meeting_info).and_return(
attendeePW: @room.attendee_pw attendeePW: @room.attendee_pw,
)
allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:create_meeting).and_return(
messageKey: "",
createTime: "1611793449622"
) )
endpoint = Rails.configuration.bigbluebutton_endpoint endpoint = Rails.configuration.bigbluebutton_endpoint
secret = Rails.configuration.bigbluebutton_secret secret = Rails.configuration.bigbluebutton_secret
fullname = "fullName=Example" fullname = "&fullName=Example"
join_via_html5 = "&join_via_html5=true" join_via_html5 = "&join_via_html5=true"
meeting_id = "&meetingID=#{@room.bbb_id}" meeting_id = "&meetingID=#{@room.bbb_id}"
password = "&password=#{@room.attendee_pw}" password = "&password=#{@room.attendee_pw}"
time = "createTime=1611793449622"
query = fullname + join_via_html5 + meeting_id + password query = time + fullname + join_via_html5 + meeting_id + password
checksum_string = "join#{query + secret}" checksum_string = "join#{query + secret}"
checksum = OpenSSL::Digest.digest('sha1', checksum_string).unpack1("H*") checksum = OpenSSL::Digest.digest('sha1', checksum_string).unpack1("H*")

View File

@ -251,6 +251,10 @@ describe RoomsController, type: :controller do
@user = create(:user) @user = create(:user)
@owner = create(:user) @owner = create(:user)
@room = @owner.main_room @room = @owner.main_room
allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:create_meeting).and_return(
messageKey: "",
createTime: "1611793449622"
)
end end
it "should use account name if user is logged in and meeting running" do it "should use account name if user is logged in and meeting running" do
@ -521,6 +525,10 @@ describe RoomsController, type: :controller do
moderatorPW: "modpass", moderatorPW: "modpass",
attendeePW: "attpass", attendeePW: "attpass",
) )
allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:create_meeting).and_return(
messageKey: "",
createTime: "1611793449622"
)
end end
it "should redirect to join path if owner" do it "should redirect to join path if owner" do