| @@ -92,6 +92,24 @@ class RepositoriesController < ApplicationController | |||||
| end | end | ||||
| end | end | ||||
| def upload_file | |||||
| file_ids = params[:attachment_ids] | |||||
| if file_ids.present? | |||||
| file_ids.each do |id| | |||||
| attachment = Attachment.select(:id, :filename, :disk_directory, :disk_filename).find_by(id) | |||||
| file_path = attachemnt&.diskfile.to_s | |||||
| unless File.exists?(file_path) | |||||
| file_content = File.open(file_path) | |||||
| end | |||||
| end | |||||
| else | |||||
| render_error("请上传文件") | |||||
| end | |||||
| files.each do | |||||
| end | |||||
| def repo_hook | def repo_hook | ||||
| hook_type = request.headers["X-Gitea-Event"].to_s # 获取推送的方式 | hook_type = request.headers["X-Gitea-Event"].to_s # 获取推送的方式 | ||||
| ownername = @project.owner.try(:login) | ownername = @project.owner.try(:login) | ||||
| @@ -53,7 +53,7 @@ module Gitea | |||||
| def file_params | def file_params | ||||
| file_params = {} | file_params = {} | ||||
| file_params = file_params.merge(branch: @params[:branch]) unless @params[:branch].blank? | |||||
| file_params = file_params.merge(branch: @params[:branch]) unless @params[:branch].blank? || @params[:new_branch].present? | |||||
| file_params = file_params.merge(new_branch: @params[:new_branch]) unless @params[:new_branch].blank? | file_params = file_params.merge(new_branch: @params[:new_branch]) unless @params[:new_branch].blank? | ||||
| file_params = file_params.merge(content: Base64.encode64(@params[:content])) | file_params = file_params.merge(content: Base64.encode64(@params[:content])) | ||||
| file_params = file_params.merge(message: @params[:message]) unless @params[:message].blank? | file_params = file_params.merge(message: @params[:message]) unless @params[:message].blank? | ||||
| @@ -12,6 +12,7 @@ json.praises_count project.praises_count.to_i | |||||
| json.forked_count project.forked_count.to_i | json.forked_count project.forked_count.to_i | ||||
| json.is_public project.is_public | json.is_public project.is_public | ||||
| json.mirror_url project.repository&.mirror_url | json.mirror_url project.repository&.mirror_url | ||||
| json.type project.numerical_for_project_type | |||||
| json.last_update_time render_unix_time(project.updated_on) | json.last_update_time render_unix_time(project.updated_on) | ||||
| json.time_ago time_from_now(project.updated_on) | json.time_ago time_from_now(project.updated_on) | ||||
| json.forked_from_project_id project.forked_from_project_id | json.forked_from_project_id project.forked_from_project_id | ||||