diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 6d0867a0..78361f71 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -92,6 +92,24 @@ class RepositoriesController < ApplicationController 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 hook_type = request.headers["X-Gitea-Event"].to_s # 获取推送的方式 ownername = @project.owner.try(:login) diff --git a/app/interactors/gitea/create_file_interactor.rb b/app/interactors/gitea/create_file_interactor.rb index d8232379..6e3a6ca0 100644 --- a/app/interactors/gitea/create_file_interactor.rb +++ b/app/interactors/gitea/create_file_interactor.rb @@ -53,7 +53,7 @@ module Gitea def 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(content: Base64.encode64(@params[:content])) file_params = file_params.merge(message: @params[:message]) unless @params[:message].blank? diff --git a/app/views/projects/_project_detail.json.jbuilder b/app/views/projects/_project_detail.json.jbuilder index f3a54a32..6ed48cd7 100644 --- a/app/views/projects/_project_detail.json.jbuilder +++ b/app/views/projects/_project_detail.json.jbuilder @@ -12,6 +12,7 @@ json.praises_count project.praises_count.to_i json.forked_count project.forked_count.to_i json.is_public project.is_public 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.time_ago time_from_now(project.updated_on) json.forked_from_project_id project.forked_from_project_id diff --git a/dump.rdb b/dump.rdb index 2e340e19..4b391e94 100644 Binary files a/dump.rdb and b/dump.rdb differ