mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-06-17 23:08:07 +00:00
enhanced
This commit is contained in:
@ -29,8 +29,6 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from lollms.security import sanitize_path
|
|
||||||
|
|
||||||
def validate_file_path(path):
|
def validate_file_path(path):
|
||||||
try:
|
try:
|
||||||
sanitized_path = sanitize_path(path, allow_absolute_path=False)
|
sanitized_path = sanitize_path(path, allow_absolute_path=False)
|
||||||
@ -180,12 +178,11 @@ async def open_folder(file_path: FilePath):
|
|||||||
:param file_path: The file path object.
|
:param file_path: The file path object.
|
||||||
:return: A JSON response with the status of the operation.
|
:return: A JSON response with the status of the operation.
|
||||||
"""
|
"""
|
||||||
|
forbid_remote_access(lollmsElfServer, "Open file is blocked when the server is exposed outside for very obvious reasons!")
|
||||||
|
|
||||||
if lollmsElfServer.config.headless_server_mode:
|
if lollmsElfServer.config.headless_server_mode:
|
||||||
return {"status":False,"error":"Open file is blocked when in headless mode for obvious security reasons!"}
|
return {"status":False,"error":"Open file is blocked when in headless mode for obvious security reasons!"}
|
||||||
|
|
||||||
if lollmsElfServer.config.host!="localhost" and lollmsElfServer.config.host!="127.0.0.1":
|
|
||||||
return {"status":False,"error":"Open file is blocked when the server is exposed outside for very obvious reasons!"}
|
|
||||||
|
|
||||||
if lollmsElfServer.config.turn_on_open_file_validation:
|
if lollmsElfServer.config.turn_on_open_file_validation:
|
||||||
if not show_yes_no_dialog("Validation","Do you validate the opening of a file?"):
|
if not show_yes_no_dialog("Validation","Do you validate the opening of a file?"):
|
||||||
return {"status":False,"error":"User refused the opeining file!"}
|
return {"status":False,"error":"User refused the opeining file!"}
|
||||||
|
Submodule zoos/personalities_zoo updated: 045568f106...e48cb87e87
Reference in New Issue
Block a user