aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-12 12:10:05 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-09-12 12:10:05 +0000
commit372a2c3e2e68acb0c457e2fb328ec31eba5677d2 (patch)
treefa4eab89979da9653116a6346faa5916b02281f0
parente4f080f61a8002949eb6fef6ade18abee4dcf5fe (diff)
downloadstable-diffusion-webui-gfx803-372a2c3e2e68acb0c457e2fb328ec31eba5677d2.tar.gz
stable-diffusion-webui-gfx803-372a2c3e2e68acb0c457e2fb328ec31eba5677d2.tar.bz2
stable-diffusion-webui-gfx803-372a2c3e2e68acb0c457e2fb328ec31eba5677d2.zip
[Feature Request] Please add "--share-password" for Gradio server security #315
-rw-r--r--modules/shared.py4
-rw-r--r--webui.py8
2 files changed, 10 insertions, 2 deletions
diff --git a/modules/shared.py b/modules/shared.py
index 38d24fae..52d3db4b 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -42,7 +42,9 @@ parser.add_argument("--show-negative-prompt", action='store_true', help="does no
parser.add_argument("--ui-config-file", type=str, help="filename to use for ui configuration", default=os.path.join(script_path, 'ui-config.json'))
parser.add_argument("--hide-ui-dir-config", action='store_true', help="hide directory configuration from webui", default=False)
parser.add_argument("--ui-settings-file", type=str, help="filename to use for ui settings", default=os.path.join(script_path, 'config.json'))
-parser.add_argument("--gradio-debug", action='store_true', help="launch gradio with --debug option")
+parser.add_argument("--gradio-debug", action='store_true', help="launch gradio with --debug option")
+parser.add_argument("--gradio-username", type=str, help="username for gradio authentication; default: user", default="user")
+parser.add_argument("--gradio-password", type=str, help="password for gradio authentication; default: no authentication", default=None)
cmd_opts = parser.parse_args()
diff --git a/webui.py b/webui.py
index 35c8362b..735ad336 100644
--- a/webui.py
+++ b/webui.py
@@ -115,7 +115,13 @@ def webui():
run_pnginfo=modules.extras.run_pnginfo
)
- demo.launch(share=cmd_opts.share, server_name="0.0.0.0" if cmd_opts.listen else None, server_port=cmd_opts.port, debug=cmd_opts.gradio_debug)
+ demo.launch(
+ share=cmd_opts.share,
+ server_name="0.0.0.0" if cmd_opts.listen else None,
+ server_port=cmd_opts.port,
+ debug=cmd_opts.gradio_debug,
+ auth=(cmd_opts.gradio_username, cmd_opts.gradio_password) if cmd_opts.gradio_password is not None else None,
+ )
if __name__ == "__main__":