From aeba3cadd5efaa14fe06ef34df26903b5a778e49 Mon Sep 17 00:00:00 2001
From: AUTOMATIC <16777216c@gmail.com>
Date: Sun, 4 Jun 2023 11:16:00 +0300
Subject: [PATCH] add whitelist for environment in the report add extra link to
view the report instead of downloading it
---
modules/sysinfo.py | 30 +++++++++++++++++++++++++++++-
modules/ui_settings.py | 2 +-
style.css | 5 ++++-
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/modules/sysinfo.py b/modules/sysinfo.py
index f630c58b..5f15ac4f 100644
--- a/modules/sysinfo.py
+++ b/modules/sysinfo.py
@@ -13,6 +13,30 @@ import launch
from modules import paths_internal, timer
checksum_token = "DontStealMyGamePlz__WINNERS_DONT_USE_DRUGS__DONT_COPY_THAT_FLOPPY"
+environment_whitelist = {
+ "GIT",
+ "INDEX_URL",
+ "WEBUI_LAUNCH_LIVE_OUTPUT",
+ "GRADIO_ANALYTICS_ENABLED",
+ "PYTHONPATH",
+ "TORCH_INDEX_URL",
+ "TORCH_COMMAND",
+ "REQS_FILE",
+ "XFORMERS_PACKAGE",
+ "GFPGAN_PACKAGE",
+ "CLIP_PACKAGE",
+ "OPENCLIP_PACKAGE",
+ "STABLE_DIFFUSION_REPO",
+ "K_DIFFUSION_REPO",
+ "CODEFORMER_REPO",
+ "BLIP_REPO",
+ "STABLE_DIFFUSION_COMMIT_HASH",
+ "K_DIFFUSION_COMMIT_HASH",
+ "CODEFORMER_COMMIT_HASH",
+ "BLIP_COMMIT_HASH",
+ "COMMANDLINE_ARGS",
+ "IGNORE_CMD_ARGS_ERRORS",
+}
def pretty_bytes(num, suffix="B"):
@@ -72,7 +96,7 @@ def get_dict():
},
"Extensions": get_extensions(enabled=True),
"Inactive extensions": get_extensions(enabled=False),
- "Environment": {k: os.environ[k] for k in sorted(os.environ)},
+ "Environment": get_environment(),
"Config": get_config(),
"Startup": timer.startup_record,
"Packages": sorted([f"{pkg.key}=={pkg.version}" for pkg in pkg_resources.working_set]),
@@ -94,6 +118,10 @@ def get_exceptions():
return str(e)
+def get_environment():
+ return {k: os.environ[k] for k in sorted(os.environ) if k in environment_whitelist}
+
+
re_newline = re.compile(r"\r*\n")
diff --git a/modules/ui_settings.py b/modules/ui_settings.py
index 49445bd8..892c5e1a 100644
--- a/modules/ui_settings.py
+++ b/modules/ui_settings.py
@@ -158,7 +158,7 @@ class UiSettings:
loadsave.create_ui()
with gr.TabItem("Sysinfo", id="sysinfo", elem_id="settings_tab_sysinfo"):
- gr.HTML('Download system info', elem_id="sysinfo_download")
+ gr.HTML('Download system info
(or open as text in a new page)', elem_id="sysinfo_download")
with gr.Row():
with gr.Column(scale=1):
diff --git a/style.css b/style.css
index d8bdb73b..e1df716f 100644
--- a/style.css
+++ b/style.css
@@ -450,8 +450,11 @@ table.popup-table .link{
opacity: 0.75;
}
-#sysinfo_download a{
+#sysinfo_download a.sysinfo_big_link{
font-size: 24pt;
+}
+
+#sysinfo_download a{
text-decoration: underline;
}