Disable chat deletion

This commit is contained in:
sevenhill
2026-07-06 22:46:55 +03:00
parent 52ae43c25d
commit 183ec8d90f
11 changed files with 95 additions and 253 deletions
+4 -31
View File
@@ -393,16 +393,14 @@ app.post("/chat/clear-history", async (req, res) => {
app.post("/chat/delete", async (req, res) => {
try {
const externalChatId = String(req.body?.externalChatId || "").trim();
const chatUrl = normalizeMaxChatUrl(req.body?.chatUrl);
if (!externalChatId) {
return res.json({ success: false, error: "externalChatId is required." });
}
const result = await withPageLock(async () => {
const p = await ensurePage("commands");
return await deleteChatInMax(p, externalChatId, chatUrl);
}, "commands");
res.json(result);
res.json({
success: false,
error: "Chat deletion is disabled because MAX does not remove chats from the web client."
});
} catch (error) {
res.json({ success: false, error: String(error?.message || error) });
}
@@ -5740,31 +5738,6 @@ async function clearChatHistoryInMax(p, externalChatId, chatUrl) {
"clear history");
}
async function deleteChatInMax(p, externalChatId, chatUrl) {
return await applyChatMenuActionInMax(
p,
externalChatId,
chatUrl,
[
"\u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0447\u0430\u0442",
"\u0443\u0434\u0430\u043b\u0438\u0442\u044c",
"delete chat",
"delete conversation",
"remove chat"
],
[
"\u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0447\u0430\u0442",
"\u0443\u0434\u0430\u043b\u0438\u0442\u044c",
"\u0434\u0430, \u0443\u0434\u0430\u043b\u0438\u0442\u044c",
"\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c",
"delete",
"confirm",
"yes",
"ok"
],
"delete chat");
}
async function applyChatMenuActionInMax(p, externalChatId, chatUrl, actionLabels, confirmLabels, actionName) {
const menuOpened = await openSidebarChatMenu(p, externalChatId, chatUrl, actionLabels, actionName === "delete chat");
if (!menuOpened) {