add auth to --listen and readme (#2127)
* Update webui.py * Update readme.md * Update webui.py Only enable AuthN for --listen and --share Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> * docs: rephrase documentation changes for auth --------- Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Co-authored-by: Manuel Schmid <manuel.schmid@odt.net>
This commit is contained in:
parent
95f93a1f4b
commit
ac10e51364
@ -281,6 +281,13 @@ Given different goals, the default models and configs of Fooocus are different:
|
|||||||
|
|
||||||
Note that the download is **automatic** - you do not need to do anything if the internet connection is okay. However, you can download them manually if you (or move them from somewhere else) have your own preparation.
|
Note that the download is **automatic** - you do not need to do anything if the internet connection is okay. However, you can download them manually if you (or move them from somewhere else) have your own preparation.
|
||||||
|
|
||||||
|
## UI Access and Authentication
|
||||||
|
In addition to running on localhost, Fooocus can also expose its UI in two ways:
|
||||||
|
* Local UI listener: use `--listen` (specify port e.g. with `--port 8888`).
|
||||||
|
* API access: use `--share` (registers an endpoint at `.gradio.live`).
|
||||||
|
|
||||||
|
In both ways the access is unauthenticated by default. You can add basic authentication by creating a file called `auth.json` in the main directory, which contains a list of JSON objects with the keys `user` and `pass` (see example in [auth-example.json](./auth-example.json)).
|
||||||
|
|
||||||
## List of "Hidden" Tricks
|
## List of "Hidden" Tricks
|
||||||
<a name="tech_list"></a>
|
<a name="tech_list"></a>
|
||||||
|
|
||||||
|
2
webui.py
2
webui.py
@ -618,6 +618,6 @@ shared.gradio_root.launch(
|
|||||||
server_name=args_manager.args.listen,
|
server_name=args_manager.args.listen,
|
||||||
server_port=args_manager.args.port,
|
server_port=args_manager.args.port,
|
||||||
share=args_manager.args.share,
|
share=args_manager.args.share,
|
||||||
auth=check_auth if args_manager.args.share and auth_enabled else None,
|
auth=check_auth if (args_manager.args.share or args_manager.args.listen) and auth_enabled else None,
|
||||||
blocked_paths=[constants.AUTH_FILENAME]
|
blocked_paths=[constants.AUTH_FILENAME]
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user