Welcome to mirror list, hosted at ThFree Co, Russian Federation.

version_check.rb « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ada5e0db7a997e4b4c9b70f5ee60c1c2fde8d653 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This class is used to encrypt GitLab version and URL
# with public key when we send it to version.gitlab.com to
# check if it is a new version for update
class VersionCheck
  include SimpleEncrypt

  def public_key
    public_key_file = Rails.root.join('safe', 'public.pem').to_s
    File.read(public_key_file)
  end

  def data
    {
      version: Gitlab::VERSION,
      url: Gitlab.config.gitlab.url
    }
  end

  def encrypt(string)
    encrypt_with_public_key(string, public_key)
  end

  def url
    "#{host}?gitlab_info=#{encrypt(data.to_json)}"
  end

  def host
    'http://localhost:9090/check.png'
  end
end