diff --git a/aiserver.py b/aiserver.py index ae9b1f67..c8d0d1f0 100644 --- a/aiserver.py +++ b/aiserver.py @@ -657,6 +657,7 @@ logger.add(UI_2_log_history, serialize=True, colorize=True, enqueue=True, level= #logger.add("log_file_1.log", rotation="500 MB") # Automatically rotate too big file koboldai_vars = koboldai_settings.koboldai_vars(socketio) +koboldai_settings.koboldai_vars_main = koboldai_vars utils.koboldai_vars = koboldai_vars utils.socketio = socketio @@ -7992,7 +7993,7 @@ def model_info(): @require_allowed_ip @logger.catch def show_vars(): - if args.no_ui: + if args.no_ui or koboldai_vars.host: return redirect('/api/latest') json_data = {} json_data['story_settings'] = json.loads(koboldai_vars.to_json("story_settings")) diff --git a/koboldai_settings.py b/koboldai_settings.py index 6a529c32..b7408b93 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -25,6 +25,8 @@ enable_whitelist = False if importlib.util.find_spec("tortoise") is not None: from tortoise import api from tortoise.utils.audio import load_voices + +password_vars = ["horde_api_key", "privacy_password", "img_gen_api_password"] def clean_var_for_emit(value): if isinstance(value, KoboldStoryRegister) or isinstance(value, KoboldWorldInfo): @@ -37,7 +39,7 @@ def clean_var_for_emit(value): return value def process_variable_changes(socketio, classname, name, value, old_value, debug_message=None): - global multi_story + global multi_story, koboldai_vars_main if serverstarted and name != "serverstarted": transmit_time = str(datetime.datetime.now()) if debug_message is not None: @@ -83,14 +85,20 @@ def process_variable_changes(socketio, classname, name, value, old_value, debug_ else: #If we got a variable change from a thread other than what the app is run it, eventlet seems to block and no further messages are sent. Instead, we'll rely the message to the app and have the main thread send it if not has_request_context(): - data = ["var_changed", {"classname": classname, "name": name, "old_value": clean_var_for_emit(old_value), "value": clean_var_for_emit(value), "transmit_time": transmit_time}, {"include_self":True, "broadcast":True, "room":room}] + if not koboldai_vars_main.host or name not in password_vars: + data = ["var_changed", {"classname": classname, "name": name, "old_value": clean_var_for_emit(old_value), "value": clean_var_for_emit(value), "transmit_time": transmit_time}, {"include_self":True, "broadcast":True, "room":room}] + else: + data = ["var_changed", {"classname": classname, "name": name, "old_value": "*" * len(old_value) if old_value is not None else "", "value": "*" * len(value) if value is not None else "", "transmit_time": transmit_time}, {"include_self":True, "broadcast":True, "room":room}] if queue is not None: #logger.debug("Had to use queue") queue.put(data) else: if socketio is not None: - socketio.emit("var_changed", {"classname": classname, "name": name, "old_value": clean_var_for_emit(old_value), "value": clean_var_for_emit(value), "transmit_time": transmit_time}, include_self=True, broadcast=True, room=room) + if not koboldai_vars_main.host or name not in password_vars: + socketio.emit("var_changed", {"classname": classname, "name": name, "old_value": clean_var_for_emit(old_value), "value": clean_var_for_emit(value), "transmit_time": transmit_time}, include_self=True, broadcast=True, room=room) + else: + socketio.emit("var_changed", {"classname": classname, "name": name, "old_value": "*" * len(old_value) if old_value is not None else "", "value": "*" * len(value) if value is not None else "", "transmit_time": transmit_time}, include_self=True, broadcast=True, room=room) class koboldai_vars(object): def __init__(self, socketio): diff --git a/static/koboldai.css b/static/koboldai.css index 9aca6da1..a419a4f3 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -906,6 +906,10 @@ border-top-right-radius: var(--tabs_rounding); grid-area: lefticon; } +.high_z.right_menu_icon { + z-index: 51; +} + @media only screen and (max-aspect-ratio: 5/6) { /* mobile */ .right_menu_icon.hidden { @@ -932,6 +936,10 @@ border-top-right-radius: var(--tabs_rounding); will-change: transform; } +.high_z.rightSideMenu { + z-index: 50; +} + .rightSideMenu.open { left: calc(100% - var(--flyout_menu_width)); } diff --git a/static/koboldai.js b/static/koboldai.js index b2a5f0ed..038b6e87 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -4963,11 +4963,17 @@ function toggle_flyout_right(x) { x.classList.remove("change"); document.getElementById("rightSideMenu").classList.remove("open"); document.getElementById("main-grid").classList.remove("story_menu-open"); + //need to set the layer priority back down + document.getElementById("rightSideMenu").classList.remove("high_z"); + document.getElementById("story_menu_icon").classList.remove("high_z"); } else { x.classList.add("change"); document.getElementById("rightSideMenu").classList.add("open"); document.getElementById("main-grid").classList.add("story_menu-open"); document.getElementById("story_menu_pin").classList.remove("hidden"); + //need to set the layer priority up (due to mobile overlap + document.getElementById("rightSideMenu").classList.add("high_z"); + document.getElementById("story_menu_icon").classList.add("high_z"); } }