|
|
|
@@ -3,9 +3,8 @@ class RepositoriesController < ApplicationController |
|
|
|
include OperateProjectAbilityAble
|
|
|
|
|
|
|
|
before_action :require_login, only: %i[edit update create_file update_file delete_file sync_mirror]
|
|
|
|
before_action :load_project
|
|
|
|
before_action :load_repository
|
|
|
|
before_action :authorizate!, except: [:sync_mirror, :tags, :commit]
|
|
|
|
before_action :find_repository_by_id, only: %i[commit sync_mirror]
|
|
|
|
before_action :authorizate_user_can_edit_repo!, only: %i[sync_mirror]
|
|
|
|
before_action :get_ref, only: %i[entries sub_entries top_counts]
|
|
|
|
before_action :get_latest_commit, only: %i[entries sub_entries top_counts]
|
|
|
|
@@ -56,7 +55,7 @@ class RepositoriesController < ApplicationController |
|
|
|
end
|
|
|
|
|
|
|
|
def commit
|
|
|
|
@commit = Gitea::Repository::Commits::GetService.new(@repo.user.login, @repo.identifier, params[:sha], current_user.gitea_token).call
|
|
|
|
@commit = Gitea::Repository::Commits::GetService.new(@repository.user.login, @repository.identifier, params[:sha], current_user.gitea_token).call
|
|
|
|
end
|
|
|
|
|
|
|
|
def tags
|
|
|
|
@@ -102,10 +101,10 @@ class RepositoriesController < ApplicationController |
|
|
|
end
|
|
|
|
|
|
|
|
def sync_mirror
|
|
|
|
return render_error("正在镜像中..") if @repo.mirror.waiting?
|
|
|
|
return render_error("正在镜像中..") if @repository.mirror.waiting?
|
|
|
|
|
|
|
|
@repo.sync_mirror!
|
|
|
|
SyncMirroredRepositoryJob.perform_later(@repo.id, current_user.id)
|
|
|
|
@repository.sync_mirror!
|
|
|
|
SyncMirroredRepositoryJob.perform_later(@repository.id, current_user.id)
|
|
|
|
render_ok
|
|
|
|
end
|
|
|
|
|
|
|
|
|