mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
fixed display bug in past chat deletion
This commit is contained in:
@ -1262,7 +1262,7 @@
|
||||
<input id="chat_import_avatar_url" name="avatar_url" class="text_pole" maxlength="999" size="2" value="" autocomplete="off" style="display: none;">
|
||||
<input id="chat_import_character_name" name="character_name" class="text_pole" maxlength="999" size="2" value="" autocomplete="off" style="display: none;">
|
||||
</form>
|
||||
<img id="select_chat_cross" src="img/cross.png" alt="Close">
|
||||
<img id="select_chat_cross" src="img/cross.png" alt="Close Past Chat Popup">
|
||||
</div>
|
||||
|
||||
<div id="select_chat_div">
|
||||
|
@ -702,7 +702,8 @@ async function delChat(chatfile) {
|
||||
}),
|
||||
});
|
||||
if (response.ok === true) {
|
||||
|
||||
clearChat();
|
||||
getChat();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2330,19 +2331,17 @@ async function getAllCharaChats() {
|
||||
mes = "..." + mes.substring(mes.length - strlen);
|
||||
}
|
||||
$("#select_chat_div").append(
|
||||
'<div class="select_chat_block" file_name="' +
|
||||
data[key]["file_name"] +
|
||||
'"><div class=avatar><img src="characters/' +
|
||||
characters[this_chid]["avatar"] +
|
||||
'""></div><div class="select_chat_block_filename">' +
|
||||
data[key]["file_name"] +
|
||||
'</div><div class="select_chat_block_mes">' +
|
||||
'<div class="select_chat_block_wrapper">' +
|
||||
'<div class="select_chat_block" file_name="' + data[key]["file_name"] + '">' +
|
||||
'<div class=avatar><img src="characters/' + characters[this_chid]["avatar"] + '""></div >' +
|
||||
'<div class="select_chat_block_filename">' + data[key]["file_name"] + '</div>' +
|
||||
'<div class="select_chat_block_mes">' +
|
||||
mes +
|
||||
"</div>" +
|
||||
'<div file_name="' +
|
||||
data[key]["file_name"] +
|
||||
'" class="PastChat_cross"></div>' +
|
||||
"</div >"
|
||||
"</div >" +
|
||||
'<div file_name="' + data[key]["file_name"] + '" class="PastChat_cross"></div>' +
|
||||
'</div>'
|
||||
|
||||
|
||||
);
|
||||
if (
|
||||
@ -2351,7 +2350,7 @@ async function getAllCharaChats() {
|
||||
) {
|
||||
//children().last()
|
||||
$("#select_chat_div")
|
||||
.children(":nth-last-child(1)")
|
||||
.find(".select_chat_block:last")
|
||||
.attr("highlight", true);
|
||||
}
|
||||
}
|
||||
@ -3230,7 +3229,9 @@ $(document).ready(function () {
|
||||
bg_file_for_del.parent().remove();
|
||||
}
|
||||
if (popup_type == "del_chat") {
|
||||
$("#select_chat_cross").click();
|
||||
delChat(chat_file_for_del);
|
||||
$("#option_select_chat").click();
|
||||
}
|
||||
if (popup_type == "del_ch") {
|
||||
console.log(
|
||||
|
@ -2048,6 +2048,13 @@ input[type="range"]{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.select_chat_block_wrapper{
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
align-items: center;
|
||||
grid-gap: 10px;
|
||||
}
|
||||
|
||||
.select_chat_block {
|
||||
border-radius: 10px;
|
||||
/* margin-right: 10px; */
|
||||
@ -2092,9 +2099,9 @@ input[type="range"]{
|
||||
}
|
||||
|
||||
.PastChat_cross{
|
||||
position: absolute;
|
||||
/* position: absolute;
|
||||
right: 15px;
|
||||
margin-top: 5px;
|
||||
margin-top: 5px; */
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
cursor: pointer;
|
||||
@ -2108,6 +2115,11 @@ input[type="range"]{
|
||||
box-shadow: 0 0 0 2pt black;
|
||||
}
|
||||
|
||||
.PastChat_cross:hover{
|
||||
background-color: var(--fullred);
|
||||
box-shadow: 0 0 0 2pt red;
|
||||
}
|
||||
|
||||
#advanced_book_logo {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
|
16
server.js
16
server.js
@ -814,8 +814,11 @@ app.post("/delbackground", jsonParser, function (request, response) {
|
||||
});
|
||||
|
||||
app.post("/delchat", jsonParser, function (request, response) {
|
||||
|
||||
if (!request.body) return response.sendStatus(400);
|
||||
console.log('/delchat entered');
|
||||
if (!request.body) {
|
||||
console.log('no request body seen');
|
||||
return response.sendStatus(400);
|
||||
}
|
||||
|
||||
if (request.body.chatfile !== sanitize(request.body.chatfile)) {
|
||||
console.error('Malicious chat name prevented');
|
||||
@ -826,10 +829,15 @@ app.post("/delchat", jsonParser, function (request, response) {
|
||||
if (!fs.existsSync(fileName)) {
|
||||
console.log('Chat file not found');
|
||||
return response.sendStatus(400);
|
||||
} else {
|
||||
console.log('found the chat file: ' + fileName);
|
||||
/* fs.unlinkSync(fileName); */
|
||||
fs.rmSync(fileName);
|
||||
console.log('deleted chat file: ' + fileName);
|
||||
|
||||
}
|
||||
|
||||
fs.rmSync(fileName);
|
||||
console.log('deleted chat file: ' + fileName);
|
||||
|
||||
return response.send('ok');
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user