mirror of
https://github.com/sd-webui/stable-diffusion-webui.git
synced 2024-12-13 08:41:58 +03:00
Added option for admins to hide the server and browser settings form the Settings page. (#1618)
This commit is contained in:
commit
1edaccfeb5
@ -65,6 +65,10 @@ general:
|
||||
update_preview: True
|
||||
update_preview_frequency: 10
|
||||
|
||||
admin:
|
||||
hide_server_setting: False
|
||||
hide_browser_setting: False
|
||||
|
||||
debug:
|
||||
enable_hydralit: False
|
||||
|
||||
|
@ -213,59 +213,59 @@ def layout():
|
||||
help="Defaut theme to use as base for streamlit. Default: dark")
|
||||
st.session_state["streamlit_config"]["theme"]["base"] = st.session_state["defaults"].general.default_theme
|
||||
|
||||
with st.expander("Server", True):
|
||||
|
||||
st.session_state["streamlit_config"]['server']['headless'] = st.checkbox("Run Headless", help="If false, will attempt to open a browser window on start. \
|
||||
Default: false unless (1) we are on a Linux box where DISPLAY is unset, \
|
||||
or (2) we are running in the Streamlit Atom plugin.")
|
||||
if not st.session_state['defaults'].admin.hide_server_setting:
|
||||
with st.expander("Server", True):
|
||||
|
||||
st.session_state["streamlit_config"]['server']['port'] = st.number_input("Port", value=st.session_state["streamlit_config"]['server']['port'],
|
||||
help="The port where the server will listen for browser connections. Default: 8501")
|
||||
st.session_state["streamlit_config"]['server']['headless'] = st.checkbox("Run Headless", help="If false, will attempt to open a browser window on start. \
|
||||
Default: false unless (1) we are on a Linux box where DISPLAY is unset, \
|
||||
or (2) we are running in the Streamlit Atom plugin.")
|
||||
|
||||
st.session_state["streamlit_config"]['server']['baseUrlPath'] = st.text_input("Base Url Path", value=st.session_state["streamlit_config"]['server']['baseUrlPath'],
|
||||
help="The base path for the URL where Streamlit should be served from. Default: '' ")
|
||||
st.session_state["streamlit_config"]['server']['port'] = st.number_input("Port", value=st.session_state["streamlit_config"]['server']['port'],
|
||||
help="The port where the server will listen for browser connections. Default: 8501")
|
||||
|
||||
st.session_state["streamlit_config"]['server']['enableCORS'] = st.checkbox("Enable CORS", value=st.session_state['streamlit_config']['server']['enableCORS'],
|
||||
help="Enables support for Cross-Origin Request Sharing (CORS) protection, for added security. \
|
||||
Due to conflicts between CORS and XSRF, if `server.enableXsrfProtection` is on and `server.enableCORS` \
|
||||
is off at the same time, we will prioritize `server.enableXsrfProtection`. Default: true")
|
||||
st.session_state["streamlit_config"]['server']['baseUrlPath'] = st.text_input("Base Url Path", value=st.session_state["streamlit_config"]['server']['baseUrlPath'],
|
||||
help="The base path for the URL where Streamlit should be served from. Default: '' ")
|
||||
|
||||
st.session_state["streamlit_config"]['server']['enableXsrfProtection'] = st.checkbox("Enable Xsrf Protection",
|
||||
value=st.session_state['streamlit_config']['server']['enableXsrfProtection'],
|
||||
help="Enables support for Cross-Site Request Forgery (XSRF) protection, \
|
||||
for added security. Due to conflicts between CORS and XSRF, \
|
||||
if `server.enableXsrfProtection` is on and `server.enableCORS` is off at \
|
||||
the same time, we will prioritize `server.enableXsrfProtection`. Default: true")
|
||||
st.session_state["streamlit_config"]['server']['enableCORS'] = st.checkbox("Enable CORS", value=st.session_state['streamlit_config']['server']['enableCORS'],
|
||||
help="Enables support for Cross-Origin Request Sharing (CORS) protection, for added security. \
|
||||
Due to conflicts between CORS and XSRF, if `server.enableXsrfProtection` is on and `server.enableCORS` \
|
||||
is off at the same time, we will prioritize `server.enableXsrfProtection`. Default: true")
|
||||
|
||||
st.session_state["streamlit_config"]['server']['maxUploadSize'] = st.number_input("Max Upload Size", value=st.session_state["streamlit_config"]['server']['maxUploadSize'],
|
||||
help="Max size, in megabytes, for files uploaded with the file_uploader. Default: 200")
|
||||
st.session_state["streamlit_config"]['server']['enableXsrfProtection'] = st.checkbox("Enable Xsrf Protection",
|
||||
value=st.session_state['streamlit_config']['server']['enableXsrfProtection'],
|
||||
help="Enables support for Cross-Site Request Forgery (XSRF) protection, \
|
||||
for added security. Due to conflicts between CORS and XSRF, \
|
||||
if `server.enableXsrfProtection` is on and `server.enableCORS` is off at \
|
||||
the same time, we will prioritize `server.enableXsrfProtection`. Default: true")
|
||||
|
||||
st.session_state["streamlit_config"]['server']['maxMessageSize'] = st.number_input("Max Message Size", value=st.session_state["streamlit_config"]['server']['maxUploadSize'],
|
||||
help="Max size, in megabytes, of messages that can be sent via the WebSocket connection. Default: 200")
|
||||
st.session_state["streamlit_config"]['server']['maxUploadSize'] = st.number_input("Max Upload Size", value=st.session_state["streamlit_config"]['server']['maxUploadSize'],
|
||||
help="Max size, in megabytes, for files uploaded with the file_uploader. Default: 200")
|
||||
|
||||
st.session_state["streamlit_config"]['server']['enableWebsocketCompression'] = st.checkbox("Enable Websocket Compression",
|
||||
value=st.session_state["streamlit_config"]['server']['enableWebsocketCompression'],
|
||||
help=" Enables support for websocket compression. Default: false")
|
||||
with st.expander("Browser", expanded=True):
|
||||
st.session_state["streamlit_config"]['browser']['serverAddress'] = st.text_input("Server Address",
|
||||
value=st.session_state["streamlit_config"]['browser']['serverAddress'],
|
||||
help="Internet address where users should point their browsers in order \
|
||||
to connect to the app. Can be IP address or DNS name and path.\
|
||||
This is used to: - Set the correct URL for CORS and XSRF protection purposes. \
|
||||
- Show the URL on the terminal - Open the browser. Default: 'localhost'")
|
||||
|
||||
st.session_state["defaults"].general.streamlit_telemetry = st.checkbox("Enable Telemetry", value=st.session_state['defaults'].general.streamlit_telemetry,
|
||||
help="Enables or Disables streamlit telemetry. Default: False")
|
||||
st.session_state["streamlit_config"]["browser"]["gatherUsageStats"] = st.session_state["defaults"].general.streamlit_telemetry
|
||||
|
||||
st.session_state["streamlit_config"]['browser']['serverPort'] = st.number_input("Server Port", value=st.session_state["streamlit_config"]['browser']['serverPort'],
|
||||
help="Port where users should point their browsers in order to connect to the app. \
|
||||
This is used to: - Set the correct URL for CORS and XSRF protection purposes. \
|
||||
- Show the URL on the terminal - Open the browser \
|
||||
Default: whatever value is set in server.port.")
|
||||
st.session_state["streamlit_config"]['server']['maxMessageSize'] = st.number_input("Max Message Size", value=st.session_state["streamlit_config"]['server']['maxUploadSize'],
|
||||
help="Max size, in megabytes, of messages that can be sent via the WebSocket connection. Default: 200")
|
||||
|
||||
st.session_state["streamlit_config"]['server']['enableWebsocketCompression'] = st.checkbox("Enable Websocket Compression",
|
||||
value=st.session_state["streamlit_config"]['server']['enableWebsocketCompression'],
|
||||
help=" Enables support for websocket compression. Default: false")
|
||||
if not st.session_state['defaults'].admin.hide_browser_setting:
|
||||
with st.expander("Browser", expanded=True):
|
||||
st.session_state["streamlit_config"]['browser']['serverAddress'] = st.text_input("Server Address",
|
||||
value=st.session_state["streamlit_config"]['browser']['serverAddress'],
|
||||
help="Internet address where users should point their browsers in order \
|
||||
to connect to the app. Can be IP address or DNS name and path.\
|
||||
This is used to: - Set the correct URL for CORS and XSRF protection purposes. \
|
||||
- Show the URL on the terminal - Open the browser. Default: 'localhost'")
|
||||
|
||||
st.session_state["defaults"].general.streamlit_telemetry = st.checkbox("Enable Telemetry", value=st.session_state['defaults'].general.streamlit_telemetry,
|
||||
help="Enables or Disables streamlit telemetry. Default: False")
|
||||
st.session_state["streamlit_config"]["browser"]["gatherUsageStats"] = st.session_state["defaults"].general.streamlit_telemetry
|
||||
|
||||
st.session_state["streamlit_config"]['browser']['serverPort'] = st.number_input("Server Port", value=st.session_state["streamlit_config"]['browser']['serverPort'],
|
||||
help="Port where users should point their browsers in order to connect to the app. \
|
||||
This is used to: - Set the correct URL for CORS and XSRF protection purposes. \
|
||||
- Show the URL on the terminal - Open the browser \
|
||||
Default: whatever value is set in server.port.")
|
||||
|
||||
with col5:
|
||||
st.title("Huggingface")
|
||||
|
Loading…
Reference in New Issue
Block a user