* fix(macros): prevent list-arg macros from accepting scoped content
List-arg macros now correctly reject scoped content since they only accept arbitrary inline arguments. Updated validation logic in autocomplete, scope detection, and CST walker to check for `list === null` before allowing scopes. Also improved list item hint display to show total count when typing additional items.
* feat(macros): display min/max constraints for list arguments in autocomplete hints
Add visual indication of list argument constraints by showing min/max values in autocomplete hints. List items now display "(list, min: X, max: Y)" or "(variable-length list)" when no constraints exist. Includes new CSS styling for smaller, dimmed hint text.
* feat(macros): validate list argument min/max constraints and improve warning display
Add validation for list argument constraints (min/max) with specific error messages when too few or too many list items are provided. Continue highlighting current argument position even when warnings are present (except where semantically invalid), allowing users to navigate back to valid arguments while seeing "too many arguments" warnings.
* feat(server): make CORS middleware configurable
Add detailed configuration options for CORS in config.yaml, including
origin, methods, headers, credentials, and max age. Update server
initialization to apply these settings dynamically instead of using
hardcoded values.
* fix(server): Fix default value and conditional logic issues in CORS configuration
- Changed the default value of `cors.maxAge` from `null` to `0`.
- Simplified the conditional check logic for `allowedHeaders`, removing duplicate checks for `corsAllowedHeaders` being `null`.
* fix(server): Fix CORS exposed headers configuration logic
- Removed redundant conditional checks. now directly validates array length when `corsExposedHeaders` has a truthy value
* Improve types + simplify checks
* fix(cors): align maxAge default with original behavior
* Adjust default array values
* Remove debug log
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* feat(macros): Add optional scope detection and improved closing tag autocomplete
- Implement `isScopeOptional()` to detect when scoped content is optional based on macro argument requirements
- Filter optional scopes from autocomplete hints unless force-triggered (Ctrl+Space)
- Add "OPTIONAL" badge styling for optional scoped content in autocomplete UI
- Show multiple closing tag suggestions (innermost to outermost) with priority ordering
- Display nesting level information for nested optional scopes
* fix(autocomplete): show original macro details when typing closing tags
Add nameOffset=2 to MacroClosingTagAutoCompleteOption to skip {{ prefix for fuzzy highlighting. When typing closing tags ({{/macroName}}), detect and show the original macro's details instead of "no match" error by looking up the macro definition and creating a non-selectable context option with no argument highlighting.
* Add background sort by date added feature
* reapply search after changing sort
* overengineer it
* use sortIgnoreCaseAndAccents
* make enum for sort options
* Centralized `await clearChat();` and `chat.length = 0;` into `wipeChat()`
* Added `clearData` argument to `clearChat`.
---------
Co-authored-by: user <user@exmaple.com>
* Startup and on-demand check
* Update comments, add color preload
* remove redundant metadata generation
* changed image-metadata/all from GET to POST
* move initializeAllUserMetadata to image-metadata.js, make blocking (?)
* Add type annotations
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* Feat - Allow to bulk toggle all third-party extensions from popup manager
* Fix - Prevent reloading the page if the final state is the same
* Fix - Handle bulk toggle with no extensions installed
* Update - Delete leftover debug logs
* Fix - Simplify extension toggle logic and improve readability
* Update - State that bulk toggle only affects external extensions
* Feat - Allow to restore bulk toggled extensions
* Update - Move bulk toggle to the third-party extensions header
* Uncenter section headers
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* fix(autocomplete): handle nested macros in :: separator parsing
Track nesting depth when parsing macro parts to avoid treating :: inside nested macros as separators. Increment depth on {{ and decrement on }}, only recognizing :: as a separator when nestedDepth is 0.
* chore(autocomplete): add missing properties for non-variable macros
Add `variableNameEnd` and `variableOperatorEnd` fields to track end positions of variable components in macro parsing context.
* fix(autocomplete): stop macro parsing at newlines before first :: separator
Prevent newlines before the first :: separator from being included in macro identifier/space-arg parsing. Track separator state and break early when encountering newlines at depth 0 before any :: is seen. Only include the last part if cursor is within its bounds to avoid extending macro context across line breaks.
* fix(autocomplete): handle cursor position after closing braces in macro detection
Skip closing }} when searching backwards if cursor is immediately after them, treating them as the target macro's closing braces rather than nested braces. Skip forward search entirely when cursor is after }}, using cursor position as closePos directly.
* fix(autocomplete): show macro details when typing closing brace and add no-match indicator
Track `isTypingClosingBrace` state when cursor is after a single `}` on standalone macros (no separators/args). Strip trailing `}` from identifier in this case. Show matching macro details when typing closing brace, same as when typing args. Add "no match" error option when typing args/closing brace but identifier doesn't match any macro. Extract `AnyMacroAutoCompleteOption` typedef for cleaner type annotations
* fix(autocomplete): show variable context when typing closing brace on shorthand macros
Detect `isTypingClosingBrace` state for variable shorthands (e.g., `{{.Lila}`, `{{.Lila+=4}`). Parse value before brace detection to check for trailing `}`. Show non-selectable context options (variable name, operator, value) when typing closing brace instead of operator/value suggestions. Strip trailing `}` from value when detected. Set `resultStart` to cursor position when typing closing brace to avoid replacement
* fix(autocomplete): stop flag parsing at newlines and show context when typing closing brace on variable shorthands
Skip newlines (not just all whitespace) between flags to prevent extending macro context across line breaks. Show variable context (name, operator, value) when typing closing brace on shorthand macros by excluding `isTypingClosingBrace` from the value-typing check.
* Fix highlight of value autocomplete option
* Rename permanentMatch to forceFullNameMatch
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* git push --force
Implement background management in json
lint
upload multer weirdness, fix for timestamp
* remove duplicated logic to generate backgrounds.json
* remove duplicate logic to create backgrounds.js
* remove excessive enodent eror handling
* simplify shared extension constants
* move backgrounds.json to backgrounds/index.json
* use plimit
* move user directory iteration to syncBackgroundsMetadata insetad of server main
* create and move getBackgroundThumbnailResolution
* nitpick
* typdef
* simplify checks
* use read method
* error -> regenerate
* use fileExists
* type error fix (maybe)
* add object to jsdoc returns
* typo
* use getUniqueName from util.js
* remove duplicated multer something or other
* make skipped_extensions a set
* remove strict comparison
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* create isAnimatedWebP and use it
* use file creation date instead of server date
* actually type BackgroundImageMetadata
* use fileExists instead of try catch
* response.sendStatus(500);
* sync json to allow adding images to the folder without restart
* lint
* Generic image metadata endpoint. Remove tags and starred. No startup sync.
* lint
* Descriptive json and move to util.js
* remove folders routes
* It's a POST
* Revert file name to index.json
* Type errors fixing
* Remove p-limit
* Why?
* apply codex suggestions
* see comment
* remove unused functions
* remove path normalization for da path, not needed
* Fix dimensions shadowing issue, circular imports, and apply bg res to only bg
* move thumbnailsEnabled to the top level
* Metadata now stored at {userDataRoot}/image-metadata.json instead of per-folder index.json
Uses relative paths as keys (e.g., backgrounds/sunset.png) for easy file existence checking
Added cleanupOrphanedMetadata() function and /api/image-metadata/cleanup endpoint for data-maid integration
Simplified the API endpoint by removing folder-grouping logic
* lint
* update backgrounds.js imports
* security check, .replaceAll
* Remove useless function, pass type to cache invalidate and seperate file types
* fix: normalize file paths to use POSIX separators in metadata functions
* serve original
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* Refactor /search to use per-line async parsing
Supersedes #5047
* Use named type
* Cache query fragments, add file name match
* Skip invalid chat files in search
* Remove extensions from /search results
* Use file_id when appropriate
* Revert "Use file_id when appropriate"
This reverts commit aaa0274b53da6a677183b6f923163053cfd6d569.
* Clean-up file extension handling
* Move extension append down for non-group
* feat(tts): Add support for Volcengine TTS provider
* refactor: Remove the redundant comments in the Volcengine TTS-related code.
* fix(volcengine): Fix the audio data processing logic in the voice generation interface
* feat(tts): Enhance Volcengine TTS functionality and improve error handling
- Return more detailed error information when generating voice fails
- Add multiple preset voice options and support custom voice management
- Reconstruct the audio stream processing logic to enhance reliability
- Improve the UI interface, adding a voice selection dropdown menu and operation buttons
* refactor(tts): Optimize the code structure and error handling of the Volcengine TTS provider
- Remove the unused "voices" array and "model" parameter
- Improve the text processing logic, eliminating unnecessary separators
- Standardize the error handling logic, simplifying the status code checks
- Fix the DOM operation method, using "createElement" instead of string concatenation
- Ensure the existence check of the "customVoices" array
* Fix: Change the Content-Type of the audio response to audio/mpeg.
* Clean-up
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>