Merge branch 'staging' into webpack-cache-dataroot
| @@ -4666,7 +4666,7 @@ | ||
| 4666 | 4666 | <small data-i18n="Enabled">Enabled</small> |
| 4667 | 4667 | </label> |
| 4668 | 4668 | <small data-i18n="Minimum generated message length">Minimum generated message length</small> |
| 4669 | 4669 | <input id="auto_swipe_minimum_length" name="auto_swipe_minimum_length" type="number" min="0" step="1" value="0" class="text_pole" title="If the generated message is shorter than thisthese many characters, trigger an auto-swipe." data-i18n="[title]If the generated message is shorter than thisthese many characters, trigger an auto-swipe"> |
| 4670 | 4670 | <small data-i18n="Blacklisted words">Blacklisted words</small> |
| 4671 | 4671 | <div class="auto_swipe"> |
| 4672 | 4672 | <textarea id="auto_swipe_blacklist" name="auto_swipe_blacklist" data-i18n="[placeholder]words you dont want generated separated by comma ','" placeholder="words you don't want generated separated by comma ','" class="text_pole textarea_compact" value="" autocomplete="off" rows="3"></textarea> |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "السحب التلقائي", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "تمكين وظيفة السحب التلقائي. الإعدادات في هذا القسم تؤثر فقط عند تمكين السحب التلقائي", |
| 711 | 711 | "Minimum generated message length": "الحد الأدنى لطول الرسالة المولدة", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "إذا كانت الرسالة المولدة أقصر من هذا، فتحريض السحب التلقائي", |
| 713 | 713 | "Blacklisted words": "الكلمات الممنوعة", |
| 714 | 714 | "words you dont want generated separated by comma ','": "الكلمات التي لا تريد توليدها مفصولة بفاصلة ','", |
| 715 | 715 | "Blacklisted word count to swipe": "عدد الكلمات الممنوعة للسحب", |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "Automatisches Wischen", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Aktiviere die Auto-Wisch-Funktion. Einstellungen in diesem Abschnitt haben nur dann Auswirkungen, wenn das automatische Wischen aktiviert ist", |
| 711 | 711 | "Minimum generated message length": "Minimale generierte Nachrichtenlänge", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Wenn die generierte Nachricht kürzer ist als diese, löse automatisches Wischen aus", |
| 713 | 713 | "Blacklisted words": "Verbotene Wörter", |
| 714 | 714 | "words you dont want generated separated by comma ','": "Wörter, die du nicht generiert haben möchtest, durch Komma ',' getrennt", |
| 715 | 715 | "Blacklisted word count to swipe": "Anzahl der verbotenen Wörter, um zu wischen", |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "Deslizamiento automático", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Habilitar la función de deslizamiento automático. La configuración en esta sección solo tiene efecto cuando el deslizamiento automático está habilitado", |
| 711 | 711 | "Minimum generated message length": "Longitud mínima del mensaje generado", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Si el mensaje generado es más corto que esto, activar un deslizamiento automático", |
| 713 | 713 | "Blacklisted words": "Palabras prohibidas", |
| 714 | 714 | "words you dont want generated separated by comma ','": "palabras que no desea generar separadas por coma ','", |
| 715 | 715 | "Blacklisted word count to swipe": "Número de palabras prohibidas para deslizar", |
| @@ -656,7 +656,7 @@ | ||
| 656 | 656 | "Auto-swipe": "Balayage automatique", |
| 657 | 657 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Activer la fonction de balayage automatique. Les paramètres de cette section n'ont d'effet que lorsque le balayage automatique est activé", |
| 658 | 658 | "Minimum generated message length": "Longueur minimale du message généré", |
| 659 | 659 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Si le message généré est plus court que cela, déclenchez un balayage automatique", |
| 660 | 660 | "Blacklisted words": "Mots en liste noire", |
| 661 | 661 | "words you dont want generated separated by comma ','": "mots que vous ne voulez pas générer séparés par des virgules ','", |
| 662 | 662 | "Blacklisted word count to swipe": "Nombre de mots en liste noire pour balayer", |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "Sjálfvirkur sveip", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Virkjaðu sjálfvirka sveiflugerð. Stillingar í þessum hluta hafa aðeins áhrif þegar sjálfvirkur sveiflugerð er virk", |
| 711 | 711 | "Minimum generated message length": "Lágmarks lengd á mynduðum skilaboðum", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Ef mynduðu skilaboðin eru styttri en þessi, kallaðu fram sjálfvirkar sveiflugerðar", |
| 713 | 713 | "Blacklisted words": "Svört orð", |
| 714 | 714 | "words you dont want generated separated by comma ','": "orð sem þú vilt ekki að framleiða aðskilin með kommu ','", |
| 715 | 715 | "Blacklisted word count to swipe": "Fjöldi svörtra orða til að sveipa", |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "Auto-swipe", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Abilita la funzione di auto-swipe. Le impostazioni in questa sezione hanno effetto solo quando l'auto-swipe è abilitato", |
| 711 | 711 | "Minimum generated message length": "Lunghezza minima del messaggio generato", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Se il messaggio generato è più breve di questo, attiva un'automatica rimozione", |
| 713 | 713 | "Blacklisted words": "Parole in blacklist", |
| 714 | 714 | "words you dont want generated separated by comma ','": "parole che non vuoi generate separate da virgola ','", |
| 715 | 715 | "Blacklisted word count to swipe": "Numero di parole in blacklist per attivare un'automatica rimozione", |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "オートスワイプ", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "自動スワイプ機能を有効にします。このセクションの設定は、自動スワイプが有効になっている場合にのみ効果があります", |
| 711 | 711 | "Minimum generated message length": "生成されたメッセージの最小長", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "生成されたメッセージがこれよりも短い場合、自動スワイプをトリガーします", |
| 713 | 713 | "Blacklisted words": "ブラックリストされた単語", |
| 714 | 714 | "words you dont want generated separated by comma ','": "コンマ ',' で区切られた生成したくない単語", |
| 715 | 715 | "Blacklisted word count to swipe": "スワイプするブラックリストされた単語の数", |
| @@ -724,7 +724,7 @@ | ||
| 724 | 724 | "Auto-swipe": "자동 스와이프", |
| 725 | 725 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "자동 스와이프 기능을 활성화합니다. 이 섹션의 설정은 자동 스와이프가 활성화되었을 때만 영향을 미칩니다", |
| 726 | 726 | "Minimum generated message length": "생성된 메시지 최소 길이", |
| 727 | 727 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "생성된 메시지가이보다 짧으면 자동 스와이프를 트리거합니다", |
| 728 | 728 | "Blacklisted words": "금지어", |
| 729 | 729 | "words you dont want generated separated by comma ','": "쉼표로 구분된 생성하지 않으려는 단어", |
| 730 | 730 | "Blacklisted word count to swipe": "스와이프할 금지어 개수", |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "Automatisch vegen", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Schakel de automatische-vegen functie in. Instellingen in dit gedeelte hebben alleen effect wanneer automatisch vegen is ingeschakeld", |
| 711 | 711 | "Minimum generated message length": "Minimale gegenereerde berichtlengte", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Als het gegenereerde bericht korter is dan dit, activeer dan een automatische veeg", |
| 713 | 713 | "Blacklisted words": "Verboden woorden", |
| 714 | 714 | "words you dont want generated separated by comma ','": "woorden die je niet gegenereerd wilt hebben gescheiden door komma ','", |
| 715 | 715 | "Blacklisted word count to swipe": "Aantal verboden woorden om te vegen", |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "Auto-swipe", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Ativar a função de auto-swipe. As configurações nesta seção só têm efeito quando o auto-swipe está ativado", |
| 711 | 711 | "Minimum generated message length": "Comprimento mínimo da mensagem gerada", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Se a mensagem gerada for mais curta que isso, acione um auto-swipe", |
| 713 | 713 | "Blacklisted words": "Palavras proibidas", |
| 714 | 714 | "words you dont want generated separated by comma ','": "palavras que você não quer geradas separadas por vírgula ','", |
| 715 | 715 | "Blacklisted word count to swipe": "Contagem de palavras proibidas para swipe", |
| @@ -426,7 +426,7 @@ | ||
| 426 | 426 | "Requests logprobs from the API for the Token Probabilities feature": "Запросить логпробы из API для функции Token Probabilities.", |
| 427 | 427 | "Automatically reject and re-generate AI message based on configurable criteria": "Автоматическое отклонение и повторная генерация сообщений AI на основе настраиваемых критериев.", |
| 428 | 428 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Включить авто-свайп. Настройки в этом разделе действуют только при включенном авто-свайпе.", |
| 429 | 429 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Если сгенерированное сообщение короче этого значения, срабатывает авто-свайп.", |
| 430 | 430 | "Reload and redraw the currently open chat": "Перезагрузить и перерисовать открытый в данный момент чат.", |
| 431 | 431 | "Auto-Expand Message Actions": "Развернуть действия", |
| 432 | 432 | "Persona Management": "Управление персоной", |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "Автоматичний змах", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Вмикає функцію автоматичного змаху. Налаштування в цьому розділі діють лише тоді, коли увімкнено автоматичний змах", |
| 711 | 711 | "Minimum generated message length": "Мінімальна довжина згенерованого повідомлення", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Якщо згенероване повідомлення коротше за це, викликайте автоматичний змаху", |
| 713 | 713 | "Blacklisted words": "Список заборонених слів", |
| 714 | 714 | "words you dont want generated separated by comma ','": "слова, які ви не хочете генерувати, розділені комою ','", |
| 715 | 715 | "Blacklisted word count to swipe": "Кількість заборонених слів для змаху", |
| @@ -709,7 +709,7 @@ | ||
| 709 | 709 | "Auto-swipe": "Tự động vuốt", |
| 710 | 710 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "Bật chức năng tự động vuốt. Các cài đặt trong phần này chỉ có tác dụng khi tự động vuốt được bật", |
| 711 | 711 | "Minimum generated message length": "Độ dài tối thiểu của tin nhắn được tạo", |
| 712 | 712 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "Nếu tin nhắn được tạo ra ngắn hơn điều này, kích hoạt tự động vuốt", |
| 713 | 713 | "Blacklisted words": "Từ trong danh sách đen", |
| 714 | 714 | "words you dont want generated separated by comma ','": "các từ bạn không muốn được tạo ra được phân tách bằng dấu phẩy ','", |
| 715 | 715 | "Blacklisted word count to swipe": "Số từ trong danh sách đen để vuốt", |
| @@ -804,7 +804,7 @@ | ||
| 804 | 804 | "Auto-swipe": "自动滑动", |
| 805 | 805 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "启用自动滑动功能。仅当启用自动滑动时,本节中的设置才会生效", |
| 806 | 806 | "Minimum generated message length": "生成的消息的最小长度", |
| 807 | 807 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "如果生成的消息短于此长度,则触发自动滑动", |
| 808 | 808 | "Blacklisted words": "屏蔽词", |
| 809 | 809 | "words you dont want generated separated by comma ','": "不想生成的词语,用半角逗号“,”分隔", |
| 810 | 810 | "Blacklisted word count to swipe": "触发滑动的黑名单词语数量", |
| @@ -710,7 +710,7 @@ | ||
| 710 | 710 | "Auto-swipe": "自動滑動", |
| 711 | 711 | "Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "啟用自動滑動功能。此部分的設定僅在啟用自動滑動時有效。", |
| 712 | 712 | "Minimum generated message length": "生成訊息的最小長度", |
| 713 | 713 | "If the generated message is shorter than thisthese many characters, trigger an auto-swipe": "如果生成的訊息比這個短,將觸發自動滑動。", |
| 714 | 714 | "Blacklisted words": "黑名單詞語", |
| 715 | 715 | "words you dont want generated separated by comma ','": "您不想生成的文字,使用逗號分隔", |
| 716 | 716 | "Blacklisted word count to swipe": "滑動的黑名單詞語數量", |
| @@ -25,7 +25,7 @@ class OpenAICompatibleTtsProvider { | ||
| 25 | 25 | <label for="openai_compatible_tts_endpoint">Provider Endpoint:</label> |
| 26 | 26 | <div class="flex-container alignItemsCenter"> |
| 27 | 27 | <div class="flex1"> |
| 28 | 28 | <input id="openai_compatible_tts_endpoint" type="text" class="text_pole" maxlength="250500" value="${this.defaultSettings.provider_endpoint}"/> |
| 29 | 29 | </div> |
| 30 | 30 | <div id="openai_compatible_tts_key" class="menu_button menu_button_icon"> |
| 31 | 31 | <i class="fa-solid fa-key"></i> |
| @@ -33,9 +33,9 @@ class OpenAICompatibleTtsProvider { | ||
| 33 | 33 | </div> |
| 34 | 34 | </div> |
| 35 | 35 | <label for="openai_compatible_model">Model:</label> |
| 36 | 36 | <input id="openai_compatible_model" type="text" class="text_pole" maxlength="250500" value="${this.defaultSettings.model}"/> |
| 37 | 37 | <label for="openai_compatible_tts_voices">Available Voices (comma separated):</label> |
| 38 | 38 | <input id="openai_compatible_tts_voices" type="text" class="text_pole" maxlength="250" value="${this.defaultSettings.available_voices.join()}"/> |
| 39 | 39 | <label for="openai_compatible_tts_speed">Speed: <span id="openai_compatible_tts_speed_output"></span></label> |
| 40 | 40 | <input type="range" id="openai_compatible_tts_speed" value="1" min="0.25" max="4" step="0.05">`; |
| 41 | 41 | return html; |
| @@ -57,7 +57,7 @@ import { | ||
| 57 | 57 | |
| 58 | 58 | import getWebpackServeMiddleware from './src/middleware/webpack-serve.js'; |
| 59 | 59 | import basicAuthMiddleware from './src/middleware/basicAuth.js'; |
| 60 | 60 | import whitelistMiddleware, { getAccessLogPath, migrateAccessLog } from './src/middleware/whitelist.js'; |
| 61 | 61 | import multerMonkeyPatch from './src/middleware/multerMonkeyPatch.js'; |
| 62 | 62 | import initRequestProxy from './src/request-proxy.js'; |
| 63 | 63 | import getCacheBusterMiddleware from './src/middleware/cacheBuster.js'; |
| @@ -754,6 +754,7 @@ const preSetupTasks = async function () { | ||
| 754 | 754 | await checkForNewContent(directories); |
| 755 | 755 | await ensureThumbnailCache(); |
| 756 | 756 | cleanUploads(); |
| 757 | + migrateAccessLog(); | |
| 757 | 758 | |
| 758 | 759 | await settingsInit(); |
| 759 | 760 | await statsInit(); |
| @@ -856,7 +857,7 @@ const postSetupTasks = async function (v6Failed, v4Failed, useIPv6, useIPv4) { | ||
| 856 | 857 | if (listen) { |
| 857 | 858 | console.log(); |
| 858 | 859 | console.log('To limit connections to internal localhost only ([::1] or 127.0.0.1), change the setting in config.yaml to "listen: false".'); |
| 859 | 860 | console.log('Check the "access.log" file in the SillyTaverndata directory to inspect incoming connections.:', color.green(getAccessLogPath())); |
| 860 | 861 | } |
| 861 | 862 | console.log('\n' + getSeparator(plainGoToLog.length) + '\n'); |
| 862 | 863 | console.log(goToLog); |
| @@ -12,6 +12,8 @@ const enableForwardedWhitelist = getConfigValue('enableForwardedWhitelist', fals | ||
| 12 | 12 | let whitelist = getConfigValue('whitelist', []); |
| 13 | 13 | let knownIPs = new Set(); |
| 14 | 14 | |
| 15 | +export const getAccessLogPath = () => path.join(globalThis.DATA_ROOT, 'access.log'); | |
| 16 | + | |
| 15 | 17 | if (fs.existsSync(whitelistPath)) { |
| 16 | 18 | try { |
| 17 | 19 | let whitelistTxt = fs.readFileSync(whitelistPath, 'utf-8'); |
| @@ -46,6 +48,23 @@ function getForwardedIp(req) { | ||
| 46 | 48 | return undefined; |
| 47 | 49 | } |
| 48 | 50 | |
| 51 | +export function migrateAccessLog() { | |
| 52 | + try { | |
| 53 | + if (!fs.existsSync('access.log')) { | |
| 54 | + return; | |
| 55 | + } | |
| 56 | + const logPath = getAccessLogPath(); | |
| 57 | + if (fs.existsSync(logPath)) { | |
| 58 | + return; | |
| 59 | + } | |
| 60 | + fs.renameSync('access.log', logPath); | |
| 61 | + console.log(color.yellow('Migrated access.log to new location:'), logPath); | |
| 62 | + } catch (e) { | |
| 63 | + console.error('Failed to migrate access log:', e); | |
| 64 | + console.info('Please move access.log to the data directory manually.'); | |
| 65 | + } | |
| 66 | +} | |
| 67 | + | |
| 49 | 68 | /** |
| 50 | 69 | * Returns a middleware function that checks if the client IP is in the whitelist. |
| 51 | 70 | * @param {boolean} whitelistMode If whitelist mode is enabled via config or command line |
| @@ -67,9 +86,10 @@ export default function whitelistMiddleware(whitelistMode, listen) { | ||
| 67 | 86 | knownIPs.add(clientIp); |
| 68 | 87 | |
| 69 | 88 | // Write access log |
| 89 | + const logPath = getAccessLogPath(); | |
| 70 | 90 | const timestamp = new Date().toISOString(); |
| 71 | 91 | const log = `${timestamp} ${clientIp} ${userAgent}\n`; |
| 72 | 92 | fs.appendFile('access.log'logPath, log, (err) => { |
| 73 | 93 | if (err) { |
| 74 | 94 | console.error('Failed to write access log:', err); |
| 75 | 95 | } |