From efbf42f6983a0c2eba8140c77390835af23bab35 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Fri, 29 Jun 2018 16:18:00 -0400 Subject: [PATCH 01/12] remove unused launch route --- app/controllers/sessions_controller.rb | 12 ------------ config/routes.rb | 3 --- 2 files changed, 15 deletions(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index af6f531b..41a623d8 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -19,18 +19,6 @@ class SessionsController < ApplicationController end end - # POST /launch - def launch - # This will recieve a encoded POST from a launcher that - # contains the provider, and all user information. The - # launcher is what does the authentication, so we know - # that the user is who they say they are. We just need - # to use our secret to decode it and then log them in - # to GreenLight (or sign them up). - - # User.from_launch() - end - # GET/POST /auth/:provider/callback def omniauth user = User.from_omniauth(request.env['omniauth.auth']) diff --git a/config/routes.rb b/config/routes.rb index 924b1191..0b791d70 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -24,9 +24,6 @@ Rails.application.routes.draw do patch '/:user_uid/edit', to: 'users#update', as: :update_user end - # Handles launches from a trusted launcher. - post '/launch', to: 'sessions#launch' - # Handles Omniauth authentication. match '/auth/:provider/callback', to: 'sessions#omniauth', via: [:get, :post], as: :omniauth_session get '/auth/failure', to: 'sessions#fail' From ab7ae8434b792602d156cf08b8f927682f810be0 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Fri, 29 Jun 2018 16:59:45 -0400 Subject: [PATCH 02/12] add demo server trial to README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ce64bb4d..8ad4d658 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,11 @@ Greenlight is a simple front-end interface for your BigBlueButton server. At it' * Invite others to your room using a simple URL. * View recordings and share them with others. -Furthermore, Greenlight is completely configurable. This means you can turn on/off features to make Greenlight fit your specific use case. For more information on Greenlight and it's features, see our [documentation](http://docs.bigbluebutton.org/install/greenlight.html). +Interested? Try Greenlight out on our [demo server](https://demo.bigbluebutton.org/gl)! -For a overview of how GreenLight works, checkout our [Introduction to Greenlight Video](https://youtu.be/yGX3JCv7OVM). +Greenlight is also completely configurable. This means you can turn on/off features to make Greenlight fit your specific use case. For more information on Greenlight and its features, see our [documentation](http://docs.bigbluebutton.org/install/greenlight.html). + +For a overview of how Greenlight works, checkout our [Introduction to Greenlight Video](https://youtu.be/yGX3JCv7OVM). ## Installation on a BigBlueButton Server @@ -20,7 +22,7 @@ For information on installing Greenlight, checkout our [Installing Greenlight on ## Source Code & Contributing -GreenLight is built using Ruby on Rails. Many developers already know Rails well, and we wanted to create both a full front-end to BigBlueButton but also a reference implementation of how to fully leverage the [BigBlueButton API](http://docs.bigbluebutton.org/dev/api.html). +Greenlight is built using Ruby on Rails. Many developers already know Rails well, and we wanted to create both a full front-end to BigBlueButton but also a reference implementation of how to fully leverage the [BigBlueButton API](http://docs.bigbluebutton.org/dev/api.html). We invite you to build upon GreenLight and help make it better. See [Contributing to BigBlueButton](http://docs.bigbluebutton.org/support/faq.html#contributing-to-bigbluebutton). From efcc312e9edb239eb22fbf3e7f592753bd22e686 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Tue, 3 Jul 2018 11:57:45 -0400 Subject: [PATCH 03/12] remove ability to change home room --- app/controllers/rooms_controller.rb | 8 ------- .../shared/components/_room_block.html.erb | 21 +++++++++---------- config/routes.rb | 1 - 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 218eea7e..e922f36b 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -90,14 +90,6 @@ class RoomsController < ApplicationController redirect_to @room end - # POST /:room_uid/home - def home - current_user.main_room = @room - current_user.save - - redirect_to @room - end - # POST /:room_uid/:record_id def update_recording meta = { diff --git a/app/views/shared/components/_room_block.html.erb b/app/views/shared/components/_room_block.html.erb index 69d4b2d9..528329b6 100644 --- a/app/views/shared/components/_room_block.html.erb +++ b/app/views/shared/components/_room_block.html.erb @@ -22,22 +22,21 @@ - - <% configured_providers.each do |provider| %> - <%= link_to omniauth_login_url(provider), class: "btn btn-pill btn-#{provider} btn-block" do %> -  <%= "Login with #{provider.capitalize}" %> + <% unless configured_providers.length.zero? %> + <% configured_providers.each do |provider| %> + <%= link_to omniauth_login_url(provider), class: "btn btn-pill btn-#{provider} btn-block" do %> +  <%= "Login with #{provider.capitalize}" %> + <% end %> <% end %> - <% end %> -
- +
+
+ + or + +
+
+ <% end %> <%= form_for(:session, url: create_session_path) do |f| %>
From d383f142ee9e0f8a6b050a3575b3fba70ffff234 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Wed, 4 Jul 2018 09:43:08 -0400 Subject: [PATCH 06/12] tidy or line styling --- app/assets/stylesheets/main.scss | 18 ++++++++---------- app/views/shared/modals/_login_modal.html.erb | 11 ++++------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index fbc145bb..27a3d0c4 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -22,18 +22,16 @@ margin-top: 50%; } -.or-line{ - margin-top:32px; - margin-bottom:32px; - div{ - width: 100%; - height: 20px; - border-bottom: 1px solid #d3d3d3; +.or-line { + div { + width: 100%; + height: 16px; + border-bottom: 1px solid #d3d3d3; text-align: center; - span{ - font-size: 150%; + span { + font-size: 120%; background-color: #ffffff; - padding: 0 10px; + padding: 0 10px; color: #d3d3d3 } } diff --git a/app/views/shared/modals/_login_modal.html.erb b/app/views/shared/modals/_login_modal.html.erb index 8e6635c9..5896d4fb 100644 --- a/app/views/shared/modals/_login_modal.html.erb +++ b/app/views/shared/modals/_login_modal.html.erb @@ -6,7 +6,7 @@

Login

- + <% unless configured_providers.length.zero? %> <% configured_providers.each do |provider| %> <%= link_to omniauth_login_url(provider), class: "btn btn-pill btn-#{provider} btn-block" do %> @@ -14,14 +14,11 @@ <% end %> <% end %> -
-
- - or - -
+
+
or
<% end %> + <%= form_for(:session, url: create_session_path) do |f| %>
From 91b9bb405427eae9cb99034dc0e5ca2f07762648 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Wed, 4 Jul 2018 09:56:50 -0400 Subject: [PATCH 07/12] set .ruby-version to 2.5.1 --- .ruby-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..73462a5a --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.5.1 From 21e0a3558dddb67e25ec4b9af8ef8f4f78e4e164 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Wed, 4 Jul 2018 15:20:12 -0400 Subject: [PATCH 08/12] add delete confirmation modal --- app/assets/stylesheets/rooms.scss | 6 ++++- app/controllers/rooms_controller.rb | 3 ++- app/views/main/index.html.erb | 2 +- app/views/rooms/show.html.erb | 1 + .../shared/components/_room_block.html.erb | 6 ++--- .../shared/modals/_delete_room_modal.html.erb | 25 +++++++++++++++++++ 6 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 app/views/shared/modals/_delete_room_modal.html.erb diff --git a/app/assets/stylesheets/rooms.scss b/app/assets/stylesheets/rooms.scss index 42daca51..6066d2db 100644 --- a/app/assets/stylesheets/rooms.scss +++ b/app/assets/stylesheets/rooms.scss @@ -7,7 +7,7 @@ } .thumbnail { - height: 40% !important; + height: 60px !important; width: auto; } @@ -22,3 +22,7 @@ .home-indicator { font-size: 22px !important; } + +.btn-del-room { + width: 70% !important; +} diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index e922f36b..57569b3a 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -65,8 +65,9 @@ class RoomsController < ApplicationController # DELETE /:room_uid def destroy + p @room # Don't delete the users home room. - @room.destroy if @room != current_user.main_room + @room.destroy if @room.owned_by?(current_user) && @room != current_user.main_room redirect_to current_user.main_room end diff --git a/app/views/main/index.html.erb b/app/views/main/index.html.erb index 5ce4ab45..57ca2794 100644 --- a/app/views/main/index.html.erb +++ b/app/views/main/index.html.erb @@ -12,7 +12,7 @@

Welcome to Greenlight.

A simple front end for your BigBlueButton Open Source Web Conferencing Server.

- <%= link_to "https://www.youtube.com/watch?v=yGX3JCv7OVM&feature=youtu.be", class: "p-3", target: "_blank" do %> + <%= link_to "https://youtu.be/Hso8yLzkqj8", class: "p-3", target: "_blank" do %>

Watch a tutorial on using Greenlight

<% end %>
diff --git a/app/views/rooms/show.html.erb b/app/views/rooms/show.html.erb index 79500e11..f48df08c 100644 --- a/app/views/rooms/show.html.erb +++ b/app/views/rooms/show.html.erb @@ -48,6 +48,7 @@ <%= render "shared/components/room_block", room: room %> <% end %>
+ <%= render "shared/modals/delete_room_modal", room: room %> <% end %> <% end %>
diff --git a/app/views/shared/components/_room_block.html.erb b/app/views/shared/components/_room_block.html.erb index 528329b6..0a796d84 100644 --- a/app/views/shared/components/_room_block.html.erb +++ b/app/views/shared/components/_room_block.html.erb @@ -25,15 +25,15 @@ <% if room != current_user.main_room %>
<%= f.label "Provider", class: "form-label" %> - <%= f.text_field :provider, class: "form-control", value: @user.provider.capitalize, readonly: "" %> + <%= f.text_field :provider, class: "form-control", readonly: "" %> <%= f.label "Image", class: "form-label mt-5" %>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 56620103..06b3168d 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -28,7 +28,8 @@
<%= @user.errors.full_messages_for(:password_confirmation).first %>
<% end %>
From e2ad6e7715141c2cedf1d7f9c8173b17a55769dc Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Thu, 5 Jul 2018 17:25:59 -0400 Subject: [PATCH 10/12] make upgrading from 1.0 easier --- .dockerignore | 2 +- .gitignore | 2 +- Dockerfile | 6 +++--- README.md | 4 +++- app/controllers/application_controller.rb | 7 +++++++ app/views/application/migration_error.html.erb | 16 ++++++++++++++++ bin/start | 4 +++- config/environments/production.rb | 5 +++-- config/puma.rb | 2 +- docker-compose.yml | 10 +++++----- greenlight.nginx | 12 ++++++------ sample.env | 4 ++-- 12 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 app/views/application/migration_error.html.erb diff --git a/.dockerignore b/.dockerignore index 328b891a..ba912f55 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,7 +14,7 @@ tmp /db/**/*.sqlite3-journal /db/production public/assets -public/gl +public/b coverage/ spec/tmp .rvmrc diff --git a/.gitignore b/.gitignore index 51f1d350..2dfd8836 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ # Ignore static assets. /public/system/** /public/assets/** -/public/gl/** +/public/b/** # Ignore production paths. /db/production diff --git a/Dockerfile b/Dockerfile index 1155f08e..e31dc13c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM ruby:2.5 # Install app dependencies. -RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs +RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs # Set an environment variable for the install location. ENV RAILS_ROOT /usr/src/app @@ -23,8 +23,8 @@ RUN bundle install --without development test --deployment --clean RUN bundle exec rake assets:clean RUN bundle exec rake assets:precompile -# Expose port 3000. -EXPOSE 3000 +# Expose port 80. +EXPOSE 80 # Start the application. CMD ["bin/start"] diff --git a/README.md b/README.md index be58538d..fbdda367 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Greenlight +Greenlight is currently on version 2.0. If you are still running Greenlight 1.0 we suggest [upgrading to 2.0](http://docs.bigbluebutton.org/install/greenlight-v2.html#upgrading-from-greenlight-10). + Greenlight is a simple front-end interface for your BigBlueButton server. At it's heart, Greenlight provides a minimalistic web-based application that allows users to: * Signup/Login with Twitter, Google, or through the application itself. @@ -10,7 +12,7 @@ Greenlight is a simple front-end interface for your BigBlueButton server. At it' Interested? Try Greenlight out on our [demo server](https://demo.bigbluebutton.org/gl)! -Greenlight is also completely configurable. This means you can turn on/off features to make Greenlight fit your specific use case. For more information on Greenlight and its features, see our [documentation](http://docs.bigbluebutton.org/install/greenlight.html). +Greenlight is also completely configurable. This means you can turn on/off features to make Greenlight fit your specific use case. For more information on Greenlight and its features, see our [documentation](http://docs.bigbluebutton.org/install/greenlight-v2.html). For a overview of how Greenlight works, checkout our Introduction to Greenlight Video: diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d7f31433..2f720083 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,6 +5,13 @@ require 'bigbluebutton_api' class ApplicationController < ActionController::Base include SessionsHelper + before_action :migration_error? + + # Show an information page when migration fails and there is a version error. + def migration_error? + render :migration_error unless ENV["DB_MIGRATE_FAILED"].blank? + end + protect_from_forgery with: :exception MEETING_NAME_LIMIT = 90 diff --git a/app/views/application/migration_error.html.erb b/app/views/application/migration_error.html.erb new file mode 100644 index 00000000..8abf01b2 --- /dev/null +++ b/app/views/application/migration_error.html.erb @@ -0,0 +1,16 @@ +
+
+
+ +

Greenlight encountered a database migration error.
This may be because you haven't updated to Greenlight 2.0.

+

If you are not an administrator, please contact one.

+

We've released a new version of Greenlight, but your database isn't compatible.

+ + Show me how to upgrade to 2.0! + + + I'd like to stay using 1.0. + +
+
+
diff --git a/bin/start b/bin/start index 93c2bb22..a0d04505 100755 --- a/bin/start +++ b/bin/start @@ -1,6 +1,8 @@ #!/bin/bash bundle exec rake db:create -bundle exec rake db:migrate +if ! bundle exec rake db:migrate ; then + export DB_MIGRATE_FAILED=1 +fi exec bundle exec puma -C config/puma.rb diff --git a/config/environments/production.rb b/config/environments/production.rb index 42d2e076..42654597 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -87,6 +87,7 @@ Rails.application.configure do config.active_record.dump_schema_after_migration = false # Set the relative url root for deployment to a subdirectory. - config.relative_url_root = "/" - config.relative_url_root = ENV['RELATIVE_URL_ROOT'] if ENV['RELATIVE_URL_ROOT'].present? + if ENV['RELATIVE_URL_ROOT'] != "/" + config.relative_url_root = ENV['RELATIVE_URL_ROOT'] || "/b" + end end diff --git a/config/puma.rb b/config/puma.rb index 991c3a6f..2ef031d5 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -11,7 +11,7 @@ threads threads_count, threads_count # Specifies the `port` that Puma will listen on to receive requests, default is 3000. # -port ENV.fetch("PORT") { 3000 } +port ENV.fetch("PORT") { 80 } # Specifies the `environment` that Puma will run in. # diff --git a/docker-compose.yml b/docker-compose.yml index ef11cc2f..29b8f40e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,14 @@ version: '3' -services: +services: app: entrypoint: [bin/start] - image: joshblind/greenlight:latest - container_name: greenlight-web + image: joshblind/greenlight:v2 + container_name: greenlight-v2 env_file: env restart: unless-stopped ports: - - 6000:3000 - volumes: + - 5000:80 + volumes: - ./db/production:/usr/src/app/db/production - ./log:/usr/src/app/log diff --git a/greenlight.nginx b/greenlight.nginx index a40d30ba..b3d5f904 100644 --- a/greenlight.nginx +++ b/greenlight.nginx @@ -1,18 +1,18 @@ -# Routes requests to Greenlight based on the '/gl' prefix. -# Use this file to route '/gl' paths on your BigBlueButton server +# Routes requests to Greenlight based on the '/b' prefix. +# Use this file to route '/b' paths on your BigBlueButton server # to the Greenlight application. If you are using a different # subpath, you should change it here. -location /gl { - proxy_pass http://127.0.0.1:6000; +location /b { + proxy_pass http://127.0.0.1:5000; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; } -location /gl/cable { - proxy_pass http://127.0.0.1:6000; +location /b/cable { + proxy_pass http://127.0.0.1:5000; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; diff --git a/sample.env b/sample.env index 26973ac0..dd635fe4 100644 --- a/sample.env +++ b/sample.env @@ -50,6 +50,6 @@ ALLOW_GREENLIGHT_ACCOUNTS=true # if deploying on a BigBlueButton server. Keep in mind that if you change this, you'll # have to update your authentication callback URL's to reflect this change. # -# The recommended prefix is "/gl". +# The recommended prefix is "/b". # -RELATIVE_URL_ROOT=/gl +RELATIVE_URL_ROOT=/b From 8647993443b2bd8d1324a813061101de5e572005 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Fri, 6 Jul 2018 11:42:50 -0400 Subject: [PATCH 11/12] fix docker-compose org --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 29b8f40e..7b50ff0c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: app: entrypoint: [bin/start] - image: joshblind/greenlight:v2 + image: bigbluebutton/greenlight:v2 container_name: greenlight-v2 env_file: env restart: unless-stopped From 60a5b57121556f8003f8b6b5cd97f4bd9b80e6fe Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Fri, 6 Jul 2018 12:12:27 -0400 Subject: [PATCH 12/12] add stay on 1.0 link --- app/views/application/migration_error.html.erb | 2 +- sample.env | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/application/migration_error.html.erb b/app/views/application/migration_error.html.erb index 8abf01b2..8d90ff3d 100644 --- a/app/views/application/migration_error.html.erb +++ b/app/views/application/migration_error.html.erb @@ -8,7 +8,7 @@ Show me how to upgrade to 2.0! - + I'd like to stay using 1.0.
diff --git a/sample.env b/sample.env index dd635fe4..864b5d0c 100644 --- a/sample.env +++ b/sample.env @@ -3,7 +3,7 @@ # You can generate a secure one through the Greenlight docker image # with with the command. # -# docker run --rm bigbluebutton/greenlight bundle exec rake secret +# docker run --rm bigbluebutton/greenlight:v2 bundle exec rake secret # SECRET_KEY_BASE=