forked from bigbluebutton/bbb-lti-broker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
145 changed files
with
4,952 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
*.DS_STORE | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore the default SQLite database. | ||
/db/*.sqlite3 | ||
/db/*.sqlite3-journal | ||
|
||
# Ignore all logfiles and tempfiles. | ||
*/log/* | ||
*/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
tmp/ | ||
log/ | ||
|
||
# Ignore Byebug command history file. | ||
.byebug_history | ||
|
||
db/*.sqlite3 | ||
|
||
/.ssh | ||
.env | ||
|
||
# used to fake https for testing | ||
localhost.crt | ||
localhost.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM ruby:2.7.0 | ||
|
||
USER root | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
postgresql-client \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - | ||
RUN apt install -y nodejs | ||
|
||
ENV APP_HOME /usr/src/app | ||
RUN mkdir -p $APP_HOME | ||
COPY . $APP_HOME | ||
WORKDIR $APP_HOME | ||
|
||
ENV BUNDLER_VERSION='2.1.4' | ||
RUN gem install bundler --no-document -v '2.1.4' | ||
RUN bundle install | ||
|
||
RUN bundle update --bundler 2.1.4 | ||
RUN gem update --system | ||
|
||
# Run startup command | ||
CMD bundle exec rails server -b 0.0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
source 'https://rubygems.org' | ||
|
||
git_source(:github) do |repo_name| | ||
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/') | ||
"https://github.com/#{repo_name}.git" | ||
end | ||
|
||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | ||
gem 'rails', '~> 6.0.0' | ||
# Use sqlite3 as the database for Active Record | ||
gem 'pg', '>= 0.4.4' | ||
# Use Puma as the app server | ||
gem 'puma', '>= 4.3.1' | ||
# Use SCSS for stylesheets | ||
gem 'sass-rails', '~> 5.0' | ||
# Use Uglifier as compressor for JavaScript assets | ||
gem 'uglifier', '>= 1.3.0' | ||
# Use CoffeeScript for .coffee assets and views | ||
gem 'coffee-rails', '~> 5.0' | ||
# See https://github.com/rails/execjs#readme for more supported runtimes | ||
# gem 'therubyracer', platforms: :ruby | ||
gem 'http' | ||
|
||
gem 'faraday' | ||
gem 'oauthenticator' | ||
gem 'addressable', '~> 2.7' | ||
|
||
gem 'bundler', '>=2.1.2' | ||
# Use jquery as the JavaScript library | ||
gem 'jquery-rails' | ||
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks | ||
gem 'turbolinks', '~> 5' | ||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder | ||
gem 'jbuilder', '~> 2.5' | ||
# Use Redis adapter to run Action Cable in production | ||
# gem 'redis', '~> 3.0' | ||
# Use ActiveModel has_secure_password | ||
# gem 'bcrypt', '~> 3.1.7' | ||
|
||
gem 'ims-lti' # , path: '../ims-lti' | ||
gem 'jwt' | ||
gem 'oauth' | ||
|
||
# gem 'doorkeeper', '~> 4.2', '>= 4.2.6' | ||
gem 'doorkeeper', '~> 5.2.2' | ||
|
||
gem 'lodash-rails' | ||
gem 'react-rails' | ||
|
||
# gem 'rails_lti2_provider', path: '../rails_lti2_provider' | ||
gem 'rails_lti2_provider', git: 'https://github.com/yfngdu/rails_lti2_provider.git', branch: 'gatekeeper-updated-rails' | ||
|
||
# Use Capistrano for deployment | ||
# gem 'capistrano-rails', group: :development | ||
|
||
group :development, :test do | ||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console | ||
gem 'byebug', platform: :mri | ||
gem 'dotenv-rails' | ||
end | ||
|
||
group :development do | ||
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code. | ||
gem 'listen', '~> 3.0.5' | ||
gem 'web-console', '>= 3.3.0' | ||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | ||
gem 'spring' | ||
gem 'spring-watcher-listen', '~> 2.0.0' | ||
end | ||
|
||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem | ||
gem 'tzinfo-data' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# bbb_lti_broker | ||
Generic LTI tool_provider | ||
|
||
# LTI Tool Provider Using ims-lti Gem | ||
|
||
[](https://heroku.com/deploy) | ||
|
||
This is a basic and simple LTI Tool Provider based on https://github.com/instructure/lti_tool_provider_example that uses the | ||
[ims-lti](https://github.com/instructure/ims-lti) 2.0.0.beta gem. It includes a simple Tool that is enabled by default, but it | ||
also allows to enable external applications to be hocked as Tools while acting as a broker for them | ||
|
||
To get this running in your development environment, check out the repo then: | ||
|
||
``` | ||
gem i bundler -v 1.17.3 | ||
bundle install | ||
bundle exec rake db:create | ||
bundle exec rake db:migrate | ||
bundle exec rake db:seed | ||
bundle exec rails s | ||
``` | ||
|
||
To get this running with Docker, follow these steps: | ||
|
||
``` | ||
cp docker-compose/config/* config/ | ||
docker-compose build | ||
docker-compose run --rm lti-test-tool bundle install | ||
docker-compose run --rm lti-test-tool bundle exec rake db:create | ||
docker-compose run --rm lti-test-tool bundle exec rake db:migrate | ||
docker-compose run --rm lti-test-tool bundle exec rake db:seed | ||
docker-compose up | ||
``` | ||
|
||
You can add the tool to a tool consumer with the the '/tool_proxy' endpoint | ||
|
||
To customize its behaviour copy the file dotenv as .env (for development only) and uncomment the environment variables as required. | ||
|
||
The database by default is sqlite3, even for production. Change the adapter for using postgresql and set up the rest of the parameters. | ||
|
||
``` | ||
# DB_ADAPTER=[sqlite3|postgresql] | ||
# DB_HOST=<localhost> | ||
# DB_NAME= | ||
# DB_USERNAME=<root> | ||
# DB_PASSWORD= | ||
``` | ||
|
||
For changing the root (this is mandatory if you run the Tool Provider in the same box where BigBlueButton is running) and also | ||
for making use of the brokerage capability the external Application(s) must be declared in environment variables. | ||
|
||
``` | ||
# App configuration | ||
# Define the root where the application is being mounted | ||
# (e.g. lti for http://example.com/lti or lti/tools for http://example.com/lti/tools) | ||
# RELATIVE_URL_ROOT=lti | ||
# LTI tools configuration | ||
# Define the external application to be used by default as for serving LTI launch requests. | ||
# DEFAULT_LTI_TOOL=<default|rooms> | ||
``` | ||
|
||
Whitelist the URL that the broker is on | ||
|
||
``` | ||
# DEVELOPER_MODE_ENABLED=broker.example.com | ||
``` | ||
|
||
There are some functions that can be enabled when setting the server into developer mode. | ||
This includes: | ||
- A LTI App can be used by default for testing purposes. | ||
- A UI for managing OAuth2 applications is enabled [http://example.com/lti/oauth/applications]. | ||
|
||
``` | ||
# DEVELOPER_MODE_ENABLED=true | ||
``` | ||
|
||
The seed will set up data by default that should be changed for production. This is: | ||
- LTI key pair | ||
``` | ||
{ | ||
:key => 'key', | ||
:secret => 'secret' | ||
} | ||
``` | ||
- LTI Tool specific for https://github.com/bigbluebutton/bbb-app-rooms | ||
``` | ||
{ | ||
:name => 'rooms', | ||
:uid => 'b21211c29d2720a4c847fc3a9097720a196f7fafddbaa0f68d5c1cb54fdbb046', | ||
:secret => '3590e00d7ebd398b75c4ea5a65097a19a687d72715af811bc8b3e78aa1664789', | ||
:redirect_uri => 'http://example.com/apps/rooms/auth/ltibroker/callback' | ||
} | ||
``` | ||
Where name is the application key (keep it short, 'rooms' is the identifier for bbb-app-rooms). uid and secret have to be used for OAuth2 when configuring the tool. And redirect_url holds the callback url for the application. As the app uses a gem that implements an omniauth strategy (see bbb-app-rooms documentation) you should keep it in the format expressed in the example. | ||
|
||
``` | ||
<scheme>://<hostname>/<root for the app>/<key for the app>/<omniauth callback> | ||
``` | ||
|
||
For changing the seeded data or adding keys and apps manually, there are some rake tools provided. | ||
|
||
``` | ||
rake db:apps:showall | ||
rake db:apps:update[rooms,https://newexample.com/apps] | ||
``` | ||
|
||
For adding an LTI 1.3 registration, there are some rake commands (for production) and a web UI for development mode. | ||
|
||
``` | ||
http://broker.example.com/lti/registration/list | ||
``` | ||
``` | ||
rake db:registration:new[key] | ||
rake db:registration:keygen[key] | ||
``` | ||
|
||
Use rake --tasks for seeing all the options available | ||
|
||
To set the default room settings, use the custom parameters: | ||
|
||
``` | ||
record=true | ||
wait_moderator=true | ||
all_moderators=true | ||
``` | ||
|
||
They correspond to turn recording on, wait for moderator to start the meeting, and allow all users to join as a moderator. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require_relative 'config/application' | ||
|
||
Rails.application.load_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//= link_tree ../images | ||
//= link_directory ../javascripts .js | ||
//= link_directory ../stylesheets .css |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// This is a manifest file that'll be compiled into application.js, which will include all the files | ||
// listed below. | ||
// | ||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | ||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. | ||
// | ||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | ||
// compiled file. JavaScript code in this file should be added after the last require_* statement. | ||
// | ||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details | ||
// about supported directives. | ||
// | ||
//= require jquery | ||
//= require jquery_ujs | ||
//= require lodash | ||
//= require turbolinks | ||
//= require react | ||
//= require react_ujs | ||
//= require components | ||
//= require_tree . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Action Cable provides the framework to deal with WebSockets in Rails. | ||
// You can generate new channels where WebSocket features live using the rails generate channel command. | ||
// | ||
//= require action_cable | ||
//= require_self | ||
//= require_tree ./channels | ||
|
||
(function() { | ||
this.App || (this.App = {}); | ||
|
||
App.cable = ActionCable.createConsumer(); | ||
|
||
}).call(this); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//= require_tree ./components |
55 changes: 55 additions & 0 deletions
55
bbb-lti-broker/app/assets/javascripts/components/content_item_builder.js.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
var ContentItemBuilder = createReactClass({ | ||
|
||
propTypes: { | ||
data: PropTypes.string, | ||
returnUrl: PropTypes.string, | ||
ltiVersion: PropTypes.string, | ||
ltiLaunchUrl: PropTypes.string, | ||
ltiUpdateUrl: PropTypes.string, | ||
textFileUrl: PropTypes.string, | ||
videoUrl: PropTypes.string, | ||
ccFileUrl: PropTypes.string, | ||
consumerKey: PropTypes.string, | ||
documentTargets: PropTypes.array, | ||
mediaTypes: PropTypes.array | ||
}, | ||
|
||
getInitialState: function () { | ||
return { | ||
contentItems: { | ||
"@context": "http://purl.imsglobal.org/ctx/lti/v1/ContentItem", | ||
"@graph": [] | ||
} | ||
}; | ||
}, | ||
|
||
updateContentItems: function () { | ||
this.setState({contentItems: this.refs.contentItemsElement.toJSON()}); | ||
}, | ||
|
||
render: function () { | ||
return ( | ||
<div style={{'background': 'white'}} > | ||
<ContentItemBuilder.ContentItems | ||
ltiLaunchUrl={this.props.ltiLaunchUrl} | ||
ltiUpdateUrl={this.props.ltiUpdateUrl} | ||
textFileUrl={this.props.textFileUrl} | ||
videoUrl={this.props.videoUrl} | ||
ccFileUrl={this.props.ccFileUrl} | ||
documentTargets={this.props.documentTargets} | ||
mediaTypes={this.props.mediaTypes} | ||
updateContentItems={this.updateContentItems} | ||
ref="contentItemsElement" | ||
/> | ||
<hr/> | ||
<ContentItemBuilder.ContentItemMessage | ||
data={this.props.data} | ||
returnUrl={this.props.returnUrl} | ||
ltiVersion={this.props.ltiVersion} | ||
contentItems={this.state.contentItems} | ||
consumerKey={this.props.consumerKey} | ||
/> | ||
</div> | ||
); | ||
} | ||
}); |
Oops, something went wrong.