bigbluebutton_rails 1.2.0 → 1.3.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-version +1 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.rdoc +15 -1
- data/Gemfile +15 -4
- data/Gemfile.lock +187 -125
- data/LICENSE +24 -0
- data/README.rdoc +96 -19
- data/Rakefile +32 -16
- data/TODO_08 +9 -10
- data/{spec/rails_app/public → app/assets}/stylesheets/bigbluebutton_rails.css +58 -79
- data/app/controllers/bigbluebutton/recordings_controller.rb +142 -0
- data/app/controllers/bigbluebutton/rooms_controller.rb +105 -50
- data/app/controllers/bigbluebutton/servers_controller.rb +78 -2
- data/app/helpers/bigbluebutton_rails_helper.rb +11 -4
- data/app/models/bigbluebutton_metadata.rb +43 -0
- data/app/models/bigbluebutton_playback_format.rb +9 -0
- data/app/models/bigbluebutton_recording.rb +191 -0
- data/app/models/bigbluebutton_room.rb +92 -66
- data/app/models/bigbluebutton_server.rb +49 -3
- data/app/views/bigbluebutton/recordings/_form.html.erb +67 -0
- data/app/views/bigbluebutton/recordings/_recordings.html.erb +56 -0
- data/app/views/bigbluebutton/recordings/edit.html.erb +5 -0
- data/app/views/bigbluebutton/recordings/index.html.erb +2 -0
- data/app/views/bigbluebutton/recordings/show.html.erb +84 -0
- data/app/views/bigbluebutton/rooms/_form.html.erb +28 -7
- data/app/views/bigbluebutton/rooms/_rooms.html.erb +19 -4
- data/app/views/bigbluebutton/rooms/edit.html.erb +0 -1
- data/app/views/bigbluebutton/rooms/invite.html.erb +2 -1
- data/app/views/bigbluebutton/rooms/join.html.erb +0 -2
- data/app/views/bigbluebutton/rooms/recordings.html.erb +2 -0
- data/app/views/bigbluebutton/rooms/show.html.erb +35 -15
- data/app/views/bigbluebutton/servers/_form.html.erb +4 -0
- data/app/views/bigbluebutton/servers/index.html.erb +8 -3
- data/app/views/bigbluebutton/servers/recordings.html.erb +2 -0
- data/app/views/bigbluebutton/servers/rooms.html.erb +1 -1
- data/app/views/bigbluebutton/servers/show.html.erb +54 -6
- data/bigbluebutton_rails.gemspec +1 -1
- data/config/locales/en.yml +105 -55
- data/config/schedule.rb +3 -0
- data/lib/bigbluebutton_rails.rb +52 -2
- data/lib/bigbluebutton_rails/controller_methods.rb +31 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +50 -14
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/generators/bigbluebutton_rails/install_generator.rb +8 -8
- data/lib/generators/bigbluebutton_rails/templates/migration.rb +37 -1
- data/lib/generators/bigbluebutton_rails/templates/migration_1_3_0.rb +55 -0
- data/lib/generators/bigbluebutton_rails/templates/migration_1_3_0_b.rb +13 -0
- data/lib/generators/bigbluebutton_rails/views_generator.rb +6 -2
- data/lib/tasks/bigbluebutton_rails/recordings.rake +18 -0
- data/spec/bigbluebutton_rails_spec.rb +2 -2
- data/spec/controllers/bigbluebutton/recordings_controller_json_responses_spec.rb +111 -0
- data/spec/controllers/bigbluebutton/recordings_controller_spec.rb +188 -0
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +15 -10
- data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +14 -7
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +327 -103
- data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +12 -12
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +166 -28
- data/spec/factories/bigbluebutton_metadata.rb +11 -0
- data/spec/factories/bigbluebutton_playback_format.rb +8 -0
- data/spec/factories/bigbluebutton_recording.rb +13 -0
- data/spec/factories/bigbluebutton_room.rb +2 -1
- data/spec/factories/bigbluebutton_server.rb +1 -1
- data/spec/factories/user.rb +1 -0
- data/spec/generators/install_generator_spec.rb +21 -10
- data/spec/generators/views_generator_spec.rb +14 -4
- data/spec/models/bigbluebutton_metadata_db_spec.rb +13 -0
- data/spec/models/bigbluebutton_metadata_spec.rb +64 -0
- data/spec/models/bigbluebutton_playback_format_db_spec.rb +13 -0
- data/spec/models/bigbluebutton_playback_format_spec.rb +22 -0
- data/spec/models/bigbluebutton_recording_db_spec.rb +24 -0
- data/spec/models/bigbluebutton_recording_spec.rb +450 -0
- data/spec/models/bigbluebutton_room_db_spec.rb +3 -2
- data/spec/models/bigbluebutton_room_spec.rb +194 -166
- data/spec/models/bigbluebutton_server_spec.rb +107 -27
- data/spec/rails_app/.gitignore +2 -0
- data/spec/rails_app/app/assets/javascripts/application.js +2 -0
- data/spec/rails_app/app/controllers/application_controller.rb +2 -0
- data/spec/rails_app/app/controllers/custom_recordings_controller.rb +8 -0
- data/spec/rails_app/app/controllers/frontpage_controller.rb +7 -0
- data/spec/rails_app/app/views/frontpage/show.html.erb +5 -0
- data/spec/rails_app/app/views/layouts/application.html.erb +5 -2
- data/spec/rails_app/config/application.rb +13 -0
- data/spec/rails_app/config/environments/development.rb +7 -2
- data/spec/rails_app/config/environments/production.rb +9 -0
- data/spec/rails_app/config/environments/test.rb +10 -0
- data/spec/rails_app/config/routes.rb +20 -2
- data/spec/rails_app/features/edit_rooms.feature +2 -3
- data/spec/rails_app/features/edit_servers.feature +2 -3
- data/spec/rails_app/features/step_definitions/activity_monitor_servers_step.rb +2 -2
- data/spec/rails_app/features/step_definitions/common_steps.rb +5 -5
- data/spec/rails_app/features/step_definitions/create_rooms_steps.rb +2 -4
- data/spec/rails_app/features/step_definitions/create_servers_steps.rb +2 -2
- data/spec/rails_app/features/step_definitions/edit_rooms_steps.rb +2 -2
- data/spec/rails_app/features/step_definitions/edit_servers_steps.rb +2 -2
- data/spec/rails_app/features/step_definitions/join_rooms_steps.rb +2 -2
- data/spec/rails_app/features/step_definitions/list_and_show_rooms_steps.rb +2 -2
- data/spec/rails_app/features/support/templates.rb +2 -6
- data/spec/rails_app/lib/tasks/db/populate.rake +119 -0
- data/spec/routing/bigbluebutton/custom_controllers_routing_spec.rb +78 -1
- data/spec/routing/bigbluebutton/recordings_only_routing_spec.rb +43 -0
- data/spec/routing/bigbluebutton/recordings_routing_spec.rb +46 -0
- data/spec/routing/bigbluebutton/rooms_only_routing_spec.rb +67 -0
- data/spec/routing/bigbluebutton/rooms_routing_spec.rb +28 -2
- data/spec/routing/bigbluebutton/servers_only_routing_spec.rb +43 -0
- data/spec/routing/bigbluebutton/servers_routing_spec.rb +16 -1
- data/spec/support/matchers/have_same_attributes_as.rb +20 -3
- data/spec/support/matchers/shoulda/{be_boolean.rb → be_boolean_matcher.rb} +0 -0
- data/spec/support/mocked_server.rb +19 -3
- metadata +48 -28
- data/public/images/loading.gif +0 -0
- data/public/javascripts/jquery.min.js +0 -16
- data/public/stylesheets/bigbluebutton_rails.css +0 -148
- data/spec/rails_app/public/images/loading.gif +0 -0
- data/spec/rails_app/public/images/rails.png +0 -0
- data/spec/rails_app/public/index.html +0 -239
- data/spec/rails_app/public/javascripts/application.js +0 -2
- data/spec/rails_app/public/javascripts/controls.js +0 -965
- data/spec/rails_app/public/javascripts/dragdrop.js +0 -974
- data/spec/rails_app/public/javascripts/effects.js +0 -1123
- data/spec/rails_app/public/javascripts/jquery.min.js +0 -16
- data/spec/rails_app/public/javascripts/prototype.js +0 -6001
- data/spec/rails_app/public/javascripts/rails.js +0 -191
- data/spec/support/shared_examples/rooms_controller.rb +0 -37
@@ -0,0 +1,142 @@
|
|
1
|
+
class Bigbluebutton::RecordingsController < ApplicationController
|
2
|
+
|
3
|
+
respond_to :html
|
4
|
+
respond_to :json, :only => [:index, :show, :update, :destroy, :publish, :unpublish]
|
5
|
+
before_filter :find_recording, :except => [:index]
|
6
|
+
before_filter :check_for_server, :only => [:publish, :unpublish]
|
7
|
+
|
8
|
+
def index
|
9
|
+
respond_with(@recordings = BigbluebuttonRecording.all)
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
respond_with(@recording)
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
respond_with(@recording)
|
18
|
+
end
|
19
|
+
|
20
|
+
def update
|
21
|
+
respond_with @recording do |format|
|
22
|
+
if @recording.update_attributes(params[:bigbluebutton_recording])
|
23
|
+
format.html {
|
24
|
+
message = t('bigbluebutton_rails.recordings.notice.update.success')
|
25
|
+
redirect_to(@recording, :notice => message)
|
26
|
+
}
|
27
|
+
format.json { head :ok }
|
28
|
+
else
|
29
|
+
format.html { render :edit }
|
30
|
+
format.json { render :json => @recording.errors.full_messages, :status => :unprocessable_entity }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def destroy
|
36
|
+
error = false
|
37
|
+
begin
|
38
|
+
if @recording.server
|
39
|
+
server = @recording.server
|
40
|
+
server.send_delete_recordings(@recording.recordid)
|
41
|
+
end
|
42
|
+
message = t('bigbluebutton_rails.recordings.notice.destroy.success')
|
43
|
+
rescue BigBlueButton::BigBlueButtonException => e
|
44
|
+
error = true
|
45
|
+
message = t('bigbluebutton_rails.recordings.notice.destroy.success_with_bbb_error', :error => e.to_s[0..200])
|
46
|
+
end
|
47
|
+
|
48
|
+
# TODO: what if it fails?
|
49
|
+
@recording.destroy
|
50
|
+
|
51
|
+
respond_with do |format|
|
52
|
+
format.html {
|
53
|
+
if error
|
54
|
+
flash[:error] = message
|
55
|
+
redirect_to params[:redir_url] ||= bigbluebutton_recordings_url
|
56
|
+
else
|
57
|
+
redirect_to params[:redir_url] ||= bigbluebutton_recordings_url, :notice => message
|
58
|
+
end
|
59
|
+
}
|
60
|
+
format.json {
|
61
|
+
if error
|
62
|
+
render :json => { :message => message }, :status => :error
|
63
|
+
else
|
64
|
+
render :json => { :message => message }
|
65
|
+
end
|
66
|
+
}
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def play
|
71
|
+
if params[:type]
|
72
|
+
playback = @recording.playback_formats.where(:format_type => params[:type]).first
|
73
|
+
else
|
74
|
+
playback = @recording.playback_formats.first
|
75
|
+
end
|
76
|
+
respond_with do |format|
|
77
|
+
format.html {
|
78
|
+
if playback
|
79
|
+
redirect_to playback.url
|
80
|
+
else
|
81
|
+
flash[:error] = t('bigbluebutton_rails.recordings.errors.play.no_format')
|
82
|
+
redirect_to bigbluebutton_recording_url(@recording)
|
83
|
+
end
|
84
|
+
}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def publish
|
89
|
+
self.publish_unpublish(true)
|
90
|
+
end
|
91
|
+
|
92
|
+
def unpublish
|
93
|
+
self.publish_unpublish(false)
|
94
|
+
end
|
95
|
+
|
96
|
+
protected
|
97
|
+
|
98
|
+
def find_recording
|
99
|
+
@recording = BigbluebuttonRecording.find_by_recordid(params[:id])
|
100
|
+
end
|
101
|
+
|
102
|
+
def check_for_server
|
103
|
+
unless @recording.server
|
104
|
+
message = t('bigbluebutton_rails.recordings.errors.check_for_server.no_server')
|
105
|
+
respond_with do |format|
|
106
|
+
format.html {
|
107
|
+
flash[:error] = message
|
108
|
+
redirect_to bigbluebutton_recording_path(@recording)
|
109
|
+
}
|
110
|
+
format.json { render :json => message, :status => :error }
|
111
|
+
end
|
112
|
+
false
|
113
|
+
else
|
114
|
+
true
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def publish_unpublish(publish)
|
119
|
+
begin
|
120
|
+
server = @recording.server
|
121
|
+
server.send_publish_recordings(@recording.recordid, publish)
|
122
|
+
respond_with do |format|
|
123
|
+
if publish
|
124
|
+
message = t('bigbluebutton_rails.recordings.notice.publish.success')
|
125
|
+
else
|
126
|
+
message = t('bigbluebutton_rails.recordings.notice.unpublish.success')
|
127
|
+
end
|
128
|
+
format.html { redirect_to(bigbluebutton_recording_path(@recording), :notice => message) }
|
129
|
+
format.json { render :json => message }
|
130
|
+
end
|
131
|
+
rescue BigBlueButton::BigBlueButtonException => e
|
132
|
+
respond_with do |format|
|
133
|
+
format.html {
|
134
|
+
flash[:error] = e.to_s[0..200]
|
135
|
+
redirect_to bigbluebutton_recording_path(@recording)
|
136
|
+
}
|
137
|
+
format.json { render :json => e.to_s[0..200], :status => :error }
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
@@ -2,8 +2,12 @@ require 'bigbluebutton_api'
|
|
2
2
|
|
3
3
|
class Bigbluebutton::RoomsController < ApplicationController
|
4
4
|
|
5
|
-
before_filter :find_room, :
|
5
|
+
before_filter :find_room, :except => [:index, :create, :new, :auth, :external, :external_auth]
|
6
6
|
before_filter :find_server, :only => [:external, :external_auth]
|
7
|
+
|
8
|
+
# set headers only in actions that might trigger api calls
|
9
|
+
before_filter :set_request_headers, :only => [:join_mobile, :end, :running, :join, :destroy, :auth, :external_auth]
|
10
|
+
|
7
11
|
respond_to :html, :except => :running
|
8
12
|
respond_to :json, :only => [:running, :show, :new, :index, :create, :update]
|
9
13
|
|
@@ -35,8 +39,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
35
39
|
if @room.save
|
36
40
|
message = t('bigbluebutton_rails.rooms.notice.create.success')
|
37
41
|
format.html {
|
38
|
-
params[:redir_url] ||= bigbluebutton_room_path(@room)
|
39
|
-
redirect_to params[:redir_url], :notice => message
|
42
|
+
redirect_to params[:redir_url] ||= bigbluebutton_room_path(@room), :notice => message
|
40
43
|
}
|
41
44
|
format.json { render :json => { :message => message }, :status => :created }
|
42
45
|
else
|
@@ -54,24 +57,18 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
54
57
|
end
|
55
58
|
|
56
59
|
def update
|
57
|
-
if !params[:bigbluebutton_room].has_key?(:meetingid) or
|
58
|
-
params[:bigbluebutton_room][:meetingid].blank?
|
59
|
-
params[:bigbluebutton_room][:meetingid] = params[:bigbluebutton_room][:name]
|
60
|
-
end
|
61
|
-
|
62
60
|
respond_with @room do |format|
|
63
61
|
if @room.update_attributes(params[:bigbluebutton_room])
|
64
62
|
message = t('bigbluebutton_rails.rooms.notice.update.success')
|
65
63
|
format.html {
|
66
|
-
params[:redir_url] ||= bigbluebutton_room_path(@room)
|
67
|
-
redirect_to params[:redir_url], :notice => message
|
64
|
+
redirect_to params[:redir_url] ||= bigbluebutton_room_path(@room), :notice => message
|
68
65
|
}
|
69
66
|
format.json { render :json => { :message => message } }
|
70
67
|
else
|
71
68
|
format.html {
|
72
69
|
unless params[:redir_url].blank?
|
73
|
-
|
74
|
-
redirect_to params[:redir_url]
|
70
|
+
flash[:error] = t('bigbluebutton_rails.rooms.notice.update.failure')
|
71
|
+
redirect_to params[:redir_url]
|
75
72
|
else
|
76
73
|
render :edit
|
77
74
|
end
|
@@ -82,32 +79,31 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
82
79
|
end
|
83
80
|
|
84
81
|
def destroy
|
85
|
-
# TODO Destroy the room record even if end_meeting failed?
|
86
|
-
|
87
82
|
error = false
|
88
83
|
begin
|
89
84
|
@room.fetch_is_running?
|
90
85
|
@room.send_end if @room.is_running?
|
86
|
+
message = t('bigbluebutton_rails.rooms.notice.destroy.success')
|
91
87
|
rescue BigBlueButton::BigBlueButtonException => e
|
92
88
|
error = true
|
93
|
-
message = e.to_s
|
94
|
-
# TODO Better error message: "Room destroyed in DB, but not in BBB..."
|
89
|
+
message = t('bigbluebutton_rails.rooms.notice.destroy.success_with_bbb_error', :error => e.to_s[0..200])
|
95
90
|
end
|
96
91
|
|
92
|
+
# TODO: what if it fails?
|
97
93
|
@room.destroy
|
98
94
|
|
99
95
|
respond_with do |format|
|
100
96
|
format.html {
|
101
97
|
flash[:error] = message if error
|
102
|
-
params[:redir_url] ||= bigbluebutton_rooms_url
|
103
|
-
|
98
|
+
redirect_to params[:redir_url] ||= bigbluebutton_rooms_url
|
99
|
+
}
|
100
|
+
format.json {
|
101
|
+
if error
|
102
|
+
render :json => { :message => message }, :status => :error
|
103
|
+
else
|
104
|
+
render :json => { :message => message }
|
105
|
+
end
|
104
106
|
}
|
105
|
-
if error
|
106
|
-
format.json { render :json => { :message => message }, :status => :error }
|
107
|
-
else
|
108
|
-
message = t('bigbluebutton_rails.rooms.notice.destroy.success')
|
109
|
-
format.json { render :json => { :message => message } }
|
110
|
-
end
|
111
107
|
end
|
112
108
|
end
|
113
109
|
|
@@ -122,11 +118,11 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
122
118
|
redirect_to :action => :invite, :mobile => params[:mobile]
|
123
119
|
|
124
120
|
else
|
125
|
-
join_internal(bigbluebutton_user.name, @user_role, :join)
|
121
|
+
join_internal(bigbluebutton_user.name, @user_role, bigbluebutton_user.id, :join)
|
126
122
|
end
|
127
123
|
end
|
128
124
|
|
129
|
-
# Used to join private rooms or to
|
125
|
+
# Used to join private rooms or to invite anonymous users (not logged)
|
130
126
|
def invite
|
131
127
|
respond_with @room do |format|
|
132
128
|
|
@@ -146,20 +142,26 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
146
142
|
@room = BigbluebuttonRoom.find_by_param(params[:id]) unless params[:id].blank?
|
147
143
|
if @room.nil?
|
148
144
|
message = t('bigbluebutton_rails.rooms.errors.auth.wrong_params')
|
149
|
-
redirect_to
|
145
|
+
redirect_to :back, :notice => message
|
150
146
|
return
|
151
147
|
end
|
152
148
|
|
149
|
+
# gets the user information, given priority to a possible logged user
|
153
150
|
name = bigbluebutton_user.nil? ? params[:user][:name] : bigbluebutton_user.name
|
151
|
+
id = bigbluebutton_user.nil? ? nil : bigbluebutton_user.id
|
152
|
+
# the role: nil means access denied, :password means check the room
|
153
|
+
# password, otherwise just use it
|
154
154
|
@user_role = bigbluebutton_role(@room)
|
155
155
|
if @user_role.nil?
|
156
156
|
raise BigbluebuttonRails::RoomAccessDenied.new
|
157
157
|
elsif @user_role == :password
|
158
|
-
|
158
|
+
role = @room.user_role(params[:user])
|
159
|
+
else
|
160
|
+
role = @user_role
|
159
161
|
end
|
160
162
|
|
161
|
-
unless
|
162
|
-
join_internal(name,
|
163
|
+
unless role.nil? or name.nil? or name.empty?
|
164
|
+
join_internal(name, role, id, :invite)
|
163
165
|
else
|
164
166
|
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.failure')
|
165
167
|
render :invite, :status => :unauthorized
|
@@ -171,8 +173,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
171
173
|
def external
|
172
174
|
if params[:meeting].blank?
|
173
175
|
message = t('bigbluebutton_rails.rooms.errors.external.blank_meetingid')
|
174
|
-
params[:redir_url] ||= bigbluebutton_rooms_path
|
175
|
-
redirect_to params[:redir_url], :notice => message
|
176
|
+
redirect_to params[:redir_url] ||= bigbluebutton_rooms_path, :notice => message
|
176
177
|
end
|
177
178
|
@room = BigbluebuttonRoom.new(:server => @server, :meetingid => params[:meeting])
|
178
179
|
end
|
@@ -191,7 +192,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
191
192
|
|
192
193
|
unless message.nil?
|
193
194
|
@room = nil
|
194
|
-
redirect_to
|
195
|
+
redirect_to :back, :notice => message
|
195
196
|
return
|
196
197
|
end
|
197
198
|
|
@@ -200,17 +201,11 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
200
201
|
|
201
202
|
# if there's a user logged, use his name instead of the name in the params
|
202
203
|
name = bigbluebutton_user.nil? ? params[:user][:name] : bigbluebutton_user.name
|
204
|
+
id = bigbluebutton_user.nil? ? nil : bigbluebutton_user.id
|
203
205
|
role = @room.user_role(params[:user])
|
204
206
|
|
205
|
-
# FIXME: use internal_join ?
|
206
207
|
unless role.nil? or name.nil? or name.empty?
|
207
|
-
|
208
|
-
unless url.nil?
|
209
|
-
redirect_to(url)
|
210
|
-
else
|
211
|
-
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.not_running')
|
212
|
-
render :external
|
213
|
-
end
|
208
|
+
join_internal(name, role, id, :external)
|
214
209
|
else
|
215
210
|
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.failure')
|
216
211
|
render :external, :status => :unauthorized
|
@@ -221,8 +216,8 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
221
216
|
begin
|
222
217
|
@room.fetch_is_running?
|
223
218
|
rescue BigBlueButton::BigBlueButtonException => e
|
224
|
-
flash[:error] = e.to_s
|
225
|
-
render :json => { :running => "false", :error => "#{e.to_s}" }
|
219
|
+
flash[:error] = e.to_s[0..200]
|
220
|
+
render :json => { :running => "false", :error => "#{e.to_s[0..200]}" }
|
226
221
|
else
|
227
222
|
render :json => { :running => "#{@room.is_running?}" }
|
228
223
|
end
|
@@ -241,14 +236,14 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
241
236
|
end
|
242
237
|
rescue BigBlueButton::BigBlueButtonException => e
|
243
238
|
error = true
|
244
|
-
message = e.to_s
|
239
|
+
message = e.to_s[0..200]
|
245
240
|
end
|
246
241
|
|
247
242
|
if error
|
248
243
|
respond_with do |format|
|
249
244
|
format.html {
|
250
245
|
flash[:error] = message
|
251
|
-
redirect_to
|
246
|
+
redirect_to :back
|
252
247
|
}
|
253
248
|
format.json { render :json => message, :status => :error }
|
254
249
|
end
|
@@ -273,6 +268,43 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
273
268
|
@qrcode_url.gsub!(/http:\/\//i, "bigbluebutton://")
|
274
269
|
end
|
275
270
|
|
271
|
+
def fetch_recordings
|
272
|
+
error = false
|
273
|
+
|
274
|
+
if @room.server.nil?
|
275
|
+
error = true
|
276
|
+
message = t('bigbluebutton_rails.rooms.error.fetch_recordings.no_server')
|
277
|
+
else
|
278
|
+
begin
|
279
|
+
# filter only recordings created by this room
|
280
|
+
filter = { :meetingID => @room.meetingid }
|
281
|
+
@room.server.fetch_recordings(filter)
|
282
|
+
message = t('bigbluebutton_rails.rooms.notice.fetch_recordings.success')
|
283
|
+
rescue BigBlueButton::BigBlueButtonException => e
|
284
|
+
error = true
|
285
|
+
message = e.to_s[0..200]
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
respond_with do |format|
|
290
|
+
format.html {
|
291
|
+
flash[error ? :error : :notice] = message
|
292
|
+
redirect_to bigbluebutton_room_path(@room)
|
293
|
+
}
|
294
|
+
format.json {
|
295
|
+
if error
|
296
|
+
render :json => { :message => message }, :status => :error
|
297
|
+
else
|
298
|
+
head :ok
|
299
|
+
end
|
300
|
+
}
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
def recordings
|
305
|
+
respond_with(@recordings = @room.recordings)
|
306
|
+
end
|
307
|
+
|
276
308
|
protected
|
277
309
|
|
278
310
|
def find_room
|
@@ -283,19 +315,42 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
283
315
|
@server = BigbluebuttonServer.find(params[:server_id])
|
284
316
|
end
|
285
317
|
|
286
|
-
def
|
318
|
+
def set_request_headers
|
319
|
+
unless @room.nil?
|
320
|
+
@room.request_headers["x-forwarded-for"] = request.remote_ip
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
def join_internal(username, role, id, wait_action)
|
287
325
|
begin
|
288
|
-
|
326
|
+
# first check if we have to create the room and if the user can do it
|
327
|
+
@room.fetch_is_running?
|
328
|
+
unless @room.is_running?
|
329
|
+
if bigbluebutton_can_create?(@room, role)
|
330
|
+
@room.create_meeting(username, id, request)
|
331
|
+
else
|
332
|
+
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.cannot_create')
|
333
|
+
render wait_action
|
334
|
+
return
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
# room created and running, try to join it
|
339
|
+
url = @room.join_url(username, role)
|
289
340
|
unless url.nil?
|
290
|
-
|
341
|
+
# change the protocol to join with BBB-Android/Mconf-Mobile if set
|
342
|
+
if BigbluebuttonRails::value_to_boolean(params[:mobile])
|
343
|
+
url.gsub!(/http:\/\//i, "bigbluebutton://")
|
344
|
+
end
|
291
345
|
redirect_to(url)
|
292
346
|
else
|
293
347
|
flash[:error] = t('bigbluebutton_rails.rooms.errors.auth.not_running')
|
294
348
|
render wait_action
|
295
349
|
end
|
350
|
+
|
296
351
|
rescue BigBlueButton::BigBlueButtonException => e
|
297
|
-
flash[:error] = e.to_s
|
298
|
-
redirect_to
|
352
|
+
flash[:error] = e.to_s[0..200]
|
353
|
+
redirect_to :back
|
299
354
|
end
|
300
355
|
end
|
301
356
|
|
@@ -2,7 +2,7 @@ class Bigbluebutton::ServersController < ApplicationController
|
|
2
2
|
|
3
3
|
respond_to :html
|
4
4
|
respond_to :json, :only => [:index, :show, :new, :create, :update, :destroy, :activity, :rooms]
|
5
|
-
before_filter :find_server, :
|
5
|
+
before_filter :find_server, :except => [:index, :new, :create]
|
6
6
|
|
7
7
|
def index
|
8
8
|
respond_with(@servers = BigbluebuttonServer.all)
|
@@ -29,7 +29,7 @@ class Bigbluebutton::ServersController < ApplicationController
|
|
29
29
|
end
|
30
30
|
rescue BigBlueButton::BigBlueButtonException => e
|
31
31
|
error = true
|
32
|
-
message = e.to_s
|
32
|
+
message = e.to_s[0..200]
|
33
33
|
end
|
34
34
|
|
35
35
|
# update_list works only for html
|
@@ -89,6 +89,7 @@ class Bigbluebutton::ServersController < ApplicationController
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def destroy
|
92
|
+
# TODO: what if it fails?
|
92
93
|
@server.destroy
|
93
94
|
|
94
95
|
respond_with do |format|
|
@@ -97,14 +98,89 @@ class Bigbluebutton::ServersController < ApplicationController
|
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
101
|
+
def recordings
|
102
|
+
respond_with(@recordings = @server.recordings)
|
103
|
+
end
|
104
|
+
|
100
105
|
def rooms
|
101
106
|
respond_with(@rooms = @server.rooms)
|
102
107
|
end
|
103
108
|
|
109
|
+
def publish_recordings
|
110
|
+
self.publish_unpublish(params[:recordings], true)
|
111
|
+
end
|
112
|
+
|
113
|
+
def unpublish_recordings
|
114
|
+
self.publish_unpublish(params[:recordings], false)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Accepts the following parameters in URL:
|
118
|
+
# meetings:: A list of meetingIDs to be used as filter.
|
119
|
+
# meta_*:: To filter by metadata, where "*" can be anything.
|
120
|
+
#
|
121
|
+
# For example: fetch_recordings?meetings=meeting1,meeting2&meta_name=value
|
122
|
+
def fetch_recordings
|
123
|
+
error = false
|
124
|
+
begin
|
125
|
+
|
126
|
+
# accept meetingID and meta_* filters
|
127
|
+
filter = {}
|
128
|
+
filter.merge!({ :meetingID => params[:meetings] }) if params[:meetings]
|
129
|
+
params.each do |key, value|
|
130
|
+
filter.merge!({ key.to_sym => value }) if key.match(/^meta_/)
|
131
|
+
end
|
132
|
+
|
133
|
+
@server.fetch_recordings(filter)
|
134
|
+
message = t('bigbluebutton_rails.servers.notice.fetch_recordings.success')
|
135
|
+
rescue BigBlueButton::BigBlueButtonException => e
|
136
|
+
error = true
|
137
|
+
message = e.to_s[0..200]
|
138
|
+
end
|
139
|
+
|
140
|
+
respond_with do |format|
|
141
|
+
format.html {
|
142
|
+
flash[error ? :error : :notice] = message
|
143
|
+
redirect_to bigbluebutton_server_path(@server)
|
144
|
+
}
|
145
|
+
format.json {
|
146
|
+
if error
|
147
|
+
render :json => { :message => message }, :status => :error
|
148
|
+
else
|
149
|
+
head :ok
|
150
|
+
end
|
151
|
+
}
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
104
155
|
protected
|
105
156
|
|
106
157
|
def find_server
|
107
158
|
@server = BigbluebuttonServer.find_by_param(params[:id])
|
108
159
|
end
|
109
160
|
|
161
|
+
def publish_unpublish(ids, publish)
|
162
|
+
begin
|
163
|
+
@server.send_publish_recordings(ids, publish)
|
164
|
+
respond_with do |format|
|
165
|
+
format.html {
|
166
|
+
if publish
|
167
|
+
message = t('bigbluebutton_rails.servers.notice.publish_recordings.success')
|
168
|
+
else
|
169
|
+
message = t('bigbluebutton_rails.servers.notice.unpublish_recordings.success')
|
170
|
+
end
|
171
|
+
redirect_to(recordings_bigbluebutton_server_path(@server), :notice => message)
|
172
|
+
}
|
173
|
+
format.json { render :json => message }
|
174
|
+
end
|
175
|
+
rescue BigBlueButton::BigBlueButtonException => e
|
176
|
+
respond_with do |format|
|
177
|
+
format.html {
|
178
|
+
flash[:error] = e.to_s[0..200]
|
179
|
+
redirect_to recordings_bigbluebutton_server_path(@server)
|
180
|
+
}
|
181
|
+
format.json { render :json => e.to_s, :status => :error }
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
110
186
|
end
|