ADD github gitlab镜像加速器

This commit is contained in:
jasder
2021-04-29 18:35:57 +08:00
parent 8bf02b1ee5
commit 1277e717ff
13 changed files with 295 additions and 82 deletions

View File

@@ -0,0 +1,28 @@
module Acceleratorable
extend ActiveSupport::Concern
def enable_accelerator?(clone_addr)
clone_addr.include?(github_domain) || clone_addr.include?(gitlab_domain)
end
def accelerator_url(repo_name)
[accelerator_domain, accelerator_username, "#{repo_name}.git"].join('/')
end
def github_domain
'github.com'
end
def gitlab_domain
'gitlab.com'
end
def accelerator_domain
Gitea.gitea_config[:accelerator]["domain"]
end
def accelerator_username
Gitea.gitea_config[:accelerator]["access_key_id"]
end
end