Skip to content

Commit c8045c5

Browse files
sgkoishiAUTOMATIC1111
authored andcommitted
The hide_ui_dir_config flag also restrict write attempt to path settings
1 parent 26a1177 commit c8045c5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

modules/shared.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@
7777

7878

7979
cmd_opts = parser.parse_args()
80+
restricted_opts = [
81+
"samples_filename_pattern",
82+
"outdir_samples",
83+
"outdir_txt2img_samples",
84+
"outdir_img2img_samples",
85+
"outdir_extras_samples",
86+
"outdir_grids",
87+
"outdir_txt2img_grids",
88+
"outdir_save",
89+
]
8090

8191
devices.device, devices.device_interrogate, devices.device_gfpgan, devices.device_bsrgan, devices.device_esrgan, devices.device_scunet, devices.device_codeformer = \
8292
(devices.cpu if any(y in cmd_opts.use_cpu for y in [x, 'all']) else devices.get_optimal_device() for x in ['sd', 'interrogate', 'gfpgan', 'bsrgan', 'esrgan', 'scunet', 'codeformer'])

modules/ui.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from modules import sd_hijack, sd_models
2727
from modules.paths import script_path
28-
from modules.shared import opts, cmd_opts
28+
from modules.shared import opts, cmd_opts, restricted_opts
2929
if cmd_opts.deepdanbooru:
3030
from modules.deepbooru import get_deepbooru_tags
3131
import modules.shared as shared
@@ -1430,6 +1430,9 @@ def run_settings(*args):
14301430
if comp_args and isinstance(comp_args, dict) and comp_args.get('visible') is False:
14311431
continue
14321432

1433+
if cmd_opts.hide_ui_dir_config and key in restricted_opts:
1434+
continue
1435+
14331436
oldval = opts.data.get(key, None)
14341437
opts.data[key] = value
14351438

@@ -1447,6 +1450,9 @@ def run_settings_single(value, key):
14471450
if not opts.same_type(value, opts.data_labels[key].default):
14481451
return gr.update(visible=True), opts.dumpjson()
14491452

1453+
if cmd_opts.hide_ui_dir_config and key in restricted_opts:
1454+
return gr.update(value=oldval), opts.dumpjson()
1455+
14501456
oldval = opts.data.get(key, None)
14511457
opts.data[key] = value
14521458

0 commit comments

Comments
 (0)