18 lines
668 B
Ruby
18 lines
668 B
Ruby
module ClientHelper
|
|
|
|
# is this the native client (or browser emulating native client with CTRL+SHIFT+0), or browser?
|
|
def is_native_client?
|
|
# is this the native client or browser?
|
|
user_agent = request.env["HTTP_USER_AGENT"]
|
|
is_native_client = !user_agent.blank? && user_agent.downcase.include?("jamkazam")
|
|
|
|
# allow override of the client type if configured to so, and if we find the override cookie in place
|
|
if Rails.application.config.allow_force_native_client
|
|
unless cookies[:act_as_native_client].nil?
|
|
is_native_client = (cookies[:act_as_native_client] == "true") ? true : false
|
|
end
|
|
end
|
|
|
|
is_native_client
|
|
end
|
|
end |