|
|
|
@@ -6,7 +6,8 @@ class RepositoriesController < ApplicationController |
|
|
|
before_action :authorizate!, except: [:sync_mirror, :tags, :commit]
|
|
|
|
before_action :find_repository_by_id, only: %i[commit sync_mirror tags]
|
|
|
|
before_action :authorizate_user_can_edit_repo!, only: %i[sync_mirror]
|
|
|
|
before_action :get_latest_commit, only: %i[entries sub_entries]
|
|
|
|
before_action :get_ref, only: %i[entries sub_entries]
|
|
|
|
before_action :get_latest_commit, :get_ref, only: %i[entries sub_entries]
|
|
|
|
|
|
|
|
def show
|
|
|
|
@branches_count = Gitea::Repository::Branches::ListService.new(@project.owner, @project.identifier).call&.size
|
|
|
|
@@ -27,13 +28,13 @@ class RepositoriesController < ApplicationController |
|
|
|
def entries
|
|
|
|
@project.increment!(:visits)
|
|
|
|
|
|
|
|
@entries = Gitea::Repository::Entries::ListService.new(@project.owner, @project.identifier, ref: get_ref).call
|
|
|
|
@entries = Gitea::Repository::Entries::ListService.new(@project.owner, @project.identifier, ref: @ref).call
|
|
|
|
@entries = @entries.sort_by{ |hash| hash['type'] }
|
|
|
|
end
|
|
|
|
|
|
|
|
def sub_entries
|
|
|
|
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))
|
|
|
|
interactor = Repositories::EntriesInteractor.call(@project.owner, @project.identifier, file_path_uri, ref: get_ref)
|
|
|
|
interactor = Repositories::EntriesInteractor.call(@project.owner, @project.identifier, file_path_uri, ref: @ref)
|
|
|
|
if interactor.success?
|
|
|
|
@sub_entries = interactor.result
|
|
|
|
@sub_entries = [] << @sub_entries unless @sub_entries.is_a? Array
|
|
|
|
@@ -137,7 +138,7 @@ class RepositoriesController < ApplicationController |
|
|
|
end
|
|
|
|
|
|
|
|
def get_ref
|
|
|
|
params[:ref] || "master"
|
|
|
|
@ref = params[:ref] || "master"
|
|
|
|
end
|
|
|
|
|
|
|
|
def content_params
|
|
|
|
|