增加开源协议,并支持对应文件下载

This commit is contained in:
xxq250 2024-02-01 15:13:13 +08:00
parent 35f724c901
commit 8d124a5128
3 changed files with 4 additions and 2 deletions

View File

@ -12,11 +12,12 @@ class ApplySignaturesController < ApplicationController
end
def template_file
license = License.find_by_name("PHengLEI")
license_name = params[:license_name] || "PHengLEI"
license = License.find_by_name(license_name)
file = license.attachments.take
# normal_status(-1, "文件不存在") if file.blank?
if file.blank?
send_file("#{Rails.root.to_s}/public/PHengLEI-License.docx", filename: "PHengLEI软件开源协议.docx",stream:false, type: 'application/octet-stream')
send_file("#{Rails.root.to_s}/public/#{license_name}-License.docx", filename: "#{license_name}软件开源协议.docx",stream:false, type: 'application/octet-stream')
else
send_file(absolute_path(local_path(file)), filename: file.title,stream:false, type: file.content_type.presence || 'application/octet-stream')
end

View File

@ -11,6 +11,7 @@ json.projects @rand_projects do |project|
json.forked_count project.forked_count.to_i
json.is_public project.is_public
json.is_secret project.is_secret
json.license_name project.license&.name
json.mirror_url project.repository&.mirror_url
json.type project&.numerical_for_project_type
json.last_update_time render_unix_time(project.updated_on)

Binary file not shown.