diff --git a/doc/TODO b/doc/TODO index ba8f8aba..9adc6f04 100644 --- a/doc/TODO +++ b/doc/TODO @@ -18,10 +18,11 @@ x pick up a theme_asset x pull request locomedia x refactor slugify method (use parameterize + create a module) x contents permalink (UI) -- BUG: has_one / has_many. Delete an author -- bushido changes in the master +x BUG: has_one / has_many. Delete an author +x bushido changes in the master +? edit sidebar (inline editor). Unable to reset it - SEO: support and support/ should be 2 different pages. Remove trailing slash -- edit sidebar (inline editor). Unable to reset it + BACKLOG: diff --git a/lib/locomotive/hosting/bushido/middleware.rb b/lib/locomotive/hosting/bushido/middleware.rb index 10df1bf7..beb770ef 100644 --- a/lib/locomotive/hosting/bushido/middleware.rb +++ b/lib/locomotive/hosting/bushido/middleware.rb @@ -5,46 +5,36 @@ module Locomotive module Bushido class Middleware - # BUSHIDO_JS_URL = 'http://localhost:4567/javascripts/bushido.js' - BUSHIDO_JS_URL = 'http://bushi.do/api/bushido.js' - include Rack::Utils def initialize(app, opts = {}) @app = app - @bushido_app_name = ENV['BUSHIDO_APP'] - @bushido_metrics_token = ENV['BUSHIDO_METRICS_TOKEN'] - @bushido_claimed = ::Locomotive.bushido_app_claimed? + @path_regexp = %r{^/admin/} end def call(env) - status, headers, response = @app.call(env) + if env['PATH_INFO'] =~ @path_regexp + status, headers, response = @app.call(env) - content = "" - response.each { |part| content += part } + content = "" + response.each { |part| content += part } - # "claiming" bar + stats ? - content.gsub!(/<\/body>/i, <<-STR - - - STR - ) + # enable chat + content.gsub!(/<\/head>/i, <<-STR + + + STR + ) - headers['content-length'] = bytesize(content).to_s + headers['content-length'] = bytesize(content).to_s - [status, headers, [content]] + [status, headers, [content]] + else + @app.call(env) + end end end end end -end +end \ No newline at end of file