This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 53fa12c  enable localhost testing of websockets
53fa12c is described below

commit 53fa12c36f3f30c701218668083b5cc8e91e08db
Author: Sam Ruby <[email protected]>
AuthorDate: Wed Oct 4 16:44:41 2017 -0400

    enable localhost testing of websockets
---
 lib/whimsy/asf/rack.rb             |  2 +-
 www/board/agenda/daemon/channel.rb |  1 -
 www/board/agenda/routes.rb         | 10 ++++++++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/whimsy/asf/rack.rb b/lib/whimsy/asf/rack.rb
index 8ae5127..bb12b66 100644
--- a/lib/whimsy/asf/rack.rb
+++ b/lib/whimsy/asf/rack.rb
@@ -209,7 +209,7 @@ module ASF
     # compute the document root by stripping the <tt>PASSENGER_BASE_URI</tt> 
from
     # the the current working directory.
     def call(env)
-      unless ENV['DOCUMENT_ROOT']
+      if ENV['PASSENGER_BASE_URI'] and not ENV['DOCUMENT_ROOT']
         base = Dir.pwd
         if base.end_with? ENV['PASSENGER_BASE_URI']
           base = base[0...-ENV['PASSENGER_BASE_URI'].length]
diff --git a/www/board/agenda/daemon/channel.rb 
b/www/board/agenda/daemon/channel.rb
index 0ae2096..5df9b7c 100644
--- a/www/board/agenda/daemon/channel.rb
+++ b/www/board/agenda/daemon/channel.rb
@@ -88,7 +88,6 @@ class Channel
 
   # listen for changes to agenda files
   board_listener = Listen.to(FOUNDATION_BOARD) do |modified, added, removed|
-    STDERR.puts [modified, added, removed].inspect
     modified.each do |path|
       next unless File.exist?(path)
       file = File.basename(path)
diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index 2ac68cb..8d88f10 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -134,6 +134,13 @@ get %r{/(\d\d\d\d-\d\d-\d\d)/(.*)} do |date, path|
     @present = YAML.load_file(file)
   end
 
+  if env['SERVER_NAME'] == 'localhost'
+    websocket = 'ws://localhost:34234/'  
+  else
+    websocket = (env['rack.url_scheme'].sub('http', 'ws')) + '://' +
+      env['SERVER_NAME'] + env['SCRIPT_NAME'] + '/websocket/'
+  end
+
   @server = {
     userid: userid,
     agendas: dir('board_agenda_*.txt').sort,
@@ -149,8 +156,7 @@ get %r{/(\d\d\d\d-\d\d-\d\d)/(.*)} do |date, path|
       initials = person.public_name.gsub(/[^A-Z]/, '').downcase
       [initials, person.public_name.split(' ').first]
     }],
-    websocket: (env['rack.url_scheme'].sub('http', 'ws')) + '://' +
-      env['SERVER_NAME'] + env['SCRIPT_NAME'] + '/websocket/'
+    websocket: websocket
   }
 
   @page = {

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to