forked from External/greenlight
refactor share button & add ability to disable youtube uploading
This commit is contained in:
parent
10c2f1f6e5
commit
949fce701c
|
@ -166,14 +166,6 @@ class @Recordings
|
|||
options.title = I18n.mail_recording
|
||||
$('#recordings').tooltip(options)
|
||||
|
||||
options.selector = '.disabled-tooltip'
|
||||
options.title = I18n.youtube_disabled
|
||||
$('#recordings').tooltip(options)
|
||||
|
||||
options.selector = '.invalid-tooltip'
|
||||
options.title = I18n.invalid_provider
|
||||
$('#recordings').tooltip(options)
|
||||
|
||||
$(document).one "turbolinks:before-cache", =>
|
||||
@getTable().api().clear().draw().destroy()
|
||||
|
||||
|
@ -375,14 +367,41 @@ class @Recordings
|
|||
canUpload = res_data['uploadable']
|
||||
)
|
||||
|
||||
if canUpload == 'true'
|
||||
$(this).attr('data-popover-body', '.mail_youtube_popover')
|
||||
else if canUpload == 'invalid_provider'
|
||||
$(this).attr('data-popover-body', '.no_youtube_popover')
|
||||
else
|
||||
$(this).attr('data-popover-body', '.mail_popover')
|
||||
youtube_button = $('.share-popover').find('.youtube-upload')
|
||||
|
||||
attr = $(this).attr('data-popover-body');
|
||||
|
||||
# Check if the cloud button has a popover body.
|
||||
if (typeof attr == typeof undefined || attr == false)
|
||||
switch canUpload
|
||||
# We can upload the recording.
|
||||
when 'true'
|
||||
youtube_button.attr('title', I18n.upload_youtube)
|
||||
youtube_button.removeClass('disabled-button')
|
||||
youtube_button.addClass('has-popover')
|
||||
youtube_button.show()
|
||||
# Can't upload because uploading is disabled.
|
||||
when 'uploading_disabled'
|
||||
youtube_button.hide()
|
||||
# Can't upload because account is not authenticated with Google.
|
||||
when 'invalid_provider'
|
||||
youtube_button.attr('title', I18n.invalid_provider)
|
||||
youtube_button.addClass('disabled-button')
|
||||
youtube_button.removeClass('has-popover')
|
||||
youtube_button.show()
|
||||
# Can't upload because recording does not contain video.
|
||||
else
|
||||
youtube_button.attr('title', I18n.no_video)
|
||||
youtube_button.addClass('disabled-button')
|
||||
youtube_button.removeClass('has-popover')
|
||||
youtube_button.show()
|
||||
|
||||
$(this).attr('data-popover-body', '.share-popover')
|
||||
$(this).popover('show')
|
||||
else
|
||||
$(this).popover('hide')
|
||||
$(this).removeAttr('data-popover-body')
|
||||
|
||||
|
||||
@getTable().on 'draw.dt', (event) ->
|
||||
$('time[data-time-ago]').timeago();
|
||||
|
|
|
@ -95,6 +95,10 @@
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
.disabled-button {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.youtube-red {
|
||||
color: red;
|
||||
}
|
||||
|
|
|
@ -202,7 +202,9 @@ class BbbController < ApplicationController
|
|||
# POST /rooms/:room_id/recordings/can_upload
|
||||
def can_upload
|
||||
# The recording is uploadable if it contains webcam data and they are logged in through Google.
|
||||
if current_user.provider != 'google'
|
||||
if Rails.configuration.enable_youtube_uploading == false then
|
||||
uploadable = 'uploading_disabled'
|
||||
elsif current_user.provider != 'google'
|
||||
uploadable = 'invalid_provider'
|
||||
else
|
||||
uploadable = (Faraday.head(get_webcams_url(params[:rec_id])).status == 200 && current_user.provider == 'google').to_s
|
||||
|
|
|
@ -79,36 +79,16 @@
|
|||
<p id = 'youtube-footer'><%= t('youtube_footer') %></p>
|
||||
</form>
|
||||
</div>
|
||||
<div class='mail_youtube_popover'>
|
||||
<div class='share-popover'>
|
||||
<button type="button" class="btn btn-default mail-recording mail-tooltip">
|
||||
<%= icon('envelope-o') %>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default has-popover youtube-upload youtube-tooltip"
|
||||
data-placement="top" data-popover-body=".youtube-popover"
|
||||
data-popover-title="<%= t('upload_to_youtube') %>" >
|
||||
data-popover-title="<%= t('upload_to_youtube') %>">
|
||||
<div class = 'youtube-red'> <%= icon('youtube-play') %> </div>
|
||||
</button>
|
||||
</div>
|
||||
<div class='mail_popover'>
|
||||
<button type="button" class="btn btn-default mail-recording mail-tooltip fa-2x">
|
||||
<%= icon('envelope-o') %>
|
||||
</button>
|
||||
<div class="tooltip-wrapper disabled disabled-tooltip">
|
||||
<button type="button" class="btn btn-default" disabled>
|
||||
<%= icon('youtube-play') %>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class='no_youtube_popover'>
|
||||
<button type="button" class="btn btn-default mail-recording mail-tooltip fa-2x">
|
||||
<%= icon('envelope-o') %>
|
||||
</button>
|
||||
<div class="tooltip-wrapper disabled invalid-tooltip">
|
||||
<button type="button" class="btn btn-default" disabled>
|
||||
<%= icon('youtube-play') %>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="recording-visibility-popover">
|
||||
<button type="button" class="btn btn-default btn-success recording-update" data-visibility="published">
|
||||
<%= t('client.published') %>
|
||||
|
|
|
@ -43,6 +43,7 @@ module Greenlight
|
|||
config.use_webhooks = ENV['GREENLIGHT_USE_WEBHOOKS'] == "true"
|
||||
config.mail_notifications = ENV['GREENLIGHT_MAIL_NOTIFICATIONS'] == "true"
|
||||
config.disable_guest_access = ENV['DISABLE_GUEST_ACCESS'] == "true"
|
||||
config.enable_youtube_uploading = ENV['ENABLE_YOUTUBE_UPLOADING'] == "true"
|
||||
|
||||
# SMTP and action mailer
|
||||
if config.mail_notifications
|
||||
|
|
|
@ -11,7 +11,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|||
provider :google_oauth2,
|
||||
ENV['GOOGLE_OAUTH2_ID'],
|
||||
ENV['GOOGLE_OAUTH2_SECRET'],
|
||||
scope: ['profile', 'email', 'youtube', 'youtube.upload'],
|
||||
scope: ENV['ENABLE_YOUTUBE_UPLOADING'] == 'true' ? ['profile', 'email', 'youtube', 'youtube.upload'] : ['profile', 'email'] ,
|
||||
access_type: 'online',
|
||||
name: 'google',
|
||||
hd: ENV['GOOGLE_OAUTH2_HD'].blank? ? nil : ENV['GOOGLE_OAUTH2_HD']
|
||||
|
|
|
@ -57,6 +57,7 @@ en-US:
|
|||
meeting_started: Meeting was started
|
||||
no_recordings: No Recordings
|
||||
no_recordings_yet: No Recordings (Yet!)
|
||||
no_video: Recording did not contain any video.
|
||||
play_recording: Play recording
|
||||
publish_recording: Publish recording
|
||||
published: Everyone
|
||||
|
@ -75,7 +76,6 @@ en-US:
|
|||
upload_youtube: Youtube
|
||||
user_waiting_body: "%{user} is waiting to join %{meeting}!"
|
||||
user_waiting_title: A user is waiting
|
||||
youtube_disabled: Recording did not contain any video.
|
||||
copied: Copied
|
||||
copy_error: Use Ctrl-c to copy
|
||||
create_your_session: Create your own meeting
|
||||
|
|
10
env
10
env
|
@ -65,6 +65,16 @@ LDAP_PASSWORD=
|
|||
# the application when recordings are done).
|
||||
GREENLIGHT_USE_WEBHOOKS=false
|
||||
|
||||
# Enable uploading to Youtube (optional)
|
||||
#
|
||||
# When this is enabled, users will be able to directly upload their recordings
|
||||
# to Youtube. If you plan to enable this, you should follow the steps outlined
|
||||
# in our docs for setting up the Youtube data API.
|
||||
#
|
||||
# http://docs.bigbluebutton.org/install/green-light.html#8-enabling-uploading-to-youtube-optional
|
||||
#
|
||||
ENABLE_YOUTUBE_UPLOADING=false
|
||||
|
||||
# Slack Integration (optional)
|
||||
#
|
||||
# You will need to register an incoming-webhook for your slack channel
|
||||
|
|
Loading…
Reference in New Issue