Merge pull request #329 from EyeDeck/master

Add --gradio-auth command line argument to enable Gradio authentication
This commit is contained in:
AUTOMATIC1111 2022-09-12 15:45:11 +03:00 committed by GitHub
commit 264d255919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -42,9 +42,8 @@ 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-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)
parser.add_argument("--gradio-debug", action='store_true', help="launch gradio with --debug option")
parser.add_argument("--gradio-auth", type=str, help='set gradio authentication like "username:password"; or comma-delimit multiple like "u1:p1,u2:p2,u3:p3"', default=None)
cmd_opts = parser.parse_args()

View File

@ -120,7 +120,7 @@ def webui():
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,
auth=[tuple(cred.split(':')) for cred in cmd_opts.auth.strip('"').split(',')] if cmd_opts.auth else None,
)