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
|
||||
if location.port
|
||||
url += ':' + location.port
|
||||
if GreenLight.relative_root
|
||||
url += GreenLight.relative_root
|
||||
return url
|
||||
|
||||
# Sends the end meeting request
|
||||
|
|
|
@ -29,4 +29,9 @@ class ApplicationController < ActionController::Base
|
|||
@current_user ||= User.find_by(id: session[:user_id])
|
||||
end
|
||||
helper_method :current_user
|
||||
|
||||
def relative_root
|
||||
Rails.configuration.relative_url_root || ""
|
||||
end
|
||||
helper_method :relative_root
|
||||
end
|
||||
|
|
|
@ -66,7 +66,7 @@ class BbbController < ApplicationController
|
|||
}
|
||||
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[:hook_url] = "#{base_url}/callback"
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def omniauth_login_url(provider)
|
||||
"/auth/#{provider}"
|
||||
"#{relative_root}/auth/#{provider}"
|
||||
end
|
||||
|
||||
# Whether the current page is the page of a room/meeting or not
|
||||
|
|
|
@ -44,7 +44,7 @@ class User < ApplicationRecord
|
|||
end
|
||||
|
||||
def room_url
|
||||
"/rooms/#{encrypted_id}"
|
||||
"#{Rails.configuration.relative_url_root}/rooms/#{encrypted_id}"
|
||||
end
|
||||
|
||||
def set_encrypted_id
|
||||
|
|
|
@ -18,8 +18,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
|||
<head>
|
||||
<title>Greenlight</title>
|
||||
<%= csrf_meta_tags %>
|
||||
<%= action_cable_meta_tag %>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<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"/>
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', '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">
|
||||
window.I18n = <%= client_translations.to_json.html_safe %>
|
||||
window.GreenLight = {};
|
||||
window.GreenLight.relative_root = "<%= relative_root %>"
|
||||
window.GreenLight.META_LISTED = "<%= BbbApi::META_LISTED %>";
|
||||
window.GreenLight.META_TOKEN = "<%= BbbApi::META_TOKEN %>";
|
||||
window.GreenLight.META_HOOK_URL = "<%= BbbApi::META_HOOK_URL %>";
|
||||
|
|
Loading…
Reference in New Issue