aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ui_extensions.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ui_extensions.py')
-rw-r--r--modules/ui_extensions.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py
index dff522ef..a208012d 100644
--- a/modules/ui_extensions.py
+++ b/modules/ui_extensions.py
@@ -325,6 +325,17 @@ def normalize_git_url(url):
return url
+def github_proxy(url):
+ proxy = shared.opts.github_proxy
+
+ if proxy == 'None':
+ return url
+ if proxy == 'ghproxy.com':
+ return "https://ghproxy.com/" + url
+
+ return url.replace('github.com', proxy)
+
+
def install_extension_from_url(dirname, url, branch_name=None):
check_access()
@@ -335,6 +346,8 @@ def install_extension_from_url(dirname, url, branch_name=None):
assert url, 'No URL specified'
+ url = github_proxy(url)
+
if dirname is None or dirname == "":
*parts, last_part = url.split('/')
last_part = normalize_git_url(last_part)
@@ -354,12 +367,12 @@ def install_extension_from_url(dirname, url, branch_name=None):
shutil.rmtree(tmpdir, True)
if not branch_name:
# if no branch is specified, use the default branch
- with git.Repo.clone_from(url, tmpdir, filter=['blob:none']) as repo:
+ with git.Repo.clone_from(url, tmpdir, filter=['blob:none'], verbose=False) as repo:
repo.remote().fetch()
for submodule in repo.submodules:
submodule.update()
else:
- with git.Repo.clone_from(url, tmpdir, filter=['blob:none'], branch=branch_name) as repo:
+ with git.Repo.clone_from(url, tmpdir, filter=['blob:none'], branch=branch_name, verbose=False) as repo:
repo.remote().fetch()
for submodule in repo.submodules:
submodule.update()