amazon-chime-sdk-rails 2.0.1 → 2.2.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/.github/dependabot.yml +7 -0
- data/.github/workflows/build.yml +14 -8
- data/CHANGELOG.md +28 -0
- data/Dockerfile +1 -1
- data/Gemfile +3 -7
- data/README.md +12 -8
- data/amazon-chime-sdk-rails.gemspec +7 -7
- data/docs/Develop_Rails_API_Application.md +9 -2
- data/docs/Develop_Rails_View_Application.md +9 -14
- data/gemfiles/Gemfile.rails-7.0 +2 -5
- data/gemfiles/Gemfile.rails-7.1 +1 -4
- data/gemfiles/Gemfile.rails-7.2 +1 -4
- data/gemfiles/Gemfile.rails-8.0 +1 -6
- data/gemfiles/Gemfile.rails-8.1 +21 -0
- data/lib/chime_sdk/config.rb +10 -0
- data/lib/chime_sdk/controller/attendees.rb +17 -3
- data/lib/chime_sdk/controller/common.rb +47 -1
- data/lib/chime_sdk/controller/meetings.rb +7 -5
- data/lib/chime_sdk/version.rb +1 -1
- data/lib/generators/chime_sdk/js_generator.rb +6 -1
- data/lib/generators/templates/chime_sdk.rb +5 -0
- data/lib/generators/templates/controllers/meeting_attendees_controller.rb +13 -1
- data/lib/generators/templates/controllers/meetings_controller.rb +2 -1
- data/lib/generators/templates/views/meetings/show.html.erb +21 -11
- data/spec/generators/controllers_generator_spec.rb +2 -0
- data/spec/rails_app/app/assets/javascripts/application.js +1 -3
- data/spec/rails_app/app/controllers/api/public/meeting_attendees_controller.rb +6 -0
- data/spec/rails_app/app/controllers/api/public/meetings_controller.rb +6 -0
- data/spec/rails_app/app/controllers/meeting_attendees_controller.rb +10 -0
- data/spec/rails_app/app/views/layouts/application.html.erb +2 -2
- data/spec/rails_app/app/views/meetings/show.html.erb +21 -11
- data/spec/rails_app/app/views/rooms/show.html.erb +1 -5
- data/spec/rails_app/config/environments/test.rb +8 -1
- data/spec/requests/atendees_spec.rb +56 -0
- data/spec/requests/meetings_spec.rb +105 -8
- metadata +18 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 168cdb6149788c0f8499ae2499df0f0d2a5590dacccaf0eed854704e91f7d3e6
|
|
4
|
+
data.tar.gz: a7d0c20d4a39929afe2b60b0c0b01f74181ab0807c5c27d76f2cc98a5a1760fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1be855d627474e0382b628578a70457beeff4b2f0f3400d107f35d99dc7e8a31020163137fc6e186eb4ff67754b17b957a16d809e0f6c751ecb563e198167d0
|
|
7
|
+
data.tar.gz: 2ce6405a5317f87052777b3830c844e6e5dd5702c2fa14ce1ff425ab04de70f6c69778d624d0268dec08d356ab801f148c7c64471ae4c04d39028780769f0141
|
data/.github/workflows/build.yml
CHANGED
|
@@ -13,7 +13,10 @@ on:
|
|
|
13
13
|
env:
|
|
14
14
|
# https://nodejs.org/en/download/current
|
|
15
15
|
# https://nodejs.org/en/about/previous-releases
|
|
16
|
-
node-version:
|
|
16
|
+
node-version: 24.x
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
17
20
|
|
|
18
21
|
jobs:
|
|
19
22
|
build:
|
|
@@ -26,16 +29,19 @@ jobs:
|
|
|
26
29
|
- gemfiles/Gemfile.rails-7.1
|
|
27
30
|
- gemfiles/Gemfile.rails-7.2
|
|
28
31
|
- gemfiles/Gemfile.rails-8.0
|
|
32
|
+
- gemfiles/Gemfile.rails-8.1
|
|
29
33
|
include:
|
|
30
34
|
# https://www.ruby-lang.org/en/downloads
|
|
31
35
|
- gemfile: gemfiles/Gemfile.rails-7.0
|
|
32
|
-
ruby-version: 3.
|
|
36
|
+
ruby-version: 3.2.9
|
|
33
37
|
- gemfile: gemfiles/Gemfile.rails-7.1
|
|
34
|
-
ruby-version: 3.2.
|
|
38
|
+
ruby-version: 3.2.9
|
|
35
39
|
- gemfile: gemfiles/Gemfile.rails-7.2
|
|
36
|
-
ruby-version: 3.3.
|
|
40
|
+
ruby-version: 3.3.10
|
|
37
41
|
- gemfile: gemfiles/Gemfile.rails-8.0
|
|
38
|
-
ruby-version: 3.
|
|
42
|
+
ruby-version: 3.4.8
|
|
43
|
+
- gemfile: gemfiles/Gemfile.rails-8.1
|
|
44
|
+
ruby-version: 4.0.0
|
|
39
45
|
- gemfile: Gemfile
|
|
40
46
|
ruby-version: head
|
|
41
47
|
allow_failures: 'true'
|
|
@@ -45,14 +51,14 @@ jobs:
|
|
|
45
51
|
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
|
|
46
52
|
|
|
47
53
|
steps:
|
|
48
|
-
- uses: actions/checkout@
|
|
54
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
49
55
|
- name: Set up Ruby
|
|
50
|
-
uses: ruby/setup-ruby@v1
|
|
56
|
+
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
|
|
51
57
|
with:
|
|
52
58
|
ruby-version: ${{ matrix.ruby-version }}
|
|
53
59
|
bundler-cache: true
|
|
54
60
|
- name: Set up Node.js
|
|
55
|
-
uses: actions/setup-node@
|
|
61
|
+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
56
62
|
with:
|
|
57
63
|
node-version: ${{ env.node-version }}
|
|
58
64
|
- name: Prepare test application
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## 2.2.0 / 2026-10-28
|
|
2
|
+
[Full Changelog](http://github.com/simukappu/amazon-chime-sdk-rails/compare/v2.1.0...v2.2.0)
|
|
3
|
+
|
|
4
|
+
Security Fixes:
|
|
5
|
+
|
|
6
|
+
* Verify that requested meetings belong to the requesting resource. Meetings and attendees controllers now respond with 404 when the meeting's `ExternalMeetingId` is not `config.prefix + meeting_request_id`, so users can no longer get, delete, or join meetings of other resources (such as other private rooms) by meeting ID
|
|
7
|
+
* Attendees controllers must now define `meeting_request_id` with the same value as the meetings controller. The generated attendees controller template includes it
|
|
8
|
+
* Set `config.verify_meeting_request_id = false`, or override `verify_meeting_request_id?` in a controller, to restore the previous behavior
|
|
9
|
+
* Do not return `JoinToken` from attendees `index` and `show` actions. A join token is the credential to join a meeting as that attendee, so other participants could impersonate the attendee
|
|
10
|
+
* Do not create meetings or attendees by HTTP GET request parameters. `create_meeting` in meetings `index` and `create_attendee_from_meeting` in meetings `show` can now only disable the creation enabled by `config.create_meeting_by_get_request` and `config.create_attendee_from_meeting`, since GET requests are not protected from CSRF
|
|
11
|
+
* Raise `NotImplementedError` from `attendee_request_id` unless it is defined in your controllers. The previous default `"default"` made every user join meetings as the same attendee with the same join token. The generated controller templates also raise it until you define `attendee_request_id`
|
|
12
|
+
* Build the attendee list in the generated meeting view with `textContent` instead of `innerHTML`, so attendee names from application metadata cannot inject HTML
|
|
13
|
+
* Remove the unpinned axios script loaded from unpkg in the generated meeting view and use `fetch` instead
|
|
14
|
+
* Pin the aws-samples/amazon-chime-sdk commit that `rails g chime_sdk:js` clones and runs npm scripts in
|
|
15
|
+
|
|
16
|
+
## 2.1.0 / 2026-04-11
|
|
17
|
+
[Full Changelog](http://github.com/simukappu/amazon-chime-sdk-rails/compare/v2.0.1...v2.1.0)
|
|
18
|
+
|
|
19
|
+
Enhancements:
|
|
20
|
+
|
|
21
|
+
* Support Rails 8.1
|
|
22
|
+
* Update CI configuration and documentation
|
|
23
|
+
|
|
24
|
+
Dependencies:
|
|
25
|
+
|
|
26
|
+
* Require Ruby 3.1+ and Rails 7.0+
|
|
27
|
+
* Update development dependencies
|
|
28
|
+
|
|
1
29
|
## 2.0.1 / 2025-01-14
|
|
2
30
|
[Full Changelog](http://github.com/simukappu/amazon-chime-sdk-rails/compare/v2.0.0...v2.0.1)
|
|
3
31
|
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
|
@@ -3,27 +3,23 @@ source 'https://rubygems.org'
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
5
|
# Bundle Rails
|
|
6
|
-
gem 'rails', '~>
|
|
7
|
-
# https://github.com/lynndylanhurley/devise_token_auth/pull/
|
|
6
|
+
gem 'rails', '~> 8.1.0'
|
|
7
|
+
# https://github.com/lynndylanhurley/devise_token_auth/pull/1639
|
|
8
8
|
gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth.git'
|
|
9
9
|
|
|
10
10
|
gem 'sqlite3'
|
|
11
11
|
gem 'puma'
|
|
12
12
|
gem 'sass-rails'
|
|
13
|
-
gem 'turbolinks'
|
|
14
13
|
gem 'jbuilder'
|
|
15
14
|
|
|
16
15
|
group :development do
|
|
17
16
|
gem 'web-console'
|
|
18
17
|
gem 'listen'
|
|
19
|
-
gem 'spring'
|
|
20
|
-
gem 'spring-watcher-listen'
|
|
21
18
|
end
|
|
22
19
|
|
|
23
20
|
group :test do
|
|
24
|
-
# gem 'coveralls', require: false
|
|
25
21
|
gem 'coveralls_reborn', require: false
|
|
26
22
|
end
|
|
27
23
|
|
|
28
24
|
gem 'rack-cors', groups: [:production, :development]
|
|
29
|
-
gem 'dotenv-rails', groups: [:production, :development]
|
|
25
|
+
gem 'dotenv-rails', groups: [:production, :development]
|
data/README.md
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
# amazon-chime-sdk-rails
|
|
2
2
|
|
|
3
|
-
[](https://github.com/simukappu/amazon-chime-sdk-rails/actions/workflows/build.yml)
|
|
4
|
-
[](https://coveralls.io/github/simukappu/amazon-chime-sdk-rails?branch=master)
|
|
5
|
-
[](https://depfu.com/repos/simukappu/amazon-chime-sdk-rails)
|
|
6
|
-
[](http://inch-ci.org/github/simukappu/amazon-chime-sdk-rails)
|
|
7
3
|
[](https://rubygems.org/gems/amazon-chime-sdk-rails)
|
|
8
4
|
[](https://rubygems.org/gems/amazon-chime-sdk-rails)
|
|
9
|
-
[](https://github.com/simukappu/amazon-chime-sdk-rails/actions/workflows/build.yml)
|
|
6
|
+
[](https://coveralls.io/github/simukappu/amazon-chime-sdk-rails?branch=master)
|
|
7
|
+
[](LICENSE)
|
|
10
8
|
|
|
11
9
|
*amazon-chime-sdk-rails* brings server-side implementation of [Amazon Chime SDK](https://aws.amazon.com/chime/chime-sdk) to your [Ruby on Rails](https://rubyonrails.org) application. [Amazon Chime SDK](https://aws.amazon.com/chime/chime-sdk) provides client-side implementation to build real-time communications for your application, and *amazon-chime-sdk-rails* enables you to easily add server-side implementation to your Rails application.
|
|
12
10
|
|
|
11
|
+
## Supported Versions
|
|
12
|
+
|
|
13
|
+
* Ruby 3.1+
|
|
14
|
+
* Rails 7.0+
|
|
15
|
+
|
|
16
|
+
Tested with Rails 7.0, 7.1, 7.2, 8.0 and 8.1.
|
|
17
|
+
|
|
13
18
|
<kbd></kbd>
|
|
14
19
|
|
|
15
20
|
*amazon-chime-sdk-rails* supports both of [Rails API Application](https://guides.rubyonrails.org/api_app.html) and [Rails Application with Action View](https://guides.rubyonrails.org/action_view_overview.html). The gem provides following functions:
|
|
16
|
-
* *Meeting Coordinator* - Wrapper client module of [AWS SDK for Ruby](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/
|
|
21
|
+
* *Meeting Coordinator* - Wrapper client module of [AWS SDK for Ruby](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ChimeSDKMeetings/Client.html), which simulates [AWS SDK for JavaScript](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ChimeSDKMeetings.html) to communicate with Amazon Chime SDK client implementation by JSON format.
|
|
17
22
|
* *Controller Templates* - Mixin module implementation for meetings and attendees controllers.
|
|
18
23
|
* *Rails Generators*
|
|
19
24
|
* *Controller Generator* - Generator to create customizable meetings and attendees controllers in your Rails application.
|
|
@@ -139,8 +144,7 @@ Push "Continue" and go to the private meeting room!
|
|
|
139
144
|
|
|
140
145
|
### Deploy application to your AWS environment
|
|
141
146
|
|
|
142
|
-
At first, [install the latest version of AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), [set up AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) and [
|
|
143
|
-
At first, [install the latest version of AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), [set up AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) and [installing the AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html) in your local environment.
|
|
147
|
+
At first, [install the latest version of AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), [set up AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) and [install the AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html) in your local environment.
|
|
144
148
|
|
|
145
149
|
Deploy customized React Meeting Demo to your AWS environment:
|
|
146
150
|
|
|
@@ -16,14 +16,14 @@ Gem::Specification.new do |s|
|
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
|
17
17
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
|
18
18
|
s.require_paths = ["lib"]
|
|
19
|
-
s.required_ruby_version = '>=
|
|
19
|
+
s.required_ruby_version = '>= 3.1.0'
|
|
20
20
|
|
|
21
|
-
s.add_dependency 'railties', '>=
|
|
21
|
+
s.add_dependency 'railties', '>= 7.0.0'
|
|
22
22
|
s.add_dependency 'aws-sdk-chimesdkmeetings', '>= 1.0.0'
|
|
23
23
|
|
|
24
|
-
s.add_development_dependency 'rspec-rails', '>=
|
|
25
|
-
s.add_development_dependency 'factory_bot_rails', '>= 6.
|
|
26
|
-
s.add_development_dependency 'ammeter', '>= 1.1.
|
|
27
|
-
s.add_development_dependency 'yard', '>= 0.9.
|
|
28
|
-
s.add_development_dependency 'devise_token_auth', '>= 1.
|
|
24
|
+
s.add_development_dependency 'rspec-rails', '>= 6.0.0'
|
|
25
|
+
s.add_development_dependency 'factory_bot_rails', '>= 6.2.0'
|
|
26
|
+
s.add_development_dependency 'ammeter', '>= 1.1.5'
|
|
27
|
+
s.add_development_dependency 'yard', '>= 0.9.36'
|
|
28
|
+
s.add_development_dependency 'devise_token_auth', '>= 1.2.2'
|
|
29
29
|
end
|
|
@@ -185,7 +185,7 @@ class Api::MeetingsController < ApplicationController
|
|
|
185
185
|
"PrivateRoom-#{@room.id}"
|
|
186
186
|
end
|
|
187
187
|
|
|
188
|
-
#
|
|
188
|
+
# Update (replace raise NotImplementedError)
|
|
189
189
|
def attendee_request_id
|
|
190
190
|
"User-#{current_api_user.id}"
|
|
191
191
|
end
|
|
@@ -234,7 +234,12 @@ class Api::MeetingAttendeesController < ApplicationController
|
|
|
234
234
|
end
|
|
235
235
|
end
|
|
236
236
|
|
|
237
|
-
# Uncomment
|
|
237
|
+
# Uncomment (use the same value as your meetings controller)
|
|
238
|
+
def meeting_request_id
|
|
239
|
+
"PrivateRoom-#{@room.id}"
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# Update (replace raise NotImplementedError)
|
|
238
243
|
def attendee_request_id
|
|
239
244
|
"User-#{current_api_user.id}"
|
|
240
245
|
end
|
|
@@ -284,6 +289,8 @@ Now ready to take off!
|
|
|
284
289
|
|
|
285
290
|
Created Rails API works like this:
|
|
286
291
|
|
|
292
|
+
Note: The API response examples below are simplified for readability. Actual responses may include additional fields such as `MeetingFeatures`, `MeetingArn`, `TenantIds`, `PrimaryMeetingId` and `Capabilities` depending on the Amazon Chime SDK version.
|
|
293
|
+
|
|
287
294
|
```bash
|
|
288
295
|
# Sign up users
|
|
289
296
|
|
|
@@ -106,9 +106,8 @@ Add login header to your application. Create new `app/views/layouts/_header.html
|
|
|
106
106
|
<%= csrf_meta_tags %>
|
|
107
107
|
<%= csp_meta_tag %>
|
|
108
108
|
|
|
109
|
-
<%= stylesheet_link_tag 'application', media: 'all'
|
|
110
|
-
<%=
|
|
111
|
-
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
|
109
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
|
110
|
+
<%= javascript_include_tag 'application' %>
|
|
112
111
|
</head>
|
|
113
112
|
|
|
114
113
|
<body>
|
|
@@ -252,7 +251,7 @@ class MeetingsController < ApplicationController
|
|
|
252
251
|
"PrivateRoom-#{@room.id}"
|
|
253
252
|
end
|
|
254
253
|
|
|
255
|
-
#
|
|
254
|
+
# Update (replace raise NotImplementedError)
|
|
256
255
|
def attendee_request_id
|
|
257
256
|
"User-#{current_user.id}"
|
|
258
257
|
end
|
|
@@ -273,15 +272,6 @@ class MeetingsController < ApplicationController
|
|
|
273
272
|
"User": User.find_by_id(user_id)
|
|
274
273
|
}
|
|
275
274
|
end
|
|
276
|
-
|
|
277
|
-
# Uncomment
|
|
278
|
-
def application_attendee_metadata(attendee)
|
|
279
|
-
user_id = attendee[:Attendee][:ExternalUserId].split('-')[3]
|
|
280
|
-
{
|
|
281
|
-
"AttendeeType": "User",
|
|
282
|
-
"User": User.find_by_id(user_id)
|
|
283
|
-
}
|
|
284
|
-
end
|
|
285
275
|
end
|
|
286
276
|
```
|
|
287
277
|
|
|
@@ -309,7 +299,12 @@ class MeetingAttendeesController < ApplicationController
|
|
|
309
299
|
end
|
|
310
300
|
end
|
|
311
301
|
|
|
312
|
-
# Uncomment
|
|
302
|
+
# Uncomment (use the same value as your meetings controller)
|
|
303
|
+
def meeting_request_id
|
|
304
|
+
"PrivateRoom-#{@room.id}"
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# Update (replace raise NotImplementedError)
|
|
313
308
|
def attendee_request_id
|
|
314
309
|
"User-#{current_user.id}"
|
|
315
310
|
end
|
data/gemfiles/Gemfile.rails-7.0
CHANGED
|
@@ -5,7 +5,7 @@ gemspec path: '../'
|
|
|
5
5
|
# Bundle Rails
|
|
6
6
|
gem 'rails', '~> 7.0.0'
|
|
7
7
|
|
|
8
|
-
gem 'sqlite3',
|
|
8
|
+
gem 'sqlite3', '~> 1.4'
|
|
9
9
|
gem 'puma'
|
|
10
10
|
gem 'sass-rails'
|
|
11
11
|
gem 'turbolinks'
|
|
@@ -14,11 +14,8 @@ gem 'jbuilder'
|
|
|
14
14
|
group :development do
|
|
15
15
|
gem 'web-console'
|
|
16
16
|
gem 'listen'
|
|
17
|
-
gem 'spring'
|
|
18
|
-
gem 'spring-watcher-listen'
|
|
19
17
|
end
|
|
20
18
|
|
|
21
19
|
group :test do
|
|
22
|
-
# gem 'coveralls', require: false
|
|
23
20
|
gem 'coveralls_reborn', require: false
|
|
24
|
-
end
|
|
21
|
+
end
|
data/gemfiles/Gemfile.rails-7.1
CHANGED
data/gemfiles/Gemfile.rails-7.2
CHANGED
data/gemfiles/Gemfile.rails-8.0
CHANGED
|
@@ -10,17 +10,12 @@ gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_a
|
|
|
10
10
|
gem 'sqlite3'
|
|
11
11
|
gem 'puma'
|
|
12
12
|
gem 'sass-rails'
|
|
13
|
-
gem 'turbolinks'
|
|
14
13
|
gem 'jbuilder'
|
|
15
14
|
|
|
16
15
|
group :development do
|
|
17
16
|
gem 'web-console'
|
|
18
|
-
gem 'listen'
|
|
19
|
-
gem 'spring'
|
|
20
|
-
gem 'spring-watcher-listen'
|
|
21
17
|
end
|
|
22
18
|
|
|
23
19
|
group :test do
|
|
24
|
-
# gem 'coveralls', require: false
|
|
25
20
|
gem 'coveralls_reborn', require: false
|
|
26
|
-
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gemspec path: '../'
|
|
4
|
+
|
|
5
|
+
# Bundle Rails
|
|
6
|
+
gem 'rails', '~> 8.1.0'
|
|
7
|
+
# https://github.com/lynndylanhurley/devise_token_auth/pull/1639
|
|
8
|
+
gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth.git'
|
|
9
|
+
|
|
10
|
+
gem 'sqlite3'
|
|
11
|
+
gem 'puma'
|
|
12
|
+
gem 'sass-rails'
|
|
13
|
+
gem 'jbuilder'
|
|
14
|
+
|
|
15
|
+
group :development do
|
|
16
|
+
gem 'web-console'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
group :test do
|
|
20
|
+
gem 'coveralls_reborn', require: false
|
|
21
|
+
end
|
data/lib/chime_sdk/config.rb
CHANGED
|
@@ -64,6 +64,15 @@ module ChimeSdk
|
|
|
64
64
|
# @return [Boolean] Whether the application creates meeting in meetings#index action by HTTP GET request
|
|
65
65
|
attr_accessor :create_meeting_by_get_request
|
|
66
66
|
|
|
67
|
+
# @overload verify_meeting_request_id
|
|
68
|
+
# Return whether the controllers verify that requested meetings were created with ChimeSdk.config.prefix + meeting_request_id.
|
|
69
|
+
# @return [Boolean] Whether the controllers verify that requested meetings were created with ChimeSdk.config.prefix + meeting_request_id
|
|
70
|
+
# @overload verify_meeting_request_id=(value)
|
|
71
|
+
# Set whether the controllers verify that requested meetings were created with ChimeSdk.config.prefix + meeting_request_id.
|
|
72
|
+
# @param [Boolean] verify_meeting_request_id The new verify_meeting_request_id
|
|
73
|
+
# @return [Boolean] Whether the controllers verify that requested meetings were created with ChimeSdk.config.prefix + meeting_request_id
|
|
74
|
+
attr_accessor :verify_meeting_request_id
|
|
75
|
+
|
|
67
76
|
# Initialize configuration for ChimeSdk.
|
|
68
77
|
# These configuration can be overridden in initializer.
|
|
69
78
|
# @return [Config] A new instance of Config
|
|
@@ -75,6 +84,7 @@ module ChimeSdk
|
|
|
75
84
|
@create_meeting_with_attendee = true
|
|
76
85
|
@create_attendee_from_meeting = true
|
|
77
86
|
@create_meeting_by_get_request = false
|
|
87
|
+
@verify_meeting_request_id = true
|
|
78
88
|
end
|
|
79
89
|
end
|
|
80
90
|
end
|
|
@@ -12,15 +12,17 @@ module ChimeSdk
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
# GET /meetings/:meeting_id/attendees
|
|
15
|
+
# Join tokens are omitted since they are credentials of each attendee.
|
|
15
16
|
def index
|
|
16
17
|
list_attendees
|
|
17
|
-
render json: { attendees: @attendees }
|
|
18
|
+
render json: { attendees: @attendees.map { |attendee| without_join_token(attendee) } }
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
# GET /meetings/:meeting_id/attendees/:attendee_id
|
|
22
|
+
# The join token is omitted since it is a credential of the attendee.
|
|
21
23
|
def show
|
|
22
24
|
get_attendee
|
|
23
|
-
render json: @attendee
|
|
25
|
+
render json: without_join_token(@attendee)
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
# POST /meetings/:meeting_id/attendees
|
|
@@ -55,13 +57,25 @@ module ChimeSdk
|
|
|
55
57
|
params[:id]
|
|
56
58
|
end
|
|
57
59
|
|
|
60
|
+
# Unique meeting request id to identify meeting by Amazon Chime.
|
|
61
|
+
# Configure it depending on your application resources to identify meeting.
|
|
62
|
+
# For example, set "PrivateRoom-#{@room.id}" by Room model.
|
|
63
|
+
# Requested meetings are verified with this id when ChimeSdk.config.verify_meeting_request_id is enabled.
|
|
64
|
+
# @api protected
|
|
65
|
+
# @return [String] Unique meeting request id to identify meeting by Amazon Chime
|
|
66
|
+
def meeting_request_id
|
|
67
|
+
"default"
|
|
68
|
+
end
|
|
69
|
+
|
|
58
70
|
# Unique attendee request id to identify attendee by Amazon Chime.
|
|
59
71
|
# Configure it depending on your application resources to identify attendee.
|
|
60
72
|
# For example, set "User-#{current_user.id}" by User model.
|
|
73
|
+
# Each user must have a different value, since users with the same value join meetings as the same attendee.
|
|
61
74
|
# @api protected
|
|
62
75
|
# @return [String] Unique attendee request id to identify attendee by Amazon Chime
|
|
76
|
+
# @raise [NotImplementedError] Unless overridden in your controllers
|
|
63
77
|
def attendee_request_id
|
|
64
|
-
"
|
|
78
|
+
raise NotImplementedError, "Define attendee_request_id in #{self.class.name} to identify each attendee, e.g. \"User-\#{current_user.id}\""
|
|
65
79
|
end
|
|
66
80
|
|
|
67
81
|
# Path for meetings#index action such as meetings_path.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
module ChimeSdk
|
|
2
2
|
# Controllers implementation by amazon-chime-sdk-rails.
|
|
3
3
|
module Controller
|
|
4
|
+
# Error raised when the requested meeting is not the meeting identified by meeting_request_id.
|
|
5
|
+
class MeetingNotFoundError < StandardError; end
|
|
6
|
+
|
|
4
7
|
# Common implementation for controllers.
|
|
5
8
|
module Common
|
|
6
9
|
extend ActiveSupport::Concern
|
|
@@ -9,6 +12,7 @@ module ChimeSdk
|
|
|
9
12
|
rescue_from Aws::ChimeSDKMeetings::Errors::ForbiddenException, with: :render_forbidden
|
|
10
13
|
rescue_from Aws::ChimeSDKMeetings::Errors::NotFoundException, with: :render_resource_not_found
|
|
11
14
|
rescue_from Aws::ChimeSDKMeetings::Errors::ValidationException, with: :render_resource_not_found
|
|
15
|
+
rescue_from ChimeSdk::Controller::MeetingNotFoundError, with: :render_resource_not_found
|
|
12
16
|
|
|
13
17
|
class ::String
|
|
14
18
|
# Convets to boolean.
|
|
@@ -51,7 +55,7 @@ module ChimeSdk
|
|
|
51
55
|
# @api protected
|
|
52
56
|
# @return [Hash] Meeting
|
|
53
57
|
def get_meeting
|
|
54
|
-
@meeting = ChimeSdk::MeetingCoordinator.get_meeting(meeting_id)
|
|
58
|
+
@meeting = verify_meeting(ChimeSdk::MeetingCoordinator.get_meeting(meeting_id))
|
|
55
59
|
@meeting = merge_application_meeting_metadata(@meeting)
|
|
56
60
|
end
|
|
57
61
|
|
|
@@ -59,13 +63,43 @@ module ChimeSdk
|
|
|
59
63
|
# @api protected
|
|
60
64
|
# @return [void]
|
|
61
65
|
def delete_meeting
|
|
66
|
+
verify_meeting_id
|
|
62
67
|
ChimeSdk::MeetingCoordinator.delete_meeting(meeting_id)
|
|
63
68
|
end
|
|
64
69
|
|
|
70
|
+
# Whether to verify that requested meetings were created with ChimeSdk.config.prefix + meeting_request_id.
|
|
71
|
+
# Override it to change the behavior for each controller.
|
|
72
|
+
# @api protected
|
|
73
|
+
# @return [Boolean] Whether to verify requested meetings
|
|
74
|
+
def verify_meeting_request_id?
|
|
75
|
+
ChimeSdk.config.verify_meeting_request_id
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Verify that the meeting was created with ChimeSdk.config.prefix + meeting_request_id.
|
|
79
|
+
# @api protected
|
|
80
|
+
# @param [Hash] meeting Meeting JSON object as hash
|
|
81
|
+
# @return [Hash] Verified meeting
|
|
82
|
+
# @raise [ChimeSdk::Controller::MeetingNotFoundError] When the meeting is not the meeting identified by meeting_request_id
|
|
83
|
+
def verify_meeting(meeting)
|
|
84
|
+
if verify_meeting_request_id? && meeting.dig(:Meeting, :ExternalMeetingId) != ChimeSdk.config.prefix + meeting_request_id
|
|
85
|
+
raise ChimeSdk::Controller::MeetingNotFoundError, "Meeting not found"
|
|
86
|
+
end
|
|
87
|
+
meeting
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Verify the requested meeting by meeting id unless it has already been verified.
|
|
91
|
+
# @api protected
|
|
92
|
+
# @return [void]
|
|
93
|
+
# @raise [ChimeSdk::Controller::MeetingNotFoundError] When the meeting is not the meeting identified by meeting_request_id
|
|
94
|
+
def verify_meeting_id
|
|
95
|
+
verify_meeting(ChimeSdk::MeetingCoordinator.get_meeting(meeting_id)) if @meeting.nil? && verify_meeting_request_id?
|
|
96
|
+
end
|
|
97
|
+
|
|
65
98
|
# List attendees by MeetingCoordinator.
|
|
66
99
|
# @api protected
|
|
67
100
|
# @return [Array<Hash>] Attendee list
|
|
68
101
|
def list_attendees
|
|
102
|
+
verify_meeting_id
|
|
69
103
|
@attendees = ChimeSdk::MeetingCoordinator.list_attendees(meeting_id)
|
|
70
104
|
@attendees = @attendees.map { |attendee| merge_application_attendee_metadata(attendee) }
|
|
71
105
|
end
|
|
@@ -74,6 +108,7 @@ module ChimeSdk
|
|
|
74
108
|
# @api protected
|
|
75
109
|
# @return [Hash] Created attendee
|
|
76
110
|
def create_attendee
|
|
111
|
+
verify_meeting_id
|
|
77
112
|
@attendee = ChimeSdk::MeetingCoordinator.create_attendee(meeting_id, attendee_request_id)
|
|
78
113
|
@attendee = merge_application_attendee_metadata(@attendee)
|
|
79
114
|
end
|
|
@@ -82,6 +117,7 @@ module ChimeSdk
|
|
|
82
117
|
# @api protected
|
|
83
118
|
# @return [Hash] Attendee
|
|
84
119
|
def get_attendee
|
|
120
|
+
verify_meeting_id
|
|
85
121
|
@attendee = ChimeSdk::MeetingCoordinator.get_attendee(meeting_id, attendee_id)
|
|
86
122
|
@attendee = merge_application_attendee_metadata(@attendee)
|
|
87
123
|
end
|
|
@@ -90,6 +126,7 @@ module ChimeSdk
|
|
|
90
126
|
# @api protected
|
|
91
127
|
# @return [void]
|
|
92
128
|
def delete_attendee
|
|
129
|
+
verify_meeting_id
|
|
93
130
|
ChimeSdk::MeetingCoordinator.delete_attendee(meeting_id, attendee_id)
|
|
94
131
|
end
|
|
95
132
|
|
|
@@ -154,6 +191,15 @@ module ChimeSdk
|
|
|
154
191
|
attendee
|
|
155
192
|
end
|
|
156
193
|
|
|
194
|
+
# Return attendee without its join token.
|
|
195
|
+
# Join token is a credential to join the meeting as the attendee and must not be returned to other users.
|
|
196
|
+
# @api protected
|
|
197
|
+
# @param [Hash] attendee Attendee JSON object as hash
|
|
198
|
+
# @return [Hash] Attendee without join token
|
|
199
|
+
def without_join_token(attendee)
|
|
200
|
+
attendee.merge(Attendee: attendee[:Attendee].except(:JoinToken))
|
|
201
|
+
end
|
|
202
|
+
|
|
157
203
|
# Returns error response as Hash
|
|
158
204
|
# @api protected
|
|
159
205
|
# @return [Hash] Error message
|
|
@@ -16,9 +16,9 @@ module ChimeSdk
|
|
|
16
16
|
# GET /meetings.json
|
|
17
17
|
# @overload index(params)
|
|
18
18
|
# @param [Hash] params Request parameter options
|
|
19
|
-
# @option params [String] :create_meeting (ChimeSdk.config.create_meeting_by_get_request) Whether the application creates meeting in this meetings#index action by HTTP GET request
|
|
19
|
+
# @option params [String] :create_meeting (ChimeSdk.config.create_meeting_by_get_request) Whether the application creates meeting in this meetings#index action by HTTP GET request. This parameter can only disable it since GET requests are not protected from CSRF.
|
|
20
20
|
def index
|
|
21
|
-
if
|
|
21
|
+
if ChimeSdk.config.create_meeting_by_get_request && params[:create_meeting].to_s.to_boolean(true)
|
|
22
22
|
create
|
|
23
23
|
else
|
|
24
24
|
@meeting_request_id = ChimeSdk.config.prefix + meeting_request_id
|
|
@@ -34,10 +34,10 @@ module ChimeSdk
|
|
|
34
34
|
# GET /meetings/:meeting_id.json
|
|
35
35
|
# @overload show(params)
|
|
36
36
|
# @param [Hash] params Request parameter options
|
|
37
|
-
# @option params [String] :create_attendee_from_meeting (ChimeSdk.config.create_attendee_from_meeting) Whether the application creates attendee from meeting in meetings#show action
|
|
37
|
+
# @option params [String] :create_attendee_from_meeting (ChimeSdk.config.create_attendee_from_meeting) Whether the application creates attendee from meeting in meetings#show action. This parameter can only disable it since GET requests are not protected from CSRF.
|
|
38
38
|
def show
|
|
39
39
|
get_meeting
|
|
40
|
-
if
|
|
40
|
+
if ChimeSdk.config.create_attendee_from_meeting && params[:create_attendee_from_meeting].to_s.to_boolean(true)
|
|
41
41
|
create_attendee_from_meeting
|
|
42
42
|
end
|
|
43
43
|
respond_to do |format|
|
|
@@ -97,10 +97,12 @@ module ChimeSdk
|
|
|
97
97
|
# Unique attendee request id to identify attendee by Amazon Chime.
|
|
98
98
|
# Configure it depending on your application resources to identify attendee.
|
|
99
99
|
# For example, set "User-#{current_user.id}" by User model.
|
|
100
|
+
# Each user must have a different value, since users with the same value join meetings as the same attendee.
|
|
100
101
|
# @api protected
|
|
101
102
|
# @return [String] Unique attendee request id to identify attendee by Amazon Chime
|
|
103
|
+
# @raise [NotImplementedError] Unless overridden in your controllers
|
|
102
104
|
def attendee_request_id
|
|
103
|
-
"
|
|
105
|
+
raise NotImplementedError, "Define attendee_request_id in #{self.class.name} to identify each attendee, e.g. \"User-\#{current_user.id}\""
|
|
104
106
|
end
|
|
105
107
|
|
|
106
108
|
# Path for meetings#index action such as meetings_path.
|
data/lib/chime_sdk/version.rb
CHANGED
|
@@ -4,13 +4,17 @@ module ChimeSdk
|
|
|
4
4
|
module Generators
|
|
5
5
|
# Amazon Chime SDK single .js file generator.
|
|
6
6
|
# Bundle Amazon Chime SDK into single amazon-chime-sdk.min.js file and copy it to app/assets/javascripts directory.
|
|
7
|
-
# @example Run Amazon Chime SDK single .js file generator with the
|
|
7
|
+
# @example Run Amazon Chime SDK single .js file generator with the version in the pinned singlejs package.json
|
|
8
8
|
# rails generate chime_sdk:js
|
|
9
9
|
# @example Run Amazon Chime SDK single .js file generator with specified version
|
|
10
10
|
# rails generate chime_sdk:js 2.24.0
|
|
11
11
|
# @see https://github.com/aws-samples/amazon-chime-sdk/tree/main/utils/singlejs
|
|
12
12
|
# @see https://www.npmjs.com/package/amazon-chime-sdk-js
|
|
13
13
|
class JsGenerator < Rails::Generators::Base
|
|
14
|
+
# Commit of aws-samples/amazon-chime-sdk repository to build the single .js file from.
|
|
15
|
+
# Pinned since the generator runs npm scripts in the cloned repository.
|
|
16
|
+
SINGLEJS_REPOSITORY_COMMIT = "6abe76a732c1fce4cce9d2dbbf28946482ac203e"
|
|
17
|
+
|
|
14
18
|
desc <<-DESC.strip_heredoc
|
|
15
19
|
Bundle Amazon Chime SDK into single amazon-chime-sdk.min.js file and copy it to app/assets/javascripts directory.
|
|
16
20
|
|
|
@@ -76,6 +80,7 @@ module ChimeSdk
|
|
|
76
80
|
system "mkdir -p tmp"
|
|
77
81
|
puts "Cloning into 'amazon-chime-sdk-js' git repository in tmp directory ..."
|
|
78
82
|
system "cd tmp; git clone https://github.com/aws-samples/amazon-chime-sdk.git > /dev/null 2>&1"
|
|
83
|
+
system "cd tmp/amazon-chime-sdk; git -c advice.detachedHead=false checkout #{SINGLEJS_REPOSITORY_COMMIT} > /dev/null 2>&1"
|
|
79
84
|
repository_path = "tmp/amazon-chime-sdk"
|
|
80
85
|
singlejs_path = "#{repository_path}/utils/singlejs"
|
|
81
86
|
package_json_path = "#{singlejs_path}/package.json"
|