Skip to content

Commit

Permalink
introduce experimental baseuri support
Browse files Browse the repository at this point in the history
  • Loading branch information
stamfest committed May 30, 2014
1 parent 7bc97f3 commit adc316e
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 60 deletions.
8 changes: 5 additions & 3 deletions app/controllers/application_controller.rb
Expand Up @@ -48,10 +48,12 @@ def user_setup
else

current_uri = request.env['PATH_INFO']
routes = ["", "/", "/users/login"]

rails_root = request.env['RAILS_ROOT']
baseuri = Snorby::CONFIG[:baseuri]
routes = ["", "/", baseuri + "/users/login"]

if current_uri && routes.include?(current_uri)
redirect_to '/users/login' unless current_uri == "/users/login"
redirect_to baseuri + '/users/login' unless current_uri == baseuri + "/users/login"
else
authenticate_user!
end
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Expand Up @@ -243,14 +243,14 @@ def clippy(text, bgcolor='#FFFFFF', id=0)
height="14"
class="clippy"
id="clippy">
<param name="movie" value="/flash/clippy.swf">
<param name="movie" value="#{Snorby::CONFIG[:baseuri]}/flash/clippy.swf">
<param name="allowScriptAccess" value="always">
<param name="quality" value="high">
<param name="scale" value="noscale">
<param name="FlashVars" value="id=clippy_#{id}&amp;copied=&amp;copyto=">
<param name="bgcolor" value="#{bgcolor}">
<param name="wmode" value="opaque">
<embed src="/flash/clippy.swf"
<embed src="#{Snorby::CONFIG[:baseuri]}/flash/clippy.swf"
width="14"
height="14"
name="clippy"
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Expand Up @@ -18,6 +18,7 @@
var sev<%= sev.sig_id %>_bg_color = '<%= sev.bg_color %>';
<% end %>

var baseuri = "<%= Snorby::CONFIG[:baseuri] %>";
var current_user = <%= @current_user.to_json(
:only => [
:email,
Expand Down
5 changes: 5 additions & 0 deletions config/application.rb
Expand Up @@ -43,6 +43,11 @@ module Snorby
CONFIG[:authentication_mode] = "database"
end

# default base uri is none...
unless CONFIG.has_key?(:baseuri)
CONFIG[:baseuri] = ""
end

class Application < Rails::Application

config.threadsafe!
Expand Down

0 comments on commit adc316e

Please sign in to comment.