修复: gitea module命名重复问题
This commit is contained in:
parent
d7dd3901b8
commit
d14bf35ca1
|
@ -33,8 +33,8 @@ class AttachmentsController < ApplicationController
|
|||
normal_status(-1, "参数缺失") if params[:download_url].blank?
|
||||
url = URI.encode(params[:download_url].to_s.gsub("http:", "https:"))
|
||||
if url.starts_with?(base_url)
|
||||
domain = Gitea.gitea_config[:domain]
|
||||
api_url = Gitea.gitea_config[:base_url]
|
||||
domain = GiteaService.gitea_config[:domain]
|
||||
api_url = GiteaService.gitea_config[:base_url]
|
||||
url = url.split(base_url)[1].gsub("api", "repos").gsub('?filepath=', '/').gsub('&', '?')
|
||||
request_url = [domain, api_url, url, "?ref=#{params[:ref]}&access_token=#{current_user&.gitea_token}"].join
|
||||
response = Faraday.get(request_url)
|
||||
|
|
|
@ -18,15 +18,15 @@ module Acceleratorable
|
|||
end
|
||||
|
||||
def accelerator_domain
|
||||
Gitea.gitea_config[:accelerator]["domain"]
|
||||
GiteaService.gitea_config[:accelerator]["domain"]
|
||||
end
|
||||
|
||||
def accelerator_username
|
||||
Gitea.gitea_config[:accelerator]["access_key_id"]
|
||||
GiteaService.gitea_config[:accelerator]["access_key_id"]
|
||||
end
|
||||
|
||||
def config_accelerator?
|
||||
Gitea.gitea_config[:accelerator].present?
|
||||
GiteaService.gitea_config[:accelerator].present?
|
||||
end
|
||||
|
||||
def is_foreign_url?(clone_addr)
|
||||
|
|
|
@ -54,7 +54,7 @@ class RepositoriesController < ApplicationController
|
|||
else
|
||||
@entries = Gitea::Repository::Entries::ListService.new(@owner, @project.identifier, ref: @ref).call
|
||||
@entries = @entries.present? ? @entries.sort_by{ |hash| hash['type'] } : []
|
||||
@path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"
|
||||
@path = GiteaService.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -222,7 +222,7 @@ class RepositoriesController < ApplicationController
|
|||
else
|
||||
result = Gitea::Repository::Readme::GetService.call(@owner.login, @repository.identifier, params[:ref], current_user&.gitea_token)
|
||||
end
|
||||
@path = Gitea.gitea_config[:domain]+"/#{@owner.login}/#{@repository.identifier}/raw/branch/#{params[:ref]}/"
|
||||
@path = GiteaService.gitea_config[:domain]+"/#{@owner.login}/#{@repository.identifier}/raw/branch/#{params[:ref]}/"
|
||||
@readme = result[:status] === :success ? result[:body] : nil
|
||||
@readme['content'] = decode64_content(@readme, @owner, @repository, params[:ref], @path)
|
||||
@readme['replace_content'] = readme_decode64_content(@readme, @owner, @repository, params[:ref], @path)
|
||||
|
@ -240,8 +240,8 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def archive
|
||||
domain = Gitea.gitea_config[:domain]
|
||||
api_url = Gitea.gitea_config[:base_url]
|
||||
domain = GiteaService.gitea_config[:domain]
|
||||
api_url = GiteaService.gitea_config[:base_url]
|
||||
archive_url = "/repos/#{@owner.login}/#{@repository.identifier}/archive/#{Addressable::URI.escape(params[:archive])}"
|
||||
|
||||
file_path = [domain, api_url, archive_url].join
|
||||
|
@ -253,8 +253,8 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def raw
|
||||
domain = Gitea.gitea_config[:domain]
|
||||
api_url = Gitea.gitea_config[:base_url]
|
||||
domain = GiteaService.gitea_config[:domain]
|
||||
api_url = GiteaService.gitea_config[:base_url]
|
||||
|
||||
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{Addressable::URI.escape(params[:filepath])}?ref=#{Addressable::URI.escape(params[:ref])}"
|
||||
file_path = [domain, api_url, url].join
|
||||
|
|
|
@ -30,7 +30,7 @@ module ProjectsHelper
|
|||
end
|
||||
|
||||
def gitea_domain
|
||||
Gitea.gitea_config[:domain]
|
||||
GiteaService.gitea_config[:domain]
|
||||
end
|
||||
|
||||
def find_user_by_login_or_mail(identifier)
|
||||
|
|
|
@ -44,8 +44,8 @@ module Gitea
|
|||
|
||||
def token
|
||||
{
|
||||
username: Gitea.gitea_config[:access_key_id],
|
||||
password: Gitea.gitea_config[:access_key_secret]
|
||||
username: GiteaService.gitea_config[:access_key_id],
|
||||
password: GiteaService.gitea_config[:access_key_secret]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ class Ci::Drone::Server
|
|||
|
||||
private
|
||||
def gitea_url
|
||||
Gitea.gitea_config[:domain]
|
||||
GiteaService.gitea_config[:domain]
|
||||
end
|
||||
|
||||
def database_username
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module Gitea
|
||||
module GiteaService
|
||||
class << self
|
||||
def gitea_config
|
||||
gitea_config = {}
|
|
@ -81,7 +81,7 @@ class Educoder::ClientService < ApplicationService
|
|||
end
|
||||
|
||||
def access_key_secret
|
||||
Gitea.gitea_config[:access_key_secret]
|
||||
GiteaService.gitea_config[:access_key_secret]
|
||||
end
|
||||
|
||||
def api_url(url)
|
||||
|
|
|
@ -56,7 +56,7 @@ class Gitea::Accelerator::BaseService < ApplicationService
|
|||
end
|
||||
|
||||
def accelerator
|
||||
Gitea.gitea_config[:accelerator]
|
||||
GiteaService.gitea_config[:accelerator]
|
||||
end
|
||||
|
||||
def render_status(response)
|
||||
|
|
|
@ -96,11 +96,11 @@ class Gitea::ClientService < ApplicationService
|
|||
end
|
||||
|
||||
def base_url
|
||||
Gitea.gitea_config[:base_url]
|
||||
GiteaService.gitea_config[:base_url]
|
||||
end
|
||||
|
||||
def domain
|
||||
Gitea.gitea_config[:domain]
|
||||
GiteaService.gitea_config[:domain]
|
||||
end
|
||||
|
||||
def api_url
|
||||
|
|
|
@ -14,8 +14,8 @@ class Gitea::User::DeleteService < Gitea::ClientService
|
|||
private
|
||||
def token
|
||||
{
|
||||
username: Gitea.gitea_config[:access_key_id],
|
||||
password: Gitea.gitea_config[:access_key_secret]
|
||||
username: GiteaService.gitea_config[:access_key_id],
|
||||
password: GiteaService.gitea_config[:access_key_secret]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class Gitea::User::UpdateService < Gitea::ClientService
|
|||
# source_id integer($int64)
|
||||
# website string
|
||||
|
||||
def initialize(edit_username, params={}, token={username: Gitea.gitea_config[:access_key_id], password: Gitea.gitea_config[:access_key_secret]})
|
||||
def initialize(edit_username, params={}, token={username: GiteaService.gitea_config[:access_key_id], password: GiteaService.gitea_config[:access_key_secret]})
|
||||
@token = token
|
||||
@params = params
|
||||
@edit_username = edit_username
|
||||
|
|
|
@ -63,7 +63,7 @@ class Repositories::CreateService < ApplicationService
|
|||
end
|
||||
|
||||
def remote_repository_url
|
||||
[Gitea.gitea_config[:domain], '/', user.login, '/', params[:identifier], ".git"].join("")
|
||||
[GiteaService.gitea_config[:domain], '/', user.login, '/', params[:identifier], ".git"].join("")
|
||||
end
|
||||
|
||||
def repository_params
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace :sync_data_to_gitea do
|
|||
end
|
||||
|
||||
def remote_repository_url(username, identifier)
|
||||
[Gitea.gitea_config[:domain], '/', username, '/', identifier, ".git"].join("")
|
||||
[GiteaService.gitea_config[:domain], '/', username, '/', identifier, ".git"].join("")
|
||||
end
|
||||
|
||||
def generate_identifier
|
||||
|
|
Loading…
Reference in New Issue