2013-02-14 11:57:26 -06:00
|
|
|
require_dependency 'discourse_hub'
|
2013-02-05 13:16:51 -06:00
|
|
|
require_dependency 'version'
|
|
|
|
|
|
|
|
class Admin::VersionsController < Admin::AdminController
|
|
|
|
def show
|
|
|
|
if SiteSetting.discourse_org_access_key.present?
|
2013-02-14 11:57:26 -06:00
|
|
|
render json: success_json.merge( latest_version: DiscourseHub.current_discourse_version, installed_version: Discourse::VERSION::STRING )
|
2013-02-05 13:16:51 -06:00
|
|
|
else
|
|
|
|
# Don't contact discourse.org
|
|
|
|
render json: success_json.merge( latest_version: Discourse::VERSION::STRING, installed_version: Discourse::VERSION::STRING )
|
|
|
|
end
|
|
|
|
rescue RestClient::Forbidden
|
2013-02-14 11:57:26 -06:00
|
|
|
render json: {errors: [I18n.t("discourse_hub.access_token_problem")]}
|
2013-02-05 13:16:51 -06:00
|
|
|
end
|
2013-02-07 09:45:24 -06:00
|
|
|
end
|