Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
2c10fda3
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
11 个月 前同步成功
通知
1771
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
2c10fda3
编写于
8月 20, 2023
作者:
W
w-e-w
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make it obvious that a config_status is corrupted
also format HTML removing unnecessary text blocks
上级
7ca20adc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
117 addition
and
107 deletion
+117
-107
modules/ui_extensions.py
modules/ui_extensions.py
+117
-107
未找到文件。
modules/ui_extensions.py
浏览文件 @
2c10fda3
...
@@ -200,119 +200,129 @@ def update_config_states_table(state_name):
...
@@ -200,119 +200,129 @@ def update_config_states_table(state_name):
created_date
=
time
.
asctime
(
time
.
gmtime
(
config_state
[
"created_at"
]))
created_date
=
time
.
asctime
(
time
.
gmtime
(
config_state
[
"created_at"
]))
filepath
=
config_state
.
get
(
"filepath"
,
"<unknown>"
)
filepath
=
config_state
.
get
(
"filepath"
,
"<unknown>"
)
code
=
f
"""<!--
{
time
.
time
()
}
-->"""
try
:
webui_remote
=
config_state
[
"webui"
][
"remote"
]
or
""
webui_remote
=
config_state
[
"webui"
][
"remote"
]
or
""
webui_branch
=
config_state
[
"webui"
][
"branch"
]
webui_branch
=
config_state
[
"webui"
][
"branch"
]
webui_commit_hash
=
config_state
[
"webui"
][
"commit_hash"
]
or
"<unknown>"
webui_commit_hash
=
config_state
[
"webui"
][
"commit_hash"
]
or
"<unknown>"
webui_commit_date
=
config_state
[
"webui"
][
"commit_date"
]
webui_commit_date
=
config_state
[
"webui"
][
"commit_date"
]
if
webui_commit_date
:
if
webui_commit_date
:
webui_commit_date
=
time
.
asctime
(
time
.
gmtime
(
webui_commit_date
))
webui_commit_date
=
time
.
asctime
(
time
.
gmtime
(
webui_commit_date
))
else
:
webui_commit_date
=
"<unknown>"
remote
=
f
"""<a href="
{
html
.
escape
(
webui_remote
)
}
" target="_blank">
{
html
.
escape
(
webui_remote
or
''
)
}
</a>"""
commit_link
=
make_commit_link
(
webui_commit_hash
,
webui_remote
)
date_link
=
make_commit_link
(
webui_commit_hash
,
webui_remote
,
webui_commit_date
)
current_webui
=
config_states
.
get_webui_config
()
style_remote
=
""
style_branch
=
""
style_commit
=
""
if
current_webui
[
"remote"
]
!=
webui_remote
:
style_remote
=
STYLE_PRIMARY
if
current_webui
[
"branch"
]
!=
webui_branch
:
style_branch
=
STYLE_PRIMARY
if
current_webui
[
"commit_hash"
]
!=
webui_commit_hash
:
style_commit
=
STYLE_PRIMARY
code
+=
f
"""<h2>Config Backup:
{
config_name
}
</h2>
<div><b>Filepath:</b>
{
filepath
}
</div>
<div><b>Created at:</b>
{
created_date
}
</div>"""
code
+=
f
"""<h2>WebUI State</h2>
<table id="config_state_webui">
<thead>
<tr>
<th>URL</th>
<th>Branch</th>
<th>Commit</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td><label
{
style_remote
}
>
{
remote
}
</label></td>
<td><label
{
style_branch
}
>
{
webui_branch
}
</label></td>
<td><label
{
style_commit
}
>
{
commit_link
}
</label></td>
<td><label
{
style_commit
}
>
{
date_link
}
</label></td>
</tr>
</tbody>
</table>
"""
code
+=
"""<h2>Extension State</h2>
<table id="config_state_extensions">
<thead>
<tr>
<th>Extension</th>
<th>URL</th>
<th>Branch</th>
<th>Commit</th>
<th>Date</th>
</tr>
</thead>
<tbody>
"""
ext_map
=
{
ext
.
name
:
ext
for
ext
in
extensions
.
extensions
}
for
ext_name
,
ext_conf
in
config_state
[
"extensions"
].
items
():
ext_remote
=
ext_conf
[
"remote"
]
or
""
ext_branch
=
ext_conf
[
"branch"
]
or
"<unknown>"
ext_enabled
=
ext_conf
[
"enabled"
]
ext_commit_hash
=
ext_conf
[
"commit_hash"
]
or
"<unknown>"
ext_commit_date
=
ext_conf
[
"commit_date"
]
if
ext_commit_date
:
ext_commit_date
=
time
.
asctime
(
time
.
gmtime
(
ext_commit_date
))
else
:
else
:
ext_commit_date
=
"<unknown>"
webui_commit_date
=
"<unknown>"
remote
=
f
"""<a href="
{
html
.
escape
(
webui_remote
)
}
" target="_blank">
{
html
.
escape
(
webui_remote
or
''
)
}
</a>"""
commit_link
=
make_commit_link
(
webui_commit_hash
,
webui_remote
)
date_link
=
make_commit_link
(
webui_commit_hash
,
webui_remote
,
webui_commit_date
)
remote
=
f
"""<a href="
{
html
.
escape
(
ext_remote
)
}
" target="_blank">
{
html
.
escape
(
ext_remote
or
''
)
}
</a>"""
current_webui
=
config_states
.
get_webui_config
()
commit_link
=
make_commit_link
(
ext_commit_hash
,
ext_remote
)
date_link
=
make_commit_link
(
ext_commit_hash
,
ext_remote
,
ext_commit_date
)
style_enabled
=
""
style_remote
=
""
style_remote
=
""
style_branch
=
""
style_branch
=
""
style_commit
=
""
style_commit
=
""
if
ext_name
in
ext_map
:
if
current_webui
[
"remote"
]
!=
webui_remote
:
current_ext
=
ext_map
[
ext_name
]
style_remote
=
STYLE_PRIMARY
current_ext
.
read_info_from_repo
()
if
current_webui
[
"branch"
]
!=
webui_branch
:
if
current_ext
.
enabled
!=
ext_enabled
:
style_branch
=
STYLE_PRIMARY
style_enabled
=
STYLE_PRIMARY
if
current_webui
[
"commit_hash"
]
!=
webui_commit_hash
:
if
current_ext
.
remote
!=
ext_remote
:
style_commit
=
STYLE_PRIMARY
style_remote
=
STYLE_PRIMARY
if
current_ext
.
branch
!=
ext_branch
:
code
=
f
"""<!--
{
time
.
time
()
}
-->
style_branch
=
STYLE_PRIMARY
<h2>Config Backup:
{
config_name
}
</h2>
if
current_ext
.
commit_hash
!=
ext_commit_hash
:
<div><b>Filepath:</b>
{
filepath
}
</div>
style_commit
=
STYLE_PRIMARY
<div><b>Created at:</b>
{
created_date
}
</div>
<h2>WebUI State</h2>
code
+=
f
"""
<table id="config_state_webui">
<tr>
<thead>
<td><label
{
style_enabled
}
><input class="gr-check-radio gr-checkbox" type="checkbox" disabled="true"
{
'checked="checked"'
if
ext_enabled
else
''
}
>
{
html
.
escape
(
ext_name
)
}
</label></td>
<tr>
<td><label
{
style_remote
}
>
{
remote
}
</label></td>
<th>URL</th>
<td><label
{
style_branch
}
>
{
ext_branch
}
</label></td>
<th>Branch</th>
<td><label
{
style_commit
}
>
{
commit_link
}
</label></td>
<th>Commit</th>
<td><label
{
style_commit
}
>
{
date_link
}
</label></td>
<th>Date</th>
</tr>
</tr>
"""
</thead>
<tbody>
code
+=
"""
<tr>
</tbody>
<td>
</table>
<label
{
style_remote
}
>
{
remote
}
</label>
"""
</td>
<td>
<label
{
style_branch
}
>
{
webui_branch
}
</label>
</td>
<td>
<label
{
style_commit
}
>
{
commit_link
}
</label>
</td>
<td>
<label
{
style_commit
}
>
{
date_link
}
</label>
</td>
</tr>
</tbody>
</table>
<h2>Extension State</h2>
<table id="config_state_extensions">
<thead>
<tr>
<th>Extension</th>
<th>URL</th>
<th>Branch</th>
<th>Commit</th>
<th>Date</th>
</tr>
</thead>
<tbody>
"""
ext_map
=
{
ext
.
name
:
ext
for
ext
in
extensions
.
extensions
}
for
ext_name
,
ext_conf
in
config_state
[
"extensions"
].
items
():
ext_remote
=
ext_conf
[
"remote"
]
or
""
ext_branch
=
ext_conf
[
"branch"
]
or
"<unknown>"
ext_enabled
=
ext_conf
[
"enabled"
]
ext_commit_hash
=
ext_conf
[
"commit_hash"
]
or
"<unknown>"
ext_commit_date
=
ext_conf
[
"commit_date"
]
if
ext_commit_date
:
ext_commit_date
=
time
.
asctime
(
time
.
gmtime
(
ext_commit_date
))
else
:
ext_commit_date
=
"<unknown>"
remote
=
f
"""<a href="
{
html
.
escape
(
ext_remote
)
}
" target="_blank">
{
html
.
escape
(
ext_remote
or
''
)
}
</a>"""
commit_link
=
make_commit_link
(
ext_commit_hash
,
ext_remote
)
date_link
=
make_commit_link
(
ext_commit_hash
,
ext_remote
,
ext_commit_date
)
style_enabled
=
""
style_remote
=
""
style_branch
=
""
style_commit
=
""
if
ext_name
in
ext_map
:
current_ext
=
ext_map
[
ext_name
]
current_ext
.
read_info_from_repo
()
if
current_ext
.
enabled
!=
ext_enabled
:
style_enabled
=
STYLE_PRIMARY
if
current_ext
.
remote
!=
ext_remote
:
style_remote
=
STYLE_PRIMARY
if
current_ext
.
branch
!=
ext_branch
:
style_branch
=
STYLE_PRIMARY
if
current_ext
.
commit_hash
!=
ext_commit_hash
:
style_commit
=
STYLE_PRIMARY
code
+=
f
""" <tr>
<td><label
{
style_enabled
}
><input class="gr-check-radio gr-checkbox" type="checkbox" disabled="true"
{
'checked="checked"'
if
ext_enabled
else
''
}
>
{
html
.
escape
(
ext_name
)
}
</label></td>
<td><label
{
style_remote
}
>
{
remote
}
</label></td>
<td><label
{
style_branch
}
>
{
ext_branch
}
</label></td>
<td><label
{
style_commit
}
>
{
commit_link
}
</label></td>
<td><label
{
style_commit
}
>
{
date_link
}
</label></td>
</tr>
"""
code
+=
""" </tbody>
</table>"""
except
Exception
as
e
:
print
(
f
"[ERROR]: Config states
{
filepath
}
,
{
e
}
"
)
code
=
f
"""<!--
{
time
.
time
()
}
-->
<h2>Config Backup:
{
config_name
}
</h2>
<div><b>Filepath:</b>
{
filepath
}
</div>
<div><b>Created at:</b>
{
created_date
}
</div>
<h2>This file is corrupted</h2>"""
return
code
return
code
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录