1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-12 23:09:03 +01:00
fab-manager/app/controllers/api/version_controller.rb

25 lines
607 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'version'
2020-02-26 10:19:43 +01:00
# API Controller to get the Fab-manager version
2023-02-24 17:26:55 +01:00
class API::VersionController < API::APIController
before_action :authenticate_user!
def show
authorize :version
# save the origin
origin = Setting.find_or_create_by(name: 'origin')
if origin.value != params[:origin]
origin.value = params[:origin]
origin.save!
end
# get the last version
2020-05-13 15:02:03 +02:00
update_status = Setting.get('hub_last_version') || '{}'
json = JSON.parse(update_status)
json['current'] = Version.current
render json: json, status: :ok
end
end