Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
ee642a2f
Commit
ee642a2f
authored
Jul 08, 2023
by
AUTOMATIC1111
Committed by
GitHub
Jul 08, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11244 from MaiXiaoMeng/dev
Add github mirror for the download extension
parents
4da92281
e9bd18c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
modules/ui_extensions.py
modules/ui_extensions.py
+22
-4
No files found.
modules/ui_extensions.py
View file @
ee642a2f
...
@@ -325,7 +325,7 @@ def normalize_git_url(url):
...
@@ -325,7 +325,7 @@ def normalize_git_url(url):
return
url
return
url
def
install_extension_from_url
(
dirname
,
url
,
branch_name
=
None
):
def
install_extension_from_url
(
dirname
,
proxy
,
url
,
branch_name
=
None
):
check_access
()
check_access
()
if
isinstance
(
dirname
,
str
):
if
isinstance
(
dirname
,
str
):
...
@@ -335,6 +335,19 @@ def install_extension_from_url(dirname, url, branch_name=None):
...
@@ -335,6 +335,19 @@ def install_extension_from_url(dirname, url, branch_name=None):
assert
url
,
'No URL specified'
assert
url
,
'No URL specified'
proxy_list
=
{
"none"
:
""
,
"ghproxy"
:
"https://ghproxy.com/"
,
"yzuu"
:
"hub.yzuu.cf"
,
"njuu"
:
"hub.njuu.cf"
,
"nuaa"
:
"hub.nuaa.cf"
,
}
if
proxy
in
[
'yzuu'
,
'njuu'
,
'nuaa'
]:
url
=
url
.
replace
(
'github.com'
,
proxy_list
[
proxy
])
elif
proxy
==
'ghproxy'
:
url
=
proxy_list
[
proxy
]
+
url
if
dirname
is
None
or
dirname
==
""
:
if
dirname
is
None
or
dirname
==
""
:
*
parts
,
last_part
=
url
.
split
(
'/'
)
*
parts
,
last_part
=
url
.
split
(
'/'
)
last_part
=
normalize_git_url
(
last_part
)
last_part
=
normalize_git_url
(
last_part
)
...
@@ -354,12 +367,12 @@ def install_extension_from_url(dirname, url, branch_name=None):
...
@@ -354,12 +367,12 @@ def install_extension_from_url(dirname, url, branch_name=None):
shutil
.
rmtree
(
tmpdir
,
True
)
shutil
.
rmtree
(
tmpdir
,
True
)
if
not
branch_name
:
if
not
branch_name
:
# if no branch is specified, use the default branch
# 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
()
repo
.
remote
()
.
fetch
()
for
submodule
in
repo
.
submodules
:
for
submodule
in
repo
.
submodules
:
submodule
.
update
()
submodule
.
update
()
else
:
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
()
repo
.
remote
()
.
fetch
()
for
submodule
in
repo
.
submodules
:
for
submodule
in
repo
.
submodules
:
submodule
.
update
()
submodule
.
update
()
...
@@ -615,6 +628,11 @@ def create_ui():
...
@@ -615,6 +628,11 @@ def create_ui():
)
)
with
gr
.
TabItem
(
"Install from URL"
,
id
=
"install_from_url"
):
with
gr
.
TabItem
(
"Install from URL"
,
id
=
"install_from_url"
):
install_proxy
=
gr
.
Radio
(
label
=
"Install Proxy"
,
choices
=
[
"none"
,
"ghproxy"
,
"nuaa"
,
"yzuu"
,
"njuu"
],
value
=
"none"
,
info
=
"If you can't access github.com, you can use a proxy to install extensions from github.com"
)
install_url
=
gr
.
Text
(
label
=
"URL for extension's git repository"
)
install_url
=
gr
.
Text
(
label
=
"URL for extension's git repository"
)
install_branch
=
gr
.
Text
(
label
=
"Specific branch name"
,
placeholder
=
"Leave empty for default main branch"
)
install_branch
=
gr
.
Text
(
label
=
"Specific branch name"
,
placeholder
=
"Leave empty for default main branch"
)
install_dirname
=
gr
.
Text
(
label
=
"Local directory name"
,
placeholder
=
"Leave empty for auto"
)
install_dirname
=
gr
.
Text
(
label
=
"Local directory name"
,
placeholder
=
"Leave empty for auto"
)
...
@@ -623,7 +641,7 @@ def create_ui():
...
@@ -623,7 +641,7 @@ def create_ui():
install_button
.
click
(
install_button
.
click
(
fn
=
modules
.
ui
.
wrap_gradio_call
(
lambda
*
args
:
[
gr
.
update
(),
*
install_extension_from_url
(
*
args
)],
extra_outputs
=
[
gr
.
update
(),
gr
.
update
()]),
fn
=
modules
.
ui
.
wrap_gradio_call
(
lambda
*
args
:
[
gr
.
update
(),
*
install_extension_from_url
(
*
args
)],
extra_outputs
=
[
gr
.
update
(),
gr
.
update
()]),
inputs
=
[
install_dirname
,
install_url
,
install_branch
],
inputs
=
[
install_dirname
,
install_
proxy
,
install_
url
,
install_branch
],
outputs
=
[
install_url
,
extensions_table
,
install_result
],
outputs
=
[
install_url
,
extensions_table
,
install_result
],
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment