From d63117ace54330266dd4775c9ae85b1fc9ce9aa3 Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Sun, 27 Aug 2023 20:16:50 +0300 Subject: [PATCH] hide --gradio-auth and --api-auth values from /internal/sysinfo report --- modules/sysinfo.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/sysinfo.py b/modules/sysinfo.py index 058e66ce..2db7551d 100644 --- a/modules/sysinfo.py +++ b/modules/sysinfo.py @@ -82,7 +82,7 @@ def get_dict(): "Data path": paths_internal.data_path, "Extensions dir": paths_internal.extensions_dir, "Checksum": checksum_token, - "Commandline": sys.argv, + "Commandline": get_argv(), "Torch env info": get_torch_sysinfo(), "Exceptions": get_exceptions(), "CPU": { @@ -123,6 +123,22 @@ def get_environment(): return {k: os.environ[k] for k in sorted(os.environ) if k in environment_whitelist} +def get_argv(): + res = [] + + for v in sys.argv: + if shared.cmd_opts.gradio_auth and shared.cmd_opts.gradio_auth == v: + res.append("") + continue + + if shared.cmd_opts.api_auth and shared.cmd_opts.api_auth == v: + res.append("") + continue + + res.append(v) + + return res + re_newline = re.compile(r"\r*\n")