37 lines
886 B
Ruby
37 lines
886 B
Ruby
class ArtifactsController < ApplicationController
|
|
|
|
def versioncheck
|
|
|
|
# the reported client version
|
|
client_version = params[:ver]
|
|
|
|
# the name of the client
|
|
product = params[:product]
|
|
|
|
# the os (Win32/MacOSX/Unix)
|
|
os = params[:os]
|
|
|
|
product = "#{product}/#{os}"
|
|
|
|
unless ArtifactUpdate::PRODUCTS.include? product
|
|
render :text => "Unknown product type"
|
|
return
|
|
end
|
|
|
|
@artifact = ArtifactUpdate.find_by_product_and_environment(product, ArtifactUpdate::DEFAULT_ENVIRONMENT)
|
|
|
|
if @artifact.nil?
|
|
@log.error "no product was found for #{product} and environment: #{ArtifactUpdate::DEFAULT_ENVIRONMENT}"
|
|
render :text => "No product available"
|
|
return
|
|
elsif @artifact.version == client_version
|
|
render :text => "You have the latest version."
|
|
return
|
|
else
|
|
render :layout => false
|
|
end
|
|
|
|
end
|
|
|
|
end
|