allow different action cable host

This commit is contained in:
Zachary Chai 2017-02-16 10:29:08 -05:00
parent 82df7d209a
commit 74f1f4c071
4 changed files with 23 additions and 17 deletions

View File

@ -22,8 +22,13 @@
//= require_tree ./channels
(function() {
var protocol = window.location.protocol === "https:" ? "wss://" : "ws://";
var host = window.GreenLight.WEBSOCKET_HOST || window.location.host + window.GreenLight.RELATIVE_ROOT;
var path = window.GreenLight.WEBSOCKET_PATH || '/cable';
var url = protocol + host + path;
this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
App.cable = ActionCable.createConsumer(url);
}).call(this);

View File

@ -47,8 +47,8 @@ class @Meeting
url = location.protocol + '//' + location.hostname
if location.port
url += ':' + location.port
if GreenLight.relative_root
url += GreenLight.relative_root
if GreenLight.RELATIVE_ROOT
url += GreenLight.RELATIVE_ROOT
return url
# Sends the end meeting request

View File

@ -18,7 +18,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<head>
<title>Greenlight</title>
<%= csrf_meta_tags %>
<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"/>
<% if relative_root != '/b' %>
@ -26,6 +26,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<% else %>
<%= stylesheet_link_tag 'fa/gl-fa', media: 'all', 'data-turbolinks-track': 'reload' %>
<% end %>
<!-- Global javascript variables and helpers -->
<script type="text/javascript">
window.I18n = <%= client_translations.to_json.html_safe %>
window.GreenLight = {};
window.GreenLight.WEBSOCKET_HOST = "<%= ENV['WEBSOCKET_HOST'] %>"
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 %>";
window.GreenLight.user = {};
window.GreenLight.user.roomOwner = <%= is_room_owner %>;
</script>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
@ -54,15 +68,3 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<!-- End of Footer -->
</body>
</html>
<!-- Global javascript variables and helpers -->
<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 %>";
window.GreenLight.user = {};
window.GreenLight.user.roomOwner = <%= is_room_owner %>;
</script>

View File

@ -65,7 +65,6 @@ Rails.application.configure do
unless ENV["RAILS_ACTION_CABLE_FORGERY_PROTECTION"].present?
Rails.application.config.action_cable.disable_request_forgery_protection = true
end
# config.action_cable.allowed_request_origins = ["https://#{ENV['HOSTNAME']}", "http://#{ENV['HOSTNAME']}"]
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify