Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use auth without --share & update output_path based on username #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,25 @@
import modules.style_sorter as style_sorter
import modules.meta_parser
import args_manager
import modules.config
import copy

from modules.sdxl_styles import legal_style_names
from modules.private_logger import get_current_html_path
from modules.ui_gradio_extensions import reload_javascript
from modules.auth import auth_enabled, check_auth
from ldm_patched.utils.path_utils import set_output_directory
from ldm_patched.modules.args_parser import args as global_args

def generate_clicked(request: gr.Request, *args):

# Setup custom output directories per user if auth is enabled
if auth_enabled :
user = request.username
new_output_dir = global_args.output_path.replace("[user]",user)
modules.config.path_outputs = new_output_dir
set_output_directory(new_output_dir)


def generate_clicked(*args):
import ldm_patched.modules.model_management as model_management

with model_management.interrupt_processing_mutex:
Expand Down Expand Up @@ -601,6 +611,6 @@ def dump_default_english_config():
server_name=args_manager.args.listen,
server_port=args_manager.args.port,
share=args_manager.args.share,
auth=check_auth if args_manager.args.share and auth_enabled else None,
auth=check_auth if auth_enabled else None,
blocked_paths=[constants.AUTH_FILENAME]
)