update #2336 to prevent reading params.txt when --hide-ui-dir-config option is enabled (for servers, since this will let some users access others' params)
This commit is contained in:
parent
e72adc999b
commit
fde7fefa2e
|
@ -2,6 +2,7 @@ import os
|
||||||
import re
|
import re
|
||||||
import gradio as gr
|
import gradio as gr
|
||||||
from modules.shared import script_path
|
from modules.shared import script_path
|
||||||
|
from modules import shared
|
||||||
|
|
||||||
re_param_code = r"\s*([\w ]+):\s*([^,]+)(?:,|$)"
|
re_param_code = r"\s*([\w ]+):\s*([^,]+)(?:,|$)"
|
||||||
re_param = re.compile(re_param_code)
|
re_param = re.compile(re_param_code)
|
||||||
|
@ -63,7 +64,7 @@ Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 965400086, Size: 512x512, Model
|
||||||
|
|
||||||
def connect_paste(button, paste_fields, input_comp, js=None):
|
def connect_paste(button, paste_fields, input_comp, js=None):
|
||||||
def paste_func(prompt):
|
def paste_func(prompt):
|
||||||
if not prompt:
|
if not prompt and not shared.cmd_opts.hide_ui_dir_config:
|
||||||
filename = os.path.join(script_path, "params.txt")
|
filename = os.path.join(script_path, "params.txt")
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
with open(filename, "r", encoding="utf8") as file:
|
with open(filename, "r", encoding="utf8") as file:
|
||||||
|
|
Loading…
Reference in New Issue