houdini/app/controllers/static_controller.rb

26 lines
843 B
Ruby
Raw Normal View History

2018-05-31 17:39:16 +00:00
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class StaticController < ApplicationController
layout 'layouts/static'
def terms_and_privacy
@theme = 'minimal'
end
def ccs
ccs_method = !Settings.ccs ? 'local_tar_gz' : Settings.ccs.ccs_method
if (ccs_method == 'local_tar_gz')
2018-06-07 20:50:09 +00:00
temp_file = "#{Rails.root}/tmp/#{Time.current.to_i}.tar.gz"
result = Kernel.system("git archive --format=tar.gz -o #{temp_file} HEAD")
if result
send_file(temp_file, :type => "application/gzip")
else
render body: nil, status: 500
end
elsif (ccs_method == 'github')
2018-06-07 20:50:09 +00:00
git_hash = File.read("#{Rails.root}/CCS_HASH")
redirect_to "https://github.com/#{Settings.ccs.options.account}/#{Settings.ccs.options.repo}/tree/#{git_hash}"
end
end
end