67 lines
2.0 KiB
Ruby
67 lines
2.0 KiB
Ruby
class ClientsController < ApplicationController
|
|
|
|
include ClientHelper
|
|
include UsersHelper
|
|
|
|
|
|
AUTHED = %W{friend}
|
|
|
|
|
|
def index
|
|
|
|
# we want to enforce that /client is always the client view prefix
|
|
# this is a side effect of setting root path to '/'; soon we can remove this when we implement the new home page
|
|
if request.path == '/'
|
|
redirect_to client_url
|
|
return
|
|
end
|
|
|
|
render :layout => 'client'
|
|
end
|
|
|
|
def latency_tester
|
|
gon_properties
|
|
render :layout => 'client'
|
|
end
|
|
|
|
def auth_action
|
|
if current_user
|
|
session.delete(:return_to) if session[:return_to] =~ /authed/
|
|
# FIXME: implement auth-action on a per-case basis
|
|
redirect_to(client_url) and return
|
|
else
|
|
if AUTHED.include?(params[:authed])
|
|
session[:return_to] = auth_action_url(:authed => params[:authed], :data => params[:data])
|
|
else
|
|
session.delete(:return_to) if session[:return_to] =~ /authed/
|
|
end
|
|
redirect_to client_url
|
|
end
|
|
end
|
|
<<<<<<< HEAD
|
|
=======
|
|
|
|
private
|
|
|
|
def gon_properties
|
|
# use gon to pass variables into javascript
|
|
gon.websocket_gateway_uri = Rails.application.config.websocket_gateway_uri
|
|
gon.websocket_gateway_trusted_uri = Rails.application.config.websocket_gateway_trusted_uri
|
|
gon.check_for_client_updates = Rails.application.config.check_for_client_updates
|
|
gon.fp_apikey = Rails.application.config.filepicker_rails.api_key
|
|
gon.fp_upload_dir = Rails.application.config.filepicker_upload_dir
|
|
gon.allow_force_native_client = Rails.application.config.allow_force_native_client
|
|
gon.ftue_io_wait_time = Rails.application.config.ftue_io_wait_time
|
|
|
|
# is this the native client or browser?
|
|
@nativeClient = is_native_client?
|
|
|
|
# let javascript have access to the server's opinion if this is a native client
|
|
gon.isNativeClient = @nativeClient
|
|
|
|
gon.use_cached_session_scores = Rails.application.config.use_cached_session_scores
|
|
gon.allow_both_find_algos = Rails.application.config.allow_both_find_algos
|
|
end
|
|
>>>>>>> * wip
|
|
end
|