bigbluebutton_rails 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +34 -0
- data/Dockerfile +23 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +14 -5
- data/README.md +42 -59
- data/Rakefile +6 -3
- data/app/controllers/bigbluebutton/api/rooms_controller.rb +117 -0
- data/app/controllers/bigbluebutton/playback_types_controller.rb +0 -3
- data/app/controllers/bigbluebutton/recordings_controller.rb +37 -23
- data/app/controllers/bigbluebutton/rooms_controller.rb +6 -31
- data/app/controllers/bigbluebutton/servers_controller.rb +0 -14
- data/app/helpers/bigbluebutton_rails_helper.rb +4 -0
- data/app/models/bigbluebutton_attendee.rb +21 -0
- data/app/models/bigbluebutton_meeting.rb +5 -0
- data/app/models/bigbluebutton_playback_format.rb +3 -2
- data/app/models/bigbluebutton_recording.rb +164 -68
- data/app/models/bigbluebutton_room.rb +148 -59
- data/app/models/bigbluebutton_server.rb +1 -1
- data/app/views/bigbluebutton/api/error.rabl +10 -0
- data/app/views/bigbluebutton/api/rooms/index.rabl +45 -0
- data/app/views/bigbluebutton/api/rooms/join.rabl +6 -0
- data/app/views/bigbluebutton/api/rooms/running.rabl +10 -0
- data/app/views/bigbluebutton/recordings/play.html.erb +1 -0
- data/app/views/bigbluebutton/servers/_activity_list.html.erb +5 -5
- data/app/workers/{bigbluebutton_finish_meetings.rb → bigbluebutton_finish_meetings_worker.rb} +2 -2
- data/app/workers/{bigbluebutton_meeting_updater.rb → bigbluebutton_meeting_updater_worker.rb} +3 -3
- data/app/workers/bigbluebutton_recordings_for_room_worker.rb +27 -0
- data/app/workers/{bigbluebutton_update_recordings.rb → bigbluebutton_update_recordings_worker.rb} +2 -2
- data/app/workers/{bigbluebutton_update_server_configs.rb → bigbluebutton_update_server_configs_worker.rb} +3 -3
- data/bigbluebutton_rails.gemspec +1 -0
- data/config/locales/en.yml +21 -0
- data/config/locales/pt-br.yml +1 -0
- data/config/resque/resque.rake +7 -1
- data/config/resque/workers_schedule.yml +3 -3
- data/docker-compose.yml +68 -0
- data/dumb-init_1.2.0 +0 -0
- data/lib/bigbluebutton_rails.rb +1 -2
- data/lib/bigbluebutton_rails/api_controller_methods.rb +138 -0
- data/lib/bigbluebutton_rails/configuration.rb +33 -4
- data/lib/bigbluebutton_rails/controller_methods.rb +0 -31
- data/lib/bigbluebutton_rails/exceptions.rb +17 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +14 -0
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/generators/bigbluebutton_rails/templates/migration.rb +17 -3
- data/lib/generators/bigbluebutton_rails/templates/migration_2_2_0.rb +1 -1
- data/lib/generators/bigbluebutton_rails/templates/migration_2_2_0_b.rb +106 -0
- data/lib/generators/bigbluebutton_rails/templates/migration_2_3_0.rb +22 -0
- data/lib/tasks/bigbluebutton_rails/meetings.rake +1 -1
- data/spec/controllers/bigbluebutton/api/rooms_controller_spec.rb +498 -0
- data/spec/controllers/bigbluebutton/recordings_controller_spec.rb +84 -0
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +2 -2
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +24 -22
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +9 -0
- data/spec/factories/bigbluebutton_attendee.rb +7 -0
- data/spec/factories/bigbluebutton_meeting.rb +0 -1
- data/spec/factories/bigbluebutton_playback_type.rb +1 -0
- data/spec/factories/bigbluebutton_recording.rb +2 -4
- data/spec/helpers/bigbluebutton_rails_helper_spec.rb +10 -2
- data/spec/lib/bigbluebutton_rails/background_tasks_spec.rb +1 -0
- data/spec/lib/tasks/meetings_rake_spec.rb +1 -1
- data/spec/models/bigbluebutton_attendee_spec.rb +44 -0
- data/spec/models/bigbluebutton_meeting_db_spec.rb +0 -1
- data/spec/models/bigbluebutton_meeting_spec.rb +1 -0
- data/spec/models/bigbluebutton_playback_format_spec.rb +2 -0
- data/spec/models/bigbluebutton_playback_type_db_spec.rb +1 -0
- data/spec/models/bigbluebutton_recording_db_spec.rb +2 -2
- data/spec/models/bigbluebutton_recording_spec.rb +404 -72
- data/spec/models/bigbluebutton_room_spec.rb +435 -148
- data/spec/rails_app/config/database.yml.example +10 -11
- data/spec/rails_app/config/initializers/resque.rb +33 -0
- data/spec/rails_app/config/routes.rb +2 -0
- data/spec/rails_app/lib/tasks/db/populate.rake +73 -55
- data/spec/support/mocked_server.rb +1 -1
- data/spec/workers/{bigbluebutton_finish_meetings_spec.rb → bigbluebutton_finish_meetings_worker_spec.rb} +3 -3
- data/spec/workers/{bigbluebutton_meeting_updater_spec.rb → bigbluebutton_meeting_updater_worker_spec.rb} +8 -7
- data/spec/workers/bigbluebutton_recordings_for_room_worker_spec.rb +49 -0
- data/spec/workers/{bigbluebutton_update_recordings_spec.rb → bigbluebutton_update_recordings_worker_spec.rb} +3 -3
- data/spec/workers/{bigbluebutton_update_server_configs_spec.rb → bigbluebutton_update_server_configs_worker_spec.rb} +4 -4
- metadata +42 -14
- data/lib/classes/bigbluebutton_attendee.rb +0 -21
- data/spec/classes/bigbluebutton_attendee_spec.rb +0 -76
- data/spec/controllers/bigbluebutton/recordings_controller_json_responses_spec.rb +0 -111
- data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +0 -203
- data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +0 -162
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88081dab1ee2f637c46993cd9b6f655cc4516afb
|
|
4
|
+
data.tar.gz: 791d30eb4d1873e75834754aed5c43b4b4a1c3f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69a370e8996753af92fdf67be6d6c6172fd02938f1a9b9a2c23960a0f2cb2d656ba70a67f3a87bd830c7a9b7246cf53d8c7f75b7c4cbcf2a735c79cf18a40899
|
|
7
|
+
data.tar.gz: 2adec10068e736881b444dbf584b5427ef83d7661a0fafed7e0b5037b0762e5faf4b5323a360c4b8d5e64357e5b6c8592b410b1a2e019af93c8e3c3658d4eefa
|
data/.travis.yml
CHANGED
|
@@ -2,6 +2,8 @@ sudo: false
|
|
|
2
2
|
language: ruby
|
|
3
3
|
services:
|
|
4
4
|
- redis-server
|
|
5
|
+
before_install:
|
|
6
|
+
- gem install bundler
|
|
5
7
|
bundler_args: "--without production development"
|
|
6
8
|
before_script:
|
|
7
9
|
- "cp spec/rails_app/config/database.yml.travis spec/rails_app/config/database.yml"
|
|
@@ -11,6 +13,4 @@ before_script:
|
|
|
11
13
|
cache: bundler
|
|
12
14
|
script: "bundle exec rake rails_app:install rails_app:db spec"
|
|
13
15
|
rvm:
|
|
14
|
-
- 2.
|
|
15
|
-
- 2.2.0
|
|
16
|
-
- 1.9.3
|
|
16
|
+
- 2.2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [2.3.0] - 2019-11-14
|
|
4
|
+
|
|
5
|
+
* [#136] Improve matching between recordings and meetings and migrate old recordings to
|
|
6
|
+
always (when possible) have a meeting associated.
|
|
7
|
+
* Add new worker to fetch recordings after meetings are ended to improve the speed with which
|
|
8
|
+
recordings are found after meetings
|
|
9
|
+
* Fix setting the `recorded` attributes in newly created meetings, it was always using the
|
|
10
|
+
attributes from model, without considering that it is possible to override these attributes when
|
|
11
|
+
making a "create" call (which is exactly what Mconf-Web does).
|
|
12
|
+
* First version of a JSON API that applications can use to list and join meetings created
|
|
13
|
+
by this gem. All calls are authenticated by a secret configure in
|
|
14
|
+
`BigbluebuttonRails.configuration.api_secret`.
|
|
15
|
+
* Remove old unnecessary json responses. Most routes had it but most were not used.
|
|
16
|
+
* Add docker configs to run the gem in development and to run tests.
|
|
17
|
+
* Set the `finish_time` on meetings when setting them as ended.
|
|
18
|
+
* Add options to set dynamic options when creating and joining conferences. See
|
|
19
|
+
`get_create_options` and `get_join_options`.
|
|
20
|
+
* Make it easier for apps to customize the config.xml in a join call.
|
|
21
|
+
* Add support for `<recordingUsers>` returned by getRecordings.
|
|
22
|
+
* Add option to run on/off the authentication in playback URLs. When on, it will call
|
|
23
|
+
`getRecordingToken` on the server holding the recording and use the proper parameters
|
|
24
|
+
when redirecting the user to the playback URL.
|
|
25
|
+
See `BigbluebuttonRails.configuration.playback_url_authentication`.
|
|
26
|
+
* Add option to show recording playback pages inside an iframe. Optional and off by default.
|
|
27
|
+
If turned on all playback formats that are *not* downloadable will be shown inside an
|
|
28
|
+
iframe. See `BigbluebuttonRails.configuration.playback_iframe`.
|
|
29
|
+
* Increase the limit in the name of rooms from 150 to 250 chars.
|
|
30
|
+
* Speed up recording sync by using batch imports (`activerecord-import`) and preventing
|
|
31
|
+
unchanged recordings from being updated when syncing.
|
|
32
|
+
* Fix errors when trying to playback a recording that doesn't exist.
|
|
33
|
+
|
|
34
|
+
|
|
3
35
|
## [2.2.0] - 2017-10-04
|
|
4
36
|
|
|
5
37
|
* Make only description editable in recordings, since all other attributes are taken from
|
|
@@ -287,6 +319,8 @@ https://github.com/mconf/bigbluebutton_rails/wiki/Migrate-to-1.3.0
|
|
|
287
319
|
* Controller to access servers and rooms
|
|
288
320
|
* rooms_controller interacts with a BBB server using bigbluebutton-api-ruby
|
|
289
321
|
|
|
322
|
+
[2.2.0]: https://github.com/mconf/bigbluebutton_rails/compare/v2.2.0...v2.3.0
|
|
323
|
+
[2.3.0]: https://github.com/mconf/bigbluebutton_rails/compare/v2.1.0...v2.2.0
|
|
290
324
|
[2.1.0]: https://github.com/mconf/bigbluebutton_rails/compare/v2.0.0...v2.1.0
|
|
291
325
|
[2.0.0]: https://github.com/mconf/bigbluebutton_rails/compare/v1.4.0...v2.0.0
|
|
292
326
|
[1.4.0]: https://github.com/mconf/bigbluebutton_rails/compare/v1.3.0...v1.4.0
|
data/Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
FROM ruby:2.2.0
|
|
2
|
+
|
|
3
|
+
RUN apt-get update && \
|
|
4
|
+
apt-get install -y qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x
|
|
5
|
+
|
|
6
|
+
ENV app /usr/src/app
|
|
7
|
+
|
|
8
|
+
# Create app directory
|
|
9
|
+
RUN mkdir -p $app
|
|
10
|
+
WORKDIR $app
|
|
11
|
+
|
|
12
|
+
# Bundle app source
|
|
13
|
+
COPY . $app
|
|
14
|
+
|
|
15
|
+
# Install app dependencies
|
|
16
|
+
RUN bundle install
|
|
17
|
+
|
|
18
|
+
# dumb-init
|
|
19
|
+
ADD dumb-init_1.2.0 /usr/bin/dumb-init
|
|
20
|
+
RUN chmod +x /usr/bin/dumb-init
|
|
21
|
+
|
|
22
|
+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
|
23
|
+
CMD [ "bundle", "exec", "rails", "server" ]
|
data/Gemfile
CHANGED
|
@@ -5,6 +5,8 @@ gemspec
|
|
|
5
5
|
gem 'mysql2'
|
|
6
6
|
gem "jquery-rails"
|
|
7
7
|
gem "forgery"
|
|
8
|
+
gem 'rabl'
|
|
9
|
+
gem 'activerecord-import'
|
|
8
10
|
|
|
9
11
|
group :development do
|
|
10
12
|
gem "rdoc"
|
|
@@ -31,6 +33,7 @@ group :test do
|
|
|
31
33
|
gem "capybara-webkit" # best option found for js
|
|
32
34
|
gem "launchy"
|
|
33
35
|
gem "webmock"
|
|
36
|
+
gem "timecop"
|
|
34
37
|
|
|
35
38
|
# to use redis in-memory and clean it in-between tests, used for resque
|
|
36
39
|
gem "fakeredis", :require => "fakeredis/rspec"
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
bigbluebutton_rails (2.
|
|
4
|
+
bigbluebutton_rails (2.3.0)
|
|
5
|
+
activerecord-import (~> 1.0)
|
|
5
6
|
bigbluebutton-api-ruby (~> 1.6)
|
|
6
7
|
browser (~> 0.8.0)
|
|
7
8
|
rails (>= 4.0.0)
|
|
@@ -31,6 +32,8 @@ GEM
|
|
|
31
32
|
activemodel (= 4.1.4)
|
|
32
33
|
activesupport (= 4.1.4)
|
|
33
34
|
arel (~> 5.0.0)
|
|
35
|
+
activerecord-import (1.0.2)
|
|
36
|
+
activerecord (>= 3.2)
|
|
34
37
|
activesupport (4.1.4)
|
|
35
38
|
i18n (~> 0.6, >= 0.6.9)
|
|
36
39
|
json (~> 1.7, >= 1.7.7)
|
|
@@ -40,7 +43,7 @@ GEM
|
|
|
40
43
|
addressable (2.3.6)
|
|
41
44
|
arel (5.0.1.20140414130214)
|
|
42
45
|
awesome_print (1.2.0)
|
|
43
|
-
bigbluebutton-api-ruby (1.
|
|
46
|
+
bigbluebutton-api-ruby (1.7.0)
|
|
44
47
|
xml-simple (~> 1.1)
|
|
45
48
|
browser (0.8.0)
|
|
46
49
|
builder (3.2.2)
|
|
@@ -141,8 +144,10 @@ GEM
|
|
|
141
144
|
nokogiri (1.6.2.1-java)
|
|
142
145
|
ntlm-http (0.1.1)
|
|
143
146
|
polyglot (0.3.5)
|
|
147
|
+
rabl (0.10.1)
|
|
148
|
+
activesupport (>= 2.3.14)
|
|
144
149
|
rack (1.5.2)
|
|
145
|
-
rack-protection (1.5.
|
|
150
|
+
rack-protection (1.5.5)
|
|
146
151
|
rack
|
|
147
152
|
rack-test (0.6.2)
|
|
148
153
|
rack (>= 1.0)
|
|
@@ -175,8 +180,8 @@ GEM
|
|
|
175
180
|
rdoc (4.1.1)
|
|
176
181
|
json (~> 1.4)
|
|
177
182
|
redis (3.1.0)
|
|
178
|
-
redis-namespace (1.
|
|
179
|
-
redis (
|
|
183
|
+
redis-namespace (1.6.0)
|
|
184
|
+
redis (>= 3.0.4)
|
|
180
185
|
ref (1.0.5)
|
|
181
186
|
require_all (1.3.2)
|
|
182
187
|
resque (1.25.2)
|
|
@@ -249,6 +254,7 @@ GEM
|
|
|
249
254
|
thread_safe (0.3.4)
|
|
250
255
|
thread_safe (0.3.4-java)
|
|
251
256
|
tilt (1.4.1)
|
|
257
|
+
timecop (0.9.1)
|
|
252
258
|
treetop (1.4.15)
|
|
253
259
|
polyglot
|
|
254
260
|
polyglot (>= 0.3.1)
|
|
@@ -276,6 +282,7 @@ PLATFORMS
|
|
|
276
282
|
ruby
|
|
277
283
|
|
|
278
284
|
DEPENDENCIES
|
|
285
|
+
activerecord-import
|
|
279
286
|
bigbluebutton_rails!
|
|
280
287
|
capybara (~> 2.2.0)
|
|
281
288
|
capybara-mechanize
|
|
@@ -291,6 +298,7 @@ DEPENDENCIES
|
|
|
291
298
|
launchy
|
|
292
299
|
minitest
|
|
293
300
|
mysql2
|
|
301
|
+
rabl
|
|
294
302
|
rails_best_practices
|
|
295
303
|
rdoc
|
|
296
304
|
rspec-activemodel-mocks
|
|
@@ -299,5 +307,6 @@ DEPENDENCIES
|
|
|
299
307
|
shoulda-matchers (~> 2.6.1)
|
|
300
308
|
simplecov (>= 0.4.0)
|
|
301
309
|
therubyracer (~> 0.12.0)
|
|
310
|
+
timecop
|
|
302
311
|
uglifier (>= 1.0.3)
|
|
303
312
|
webmock
|
data/README.md
CHANGED
|
@@ -280,30 +280,37 @@ The list of meetings is also periodically synchronized using Resque-scheduler
|
|
|
280
280
|
### Associating rooms and servers
|
|
281
281
|
|
|
282
282
|
Rooms must be associated with a server to function. When a meeting is created,
|
|
283
|
-
it is created in the server that's associated with the room.
|
|
284
|
-
is done using the `server_id` attribute in `BigbluebuttonRoom`. So
|
|
285
|
-
applications that use this gem can manage all the associations by simply
|
|
286
|
-
setting this attribute.
|
|
287
|
-
|
|
283
|
+
it is created in the server that's associated with the room.
|
|
288
284
|
By default, this gem automatically selects a server **if one is needed and the
|
|
289
|
-
room has no server yet**.
|
|
290
|
-
change it.
|
|
285
|
+
room has no server yet**.
|
|
291
286
|
|
|
292
|
-
To change this behavior, applications can override the
|
|
293
|
-
`
|
|
294
|
-
|
|
295
|
-
rb#L413]`. This method is called by all methods that trigger API calls,
|
|
287
|
+
To change this behavior, applications can override the configuration
|
|
288
|
+
`BigbluebuttonRails.configuration.select_server`. This attribute receives a
|
|
289
|
+
function that will be called inside all methods that trigger API calls,
|
|
296
290
|
methods that need a server to work properly. It receives a parameter that
|
|
297
|
-
indicates which API call will be sent to the server
|
|
298
|
-
|
|
299
|
-
If the method returns a server, the server will be associated with the room.
|
|
300
|
-
If the method returns `nil`, the room will maintain the server it had
|
|
301
|
-
previously (if any).
|
|
291
|
+
indicates which API call will be sent to the server and expects the function
|
|
292
|
+
to return a `BigbluebuttonServer`.
|
|
302
293
|
|
|
303
294
|
One common use would be to override this method to always select a new server
|
|
304
295
|
when a meeting is created (when the argument received is `:create`). This
|
|
305
296
|
would allow the implementation of a simple load balancing mechanism.
|
|
306
297
|
|
|
298
|
+
To configure it, add a code like the one below to one initializer in your
|
|
299
|
+
application:
|
|
300
|
+
|
|
301
|
+
```ruby
|
|
302
|
+
BigbluebuttonRails.configure do |config|
|
|
303
|
+
config.select_server = Proc.new do |room, api_method=nil|
|
|
304
|
+
if room.name == 'special-room'
|
|
305
|
+
BigbluebuttonServer.find_by(name: 'special-server')
|
|
306
|
+
else
|
|
307
|
+
BigbluebuttonServer.first
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
|
|
307
314
|
### Example application
|
|
308
315
|
|
|
309
316
|
If you need more help to set up the gem or just want to see an example of it
|
|
@@ -317,61 +324,37 @@ working, check out the test application at `spec/rails_app/`!
|
|
|
317
324
|
|
|
318
325
|
## Contributing/Development
|
|
319
326
|
|
|
320
|
-
|
|
321
|
-
dependencies:
|
|
322
|
-
|
|
323
|
-
bundle install
|
|
324
|
-
|
|
325
|
-
Note: if you're getting an error installing `capybara-webkit`, most likely you
|
|
326
|
-
need to install QT, see:
|
|
327
|
-
https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling
|
|
328
|
-
-capybara-webkit
|
|
329
|
-
|
|
330
|
-
First copy `spec/rails_app/config/database.yml.example` to
|
|
327
|
+
To setup an environment, first copy `spec/rails_app/config/database.yml.example` to
|
|
331
328
|
`spec/rails_app/config/database.yml`. It uses MySQL since this is the database
|
|
332
|
-
recommended for the applications that use this gem.
|
|
333
|
-
appropriate password for your MySQL user.
|
|
334
|
-
|
|
335
|
-
Save `spec/rails_app/features/config.yml.example` as
|
|
336
|
-
`spec/rails_app/features/config.yml` and edit it to set values for an existent
|
|
337
|
-
BigBlueButton server. You will need it to run the integration tests. For more
|
|
338
|
-
information see the page
|
|
339
|
-
[Testing](https://github.com/mconf/bigbluebutton_rails/wiki/Testing) in our
|
|
340
|
-
wiki.
|
|
329
|
+
recommended for the applications that use this gem.
|
|
341
330
|
|
|
342
|
-
|
|
331
|
+
You can start the example application (from `spec/rails_app`) with:
|
|
343
332
|
|
|
344
|
-
|
|
345
|
-
rake rails_app:db SERVER=my-server # select a server you defined in 'config.yml'
|
|
346
|
-
rake rails_app:populate # to create fake data, optional
|
|
333
|
+
docker-compose up dev
|
|
347
334
|
|
|
348
|
-
|
|
335
|
+
It will probably not work straight away, because you need to setup the application first.
|
|
336
|
+
Do so with:
|
|
349
337
|
|
|
350
|
-
rake
|
|
351
|
-
rake
|
|
338
|
+
docker-compose run dev rake rails_app:install
|
|
339
|
+
docker-compose run dev rake rails_app:db
|
|
352
340
|
|
|
353
|
-
|
|
341
|
+
# optionally:
|
|
342
|
+
docker-compose run dev rake rails_app:populate # to create fake data
|
|
354
343
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
If you're adding migrations to the gem, test them with:
|
|
344
|
+
Then try the `up dev` command again and it should open up a server. Access `localhost:3000`
|
|
345
|
+
to see it.
|
|
358
346
|
|
|
359
|
-
|
|
347
|
+
To run the tests the process is exactly the same, just replace the `dev` target with `test`:
|
|
360
348
|
|
|
361
|
-
|
|
362
|
-
will be used.
|
|
349
|
+
docker-compose up test
|
|
363
350
|
|
|
364
|
-
|
|
365
|
-
check it:
|
|
351
|
+
If you're adding migrations to the gem, test them with:
|
|
366
352
|
|
|
367
|
-
|
|
368
|
-
rails server
|
|
353
|
+
docker-compose run test rake spec:migrations
|
|
369
354
|
|
|
370
355
|
If you need to keep track of meetings, run the resque workers with:
|
|
371
356
|
|
|
372
|
-
rake resque:work QUEUE='bigbluebutton_rails'
|
|
373
|
-
|
|
374
|
-
Develop. :)
|
|
357
|
+
docker-compose run dev rake resque:work QUEUE='bigbluebutton_rails'
|
|
375
358
|
|
|
376
359
|
If you want your code to be integrated in this repository, please fork it,
|
|
377
360
|
create a branch with your modifications and submit a pull request.
|
|
@@ -383,7 +366,7 @@ create a branch with your modifications and submit a pull request.
|
|
|
383
366
|
|
|
384
367
|
Coverage is analyzed by default when you run:
|
|
385
368
|
|
|
386
|
-
|
|
369
|
+
docker-compose up test
|
|
387
370
|
|
|
388
371
|
Run it and look at the file `coverage/index.html`.
|
|
389
372
|
|
|
@@ -394,7 +377,7 @@ the code.
|
|
|
394
377
|
|
|
395
378
|
Run:
|
|
396
379
|
|
|
397
|
-
rake best_practices
|
|
380
|
+
docker-compose run dev rake best_practices
|
|
398
381
|
|
|
399
382
|
And look at the file `rails_best_practices_output.html` to see the tips.
|
|
400
383
|
|
data/Rakefile
CHANGED
|
@@ -39,8 +39,7 @@ namespace :rails_app do
|
|
|
39
39
|
desc 'Setup the db in the rails app used in tests.'
|
|
40
40
|
task :db do
|
|
41
41
|
cd File.join(File.dirname(__FILE__), "spec", "rails_app")
|
|
42
|
-
sh "bundle exec rake db:drop db:create db:migrate db:seed
|
|
43
|
-
sh "bundle exec rake db:drop db:create db:migrate db:seed RAILS_ENV=test"
|
|
42
|
+
sh "bundle exec rake db:drop db:create db:migrate db:seed"
|
|
44
43
|
cd File.dirname(__FILE__)
|
|
45
44
|
end
|
|
46
45
|
|
|
@@ -86,17 +85,21 @@ namespace :spec do
|
|
|
86
85
|
sh "bundle exec rails generate bigbluebutton_rails:install 1.3.0 --migration-only --force"
|
|
87
86
|
sh "bundle exec rails generate bigbluebutton_rails:install 1.4.0 --migration-only --force"
|
|
88
87
|
sh "bundle exec rails generate bigbluebutton_rails:install 2.0.0 --migration-only --force"
|
|
88
|
+
sh "bundle exec rails generate bigbluebutton_rails:install 2.1.0 --migration-only --force"
|
|
89
|
+
sh "bundle exec rails generate bigbluebutton_rails:install 2.2.0 --migration-only --force"
|
|
89
90
|
|
|
90
91
|
sh "bundle exec rake db:drop RAILS_ENV=test"
|
|
91
92
|
sh "bundle exec rake db:create RAILS_ENV=test"
|
|
92
93
|
sh "bundle exec rake db:migrate RAILS_ENV=test"
|
|
93
|
-
sh "bundle exec rake db:
|
|
94
|
+
sh "bundle exec rake db:seed RAILS_ENV=test"
|
|
94
95
|
|
|
95
96
|
cd "../.."
|
|
96
97
|
Rake::Task["spec"].invoke
|
|
97
98
|
# Rake::Task["cucumber"].invoke
|
|
98
99
|
|
|
99
100
|
cd "spec/rails_app/"
|
|
101
|
+
sh "bundle exec rails destroy bigbluebutton_rails:install 2.2.0 --migration-only"
|
|
102
|
+
sh "bundle exec rails destroy bigbluebutton_rails:install 2.1.0 --migration-only"
|
|
100
103
|
sh "bundle exec rails destroy bigbluebutton_rails:install 2.0.0 --migration-only"
|
|
101
104
|
sh "bundle exec rails destroy bigbluebutton_rails:install 1.4.0 --migration-only"
|
|
102
105
|
sh "bundle exec rails destroy bigbluebutton_rails:install 1.3.0 --migration-only"
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
require 'bigbluebutton_api'
|
|
3
|
+
|
|
4
|
+
class Bigbluebutton::Api::RoomsController < ApplicationController
|
|
5
|
+
include BigbluebuttonRails::APIControllerMethods
|
|
6
|
+
|
|
7
|
+
skip_before_filter :verify_authenticity_token
|
|
8
|
+
before_filter :authenticate_api
|
|
9
|
+
|
|
10
|
+
before_filter :validate_pagination, only: :index
|
|
11
|
+
|
|
12
|
+
before_filter :find_room, only: [:running, :join]
|
|
13
|
+
|
|
14
|
+
before_filter :join_user_params, only: :join
|
|
15
|
+
|
|
16
|
+
# only for the ones that trigger API calls
|
|
17
|
+
before_filter :set_request_headers, only: [:join, :running]
|
|
18
|
+
before_filter :set_content_type
|
|
19
|
+
|
|
20
|
+
respond_to :json
|
|
21
|
+
|
|
22
|
+
def index
|
|
23
|
+
query = BigbluebuttonRoom
|
|
24
|
+
|
|
25
|
+
# Search
|
|
26
|
+
search_terms = map_search(params[:filter])
|
|
27
|
+
query = query.search_by_terms(search_terms) unless search_terms.blank?
|
|
28
|
+
|
|
29
|
+
# Sort
|
|
30
|
+
sort_str = map_sort(params[:sort], 'name ASC', ['activity', 'name'])
|
|
31
|
+
if sort_str.match(/activity/) # if requested activity ignore the rest
|
|
32
|
+
activity_order = sort_str.match(/activity ASC/) ? 'DESC' : 'ASC' # yes, inverse logic!
|
|
33
|
+
query = query.order_by_activity(activity_order)
|
|
34
|
+
else
|
|
35
|
+
query = query.order(sort_str)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Limits and pagination
|
|
39
|
+
limit, offset, page = map_pagination(params[:page], 10)
|
|
40
|
+
query = query.limit(limit).offset(offset)
|
|
41
|
+
@pagination_links = map_pagination_links(page)
|
|
42
|
+
|
|
43
|
+
@rooms = query
|
|
44
|
+
respond_with(@rooms)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def running
|
|
48
|
+
check_is_running
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def join
|
|
52
|
+
error_room_not_running unless check_is_running
|
|
53
|
+
|
|
54
|
+
# map "meta[_-]" to "userdata-"
|
|
55
|
+
options = params.select{ |k,v| k.match(/^meta[-_]/) }
|
|
56
|
+
unless options.blank?
|
|
57
|
+
options = options.map{ |k,v| { k.gsub(/^meta[-_]/, 'userdata-') => v } }.reduce(:merge)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
@url = @room.parameterized_join_url(@user_name, @user_role, nil, options)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
protected
|
|
64
|
+
|
|
65
|
+
def find_room
|
|
66
|
+
@room ||= BigbluebuttonRoom.find_by(param: params[:id])
|
|
67
|
+
error_room_not_found if @room.nil?
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def join_user_params
|
|
71
|
+
if BigbluebuttonRails.configuration.guest_support
|
|
72
|
+
guest_role = :guest
|
|
73
|
+
else
|
|
74
|
+
guest_role = :attendee
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
@user_name = params[:name]
|
|
78
|
+
return error_missing_params if @user_name.blank?
|
|
79
|
+
|
|
80
|
+
if @room.private
|
|
81
|
+
key = params[:key]
|
|
82
|
+
return error_missing_params if key.blank?
|
|
83
|
+
@user_role = @room.user_role(key)
|
|
84
|
+
return error_invalid_key if @user_role.blank?
|
|
85
|
+
else
|
|
86
|
+
@user_role = guest_role
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def check_is_running
|
|
91
|
+
begin
|
|
92
|
+
@room.fetch_is_running?
|
|
93
|
+
rescue StandardError => e
|
|
94
|
+
@errors = [BigbluebuttonRails::APIError.new(e.to_s, 500)]
|
|
95
|
+
render 'bigbluebutton/api/error'
|
|
96
|
+
end
|
|
97
|
+
@room.is_running?
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def set_content_type
|
|
101
|
+
self.content_type = 'application/vnd.api+json'
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def set_request_headers
|
|
105
|
+
@room.request_headers["x-forwarded-for"] = request.remote_ip if @room.present?
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def authenticate_api
|
|
109
|
+
authorization = request.headers["Authorization"]
|
|
110
|
+
secret = authorization.gsub(/^Bearer /, '') if authorization.present?
|
|
111
|
+
server_secret = BigbluebuttonRails.configuration.api_secret
|
|
112
|
+
if server_secret != '' &&
|
|
113
|
+
(server_secret.nil? || secret.blank? || secret != server_secret)
|
|
114
|
+
error_forbidden
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|