FIX migration project accelerator's bug

This commit is contained in:
jasder 2021-05-17 17:14:55 +08:00
parent 2f9d583fac
commit c627ea6c19
1 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,7 @@ module Acceleratorable
extend ActiveSupport::Concern
def enable_accelerator?(clone_addr)
clone_addr.include?(github_domain) || clone_addr.include?(gitlab_domain)
is_foreign_url?(clone_addr) && config_accelerator?
end
def accelerator_url(repo_name)
@ -25,4 +25,12 @@ module Acceleratorable
Gitea.gitea_config[:accelerator]["access_key_id"]
end
def config_accelerator?
Gitea.gitea_config[:accelerator].present?
end
def is_foreign_url?(clone_addr)
clone_addr.include?(github_domain) || clone_addr.include?(gitlab_domain)
end
end