From c873a6b04cd970ba4f5cb7fb6894f6234760cab8 Mon Sep 17 00:00:00 2001 From: Cohee Date: Fri, 23 Jun 2023 13:53:37 +0300 Subject: [PATCH 1/6] Fix npm audit. --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 60cfacdd9..c83ebade9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3035,9 +3035,9 @@ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, "node_modules/semver": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", - "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" From 2aa0c5d707ef38b121e215468bdc916f75bcf8d2 Mon Sep 17 00:00:00 2001 From: 50h100a Date: Mon, 26 Jun 2023 17:33:10 -0400 Subject: [PATCH 2/6] Display avatar name in card list --- public/index.html | 2 +- public/script.js | 1 + public/style.css | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index a9e3b7efc..0cbd24e3d 100644 --- a/public/index.html +++ b/public/index.html @@ -3151,7 +3151,7 @@
-
+
diff --git a/public/script.js b/public/script.js index d682afa8b..72f9ad6ee 100644 --- a/public/script.js +++ b/public/script.js @@ -803,6 +803,7 @@ async function printCharacters() { template.find('img').attr('src', this_avatar); template.find('.avatar').attr('title', item.avatar); template.find('.ch_name').text(item.name); + template.find('.ch_avatar_url').text(item.avatar); template.find('.ch_fav_icon').css("display", 'none'); template.toggleClass('is_fav', item.fav || item.fav == 'true'); template.find('.ch_fav').val(item.fav); diff --git a/public/style.css b/public/style.css index 4e17cbd6e..a78fb5b08 100644 --- a/public/style.css +++ b/public/style.css @@ -1353,6 +1353,10 @@ input[type=search]:focus::-webkit-search-cancel-button { font-weight: bolder; } +.ch_avatar_url { + float: right; +} + .character_select .avatar { align-self: center; } From 3e30fb5d14e2e4f92f85ed2471dc4c1aebbc5764 Mon Sep 17 00:00:00 2001 From: kingbri Date: Mon, 26 Jun 2023 20:19:21 -0400 Subject: [PATCH 3/6] World Info: Fix lorebook loading error charLore isn't always present, so make optional calls to it. Signed-off-by: kingbri --- public/scripts/world-info.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index 7b7bdc710..8942040df 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -250,7 +250,7 @@ function displayWorldEntries(name, data) { return; } - const existingCharLores = world_info.charLore.filter((e) => e.extraBooks.includes(name)); + const existingCharLores = world_info.charLore?.filter((e) => e.extraBooks.includes(name)); if (existingCharLores && existingCharLores.length > 0) { existingCharLores.forEach((charLore) => { const tempCharLore = charLore.extraBooks.filter((e) => e !== name); @@ -627,7 +627,7 @@ async function renameWorldInfo(name, data) { await saveWorldInfo(newName, data, true); await deleteWorldInfo(oldName); - const existingCharLores = world_info.charLore.filter((e) => e.extraBooks.includes(oldName)); + const existingCharLores = world_info.charLore?.filter((e) => e.extraBooks.includes(oldName)); if (existingCharLores && existingCharLores.length > 0) { existingCharLores.forEach((charLore) => { const tempCharLore = charLore.extraBooks.filter((e) => e !== oldName); @@ -747,7 +747,7 @@ async function getCharacterLore() { // TODO: Maybe make the utility function not use the window context? const fileName = getCharaFilename(this_chid); - const extraCharLore = world_info.charLore.find((e) => e.name === fileName); + const extraCharLore = world_info.charLore?.find((e) => e.name === fileName); if (extraCharLore) { worldsToSearch = new Set([...worldsToSearch, ...extraCharLore.extraBooks]); } From 06f580ed2903a3af77c898e5ed1d6e3c3190c711 Mon Sep 17 00:00:00 2001 From: 50h100a Date: Mon, 26 Jun 2023 21:45:15 -0400 Subject: [PATCH 4/6] Add power-user option to toggle card filenames. Rephrased 'resize' option so It's Not Talking Like This. --- public/index.html | 7 +++++-- public/script.js | 5 ++++- public/scripts/power-user.js | 10 +++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/public/index.html b/public/index.html index 0cbd24e3d..447d3c8fa 100644 --- a/public/index.html +++ b/public/index.html @@ -2262,9 +2262,12 @@ - + +
Auto-swipe diff --git a/public/script.js b/public/script.js index 72f9ad6ee..1c1708150 100644 --- a/public/script.js +++ b/public/script.js @@ -226,6 +226,7 @@ export { extension_prompt_types, updateVisibleDivs, mesForShowdownParse, + printCharacters, } // API OBJECT FOR EXTERNAL WIRING @@ -803,7 +804,9 @@ async function printCharacters() { template.find('img').attr('src', this_avatar); template.find('.avatar').attr('title', item.avatar); template.find('.ch_name').text(item.name); - template.find('.ch_avatar_url').text(item.avatar); + if (power_user.show_card_avatar_urls) { + template.find('.ch_avatar_url').text(item.avatar); + } template.find('.ch_fav_icon').css("display", 'none'); template.toggleClass('is_fav', item.fav || item.fav == 'true'); template.find('.ch_fav').val(item.fav); diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 70581963f..34ecfa0d9 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -12,6 +12,7 @@ import { eventSource, event_types, getCurrentChatId, + printCharacters, name1, name2, } from "../script.js"; @@ -106,6 +107,7 @@ let power_user = { chat_display: chat_styles.DEFAULT, sheld_width: sheld_width.DEFAULT, never_resize_avatars: false, + show_card_avatar_urls: true, play_message_sound: false, play_sound_unfocused: true, auto_save_msg_edits: false, @@ -584,6 +586,7 @@ function loadPowerUserSettings(settings, data) { $("#play_message_sound").prop("checked", power_user.play_message_sound); $("#play_sound_unfocused").prop("checked", power_user.play_sound_unfocused); $("#never_resize_avatars").prop("checked", power_user.never_resize_avatars); + $("#show_card_avatar_urls").prop("checked", power_user.show_card_avatar_urls); $("#auto_save_msg_edits").prop("checked", power_user.auto_save_msg_edits); $("#allow_name1_display").prop("checked", power_user.allow_name1_display); $("#allow_name2_display").prop("checked", power_user.allow_name2_display); @@ -1160,7 +1163,12 @@ $(document).ready(() => { power_user.never_resize_avatars = !!$(this).prop('checked'); saveSettingsDebounced(); }); - + $("#show_card_avatar_urls").on('input', function () { + power_user.show_card_avatar_urls = !!$(this).prop('checked'); + printCharacters(); + saveSettingsDebounced(); + }); + $("#play_message_sound").on('input', function () { power_user.play_message_sound = !!$(this).prop('checked'); saveSettingsDebounced(); From 748bee74cbed4c5344af384231bea45776055fc5 Mon Sep 17 00:00:00 2001 From: Cohee Date: Tue, 27 Jun 2023 12:38:46 +0300 Subject: [PATCH 5/6] Make avatar URL display not default --- public/scripts/power-user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 34ecfa0d9..77b49977d 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -107,7 +107,7 @@ let power_user = { chat_display: chat_styles.DEFAULT, sheld_width: sheld_width.DEFAULT, never_resize_avatars: false, - show_card_avatar_urls: true, + show_card_avatar_urls: false, play_message_sound: false, play_sound_unfocused: true, auto_save_msg_edits: false, From 69fdb9090f43816f99d545ce08fad0f4d25f1271 Mon Sep 17 00:00:00 2001 From: Cohee Date: Tue, 27 Jun 2023 18:39:08 +0300 Subject: [PATCH 6/6] Add Chub downloader for characters and lorebooks --- public/index.html | 3 +- public/script.js | 50 +++++++++++++ public/scripts/world-info.js | 137 ++++++++++++++++++----------------- public/style.css | 3 +- server.js | 124 +++++++++++++++++++++++++++++-- 5 files changed, 242 insertions(+), 75 deletions(-) diff --git a/public/index.html b/public/index.html index 447d3c8fa..f632f15b3 100644 --- a/public/index.html +++ b/public/index.html @@ -2267,7 +2267,7 @@ - +
Auto-swipe @@ -2676,6 +2676,7 @@
+