version_check.rb 384 Bytes
Newer Older
1 2
# frozen_string_literal: true

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
3 4 5
require "base64"

# This class is used to build image URL to
6 7 8
# check if it is a new version for update
class VersionCheck
  def data
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
9
    { version: Gitlab::VERSION }
10 11 12
  end

  def url
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
13 14
    encoded_data = Base64.urlsafe_encode64(data.to_json)
    "#{host}?gitlab_info=#{encoded_data}"
15 16 17
  end

  def host
18
    'https://version.gitlab.com/check.svg'
19 20
  end
end