From 1d3914324fbb0ac1b467cf40f644c20a5bfd9a4e Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 17 Jun 2024 11:25:13 +0300 Subject: [PATCH 1/8] Fix data-i18n removing options --- public/scripts/extensions/expressions/settings.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/extensions/expressions/settings.html b/public/scripts/extensions/expressions/settings.html index e819d3bfd..20aa760fd 100644 --- a/public/scripts/extensions/expressions/settings.html +++ b/public/scripts/extensions/expressions/settings.html @@ -21,7 +21,7 @@
Select the API for classifying expressions. - From bca99a4d7fb5fa0991625ad34f5cd405a4855637 Mon Sep 17 00:00:00 2001 From: deffcolony <61471128+deffcolony@users.noreply.github.com> Date: Mon, 17 Jun 2024 13:04:06 +0200 Subject: [PATCH 2/8] Update readme.md + Updated install instructions for SillyTavern Launcher --- .github/readme.md | 56 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/.github/readme.md b/.github/readme.md index 11d99e105..3b039849d 100644 --- a/.github/readme.md +++ b/.github/readme.md @@ -144,12 +144,14 @@ A full list of included extensions and tutorials on how to use them can be found 8. The server will then start, and SillyTavern will pop up in your browser. ## Installing via SillyTavern Launcher - 1. Install [Git for Windows](https://gitforwindows.org/) - 2. Open Windows Explorer (`Win+E`) and make or choose a folder where you wanna install the launcher to - 3. Open a Command Prompt inside that folder by clicking in the 'Address Bar' at the top, typing `cmd`, and pressing Enter. - 4. When you see a black box, insert the following command: `git clone https://github.com/SillyTavern/SillyTavern-Launcher.git` - 5. Double-click on `installer.bat` and choose what you wanna install - 6. After installation double-click on `launcher.bat` +1. On your keyboard: press **`WINDOWS + R`** to open Run dialog box. Then, run the following command to install git: +```shell +cmd /c winget install -e --id Git.Git +``` +2. On your keyboard: press **`WINDOWS + E`** to open File Explorer, then navigate to the folder where you want to install the launcher. Once in the desired folder, type `cmd` into the address bar and press enter. Then, run the following command: +```shell +git clone https://github.com/SillyTavern/SillyTavern-Launcher.git && cd SillyTavern-Launcher && start installer.bat +``` ## Installing via GitHub Desktop (This allows git usage **only** in GitHub Desktop, if you want to use `git` on the command line too, you also need to install [Git for Windows](https://gitforwindows.org/)) @@ -183,18 +185,40 @@ For MacOS / Linux all of these will be done in a Terminal. ### For Linux users 1. Open your favorite terminal and install git -2. Download Sillytavern Launcher with: `git clone https://github.com/SillyTavern/SillyTavern-Launcher.git` -3. Navigate to the SillyTavern-Launcher with: `cd SillyTavern-Launcher` -4. Start the install launcher with: `chmod +x install.sh && ./install.sh` and choose what you wanna install -5. After installation start the launcher with: `chmod +x launcher.sh && ./launcher.sh` +2. Git clone the Sillytavern-Launcher with: +```shell +git clone https://github.com/SillyTavern/SillyTavern-Launcher.git && cd SillyTavern-Launcher +``` +3. Start the installer.sh with: +```shell +chmod +x install.sh && ./install.sh +``` +4. After installation start the launcher.sh with: +```shell +chmod +x launcher.sh && ./launcher.sh +``` ### For Mac users -1. Open a terminal and install brew with: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"` -2. Then install git with: `brew install git` -3. Download Sillytavern Launcher with: `git clone https://github.com/SillyTavern/SillyTavern-Launcher.git` -4. Navigate to the SillyTavern-Launcher with: `cd SillyTavern-Launcher` -5. Start the install launcher with: `chmod +x install.sh && ./install.sh` and choose what you wanna install -6. After installation start the launcher with: `chmod +x launcher.sh && ./launcher.sh` +1. Open a terminal and install brew with: +```shell +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` +2. Install git with: +```shell +brew install git +``` +3. Git clone the Sillytavern-Launcher with: +```shell +git clone https://github.com/SillyTavern/SillyTavern-Launcher.git && cd SillyTavern-Launcher +``` +4. Start the installer.sh with: +```shell +chmod +x install.sh && ./install.sh +``` +5. After installation start the launcher.sh with: +```shell +chmod +x launcher.sh && ./launcher.sh +``` ## 🐋 Installing via Docker From 4607b79a83dbf1da14b4ef1dc27b3c0f0c5c0bea Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:27:50 +0300 Subject: [PATCH 3/8] Update readme.md --- .github/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/readme.md b/.github/readme.md index 3b039849d..8918d7142 100644 --- a/.github/readme.md +++ b/.github/readme.md @@ -268,7 +268,7 @@ You will need two mandatory directory mappings and a port mapping to allow Silly ## API keys management -SillyTavern saves your API keys to a `secrets.json` file in the server directory. +SillyTavern saves your API keys to a `secrets.json` file in the user data directory (`/data/default-user/secrets.json` is the default path). By default, they will not be exposed to a frontend after you enter them and reload the page. From 5843bb788f9114a93fecfa896be144daee40c4ee Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:31:12 +0300 Subject: [PATCH 4/8] Update readme.md --- .github/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/readme.md b/.github/readme.md index 8918d7142..e0f2df585 100644 --- a/.github/readme.md +++ b/.github/readme.md @@ -283,7 +283,7 @@ Most often this is for people who want to use SillyTavern on their mobile phones However, it can be used to allow remote connections from anywhere as well. -**IMPORTANT: SillyTavern is a single-user program, so anyone who logs in will be able to see all characters and chats, and be able to change any settings inside the UI.** +**IMPORTANT: Refer to the official guide if you want to configure SillyTavern user accounts with (optional) password protection: [Users](https://docs.sillytavern.app/installation/st-1.12.0-migration-guide/#users).** ### 1. Managing whitelisted IPs From dca81aef3d746d0643f3f552110266ef83dbb877 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Wed, 19 Jun 2024 01:40:22 +0200 Subject: [PATCH 5/8] Small fixes to /popup, /buttons and QR popup - FIx /popup and /buttons commands to use the new popups - Change /buttons to utilize data results - Fix "hide while executing" option from QR editor - Fix QR editor throwing an error on execution --- .../extensions/quick-reply/src/QuickReply.js | 5 ++-- .../scripts/extensions/quick-reply/style.css | 4 ++++ public/scripts/slash-commands.js | 24 +++++++++++++------ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/public/scripts/extensions/quick-reply/src/QuickReply.js b/public/scripts/extensions/quick-reply/src/QuickReply.js index f4a09906f..ceccfef31 100644 --- a/public/scripts/extensions/quick-reply/src/QuickReply.js +++ b/public/scripts/extensions/quick-reply/src/QuickReply.js @@ -557,7 +557,7 @@ export class QuickReply { this.editorExecuteErrors.innerHTML = ''; this.editorExecuteResult.innerHTML = ''; if (this.editorExecuteHide.checked) { - this.editorPopup.dom.classList.add('qr--hide'); + this.editorPopup.dlg.classList.add('qr--hide'); } try { this.editorExecutePromise = this.execute({}, true); @@ -585,10 +585,11 @@ export class QuickReply {
${ex.message}
`; } + const t = toastr.success('b'); } this.editorExecutePromise = null; this.editorExecuteBtn.classList.remove('qr--busy'); - this.editorPopup.dom.classList.remove('qr--hide'); + this.editorPopup.dlg.classList.remove('qr--hide'); } updateEditorProgress(done, total) { diff --git a/public/scripts/extensions/quick-reply/style.css b/public/scripts/extensions/quick-reply/style.css index dfab049d8..28dd44fba 100644 --- a/public/scripts/extensions/quick-reply/style.css +++ b/public/scripts/extensions/quick-reply/style.css @@ -485,6 +485,10 @@ background-color: var(--progFlashColor); } } + .popup.qr--hide { opacity: 0 !important; } +.popup.qr--hide::backdrop { + opacity: 0 !important; +} diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 019ab0d45..3672a954d 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -62,6 +62,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js'; import { SlashCommandAbortController } from './slash-commands/SlashCommandAbortController.js'; import { SlashCommandNamedArgumentAssignment } from './slash-commands/SlashCommandNamedArgumentAssignment.js'; import { SlashCommandEnumValue } from './slash-commands/SlashCommandEnumValue.js'; +import { POPUP_TYPE, Popup, callGenericPopup } from './popup.js'; export { executeSlashCommands, executeSlashCommandsWithOptions, getSlashCommandsHelp, registerSlashCommand, }; @@ -1449,6 +1450,7 @@ async function trimTokensCallback(arg, value) { async function buttonsCallback(args, text) { try { + /** @type {string[]} */ const buttons = JSON.parse(resolveVariable(args?.labels)); if (!Array.isArray(buttons) || !buttons.length) { @@ -1456,18 +1458,24 @@ async function buttonsCallback(args, text) { return ''; } + // Map custom buttons to results. Start at 2 because 1 and 0 are reserved for ok and cancel + const resultToButtonMap = new Map(buttons.map((button, index) => [index + 2, button])); + return new Promise(async (resolve) => { const safeValue = DOMPurify.sanitize(text || ''); + /** @type {Popup} */ + let popup; + const buttonContainer = document.createElement('div'); buttonContainer.classList.add('flex-container', 'flexFlowColumn', 'wide100p', 'm-t-1'); - for (const button of buttons) { + for (const [result, button] of resultToButtonMap) { const buttonElement = document.createElement('div'); - buttonElement.classList.add('menu_button', 'wide100p'); + buttonElement.classList.add('menu_button', 'result-control', 'wide100p'); + buttonElement.dataset.result = String(result); buttonElement.addEventListener('click', () => { - resolve(button); - $('#dialogue_popup_ok').trigger('click'); + popup?.complete(result); }); buttonElement.innerText = button; buttonContainer.appendChild(buttonElement); @@ -1476,8 +1484,10 @@ async function buttonsCallback(args, text) { const popupContainer = document.createElement('div'); popupContainer.innerHTML = safeValue; popupContainer.appendChild(buttonContainer); - callPopup(popupContainer, 'text', '', { okButton: 'Cancel' }) - .then(() => resolve('')) + + popup = new Popup(popupContainer, POPUP_TYPE.TEXT, '', { okButton: 'Cancel' }); + popup.show() + .then((result => resolve(typeof result === 'number' ? resultToButtonMap.get(result) ?? '' : ''))) .catch(() => resolve('')); }); } catch { @@ -1493,7 +1503,7 @@ async function popupCallback(args, value) { okButton: args?.okButton !== undefined && typeof args?.okButton === 'string' ? args.okButton : 'Ok', }; await delay(1); - await callPopup(safeValue, 'text', '', popupOptions); + await callGenericPopup(safeValue, POPUP_TYPE.TEXT, '', popupOptions); await delay(1); return value; } From fc488574c60e6e795817c7cf1a0791053ce6ae2e Mon Sep 17 00:00:00 2001 From: dllt98 <135049225+dllt98@users.noreply.github.com> Date: Wed, 19 Jun 2024 02:22:05 +0000 Subject: [PATCH 6/8] update endpoint --- src/endpoints/content-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/endpoints/content-manager.js b/src/endpoints/content-manager.js index f87520189..a0fbf9fee 100644 --- a/src/endpoints/content-manager.js +++ b/src/endpoints/content-manager.js @@ -420,7 +420,7 @@ async function downloadJannyCharacter(uuid) { // This endpoint is being guarded behind Bot Fight Mode of Cloudflare // So hosted ST on Azure/AWS/GCP/Collab might get blocked by IP // Should work normally on self-host PC/Android - const result = await fetch('https://api.janitorai.me/api/v1/download', { + const result = await fetch('https://api.jannyai.com/api/v1/download', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ From e5c8a920eebcbc153c9ec88347b14eca8b4ca686 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:13:34 +0300 Subject: [PATCH 7/8] Remove debug toast(?) --- public/scripts/extensions/quick-reply/src/QuickReply.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/scripts/extensions/quick-reply/src/QuickReply.js b/public/scripts/extensions/quick-reply/src/QuickReply.js index ceccfef31..2def1bffc 100644 --- a/public/scripts/extensions/quick-reply/src/QuickReply.js +++ b/public/scripts/extensions/quick-reply/src/QuickReply.js @@ -585,7 +585,6 @@ export class QuickReply {
${ex.message}
`; } - const t = toastr.success('b'); } this.editorExecutePromise = null; this.editorExecuteBtn.classList.remove('qr--busy'); From 9923018a49f402618dfa94efbcb10e64df6432f5 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:25:29 +0300 Subject: [PATCH 8/8] Update ws dependency --- package-lock.json | 7 ++++--- package.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 54a5ef2b0..fc3c67537 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "vectra": "^0.2.2", "wavefile": "^11.0.0", "write-file-atomic": "^5.0.1", - "ws": "^8.13.0", + "ws": "^8.17.1", "yaml": "^2.3.4", "yargs": "^17.7.1", "yauzl": "^2.10.0" @@ -4659,8 +4659,9 @@ } }, "node_modules/ws": { - "version": "8.13.0", - "license": "MIT", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "engines": { "node": ">=10.0.0" }, diff --git a/package.json b/package.json index d6ed0d933..d8496ad7a 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "vectra": "^0.2.2", "wavefile": "^11.0.0", "write-file-atomic": "^5.0.1", - "ws": "^8.13.0", + "ws": "^8.17.1", "yaml": "^2.3.4", "yargs": "^17.7.1", "yauzl": "^2.10.0"