forked from External/greenlight
support relative root urls for deploy to subdirectories
This commit is contained in:
parent
b09ec1fc69
commit
3db284b8bf
|
@ -47,6 +47,8 @@ class @Meeting
|
||||||
url = location.protocol + '//' + location.hostname
|
url = location.protocol + '//' + location.hostname
|
||||||
if location.port
|
if location.port
|
||||||
url += ':' + location.port
|
url += ':' + location.port
|
||||||
|
if GreenLight.relative_root
|
||||||
|
url += GreenLight.relative_root
|
||||||
return url
|
return url
|
||||||
|
|
||||||
# Sends the end meeting request
|
# Sends the end meeting request
|
||||||
|
|
|
@ -29,4 +29,9 @@ class ApplicationController < ActionController::Base
|
||||||
@current_user ||= User.find_by(id: session[:user_id])
|
@current_user ||= User.find_by(id: session[:user_id])
|
||||||
end
|
end
|
||||||
helper_method :current_user
|
helper_method :current_user
|
||||||
|
|
||||||
|
def relative_root
|
||||||
|
Rails.configuration.relative_url_root || ""
|
||||||
|
end
|
||||||
|
helper_method :relative_root
|
||||||
end
|
end
|
||||||
|
|
|
@ -66,7 +66,7 @@ class BbbController < ApplicationController
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
base_url = "#{request.base_url}/#{params[:resource]}/#{meeting_path}"
|
base_url = "#{request.base_url}#{relative_root}/#{params[:resource]}/#{meeting_path}"
|
||||||
options[:meeting_logout_url] = base_url
|
options[:meeting_logout_url] = base_url
|
||||||
options[:hook_url] = "#{base_url}/callback"
|
options[:hook_url] = "#{base_url}/callback"
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def omniauth_login_url(provider)
|
def omniauth_login_url(provider)
|
||||||
"/auth/#{provider}"
|
"#{relative_root}/auth/#{provider}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether the current page is the page of a room/meeting or not
|
# Whether the current page is the page of a room/meeting or not
|
||||||
|
|
|
@ -44,7 +44,7 @@ class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def room_url
|
def room_url
|
||||||
"/rooms/#{encrypted_id}"
|
"#{Rails.configuration.relative_url_root}/rooms/#{encrypted_id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_encrypted_id
|
def set_encrypted_id
|
||||||
|
|
|
@ -18,8 +18,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||||
<head>
|
<head>
|
||||||
<title>Greenlight</title>
|
<title>Greenlight</title>
|
||||||
<%= csrf_meta_tags %>
|
<%= csrf_meta_tags %>
|
||||||
<%= action_cable_meta_tag %>
|
<meta name="action-cable-url" content="<%= relative_root+Rails.configuration.action_cable.mount_path %>"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
|
@ -53,6 +53,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.I18n = <%= client_translations.to_json.html_safe %>
|
window.I18n = <%= client_translations.to_json.html_safe %>
|
||||||
window.GreenLight = {};
|
window.GreenLight = {};
|
||||||
|
window.GreenLight.relative_root = "<%= relative_root %>"
|
||||||
window.GreenLight.META_LISTED = "<%= BbbApi::META_LISTED %>";
|
window.GreenLight.META_LISTED = "<%= BbbApi::META_LISTED %>";
|
||||||
window.GreenLight.META_TOKEN = "<%= BbbApi::META_TOKEN %>";
|
window.GreenLight.META_TOKEN = "<%= BbbApi::META_TOKEN %>";
|
||||||
window.GreenLight.META_HOOK_URL = "<%= BbbApi::META_HOOK_URL %>";
|
window.GreenLight.META_HOOK_URL = "<%= BbbApi::META_HOOK_URL %>";
|
||||||
|
|
Loading…
Reference in New Issue