Added protection against malicious code inside messages

This commit is contained in:
Saifeddine ALOUI 2025-01-31 00:00:23 +01:00
parent 9b3405f56b
commit 4bcb5765a4
6 changed files with 7 additions and 42 deletions

View File

@ -163,42 +163,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
# migrate old databases to new ones:
databases_path = self.lollms_paths.personal_path / "databases"
if (
databases_path.exists()
and len([f for f in databases_path.iterdir() if f.suffix == ".db"]) > 0
):
if yes_or_no_input(
"Old databases have been spotted on your system. Do you want me to migrate them to the new format?"
):
databases_found = False
for database_path in databases_path.iterdir():
if database_path.suffix == ".db":
ASCIIColors.red(
f"Found old discussion database format : {database_path}"
)
ASCIIColors.red(f"Migrating to new format... ", end="")
new_db_path = (
self.lollms_paths.personal_discussions_path
/ database_path.stem
)
new_db_path.mkdir(exist_ok=True, parents=True)
try:
shutil.copy(database_path, new_db_path / "database.db")
ASCIIColors.green("ok")
databases_found = True
except Exception as ex:
ASCIIColors.warning(ex)
if databases_found:
ASCIIColors.green(
f"Databases are migrated from {databases_path} to the new {self.lollms_paths.personal_discussions_path} path"
)
if yes_or_no_input(
"Databases are migrated to the new format. Do you want me to delete the previous version?"
):
for database_path in databases_path.iterdir():
if database_path.suffix == ".db":
ASCIIColors.red(f"Deleting {database_path}")
database_path.unlink()
if config["discussion_db_name"].endswith(".db"):
config["discussion_db_name"] = config["discussion_db_name"].replace(
".db", ""

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
web/dist/index.html vendored
View File

@ -6,8 +6,8 @@
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI</title>
<script type="module" crossorigin src="/assets/index-BtOzy8LJ.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CqCqluH7.css">
<script type="module" crossorigin src="/assets/index-BBWJ2GgX.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B55wATP4.css">
</head>
<body>
<div id="app"></div>

View File

@ -130,7 +130,7 @@
};
const md = new MarkdownIt({
html: true,
html: false,
breaks: true,
highlight: (code, language) => {
const validLanguage = language && hljs.getLanguage(language) ? language : 'plaintext';

@ -1 +1 @@
Subproject commit e02812f75dd095fb754a28ce16fecfb93e56e072
Subproject commit 6b54760fe6271dc70a8b4380ada42eb6562bddc5