Commit Graph

64 Commits

Author SHA1 Message Date
Cohee 97392a4ca0 Refactor extension management and assets download menu (#5583)
* feat: refactor extension and asset management

* feat: refactor name selector

* fix: make text localizable

* fix: handle abort errors in extension version checks

* fix: replace returns with throws

* fix: remove debug prefix from toast

* fix: preserve file names of imported characters
2026-05-02 20:01:44 +03:00
Cohee 5512473b29 Extension management improvements (#5552)
* feat: enhance asset management with extension categories

Co-authored-by: Copilot <copilot@github.com>

* fix: enhance extension name validation in server endpoints

* feat: display extension author in the extensions list

* fix: unify server error response format

Co-authored-by: Copilot <copilot@github.com>

* feat: add splash on installing third-party for the first time

* fix: add URL format validation, unify validation error messages

Co-authored-by: Copilot <copilot@github.com>

* fix: apply object freeze to EMPTY_AUTHOR value

Co-authored-by: Copilot <copilot@github.com>

* fix: typecheck extensionName in API requests

Co-authored-by: Copilot <copilot@github.com>

* feat: add feature flag guard to extensions endpoints

Co-authored-by: Copilot <copilot@github.com>

* fix: parse URL before checking

Co-authored-by: Copilot <copilot@github.com>

* fix: use case insensitive regex check

* fix: make debug log more useful

Co-authored-by: Copilot <copilot@github.com>

* fix: add pre-validation of URL format and protocol

Co-authored-by: Copilot <copilot@github.com>

* fix: leaner installation success toast

* fix: settings data loss when extensions are disabled

* fix: don't try to auto-focus elements that don't exist

Co-authored-by: Copilot <copilot@github.com>

* fix: set Popup.defaultResult to negative

Co-authored-by: Copilot <copilot@github.com>

* revert: restore undefined default result

---------

Co-authored-by: Copilot <copilot@github.com>
2026-04-30 23:31:50 +03:00
Wolfsblvt f3521e7007 Migrate built-in extensions to use manifest-based activate hooks (#5435)
* Convert jQuery/IIFE wrappers to exported init() functions and register activate hooks in 8 extension manifests

* Convert remaining extensions to exported init() with activate hooks and await initExtensions()

- Convert jQuery/IIFE wrappers to exported init() functions in expressions, memory, quick-reply, regex, stable-diffusion, translate, tts, and vectors extensions

- Register init functions as activate hooks in extension manifests

- Properly await async initExtensions() in firstLoadInit()

* Fix eslint

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-09 23:49:55 +03:00
Cohee 4d1619ba47 Chore: enable brace-style eslint check (#5159)
* eslint: enable brace-style check

* Fix jsdoc and color

* fix: correct CSS color syntax in CreateZenSliders function
2026-02-15 01:46:32 +02:00
Cohee 357da3219b Chore: Add code formatting conventions as eslint rules (#5158)
* Add code formatting conventions as eslint rules

* Improve formatting in addQuickReply
2026-02-15 01:16:34 +02:00
DeclineThyself 8372e7bf9d "gradually replacing property access with a dot operator" (#4965)
* "gradually replacing property access with a dot operator"
https://github.com/SillyTavern/SillyTavern/pull/4963#discussion_r2663003561

(?<=\w|\])\['([a-zA-Z]\w+)'\]
My regex found 593 matches across 47 files.
Also, two typos.

* Fixed chat[0].chat_metadata type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664275854

* Fixed `swipedElementsDiv[0]?.getAnimations().filter((a) => a.animationName` type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664274593

* Fixed config.MESSAGE_SANITIZE and config.MESSAGE_ALLOW_SYSTEM_UI type errors.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664266271

* Fixed group.date_last_chat type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664295652

* Reverted SlashCommandParser dot property access.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664310931

* LLM fixed canUseNegativeLookbehind.result; type error.
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664314288

* Reverted chat-completions.js bodyParams and headers dot property access.

https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664317848
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664320088
https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664324438

* Reverted openai.js data dot property access.

https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664326244

* Reverted tests/frontend/MacroEnvBuilder.e2e.js env.dynamicMacros dot property access.

https://github.com/SillyTavern/SillyTavern/pull/4965#discussion_r2664330990

* Partially reverted `window` dot property access.

* Reverted result.json() and settings dot property access.

* Reverted google.js headers dot property access.

* Fixed regex: `(?<=\w|\])\['([a-zA-Z]\w*)'\]`

* Swapped window to globalThis with dot property access.

* LLM fixed canUseNegativeLookbehind type.

* Refactor property access

* Consistency

---------

Co-authored-by: user <user@exmaple.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-01-08 23:58:21 +02:00
Cohee 311f226be4 Fix broken entry in asset list when gallery is open 2025-12-07 23:28:39 +02:00
Cohee f26a672811 Omit content type in POST request if no body 2025-12-07 23:26:47 +02:00
Cohee 45a7c6b2aa Assets: Display extension author in the list (#4551)
* Assets: Display extension author in the list

* Fix overflow of long text
2025-09-23 15:00:11 +03:00
GregW6 1547a53d7c Refactor: Replace Deprecated Code (#4221)
* refactor: ♻️ Replace deprecated code defined within this repository

- Replace ““/public/scripts.js” > `callPopup`” with ““/public/scripts/popup.js” > `callGenericPopup`”.
- Replace ““/public/scripts/tokenizers.js” > `getTokenCount`” with ““/public/scripts/tokenizers.js” > `getTokenCountAsync`”.
- Replace ““/public/scripts/extensions/assets/index.js” > `executeSlashCommands`” with ““/public/scripts/extensions/assets/index.js” > `executeSlashCommandsWithOptions`”.

* refactor: ♻️ Replace deprecated code from standard library

1. Replace set of deprecated `escape` and deprecated `unescape` functions with `encodeURIComponent` and `decodeURIComponent` functions.
2. Replace set of `encodeURIComponent` and deprecated `unescape` functions with a custom `convertTextToBinaryString` function.

* refactor: ♻️ Replace deprecated code imported from external library

All of them is from jQuery.
1. Replace `$(document).ready(() => { ... })` → `jQuery(() => { ... })`.
2. Replace event type direct calls.
    1) Change
        - `$('...').change(function () { ... })` → `$('...').on('change', function () { ... })`.
    2) Click
        - `$('...').click(function () { ... })` → `$('...').on('click', function () { ... })`.
        - `$('...').click()` → `$('...').trigger('click')`.
    3) Focus
        - `$('...').focus(function () { ... })` → `$('...').on('focus', function () { ... })`.
        - `$('...').focus()` → `$('...').trigger('focus')`.
    4) Blur
        - `$('...').blur(function () { ... })` → `$('...').on('blur', function () { ... })`.
    5) Keyup
        - `$('...').keyup(function () { ... })` → `$('...').on('keyup', function () { ... })`.

* refactor(Attachment): ♻️ Merge `convertTextToBinaryString` and `convertTextToBase64`

`convertTextToBase64` function use `Uint8Array.prototype.toBase64` if supported by the Browser and use a combination of `Window.btoa` and `String.fromCharCode` as fallback.

* fix: 🐛 Fix Bind World Info to Character Card

Using the new `Popup` class.

* fix: 🐛 Fix Bind World Info to Character Card

Using the new `Popup` class.

* refactor: 🐛 Refactor and fix Character World Info popup

Add singleton back and some optimization.

-   **🛡️ Singleton Pattern:** Implemented a singleton pattern using the `characterWorldPopup` variable. This prevents multiple instances of the popup from being created, ensuring a clean and predictable UI. If the popup is already open, it will be brought into focus instead of creating a duplicate.
-   **♻️ Improved Readability:** The event handling logic has been extracted into clearly named functions (`handlePrimaryWorldSelect`, `handleExtrasWorldSelect`), making the `Popup` constructor cleaner and the overall code more readable and maintainable.
-   **⚙️ Optimized Performance:** The new implementation caches frequently accessed values and jQuery selectors, reducing redundant DOM lookups and improving performance.

---

* refactor(Chat): ♻️ Modernize chat deletion confirmation

Replaces the deprecated `callPopup` with the modern `callGenericPopup` for the chat deletion confirmation dialog.

* Fix /delchat command

* Remove unused code

* Fix type. Change value to debug log

* Remove value logs

* Remove singleton pattern for openCharacterWorldPopup

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-07-04 19:42:51 +03:00
Yokayo 5b4198957a Work on tl 2025-06-13 00:37:21 +07:00
Cohee 9bcbe957af Refactor transition durations to use CSS variables 2025-06-07 16:40:30 +03:00
Cohee 310b0f30cd Add branch selection on extension installer
Closes #3865
2025-04-28 22:53:22 +03:00
Cohee 9d8283e4c7 Fix assets_menu selector 2025-04-18 22:42:12 +03:00
Yokayo 40c3674da1 Update tl 2025-03-17 16:09:36 +07:00
Yokayo 890d10d811 Work on tl 2025-02-16 18:43:57 +07:00
Cohee d5bdf1cb90 Add settings.json-backed KV string storage
Fixes #3461, #3443
2025-02-11 20:17:48 +02:00
Cohee 3387fe4bd6 unvendor: Replace DOMPurify 2024-10-16 23:11:13 +03:00
Cohee f7ec2e47d6 Indicates extensions that add tools in the list 2024-10-06 21:58:59 +03:00
Yokayo e857ee8713 Update tl 2024-07-23 18:42:44 +07:00
Cohee 21de199b0f Sanitize entered URLs 2024-07-10 21:44:09 +03:00
Cohee 75382b77ea Rewrite some messages 2024-07-10 21:38:15 +03:00
Wolfsblvt 75d4a06ae6 Change asset load confirm to new popup 2024-07-10 20:10:16 +02:00
Wolfsblvt 91b5be2554 Give hint on extension link as asset list :3 2024-07-10 18:24:09 +02:00
Wolfsblvt 03d4f86d59 Make it flash and be more obvious 2024-07-10 18:12:01 +02:00
Wolfsblvt 0987fd34b9 Add info and explanation to asset list area 2024-07-10 17:59:44 +02:00
Cohee c8b9b62d8a Update built-in extensions to use fixed order in extensions menu 2024-06-24 22:15:08 +03:00
steve green 3ede4aafbe Update zh-cn.json (#2376)
* Update zh-cn.json

* html changes

* `div`->`span`

* fixes

* fixes

* more fixes

* Revert last divs

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2024-06-14 22:46:40 +03:00
Yokayo d6a02e3c47 Translated a bit more 2024-05-21 01:16:20 +07:00
Cohee cc077732c4 Sort assets alphabetically, highlight in the list 2024-05-13 16:29:34 +03:00
Cohee f53775d3f5 Fix img scaling 2024-05-13 00:11:14 +03:00
Cohee 14ba7fc646 Split downloadables list into sections 2024-05-13 00:05:32 +03:00
Cohee 9ed6ee2161 Sample Character browser to onboarding 2024-05-12 16:43:09 +03:00
Cohee 3da9fb4efe Switch to module exports 2024-04-11 22:39:42 +03:00
Cohee 235afb5d15 Fix asset title for non-extension types 2024-04-09 11:30:24 +03:00
RossAscends d56722a4b6 helper text and repo link tooltip for asset list items 2024-04-09 02:48:39 +09:00
Cohee 8ead536da6 Add asset filters 2024-03-17 21:32:21 +02:00
Cohee 3c2113a6e7 Add ability to preserve file names when loading from assets downloader 2024-02-19 00:17:23 +02:00
Cohee c06fe6abfc Add character asset type 2024-02-16 20:42:56 +02:00
Cohee c63cd87cc0 lint: Require semicolons 2023-12-02 21:11:06 +02:00
valadaptive a37f874e38 Require single quotes 2023-12-02 13:04:51 -05:00
valadaptive 518bb58d5a Enable no-unused-vars lint
This is the big one. Probably needs thorough review to make sure I
didn't accidentally remove any setInterval or fetch calls.
2023-12-02 12:11:19 -05:00
Cohee 685bb9742e Fix update button icons 2023-11-19 01:33:54 +02:00
Cohee 0c36d113bf Add git disclaimer to asset downloader 2023-10-27 13:07:56 +03:00
Cohee ec8d30a19d Remember confirm for assets list 2023-10-19 00:26:00 +03:00
Cohee 4657aef306 Improve inline preview of audio assets 2023-10-16 02:09:43 +03:00
Cohee 9ee2c2e9c1 Add asset preview links 2023-10-16 01:39:08 +03:00
Cohee b4c3985b61 Disable cache of assets loader 2023-10-15 16:16:35 +03:00
Cohee a1f6220f33 Nicer display of 3rd-party extension assets 2023-10-13 11:42:38 +03:00
Tony Ribeiro 47d4561bf8 Merge branch 'SillyTavern:staging' into staging 2023-10-10 01:51:30 +02:00