forked from External/greenlight
Cleaned up code
This commit is contained in:
parent
ad807b636b
commit
d4a9fd9147
|
@ -1,16 +1,14 @@
|
|||
class BbbController < ApplicationController
|
||||
include BbbHelper
|
||||
|
||||
# GET /join
|
||||
# GET /join.json
|
||||
def join
|
||||
logger.info params.to_json
|
||||
if ( !params.has_key?(:id) )
|
||||
render_response("missing_parameter", "meeting token was not included", :bad_request)
|
||||
elsif ( !params.has_key?(:name) )
|
||||
render_response("missing_parameter", "user name was not included", :bad_request)
|
||||
else
|
||||
bbb_join_url = bbb_join_url(params[:id], false, params[:name], false)
|
||||
bbb_join_url = helpers.bbb_join_url(params[:id], false, params[:name], false)
|
||||
if bbb_join_url[:returncode]
|
||||
logger.info "#Execute the redirect"
|
||||
render_response("ok", "execute the redirect", :ok, {:join_url => bbb_join_url[:join_url]})
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class LandingController < ApplicationController
|
||||
|
||||
def index
|
||||
@refreshable = (params[:resource] == 'meeting' && !params.has_key?(:id))
|
||||
@meeting_token = params[:id] || @meeting_token = helpers.new_meeting_token
|
||||
|
|
|
@ -1,15 +1,2 @@
|
|||
module ApplicationHelper
|
||||
def bbb_endpoint
|
||||
Rails.application.secrets[:bbb_endpoint]
|
||||
end
|
||||
|
||||
def bbb_secret
|
||||
Rails.application.secrets[:bbb_secret]
|
||||
end
|
||||
|
||||
def random_password(length)
|
||||
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
|
||||
password = (0...length).map { o[rand(o.length)] }.join
|
||||
return password
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
module BbbHelper
|
||||
def bbb_endpoint
|
||||
Rails.application.secrets[:bbb_endpoint]
|
||||
end
|
||||
|
||||
def bbb_secret
|
||||
Rails.application.secrets[:bbb_secret]
|
||||
end
|
||||
|
||||
def random_password(length)
|
||||
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
|
||||
password = (0...length).map { o[rand(o.length)] }.join
|
||||
return password
|
||||
end
|
||||
|
||||
def bbb_join_url(meeting_token, meeting_recorded=false, user_fullname='User', user_is_moderator=false)
|
||||
bbb ||= BigBlueButton::BigBlueButtonApi.new(helpers.bbb_endpoint + "api", bbb_secret, "0.8", true)
|
||||
bbb ||= BigBlueButton::BigBlueButtonApi.new(bbb_endpoint + "api", bbb_secret, "0.8", true)
|
||||
if !bbb
|
||||
return { :returncode => false, :messageKey => "BBBAPICallInvalid", :message => "BBB API call invalid." }
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue