diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-08 16:05:00 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-08 16:05:00 +0300 |
commit | c3cf32e863b47d98d6e1d2d3ed78745ddf2ccb79 (patch) | |
tree | ee9eaaeabf247a882701100e5dbac36120c80a8a | |
parent | 6c32abc5f7f090d4932054e5cc1ff0594edd5ff1 (diff) | |
parent | edf0a0715b56a50fd1ac8ac505333f7e6fa4384c (diff) | |
download | gitlab-ce-c3cf32e863b47d98d6e1d2d3ed78745ddf2ccb79.tar.gz |
Merge branch 'version-check' into gl-version-check
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Conflicts:
app/controllers/admin/application_settings_controller.rb
app/views/admin/application_settings/_form.html.haml
db/schema.rb
-rw-r--r-- | app/controllers/admin/application_settings_controller.rb | 1 | ||||
-rw-r--r-- | app/helpers/version_check_helper.rb | 5 | ||||
-rw-r--r-- | app/views/admin/application_settings/_form.html.haml | 6 | ||||
-rw-r--r-- | app/views/admin/dashboard/index.html.haml | 7 | ||||
-rw-r--r-- | app/views/help/index.html.haml | 2 | ||||
-rw-r--r-- | db/migrate/20150310194358_add_version_check_to_application_settings.rb | 5 | ||||
-rw-r--r-- | db/schema.rb | 1 | ||||
-rw-r--r-- | lib/version_check.rb | 19 | ||||
-rw-r--r-- | safe/public.pem | 9 |
9 files changed, 45 insertions, 10 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 3975e30835e..03fd12e9ecd 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -43,6 +43,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController :default_snippet_visibility, :restricted_signup_domains_raw, restricted_visibility_levels: [], + :version_check_enabled ) end end diff --git a/app/helpers/version_check_helper.rb b/app/helpers/version_check_helper.rb new file mode 100644 index 00000000000..63d8eaeb2bd --- /dev/null +++ b/app/helpers/version_check_helper.rb @@ -0,0 +1,5 @@ +module VersionCheckHelper + def version_status_badge + image_tag VersionCheck.new.url + end +end diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index b9d7e8b4586..4ceae814805 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -32,6 +32,12 @@ = f.check_box :twitter_sharing_enabled, :'aria-describedby' => 'twitter_help_block' %strong Twitter enabled %span.help-block#twitter_help_block Show users a button to share their newly created public or internal projects on twitter + .form-group + .col-sm-offset-2.col-sm-10 + .checkbox + = f.label :version_check_enabled do + = f.check_box :version_check_enabled + Version check enabled %fieldset %legend Misc .form-group diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml index d1c586328a2..3732ff847b9 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -56,7 +56,12 @@ %span.light.pull-right = boolean_to_icon Gitlab.config.omniauth.enabled .col-md-4 - %h4 Components + %h4 + Components + - if current_application_settings.version_check_enabled + .pull-right + = version_status_badge + %hr %p GitLab diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index af39dfeac5b..bf4b7234b21 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -3,6 +3,8 @@ GitLab %span= Gitlab::VERSION %small= Gitlab::REVISION + - if current_application_settings.version_check_enabled + = version_status_badge %p.slead GitLab is open source software to collaborate on code. %br diff --git a/db/migrate/20150310194358_add_version_check_to_application_settings.rb b/db/migrate/20150310194358_add_version_check_to_application_settings.rb new file mode 100644 index 00000000000..e9d42c1e749 --- /dev/null +++ b/db/migrate/20150310194358_add_version_check_to_application_settings.rb @@ -0,0 +1,5 @@ +class AddVersionCheckToApplicationSettings < ActiveRecord::Migration + def change + add_column :application_settings, :version_check_enabled, :boolean, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 04abf9bb9a6..1fe092ec5d2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -28,6 +28,7 @@ ActiveRecord::Schema.define(version: 20150502064022) do t.integer "default_branch_protection", default: 2 t.boolean "twitter_sharing_enabled", default: true t.text "restricted_visibility_levels" + t.boolean "version_check_enabled", default: true t.integer "max_attachment_size", default: 10, null: false t.integer "default_project_visibility" t.integer "default_snippet_visibility" diff --git a/lib/version_check.rb b/lib/version_check.rb new file mode 100644 index 00000000000..460dc166c41 --- /dev/null +++ b/lib/version_check.rb @@ -0,0 +1,19 @@ +require "base64" + +# This class is used to build image URL to +# check if it is a new version for update +class VersionCheck + def data + { version: Gitlab::VERSION } + end + + def url + encoded_data = Base64.urlsafe_encode64(data.to_json) + "#{host}?gitlab_info=#{encoded_data}" + end + + # FIXME: Replace with version.gitlab.com + def host + 'http://localhost:9090/check.png' + end +end diff --git a/safe/public.pem b/safe/public.pem deleted file mode 100644 index c5ffe20a5c7..00000000000 --- a/safe/public.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnp2mUaLBoHFX127ysonX -OihiGpI4098eFfH1iAxpKHIof0vs0jFF05IUScNXJZ1U3w8G1U/unY/wGGa3NzAb -ZfDd22eOF6X2Gfiey6U4w9dFf0/UT5x1bphlpX357yh4O9oWWuNaWD062DTbOOsJ -U6UW2U/sZAu/QScys0Nw+gJ58t93hb4jFq+nO5IAQc6g4S8ek5YvIXOshFEpF2in -ZLbSYowx92+9GzfjvdQ7fk0Q2ssg0zfScVa6FY8n019osz0SC3wcSd/qicdfecpu -7oycpd9YDqk4lufE1qVMOsgE8OO4KXMrByz2f+T0p/bH9zdBa5HYylf1T7i60hIL -kQIDAQAB ------END PUBLIC KEY----- |