diff --git a/.changeset/add-forward-errors.md b/.changeset/add-forward-errors.md deleted file mode 100644 index 753f99d2c..000000000 --- a/.changeset/add-forward-errors.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -Add detailed error messages to forwarding failures. diff --git a/.changeset/add_black_theme.md b/.changeset/add_black_theme.md deleted file mode 100644 index b499f1ef2..000000000 --- a/.changeset/add_black_theme.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: minor ---- - -# Add black theme diff --git a/.changeset/add_location_command.md b/.changeset/add_location_command.md deleted file mode 100644 index 6a794f9a8..000000000 --- a/.changeset/add_location_command.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: minor ---- - -Add /location sharing command, and a /sharemylocation command. diff --git a/.changeset/add_quickreply_keybinds.md b/.changeset/add_quickreply_keybinds.md deleted file mode 100644 index b97761de7..000000000 --- a/.changeset/add_quickreply_keybinds.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: minor ---- - -Add quick reply keybinds by using ctrl+up / ctrl+down you can now cycle through the message you are replying to with keybinds diff --git a/.changeset/cap_unread_badges.md b/.changeset/cap_unread_badges.md deleted file mode 100644 index affe5ee1e..000000000 --- a/.changeset/cap_unread_badges.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -Cap unread badge numbers at `1k+`, and something extra :) diff --git a/.changeset/feat-room-abbreviations.md b/.changeset/feat-room-abbreviations.md deleted file mode 100644 index d2323849f..000000000 --- a/.changeset/feat-room-abbreviations.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: minor ---- - -Add room abbreviations with hover tooltips: moderators define term/definition pairs in room settings; matching terms are highlighted in messages. diff --git a/.changeset/fix-pmp-encrypted.md b/.changeset/fix-pmp-encrypted.md deleted file mode 100644 index f9f0ab179..000000000 --- a/.changeset/fix-pmp-encrypted.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -Fixes the most recent pmp message in encrypted rooms not consistently rendering the pmp and not grouping with previous pmps. diff --git a/.changeset/fix-pmp-sending-message-with-attachments.md b/.changeset/fix-pmp-sending-message-with-attachments.md deleted file mode 100644 index a04dcf59f..000000000 --- a/.changeset/fix-pmp-sending-message-with-attachments.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -fixed sending sticker and attachments while having a persona selected diff --git a/.changeset/fix-sliding-sync-known-issues-link.md b/.changeset/fix-sliding-sync-known-issues-link.md deleted file mode 100644 index 3262e84fa..000000000 --- a/.changeset/fix-sliding-sync-known-issues-link.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -Fix broken link to Sliding Sync known issues — now points to SableClient/Sable#39 instead of the old repository. diff --git a/.changeset/fix-sw-media-auth-401.md b/.changeset/fix-sw-media-auth-401.md deleted file mode 100644 index 5390991b0..000000000 --- a/.changeset/fix-sw-media-auth-401.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -Fix service worker authenticated media requests returning 401 errors after SW restart or when session data is missing/stale. diff --git a/.changeset/fix_confusing_ui_with_client_side_embeds_setting.md b/.changeset/fix_confusing_ui_with_client_side_embeds_setting.md deleted file mode 100644 index 6fd108a67..000000000 --- a/.changeset/fix_confusing_ui_with_client_side_embeds_setting.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -# Fix confusing ui with `Client Side Embeds in Encrypted Rooms` setting diff --git a/.changeset/fix_forwarding_metadata.md b/.changeset/fix_forwarding_metadata.md deleted file mode 100644 index 36e502232..000000000 --- a/.changeset/fix_forwarding_metadata.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -fix forwarding metadata by removing the `null` value diff --git a/.changeset/fix_pmp_jumbo_emoji_display.md b/.changeset/fix_pmp_jumbo_emoji_display.md deleted file mode 100644 index 68fd7bdbd..000000000 --- a/.changeset/fix_pmp_jumbo_emoji_display.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -fix the display of jumbo emojis on messages sent with a persona diff --git a/.changeset/fix_sidebar_badge_alignment.md b/.changeset/fix_sidebar_badge_alignment.md deleted file mode 100644 index 65f35747f..000000000 --- a/.changeset/fix_sidebar_badge_alignment.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -Fix sidebar notification badge positioning so unread and unverified counts align consistently. diff --git a/.changeset/improve_youtube_embeds.md b/.changeset/improve_youtube_embeds.md deleted file mode 100644 index 9fbe326af..000000000 --- a/.changeset/improve_youtube_embeds.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: minor ---- - -# Add support for timestamps, playlists and youtube music links for the youtube embeds diff --git a/.changeset/move_filtering_pronouns_by_language_setting_to_appearance.md b/.changeset/move_filtering_pronouns_by_language_setting_to_appearance.md deleted file mode 100644 index 29e9b8610..000000000 --- a/.changeset/move_filtering_pronouns_by_language_setting_to_appearance.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: note ---- - -moved the setting for filtering pronouns by language from experimental to the appearance setting diff --git a/.changeset/replace_millify_with_intl.md b/.changeset/replace_millify_with_intl.md deleted file mode 100644 index 805f9f899..000000000 --- a/.changeset/replace_millify_with_intl.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -Use the browser's native compact number formatting for room and member counts. diff --git a/.changeset/sentry-scrub-opaque-matrix-ids.md b/.changeset/sentry-scrub-opaque-matrix-ids.md deleted file mode 100644 index 23eb1ef9e..000000000 --- a/.changeset/sentry-scrub-opaque-matrix-ids.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: patch ---- - -fix(sentry): scrub percent-encoded Matrix IDs and opaque base64url tokens from Sentry URLs diff --git a/.changeset/settings-sync.md b/.changeset/settings-sync.md deleted file mode 100644 index 95ff88520..000000000 --- a/.changeset/settings-sync.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -default: minor ---- - -Add settings sync across devices via Matrix account data, with JSON export/import diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..f1df6a2db --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,101 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: 'CodeQL Advanced' + +on: + push: + branches: ['dev'] + pull_request: + branches: ['dev'] + schedule: + - cron: '29 1 * * 2' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: javascript-typescript + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Run manual build steps + if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 + with: + category: '/language:${{matrix.language}}' diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ecbe982e..8d0dbcb8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,55 @@ # Sable Client Changelog +## 1.13.1 (2026-03-30) + +### Fixes + +* Add youtube shorts support to stop it from crashing sable. ([#578](https://github.com/SableClient/Sable/pull/578) by @nushea) +* Fix rich-text reply previews and custom-formatted messages so unsafe HTML is filtered more strictly and Matrix colors render correctly. ([#571](https://github.com/SableClient/Sable/pull/571) by @hazre) +* Fix crash when previewing non-video YouTube URLs (channels, @handles, etc.) that lack query parameters. ([#584](https://github.com/SableClient/Sable/pull/584) by @Just-Insane) +* fix id handling and id generation for Personas ([#583](https://github.com/SableClient/Sable/pull/583) by @dozro) + +## 1.13.0 (2026-03-28) + +### Features + +* Add ability to click on usernames in member and state events to view user info ([#536](https://github.com/SableClient/Sable/pull/536) by @thundertheidiot) +* Add black theme ([#437](https://github.com/SableClient/Sable/pull/437) by @Elec3137) +* added a limited compatibility with `pk;member` commands ([#550](https://github.com/SableClient/Sable/pull/550) by @dozro) +* Add /location sharing command, and a /sharemylocation command. ([#509](https://github.com/SableClient/Sable/pull/509) by @nushea) +* added option to use shorthands to send a message with a Persona, for example `✨:test` ([#550](https://github.com/SableClient/Sable/pull/550) by @dozro) +* Add quick reply keybinds by using ctrl+up / ctrl+down you can now cycle through the message you are replying to with keybinds ([#524](https://github.com/SableClient/Sable/pull/524) by @CodeF53) +* Adds a `/html` command to send HTML messages ([#560](https://github.com/SableClient/Sable/pull/560) by @Vespe-r) +* Add room abbreviations with hover tooltips: moderators define term/definition pairs in room settings; matching terms are highlighted in messages. ([#514](https://github.com/SableClient/Sable/pull/514) by @Just-Insane) +* Add support for timestamps, playlists and youtube music links for the youtube embeds ([#534](https://github.com/SableClient/Sable/pull/534) by @thundertheidiot) +* Add settings sync across devices via Matrix account data, with JSON export/import ([#515](https://github.com/SableClient/Sable/pull/515) by @Just-Insane) + +### Fixes + +* Add detailed error messages to forwarding failures. ([#532](https://github.com/SableClient/Sable/pull/532) by @7w1) +* Cap unread badge numbers at `1k+`, and something extra :) ([#484](https://github.com/SableClient/Sable/pull/484) by @hazre) +* Fix scroll-to-bottom after room navigation, timeline pagination reliability, and URL preview deduplication. ([#529](https://github.com/SableClient/Sable/pull/529) by @Just-Insane) +* Fixes the most recent pmp message in encrypted rooms not consistently rendering the pmp and not grouping with previous pmps. ([#526](https://github.com/SableClient/Sable/pull/526) by @7w1) +* fixed sending sticker and attachments while having a persona selected ([#525](https://github.com/SableClient/Sable/pull/525) by @dozro) +* Fix push notifications missing sender/room avatar and showing stale display names when using event_id_only push format. ([#551](https://github.com/SableClient/Sable/pull/551) by @Just-Insane) +* Sanitize formatted reply previews before rendering to prevent unsafe HTML from being parsed in reply snippets. ([#569](https://github.com/SableClient/Sable/pull/569) by @Just-Insane) +* Fix broken link to Sliding Sync known issues — now points to SableClient/Sable#39 instead of the old repository. ([#519](https://github.com/SableClient/Sable/pull/519) by @Just-Insane) +* Fix service worker authenticated media requests returning 401 errors after SW restart or when session data is missing/stale. ([#516](https://github.com/SableClient/Sable/pull/516) by @Just-Insane) +* rephrased the command describtion for `/usepmp` and made `/usepmp reset` actually reset the room association of the pmp ([#550](https://github.com/SableClient/Sable/pull/550) by @dozro) +* Fix confusing ui with `Client Side Embeds in Encrypted Rooms` setting ([#535](https://github.com/SableClient/Sable/pull/535) by @thundertheidiot) +* fix forwarding metadata by removing the `null` value ([#540](https://github.com/SableClient/Sable/pull/540) by @dozro) +* fix forwarding issue for users on synapse homeservers, by removing the relation ([#558](https://github.com/SableClient/Sable/pull/558) by @dozro) +* fixed the syntax issues regarding `/addpmp` and `usepmp` (note that the syntax for `/usepmp` has changed) ([#550](https://github.com/SableClient/Sable/pull/550) by @dozro) +* fix the display of jumbo emojis on messages sent with a persona ([#530](https://github.com/SableClient/Sable/pull/530) by @dozro) +* Fix sidebar notification badge positioning so unread and unverified counts align consistently. ([#484](https://github.com/SableClient/Sable/pull/484) by @hazre) +* Use the browser's native compact number formatting for room and member counts. ([#484](https://github.com/SableClient/Sable/pull/484) by @hazre) +* fix(sentry): scrub percent-encoded Matrix IDs and opaque base64url tokens from Sentry URLs ([#531](https://github.com/SableClient/Sable/pull/531) by @Just-Insane) + +### Notes + +* new/changed bios will now also be saved in the format MSC4440 expects ([#559](https://github.com/SableClient/Sable/pull/559) by @dozro) +* moved the setting for filtering pronouns by language from experimental to the appearance setting ([#521](https://github.com/SableClient/Sable/pull/521) by @dozro) + ## 1.12.3 (2026-03-24) ### Fixes diff --git a/package.json b/package.json index 2a017c8ea..cab220bb1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sable", - "version": "1.12.3", + "version": "1.13.1", "description": "An almost stable Matrix client", "type": "module", "packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be", @@ -54,6 +54,7 @@ "classnames": "^2.5.1", "dayjs": "^1.11.19", "domhandler": "^5.0.3", + "dompurify": "^3.3.3", "emojibase": "^15.3.1", "emojibase-data": "^15.3.2", "eslint-plugin-react": "7.37.5", @@ -84,7 +85,6 @@ "react-i18next": "^16.5.4", "react-range": "^1.10.0", "react-router-dom": "^6.30.3", - "sanitize-html": "^2.17.1", "slate": "^0.123.0", "slate-dom": "^0.123.0", "slate-history": "^0.113.1", @@ -112,7 +112,6 @@ "@types/react": "^18.3.28", "@types/react-dom": "^18.3.7", "@types/react-google-recaptcha": "^2.1.9", - "@types/sanitize-html": "^2.16.0", "@types/ua-parser-js": "^0.7.39", "@vitejs/plugin-react": "^5.1.4", "@vitest/coverage-v8": "^4.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c2f683f59..1a5589d58 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,7 +62,7 @@ importers: version: 0.5.7(@vanilla-extract/css@1.18.0) '@vanilla-extract/vite-plugin': specifier: ^5.1.4 - version: 5.1.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2))(yaml@2.8.2) + version: 5.1.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2))(yaml@2.8.2) await-to-js: specifier: ^3.0.0 version: 3.0.0 @@ -87,6 +87,9 @@ importers: domhandler: specifier: ^5.0.3 version: 5.0.3 + dompurify: + specifier: ^3.3.3 + version: 3.3.3 emojibase: specifier: ^15.3.1 version: 15.3.1 @@ -177,9 +180,6 @@ importers: react-router-dom: specifier: ^6.30.3 version: 6.30.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - sanitize-html: - specifier: ^2.17.1 - version: 2.17.1 slate: specifier: ^0.123.0 version: 0.123.0 @@ -204,7 +204,7 @@ importers: devDependencies: '@cloudflare/vite-plugin': specifier: ^1.26.0 - version: 1.27.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2))(workerd@1.20260310.1)(wrangler@4.72.0) + version: 1.27.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2))(workerd@1.20260310.1)(wrangler@4.72.0) '@esbuild-plugins/node-globals-polyfill': specifier: ^0.2.3 version: 0.2.3(esbuild@0.27.3) @@ -256,15 +256,12 @@ importers: '@types/react-google-recaptcha': specifier: ^2.1.9 version: 2.1.9 - '@types/sanitize-html': - specifier: ^2.16.0 - version: 2.16.1 '@types/ua-parser-js': specifier: ^0.7.39 version: 0.7.39 '@vitejs/plugin-react': specifier: ^5.1.4 - version: 5.1.4(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)) + version: 5.1.4(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)) '@vitest/coverage-v8': specifier: ^4.1.0 version: 4.1.0(vitest@4.1.0) @@ -306,25 +303,25 @@ importers: version: 5.9.3 vite: specifier: ^7.3.1 - version: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + version: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) vite-plugin-compression2: specifier: 2.5.0 version: 2.5.0(rollup@4.59.0) vite-plugin-pwa: specifier: ^1.2.0 - version: 1.2.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2))(workbox-build@7.4.0(@types/babel__core@7.20.5))(workbox-window@7.4.0) + version: 1.2.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2))(workbox-build@7.4.0(@types/babel__core@7.20.5))(workbox-window@7.4.0) vite-plugin-static-copy: specifier: ^3.2.0 - version: 3.2.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)) + version: 3.2.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)) vite-plugin-svgr: specifier: 4.5.0 - version: 4.5.0(rollup@4.59.0)(typescript@5.9.3)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)) + version: 4.5.0(rollup@4.59.0)(typescript@5.9.3)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)) vite-plugin-top-level-await: specifier: ^1.6.0 - version: 1.6.0(@swc/helpers@0.5.19)(rollup@4.59.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)) + version: 1.6.0(@swc/helpers@0.5.19)(rollup@4.59.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)) vitest: specifier: ^4.1.0 - version: 4.1.0(@types/node@24.10.13)(@vitest/ui@4.1.0)(jsdom@29.0.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)) + version: 4.1.0(@types/node@24.10.13)(@vitest/ui@4.1.0)(jsdom@29.0.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)) wrangler: specifier: ^4.70.0 version: 4.72.0 @@ -399,8 +396,8 @@ packages: peerDependencies: '@babel/core': ^7.0.0 - '@babel/helper-define-polyfill-provider@0.6.7': - resolution: {integrity: sha512-6Fqi8MtQ/PweQ9xvux65emkLQ83uB+qAVtfHkC9UodyHMIZdxNI01HjLCLUtybElp2KY2XNE0nOgyP1E1vXw9w==} + '@babel/helper-define-polyfill-provider@0.6.8': + resolution: {integrity: sha512-47UwBLPpQi1NoWzLuHNjRoHlYXMwIJoBf7MFou6viC/sIHWYygpvr0B6IAyh5sBdA2nr2LPIRww8lfaUVQINBA==} peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 @@ -849,8 +846,8 @@ packages: peerDependencies: '@babel/core': ^7.0.0 - '@babel/preset-env@7.29.0': - resolution: {integrity: sha512-fNEdfc0yi16lt6IZo2Qxk3knHVdfMYX33czNb4v8yWhemoBhibCpQK/uYHtSKIiO+p/zd3+8fYVXhQdOVV608w==} + '@babel/preset-env@7.29.2': + resolution: {integrity: sha512-DYD23veRYGvBFhcTY1iUvJnDNpuqNd/BzBwCvzOTKUnJjKg5kpUBh3/u9585Agdkgj+QuygG7jLfOPWMa2KVNw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -864,6 +861,10 @@ packages: resolution: {integrity: sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==} engines: {node: '>=6.9.0'} + '@babel/runtime@7.29.2': + resolution: {integrity: sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==} + engines: {node: '>=6.9.0'} + '@babel/template@7.28.6': resolution: {integrity: sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==} engines: {node: '>=6.9.0'} @@ -2826,9 +2827,6 @@ packages: '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} - '@types/sanitize-html@2.16.1': - resolution: {integrity: sha512-n9wjs8bCOTyN/ynwD8s/nTcTreIHB1vf31vhLMGqUPNHaweKC4/fAl4Dj+hUlCTKYgm4P3k83fmiFfzkZ6sgMA==} - '@types/trusted-types@2.0.7': resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} @@ -3197,18 +3195,18 @@ packages: resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} engines: {node: '>= 0.4'} - babel-plugin-polyfill-corejs2@0.4.16: - resolution: {integrity: sha512-xaVwwSfebXf0ooE11BJovZYKhFjIvQo7TsyVpETuIeH2JHv0k/T6Y5j22pPTvqYqmpkxdlPAJlyJ0tfOJAoMxw==} + babel-plugin-polyfill-corejs2@0.4.17: + resolution: {integrity: sha512-aTyf30K/rqAsNwN76zYrdtx8obu0E4KoUME29B1xj+B3WxgvWkp943vYQ+z8Mv3lw9xHXMHpvSPOBxzAkIa94w==} peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 - babel-plugin-polyfill-corejs3@0.14.1: - resolution: {integrity: sha512-ENp89vM9Pw4kv/koBb5N2f9bDZsR0hpf3BdPMOg/pkS3pwO4dzNnQZVXtBbeyAadgm865DmQG2jMMLqmZXvuCw==} + babel-plugin-polyfill-corejs3@0.14.2: + resolution: {integrity: sha512-coWpDLJ410R781Npmn/SIBZEsAetR4xVi0SxLMXPaMO4lSf1MwnkGYMtkFxew0Dn8B3/CpbpYxN0JCgg8mn67g==} peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 - babel-plugin-polyfill-regenerator@0.6.7: - resolution: {integrity: sha512-OTYbUlSwXhNgr4g6efMZgsO8//jA61P7ZbRX3iTT53VON8l+WQS8IAUEVo4a4cWknrg2W8Cj4gQhRYNCJ8GkAA==} + babel-plugin-polyfill-regenerator@0.6.8: + resolution: {integrity: sha512-M762rNHfSF1EV3SLtnCJXFoQbbIIz0OyRwnCmV0KPC7qosSfCO0QLTSuJX3ayAebubhE6oYBAYPrBA5ljowaZg==} peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 @@ -3362,8 +3360,8 @@ packages: resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==} engines: {node: '>=18'} - core-js-compat@3.48.0: - resolution: {integrity: sha512-OM4cAF3D6VtH/WkLtWvyNC56EZVXsZdU3iqaMG2B4WvYrlqU831pc4UtG5yp0sE9z8Y02wVN7PjW5Zf9Gt0f1Q==} + core-js-compat@3.49.0: + resolution: {integrity: sha512-VQXt1jr9cBz03b331DFDCCP90b3fanciLkgiOoy8SBHy06gNf+vQ1A3WFLqG7I8TipYIKeYK9wxd0tUrvHcOZA==} cosmiconfig@8.3.6: resolution: {integrity: sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==} @@ -3504,6 +3502,9 @@ packages: resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} engines: {node: '>= 4'} + dompurify@3.3.3: + resolution: {integrity: sha512-Oj6pzI2+RqBfFG+qOaOLbFXLQ90ARpcGG6UePL82bJLtdsa6CYJD7nmiU8MW9nQNOtCHV3lZ/Bzq1X0QYbBZCA==} + domutils@3.2.2: resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==} @@ -4072,9 +4073,6 @@ packages: htmlparser2@10.1.0: resolution: {integrity: sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==} - htmlparser2@8.0.2: - resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==} - htmlparser2@9.0.0: resolution: {integrity: sha512-uxbSI98wmFT/G4P2zXx4OVx04qWUmyFPrD2/CNepa2Zo3GPNaCaaxElDgwUrwYWkK1nr9fft0Ya8dws8coDLLQ==} @@ -4679,9 +4677,6 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} - parse-srcset@1.0.2: - resolution: {integrity: sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q==} - parse5@8.0.0: resolution: {integrity: sha512-9m4m5GSgXjL4AjumKzq1Fgfp3Z8rsvjRNbnkVwfu2ImRqE5D0LnY2QfDen18FSY9C573YU5XxSapdHZTZ2WolA==} @@ -4721,6 +4716,10 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@2.3.2: + resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} + engines: {node: '>=8.6'} + picomatch@4.0.3: resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} engines: {node: '>=12'} @@ -4948,9 +4947,6 @@ packages: resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==} engines: {node: '>= 0.4'} - sanitize-html@2.17.1: - resolution: {integrity: sha512-ehFCW+q1a4CSOWRAdX97BX/6/PDEkCqw7/0JXZAGQV57FQB3YOkTa/rrzHPeJ+Aghy4vZAFfWMYyfxIiB7F/gw==} - saxes@6.0.0: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} @@ -4974,8 +4970,8 @@ packages: engines: {node: '>=10'} hasBin: true - serialize-javascript@7.0.4: - resolution: {integrity: sha512-DuGdB+Po43Q5Jxwpzt1lhyFSYKryqoNjQSA9M92tyw0lyHIOur+XCalOUe0KTJpyqzT8+fQ5A0Jf7vCx/NKmIg==} + serialize-javascript@7.0.5: + resolution: {integrity: sha512-F4LcB0UqUl1zErq+1nYEEzSHJnIwb3AF2XWB94b+afhrekOUijwooAYqFyRbjYkm2PAKBabx6oYv/xDxNi8IBw==} engines: {node: '>=20.0.0'} set-function-length@1.2.2: @@ -5188,8 +5184,8 @@ packages: resolution: {integrity: sha512-G13vtMYPT/J8A4X2SjdtBTphZlrp1gKv6hZiOjw14RCWg6GbHuQBGtjlx75xLbYV/wEc0D7G5K4rxKP/cXk8Bw==} engines: {node: '>=10'} - terser@5.46.0: - resolution: {integrity: sha512-jTwoImyr/QbOWFFso3YoU3ik0jBBDJ6JTOQiy/J2YxVJdZCc+5u7skhNwiOR3FQIygFqVUPHl7qbbxtjW2K3Qg==} + terser@5.46.1: + resolution: {integrity: sha512-vzCjQO/rgUuK9sf8VJZvjqiqiHFaZLnOiimmUuOKODxWL8mm/xua7viT7aqX7dgPY60otQjUotzFMmCB4VdmqQ==} engines: {node: '>=10'} hasBin: true @@ -5792,7 +5788,7 @@ snapshots: regexpu-core: 6.4.0 semver: 6.3.1 - '@babel/helper-define-polyfill-provider@0.6.7(@babel/core@7.29.0)': + '@babel/helper-define-polyfill-provider@0.6.8(@babel/core@7.29.0)': dependencies: '@babel/core': 7.29.0 '@babel/helper-compilation-targets': 7.28.6 @@ -6285,7 +6281,7 @@ snapshots: '@babel/helper-create-regexp-features-plugin': 7.28.5(@babel/core@7.29.0) '@babel/helper-plugin-utils': 7.28.6 - '@babel/preset-env@7.29.0(@babel/core@7.29.0)': + '@babel/preset-env@7.29.2(@babel/core@7.29.0)': dependencies: '@babel/compat-data': 7.29.0 '@babel/core': 7.29.0 @@ -6353,10 +6349,10 @@ snapshots: '@babel/plugin-transform-unicode-regex': 7.27.1(@babel/core@7.29.0) '@babel/plugin-transform-unicode-sets-regex': 7.28.6(@babel/core@7.29.0) '@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.29.0) - babel-plugin-polyfill-corejs2: 0.4.16(@babel/core@7.29.0) - babel-plugin-polyfill-corejs3: 0.14.1(@babel/core@7.29.0) - babel-plugin-polyfill-regenerator: 0.6.7(@babel/core@7.29.0) - core-js-compat: 3.48.0 + babel-plugin-polyfill-corejs2: 0.4.17(@babel/core@7.29.0) + babel-plugin-polyfill-corejs3: 0.14.2(@babel/core@7.29.0) + babel-plugin-polyfill-regenerator: 0.6.8(@babel/core@7.29.0) + core-js-compat: 3.49.0 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -6370,6 +6366,8 @@ snapshots: '@babel/runtime@7.28.6': {} + '@babel/runtime@7.29.2': {} + '@babel/template@7.28.6': dependencies: '@babel/code-frame': 7.29.0 @@ -6407,12 +6405,12 @@ snapshots: optionalDependencies: workerd: 1.20260310.1 - '@cloudflare/vite-plugin@1.27.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2))(workerd@1.20260310.1)(wrangler@4.72.0)': + '@cloudflare/vite-plugin@1.27.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2))(workerd@1.20260310.1)(wrangler@4.72.0)': dependencies: '@cloudflare/unenv-preset': 2.15.0(unenv@2.0.0-rc.24)(workerd@1.20260310.1) miniflare: 4.20260310.0 unenv: 2.0.0-rc.24 - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) wrangler: 4.72.0 ws: 8.18.0 transitivePeerDependencies: @@ -7973,9 +7971,9 @@ snapshots: '@rollup/plugin-terser@0.4.4(rollup@4.59.0)': dependencies: - serialize-javascript: 7.0.4 + serialize-javascript: 7.0.5 smob: 1.6.1 - terser: 5.46.0 + terser: 5.46.1 optionalDependencies: rollup: 4.59.0 @@ -7993,7 +7991,7 @@ snapshots: dependencies: '@types/estree': 0.0.39 estree-walker: 1.0.1 - picomatch: 2.3.1 + picomatch: 2.3.2 rollup: 4.59.0 '@rollup/pluginutils@5.3.0(rollup@4.59.0)': @@ -8372,7 +8370,7 @@ snapshots: '@testing-library/dom@10.4.1': dependencies: '@babel/code-frame': 7.29.0 - '@babel/runtime': 7.28.6 + '@babel/runtime': 7.29.2 '@types/aria-query': 5.0.4 aria-query: 5.3.0 dom-accessibility-api: 0.5.16 @@ -8475,10 +8473,6 @@ snapshots: '@types/resolve@1.20.2': {} - '@types/sanitize-html@2.16.1': - dependencies: - htmlparser2: 10.1.0 - '@types/trusted-types@2.0.7': {} '@types/ua-parser-js@0.7.39': {} @@ -8646,12 +8640,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@vanilla-extract/compiler@0.3.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)': + '@vanilla-extract/compiler@0.3.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)': dependencies: '@vanilla-extract/css': 1.18.0 '@vanilla-extract/integration': 8.0.7 - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) - vite-node: 3.2.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) + vite-node: 3.2.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -8706,11 +8700,11 @@ snapshots: dependencies: '@vanilla-extract/css': 1.18.0 - '@vanilla-extract/vite-plugin@5.1.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2))(yaml@2.8.2)': + '@vanilla-extract/vite-plugin@5.1.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2))(yaml@2.8.2)': dependencies: - '@vanilla-extract/compiler': 0.3.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + '@vanilla-extract/compiler': 0.3.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) '@vanilla-extract/integration': 8.0.7 - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -8726,7 +8720,7 @@ snapshots: - tsx - yaml - '@vitejs/plugin-react@5.1.4(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2))': + '@vitejs/plugin-react@5.1.4(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2))': dependencies: '@babel/core': 7.29.0 '@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/core@7.29.0) @@ -8734,7 +8728,7 @@ snapshots: '@rolldown/pluginutils': 1.0.0-rc.3 '@types/babel__core': 7.20.5 react-refresh: 0.18.0 - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) transitivePeerDependencies: - supports-color @@ -8750,7 +8744,7 @@ snapshots: obug: 2.1.1 std-env: 4.0.0 tinyrainbow: 3.1.0 - vitest: 4.1.0(@types/node@24.10.13)(@vitest/ui@4.1.0)(jsdom@29.0.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)) + vitest: 4.1.0(@types/node@24.10.13)(@vitest/ui@4.1.0)(jsdom@29.0.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)) '@vitest/expect@4.1.0': dependencies: @@ -8761,13 +8755,13 @@ snapshots: chai: 6.2.2 tinyrainbow: 3.1.0 - '@vitest/mocker@4.1.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2))': + '@vitest/mocker@4.1.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2))': dependencies: '@vitest/spy': 4.1.0 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) '@vitest/pretty-format@4.1.0': dependencies: @@ -8796,7 +8790,7 @@ snapshots: sirv: 3.0.2 tinyglobby: 0.2.15 tinyrainbow: 3.1.0 - vitest: 4.1.0(@types/node@24.10.13)(@vitest/ui@4.1.0)(jsdom@29.0.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)) + vitest: 4.1.0(@types/node@24.10.13)(@vitest/ui@4.1.0)(jsdom@29.0.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)) '@vitest/utils@4.1.0': dependencies: @@ -8946,27 +8940,27 @@ snapshots: axobject-query@4.1.0: {} - babel-plugin-polyfill-corejs2@0.4.16(@babel/core@7.29.0): + babel-plugin-polyfill-corejs2@0.4.17(@babel/core@7.29.0): dependencies: '@babel/compat-data': 7.29.0 '@babel/core': 7.29.0 - '@babel/helper-define-polyfill-provider': 0.6.7(@babel/core@7.29.0) + '@babel/helper-define-polyfill-provider': 0.6.8(@babel/core@7.29.0) semver: 6.3.1 transitivePeerDependencies: - supports-color - babel-plugin-polyfill-corejs3@0.14.1(@babel/core@7.29.0): + babel-plugin-polyfill-corejs3@0.14.2(@babel/core@7.29.0): dependencies: '@babel/core': 7.29.0 - '@babel/helper-define-polyfill-provider': 0.6.7(@babel/core@7.29.0) - core-js-compat: 3.48.0 + '@babel/helper-define-polyfill-provider': 0.6.8(@babel/core@7.29.0) + core-js-compat: 3.49.0 transitivePeerDependencies: - supports-color - babel-plugin-polyfill-regenerator@0.6.7(@babel/core@7.29.0): + babel-plugin-polyfill-regenerator@0.6.8(@babel/core@7.29.0): dependencies: '@babel/core': 7.29.0 - '@babel/helper-define-polyfill-provider': 0.6.7(@babel/core@7.29.0) + '@babel/helper-define-polyfill-provider': 0.6.8(@babel/core@7.29.0) transitivePeerDependencies: - supports-color @@ -9097,7 +9091,7 @@ snapshots: cookie@1.1.1: {} - core-js-compat@3.48.0: + core-js-compat@3.49.0: dependencies: browserslist: 4.28.1 @@ -9222,6 +9216,10 @@ snapshots: dependencies: domelementtype: 2.3.0 + dompurify@3.3.3: + optionalDependencies: + '@types/trusted-types': 2.0.7 + domutils@3.2.2: dependencies: dom-serializer: 2.0.0 @@ -9977,13 +9975,6 @@ snapshots: domutils: 3.2.2 entities: 7.0.1 - htmlparser2@8.0.2: - dependencies: - domelementtype: 2.3.0 - domhandler: 5.0.3 - domutils: 3.2.2 - entities: 4.5.0 - htmlparser2@9.0.0: dependencies: domelementtype: 2.3.0 @@ -10619,8 +10610,6 @@ snapshots: json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 - parse-srcset@1.0.2: {} - parse5@8.0.0: dependencies: entities: 6.0.1 @@ -10651,6 +10640,8 @@ snapshots: picomatch@2.3.1: {} + picomatch@2.3.2: {} + picomatch@4.0.3: {} pkg-types@1.3.1: @@ -10945,15 +10936,6 @@ snapshots: es-errors: 1.3.0 is-regex: 1.2.1 - sanitize-html@2.17.1: - dependencies: - deepmerge: 4.3.1 - escape-string-regexp: 4.0.0 - htmlparser2: 8.0.2 - is-plain-object: 5.0.0 - parse-srcset: 1.0.2 - postcss: 8.5.8 - saxes@6.0.0: dependencies: xmlchars: 2.2.0 @@ -10972,7 +10954,7 @@ snapshots: semver@7.7.4: {} - serialize-javascript@7.0.4: {} + serialize-javascript@7.0.5: {} set-function-length@1.2.2: dependencies: @@ -11244,7 +11226,7 @@ snapshots: type-fest: 0.16.0 unique-string: 2.0.0 - terser@5.46.0: + terser@5.46.1: dependencies: '@jridgewell/source-map': 0.3.11 acorn: 8.16.0 @@ -11447,13 +11429,13 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - vite-node@3.2.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2): + vite-node@3.2.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2): dependencies: cac: 6.7.14 debug: 4.4.3 es-module-lexer: 1.7.0 pathe: 2.0.3 - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) transitivePeerDependencies: - '@types/node' - jiti @@ -11475,48 +11457,48 @@ snapshots: transitivePeerDependencies: - rollup - vite-plugin-pwa@1.2.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2))(workbox-build@7.4.0(@types/babel__core@7.20.5))(workbox-window@7.4.0): + vite-plugin-pwa@1.2.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2))(workbox-build@7.4.0(@types/babel__core@7.20.5))(workbox-window@7.4.0): dependencies: debug: 4.4.3 pretty-bytes: 6.1.1 tinyglobby: 0.2.15 - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) workbox-build: 7.4.0(@types/babel__core@7.20.5) workbox-window: 7.4.0 transitivePeerDependencies: - supports-color - vite-plugin-static-copy@3.2.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)): + vite-plugin-static-copy@3.2.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)): dependencies: chokidar: 3.6.0 p-map: 7.0.4 picocolors: 1.1.1 tinyglobby: 0.2.15 - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) - vite-plugin-svgr@4.5.0(rollup@4.59.0)(typescript@5.9.3)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)): + vite-plugin-svgr@4.5.0(rollup@4.59.0)(typescript@5.9.3)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)): dependencies: '@rollup/pluginutils': 5.3.0(rollup@4.59.0) '@svgr/core': 8.1.0(typescript@5.9.3) '@svgr/plugin-jsx': 8.1.0(@svgr/core@8.1.0(typescript@5.9.3)) - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) transitivePeerDependencies: - rollup - supports-color - typescript - vite-plugin-top-level-await@1.6.0(@swc/helpers@0.5.19)(rollup@4.59.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)): + vite-plugin-top-level-await@1.6.0(@swc/helpers@0.5.19)(rollup@4.59.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)): dependencies: '@rollup/plugin-virtual': 3.0.2(rollup@4.59.0) '@swc/core': 1.15.18(@swc/helpers@0.5.19) '@swc/wasm': 1.15.18 uuid: 10.0.0 - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) transitivePeerDependencies: - '@swc/helpers' - rollup - vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2): + vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2): dependencies: esbuild: 0.27.3 fdir: 6.5.0(picomatch@4.0.3) @@ -11528,13 +11510,13 @@ snapshots: '@types/node': 24.10.13 fsevents: 2.3.3 jiti: 2.6.1 - terser: 5.46.0 + terser: 5.46.1 yaml: 2.8.2 - vitest@4.1.0(@types/node@24.10.13)(@vitest/ui@4.1.0)(jsdom@29.0.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)): + vitest@4.1.0(@types/node@24.10.13)(@vitest/ui@4.1.0)(jsdom@29.0.0)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)): dependencies: '@vitest/expect': 4.1.0 - '@vitest/mocker': 4.1.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2)) + '@vitest/mocker': 4.1.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2)) '@vitest/pretty-format': 4.1.0 '@vitest/runner': 4.1.0 '@vitest/snapshot': 4.1.0 @@ -11551,7 +11533,7 @@ snapshots: tinyexec: 1.0.4 tinyglobby: 0.2.15 tinyrainbow: 3.1.0 - vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.0)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.46.1)(yaml@2.8.2) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 24.10.13 @@ -11660,8 +11642,8 @@ snapshots: dependencies: '@apideck/better-ajv-errors': 0.3.6(ajv@8.18.0) '@babel/core': 7.29.0 - '@babel/preset-env': 7.29.0(@babel/core@7.29.0) - '@babel/runtime': 7.28.6 + '@babel/preset-env': 7.29.2(@babel/core@7.29.0) + '@babel/runtime': 7.29.2 '@rollup/plugin-babel': 5.3.1(@babel/core@7.29.0)(@types/babel__core@7.20.5)(rollup@4.59.0) '@rollup/plugin-node-resolve': 15.3.1(rollup@4.59.0) '@rollup/plugin-replace': 2.4.2(rollup@4.59.0) diff --git a/src/app/components/RenderMessageContent.tsx b/src/app/components/RenderMessageContent.tsx index 6f3617858..56517903b 100644 --- a/src/app/components/RenderMessageContent.tsx +++ b/src/app/components/RenderMessageContent.tsx @@ -86,6 +86,7 @@ function RenderMessageContentInternal({ [CaptionPosition.Inline]: 'row', [CaptionPosition.Hidden]: 'row', } satisfies Record; + const attachmentDirection = captionPositionMap[captionPosition]; const renderBody = useCallback( (props: any) => ( @@ -131,6 +132,7 @@ function RenderMessageContentInternal({ }, [ts, clientUrlPreview, urlPreview] ); + const messageUrlsPreview = urlPreview ? renderUrlsPreview : undefined; const renderCaption = () => { const hasCaption = content.body && content.body.trim().length > 0; @@ -143,7 +145,7 @@ function RenderMessageContentInternal({ edited={edited} content={content} renderBody={renderBody} - renderUrlsPreview={urlPreview ? renderUrlsPreview : undefined} + renderUrlsPreview={messageUrlsPreview} /> ); return ( @@ -162,7 +164,7 @@ function RenderMessageContentInternal({ edited={edited} content={content} renderBody={renderBody} - renderUrlsPreview={urlPreview ? renderUrlsPreview : undefined} + renderUrlsPreview={messageUrlsPreview} /> ); @@ -170,54 +172,53 @@ function RenderMessageContentInternal({ return null; }; - const renderFile = () => ( -
-
- ( - ( - } - /> - )} - renderAsTextFile={() => ( - } - /> - )} - > - +
{attachment}
+ {renderCaption()} +
+ ); + } + + const renderFile = () => + renderCaptionedAttachment( + ( + ( + } /> - - )} - outlined={outlineAttachment} - /> -
- {renderCaption()} - - ); + )} + renderAsTextFile={() => ( + } + /> + )} + > + + + )} + outlined={outlineAttachment} + /> + ); if (msgType === MsgType.Text) { return ( @@ -225,7 +226,7 @@ function RenderMessageContentInternal({ edited={edited} content={content} renderBody={renderBody} - renderUrlsPreview={urlPreview ? renderUrlsPreview : undefined} + renderUrlsPreview={messageUrlsPreview} /> ); } @@ -246,7 +247,7 @@ function RenderMessageContentInternal({ edited={edited} content={content} renderBody={renderBody} - renderUrlsPreview={urlPreview ? renderUrlsPreview : undefined} + renderUrlsPreview={messageUrlsPreview} /> ); } @@ -257,7 +258,7 @@ function RenderMessageContentInternal({ edited={edited} content={content} renderBody={renderBody} - renderUrlsPreview={urlPreview ? renderUrlsPreview : undefined} + renderUrlsPreview={messageUrlsPreview} /> ); } @@ -270,101 +271,71 @@ function RenderMessageContentInternal({ content.body?.toLowerCase().endsWith('.webp') || (typeof content.url === 'string' && content.url.toLowerCase().includes('gif')); - return ( -
-
- ( - { - if (isGif && !autoplayGifs && p.src) { - return ( - - - - ); - } - return ; - }} - renderViewer={(p) => } - /> - )} - outlined={outlineAttachment} + return renderCaptionedAttachment( + ( + { + if (isGif && !autoplayGifs && p.src) { + return ( + + + + ); + } + return ; + }} + renderViewer={(p) => } /> -
- {renderCaption()} -
+ )} + outlined={outlineAttachment} + /> ); } if (msgType === MsgType.Video) { - return ( -
-
- ( - ( - ( - {body} - )} - /> - ) - : undefined - } - renderVideo={(p) => } - /> - )} - outlined={outlineAttachment} + return renderCaptionedAttachment( + ( + ( + ( + {body} + )} + /> + ) + : undefined + } + renderVideo={(p) => } /> -
- {renderCaption()} -
+ )} + outlined={outlineAttachment} + /> ); } if (msgType === MsgType.Audio) { - return ( -
-
- ( - } /> - )} - outlined={outlineAttachment} - /> -
- {renderCaption()} -
+ return renderCaptionedAttachment( + ( + } /> + )} + outlined={outlineAttachment} + /> ); } diff --git a/src/app/components/message/RenderBody.tsx b/src/app/components/message/RenderBody.tsx index e26b237b0..ad027db22 100644 --- a/src/app/components/message/RenderBody.tsx +++ b/src/app/components/message/RenderBody.tsx @@ -9,6 +9,25 @@ import { useRoomAbbreviationsContext } from '$hooks/useRoomAbbreviations'; import { splitByAbbreviations } from '$utils/abbreviations'; import { MessageEmptyContent } from './content'; +function getRenderedBodyText(text: string, highlightRegex?: RegExp): (string | JSX.Element)[] { + const emojiScaledText = scaleSystemEmoji(text); + + return highlightRegex ? highlightText(highlightRegex, emojiScaledText) : emojiScaledText; +} + +function renderLinkifiedBodyText( + text: string, + linkifyOpts: Opts, + highlightRegex: RegExp | undefined, + key?: string +): JSX.Element { + return ( + + {getRenderedBodyText(text, highlightRegex)} + + ); +} + type AbbreviationTermProps = { text: string; definition: string; @@ -92,7 +111,6 @@ export function buildAbbrReplaceTextNode( type RenderBodyProps = { body: string; customBody?: string; - highlightRegex?: RegExp; htmlReactParserOptions: HTMLReactParserOptions; linkifyOpts: Opts; @@ -107,7 +125,6 @@ export function RenderBody({ const abbrMap = useRoomAbbreviationsContext(); if (customBody) { - if (customBody === '') return ; return parse(sanitizeCustomHtml(customBody), htmlReactParserOptions); } if (body === '') return ; @@ -122,24 +139,12 @@ export function RenderBody({ const definition = abbrMap.get(seg.termKey) ?? ''; return ; } - return ( - - {highlightRegex - ? highlightText(highlightRegex, scaleSystemEmoji(seg.text)) - : scaleSystemEmoji(seg.text)} - - ); + return renderLinkifiedBodyText(seg.text, linkifyOpts, highlightRegex, seg.id); })} ); } } - return ( - - {highlightRegex - ? highlightText(highlightRegex, scaleSystemEmoji(body)) - : scaleSystemEmoji(body)} - - ); + return renderLinkifiedBodyText(body, linkifyOpts, highlightRegex); } diff --git a/src/app/components/message/Reply.test.tsx b/src/app/components/message/Reply.test.tsx new file mode 100644 index 000000000..aa5c19fb5 --- /dev/null +++ b/src/app/components/message/Reply.test.tsx @@ -0,0 +1,129 @@ +import { render, screen } from '@testing-library/react'; +import { describe, expect, it, vi } from 'vitest'; +import { Reply } from './Reply'; + +const { mockUseRoomEvent, mockInvalidateQueries } = vi.hoisted(() => ({ + mockUseRoomEvent: vi.fn(), + mockInvalidateQueries: vi.fn(), +})); + +vi.mock('@tanstack/react-query', () => ({ + useQueryClient: () => ({ + invalidateQueries: mockInvalidateQueries, + }), +})); + +vi.mock('jotai', async (importActual) => { + const actual = await importActual(); + return { + ...actual, + useAtomValue: () => ({}), + }; +}); + +vi.mock('react-i18next', () => ({ + useTranslation: () => ({ + t: (key: string) => key, + }), +})); + +vi.mock('$hooks/useRoomEvent', () => ({ + useRoomEvent: (...args: unknown[]) => mockUseRoomEvent(...args), +})); + +vi.mock('$hooks/useSableCosmetics', () => ({ + useSableCosmetics: () => ({ color: undefined, font: undefined }), +})); + +vi.mock('$hooks/useMediaAuthentication', () => ({ + useMediaAuthentication: () => false, +})); + +vi.mock('$hooks/useIgnoredUsers', () => ({ + useIgnoredUsers: () => [], +})); + +vi.mock('$hooks/useMatrixClient', () => ({ + useMatrixClient: () => + ({ + getRoom: () => undefined, + getUserId: () => '@me:example.com', + mxcUrlToHttp: () => null, + }) as any, +})); + +vi.mock('$hooks/useMemberEventParser', () => ({ + useMemberEventParser: () => vi.fn(), +})); + +vi.mock('$hooks/useMentionClickHandler', () => ({ + useMentionClickHandler: () => undefined, +})); + +vi.mock('$utils/room', async (importActual) => { + const actual = await importActual(); + return { + ...actual, + getMemberDisplayName: () => 'Alice', + }; +}); + +const createReplyEvent = (formattedBody: string) => + ({ + getContent: () => ({ + body: 'fallback body', + format: 'org.matrix.custom.html', + formatted_body: formattedBody, + msgtype: 'm.text', + }), + getSender: () => '@alice:example.com', + getType: () => 'm.room.message', + isRedacted: () => false, + isEncrypted: () => false, + isDecryptionFailure: () => false, + getClearContent: () => ({}), + }) as any; + +describe('Reply', () => { + it('sanitizes formatted_body before trimming and parsing the reply preview', () => { + mockUseRoomEvent.mockReturnValue( + createReplyEvent( + '
quoted
' + + 'visible' + + 'blocked image' + ) + ); + + render( + undefined } as any} + replyEventId="$reply:example.com" + /> + ); + + expect(screen.getByText('visible')).toBeInTheDocument(); + expect(screen.queryByText('quoted')).not.toBeInTheDocument(); + expect(screen.queryByText('alert(1)')).not.toBeInTheDocument(); + expect(screen.queryByAltText('blocked image')).not.toBeInTheDocument(); + }); + + it('does not render unresolved mxc images as raw browser img tags in reply previews', () => { + const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => undefined); + + mockUseRoomEvent.mockReturnValue( + createReplyEvent( + 'blobcat' + ) + ); + + const { container } = render( + undefined } as any} + replyEventId="$reply:example.com" + /> + ); + + expect(container.querySelector('img[src^="mxc://"]')).toBeNull(); + expect(warnSpy).not.toHaveBeenCalled(); + }); +}); diff --git a/src/app/components/message/Reply.tsx b/src/app/components/message/Reply.tsx index 3342b0d52..cf1786ca8 100644 --- a/src/app/components/message/Reply.tsx +++ b/src/app/components/message/Reply.tsx @@ -8,6 +8,7 @@ import { useAtomValue } from 'jotai'; import { getMemberDisplayName, trimReplyFromBody, trimReplyFromFormattedBody } from '$utils/room'; import { getMxIdLocalPart } from '$utils/matrix'; import { randomNumberBetween } from '$utils/common'; +import { sanitizeCustomHtml } from '$utils/sanitize'; import { getReactCustomHtmlParser, scaleSystemEmoji, @@ -91,6 +92,19 @@ type ReplyProps = { replyIcon?: JSX.Element; }; +export const sanitizeReplyFormattedPreview = (formattedBody: string): string => { + const safeFormattedBody = sanitizeCustomHtml(formattedBody); + const strippedHtml = trimReplyFromFormattedBody(safeFormattedBody) + .replaceAll(//gi, ' ') + .replaceAll(/<\/p>\s*]*>/gi, ' ') + .replaceAll(/<\/?p[^>]*>/gi, '') + .replaceAll(/<\/li>\s*]*>/gi, ' ') + .replaceAll(/<\/?(ul|ol|li|blockquote|h[1-6]|pre|div)[^>]*>/gi, '') + .replaceAll(/(?:\r\n|\r|\n)/g, ' '); + + return strippedHtml; +}; + export const Reply = as<'div', ReplyProps>( ( { room, timelineSet, replyEventId, threadRootId, mentions, onClick, replyIcon, ...props }, @@ -125,6 +139,9 @@ export const Reply = as<'div', ReplyProps>( const badEncryption = replyEvent?.getContent().msgtype === 'm.bad.encrypted'; const mentionClickHandler = useMentionClickHandler(room.roomId); + const isFormattedReply = + format === 'org.matrix.custom.html' && typeof formattedBody === 'string'; + const hasPlainTextReply = typeof body === 'string' && body !== ''; // An encrypted event that hasn't been decrypted yet (keys pending) has an // empty result from getClearContent(). Treat it as still-loading rather @@ -157,22 +174,16 @@ export const Reply = as<'div', ReplyProps>( [mx, room.roomId, mentionClickHandler, nicknames] ); - if (format === 'org.matrix.custom.html' && formattedBody) { - const strippedHtml = trimReplyFromFormattedBody(formattedBody) - .replaceAll(//gi, ' ') - .replaceAll(/<\/p>\s*]*>/gi, ' ') - .replaceAll(/<\/?p[^>]*>/gi, '') - .replaceAll(/<\/li>\s*]*>/gi, ' ') - .replaceAll(/<\/?(ul|ol|li|blockquote|h[1-6]|pre|div)[^>]*>/gi, '') - .replaceAll(/(?:\r\n|\r|\n)/g, ' '); + if (isFormattedReply && formattedBody !== '') { + const sanitizedHtml = sanitizeReplyFormattedPreview(formattedBody); const parserOpts = getReactCustomHtmlParser(mx, room.roomId, { linkifyOpts: replyLinkifyOpts, useAuthentication, nicknames, handleMentionClick: mentionClickHandler, }); - bodyJSX = parse(strippedHtml, parserOpts) as JSX.Element; - } else if (body) { + bodyJSX = parse(sanitizedHtml, parserOpts) as JSX.Element; + } else if (hasPlainTextReply) { const strippedBody = trimReplyFromBody(body).replaceAll(/(?:\r\n|\r|\n)/g, ' '); bodyJSX = scaleSystemEmoji(strippedBody); } else if (eventType === StateEvent.RoomMember && !!replyEvent) { @@ -230,6 +241,13 @@ export const Reply = as<'div', ReplyProps>( ); } + let replyContent = bodyJSX; + if (isBlockedSender) { + replyContent = ; + } else if (badEncryption) { + replyContent = ; + } + return ( {threadRootId && ( @@ -254,11 +272,7 @@ export const Reply = as<'div', ReplyProps>( > {replyEvent !== undefined && !isPendingDecrypt ? ( - {(() => { - if (isBlockedSender) return ; - if (badEncryption) return ; - return bodyJSX; - })()} + {replyContent} ) : ( (isRedacted && ) || ( diff --git a/src/app/components/message/ThreadIndicator.test.tsx b/src/app/components/message/ThreadIndicator.test.tsx index d06e1f15e..379255c1a 100644 --- a/src/app/components/message/ThreadIndicator.test.tsx +++ b/src/app/components/message/ThreadIndicator.test.tsx @@ -14,7 +14,7 @@ import { describe, it, expect } from 'vitest'; import { render, screen } from '@testing-library/react'; import { RelationType } from '$types/matrix-sdk'; -import { ThreadIndicator } from './Reply'; +import { sanitizeReplyFormattedPreview, ThreadIndicator } from './Reply'; function Subject({ relType, threadRootId }: { relType?: string; threadRootId?: string }) { return <>{relType === RelationType.Thread && !threadRootId && }; @@ -41,3 +41,26 @@ describe('ThreadIndicator visibility in compose strip', () => { expect(screen.queryByText('Thread')).not.toBeInTheDocument(); }); }); + +describe('sanitizeReplyFormattedPreview', () => { + it('removes mx-reply quote block content and keeps message text', () => { + const html = '
quoted

Visible message

'; + + const result = sanitizeReplyFormattedPreview(html); + + expect(result).not.toContain('quoted'); + expect(result).toContain('Visible message'); + }); + + it('sanitizes dangerous HTML before parse', () => { + const html = + '
old

safe

x'; + + const result = sanitizeReplyFormattedPreview(html); + + expect(result).not.toContain('') + ? sanitizeText(originalBody).replaceAll('\n', '
') : sanitizeCustomHtml(originalFormattedBody); newBodyHtml = `
` + - `

${sanitizeCustomHtml(bodyModifText)}

` + + `

${sanitizeText(bodyModifText)}

` + `
${safeHtml}
` + `
`; } @@ -224,6 +224,8 @@ export function MessageForwardInternal({ } : {}; const baseContent = { ...mEvent.getContent() }; + delete baseContent['m.relates_to']; // remove relations from the forwarded message + delete baseContent['m.mentions']; // remove mentions from forwarded message delete baseContent['com.beeper.per_message_profile']; // remove per-message profile as that could confuse clients in the target room let content; // handle privacy stuff @@ -232,8 +234,6 @@ export function MessageForwardInternal({ // we can still include the original message content in the body of the message, so we'll just use a fallback text/plain content with the original message body content = { ...baseContent, - 'm.relates_to': null, // remove any relations to avoid confusion in the target room - 'm.mentions': null, // remove mentions to avoid leaking information about users in the original room ...forwardedTextContent, 'moe.sable.message.forward': { v: 1, @@ -249,10 +249,6 @@ export function MessageForwardInternal({ content = { ...baseContent, ...forwardedTextContent, - 'm.relates_to': { - rel_type: 'm.reference', - event_id: eventId, - }, 'moe.sable.message.forward': { v: 1, is_forwarded: true, diff --git a/src/app/components/room-avatar/RoomAvatar.tsx b/src/app/components/room-avatar/RoomAvatar.tsx index 356d9dbc2..33f9f6881 100644 --- a/src/app/components/room-avatar/RoomAvatar.tsx +++ b/src/app/components/room-avatar/RoomAvatar.tsx @@ -1,6 +1,6 @@ import { JoinRule } from '$types/matrix-sdk'; import { AvatarFallback, Icon, Icons, color } from 'folds'; -import { ComponentProps, ReactNode, forwardRef, useState } from 'react'; +import { ComponentProps, ReactNode, forwardRef, useEffect, useState } from 'react'; import { getRoomIconSrc } from '$utils/room'; import colorMXID from '$utils/colorMXID'; import * as css from './RoomAvatar.css'; @@ -17,6 +17,10 @@ type RoomAvatarProps = { export function RoomAvatar({ roomId, src, alt, renderFallback, uniformIcons }: RoomAvatarProps) { const [error, setError] = useState(false); + useEffect(() => { + setError(false); + }, [src]); + if (!src || error) { return ( s.startsWith('v='), params)?.split('v=')[1]; - } + params = split[1]?.split('&'); + } else if (url.includes('/shorts/')) { + const split = path.split('?'); + [videoId] = split; + params = split[1]?.split('&') ?? []; + } else if (url.includes('youtube.com')) { + params = path.split('?')[1]?.split('&') ?? []; + videoId = params.find((s) => s.startsWith('v='))?.split('v=')[1]; + } else return null; if (!videoId) return null; // playlist is not used for the embed, it can be appended as is - const playlist = params.find((s) => s.startsWith('list='), params); - const timestamp = params.find((s) => s.startsWith('t='), params)?.split('t=')[1]; + const playlist = params ? params.find((s) => s.startsWith('list=')) : undefined; + const timestamp = params ? params.find((s) => s.startsWith('t='))?.split('t=')[1] : undefined; return { videoId, diff --git a/src/app/components/url-preview/UrlPreviewCard.tsx b/src/app/components/url-preview/UrlPreviewCard.tsx index 62106a00a..3ac780f74 100644 --- a/src/app/components/url-preview/UrlPreviewCard.tsx +++ b/src/app/components/url-preview/UrlPreviewCard.tsx @@ -14,6 +14,23 @@ import { ImageViewer } from '../image-viewer'; const linkStyles = { color: color.Success.Main }; +// Module-level in-flight deduplication: prevents N+1 concurrent requests when a +// large event batch renders many UrlPreviewCard instances for the same URL. +// Scoped by MatrixClient to avoid cross-account dedup if multiple clients exist. +// Inner cache keyed by URL only (not ts) — the same URL shows the same preview +// regardless of which message referenced it. Promises are evicted after settling +// so a later render can retry after network recovery. +const previewRequestCache = new WeakMap>>(); + +const getClientCache = (mx: any): Map> => { + let clientCache = previewRequestCache.get(mx); + if (!clientCache) { + clientCache = new Map(); + previewRequestCache.set(mx, clientCache); + } + return clientCache; +}; + const openMediaInNewTab = async (url: string | undefined) => { if (!url) { console.warn('Attempted to open an empty url'); @@ -34,7 +51,13 @@ export const UrlPreviewCard = as<'div', { url: string; ts: number; mediaType?: s const [previewStatus, loadPreview] = useAsyncCallback( useCallback(() => { if (isDirect) return Promise.resolve(null); - return mx.getUrlPreview(url, ts); + const clientCache = getClientCache(mx); + const cached = clientCache.get(url); + if (cached !== undefined) return cached; + const urlPreview = mx.getUrlPreview(url, ts); + clientCache.set(url, urlPreview); + urlPreview.finally(() => clientCache.delete(url)); + return urlPreview; }, [url, ts, mx, isDirect]) ); diff --git a/src/app/components/user-avatar/UserAvatar.tsx b/src/app/components/user-avatar/UserAvatar.tsx index 3659cb305..3b9606e7b 100644 --- a/src/app/components/user-avatar/UserAvatar.tsx +++ b/src/app/components/user-avatar/UserAvatar.tsx @@ -1,5 +1,5 @@ import { AvatarFallback, AvatarImage, color } from 'folds'; -import { ReactEventHandler, ReactNode, useState } from 'react'; +import { ReactEventHandler, ReactNode, useEffect, useState } from 'react'; import classNames from 'classnames'; import colorMXID from '$utils/colorMXID'; import * as css from './UserAvatar.css'; @@ -14,6 +14,10 @@ type UserAvatarProps = { export function UserAvatar({ className, userId, src, alt, renderFallback }: UserAvatarProps) { const [error, setError] = useState(false); + useEffect(() => { + setError(false); + }, [src]); + const handleLoad: ReactEventHandler = (evt) => { evt.currentTarget.setAttribute('data-image-loaded', 'true'); }; diff --git a/src/app/features/room/RoomInput.tsx b/src/app/features/room/RoomInput.tsx index 3b36b0d7f..70eca4dc2 100644 --- a/src/app/features/room/RoomInput.tsx +++ b/src/app/features/room/RoomInput.tsx @@ -7,6 +7,7 @@ import { useEffect, useRef, useState, + useMemo, } from 'react'; import { useAtom, useAtomValue } from 'jotai'; import { isKeyHotkey } from 'is-hotkey'; @@ -143,7 +144,9 @@ import { } from '$hooks/usePerMessageProfile'; import { Microphone, Stop } from '@phosphor-icons/react'; import { getSupportedAudioExtension } from '$plugins/voice-recorder-kit/supportedCodec'; -import { sanitizeCustomHtml } from '$utils/sanitize'; +import { sanitizeText } from '$utils/sanitize'; +import { PKitCommandMessageHandler } from '$plugins/pluralkit-handler/PKitCommandMessageHandler'; +import { PKitProxyMessageHandler } from '$plugins/pluralkit-handler/PKitProxyMessageHandler'; import { SchedulePickerDialog } from './schedule-send'; import * as css from './schedule-send/SchedulePickerDialog.css'; import { @@ -249,6 +252,20 @@ export const RoomInput = forwardRef( const [hideActivity] = useSetting(settingsAtom, 'hideActivity'); const [mentionInReplies] = useSetting(settingsAtom, 'mentionInReplies'); const commands = useCommands(mx, room); + /** + * handle pluralkit-style messages + */ + const pluralkitCmdMessageHandler = useMemo( + () => new PKitCommandMessageHandler(mx, room), + [mx, room] + ); + const pluralkitProxyMessageHandler = useMemo(() => new PKitProxyMessageHandler(mx), [mx]); + useEffect(() => { + pluralkitProxyMessageHandler.init(); + }, [pluralkitProxyMessageHandler]); + + const [pkCompatEnable] = useSetting(settingsAtom, 'pkCompat'); + const [pmpProxyingEnable] = useSetting(settingsAtom, 'pmpProxying'); const emojiBtnRef = useRef(null); const micBtnRef = useRef(null); const roomToParents = useAtomValue(roomToParentsAtom); @@ -707,6 +724,13 @@ export const RoomInput = forwardRef( return; } + // check if its a pk command + if (pkCompatEnable && PKitCommandMessageHandler.isPKCommand(plainText)) { + pluralkitCmdMessageHandler.handleMessage(plainText); + resetEditor(editor); // clear the editor + return; // don't do anything besides handling the command + } + if (commandName) { plainText = trimCommand(commandName, plainText); customHtml = trimCommand(commandName, customHtml); @@ -763,8 +787,13 @@ export const RoomInput = forwardRef( * This allows the server to apply the correct profile-based transformations (e.g. font size adjustments) when processing the message, * and also allows clients to display an accurate preview of how the message will look with the profile applied while it's being composed. */ - const perMessageProfile = await getCurrentlyUsedPerMessageProfileForRoom(mx, roomId); + const perMessageProfile = + pmpProxyingEnable && pluralkitProxyMessageHandler.isAProxiedMessage(plainText) + ? await pluralkitProxyMessageHandler.getPmpBasedOnMessage(plainText) + : await getCurrentlyUsedPerMessageProfileForRoom(mx, roomId); + if (pmpProxyingEnable && pluralkitProxyMessageHandler.isAProxiedMessage(plainText)) + plainText = pluralkitProxyMessageHandler.stripProxyFromMessage(plainText) ?? plainText; if (perMessageProfile) { content['com.beeper.per_message_profile'] = convertPerMessageProfileToBeeperFormat( perMessageProfile, @@ -783,7 +812,7 @@ export const RoomInput = forwardRef( /** * html escaped version of the display name */ - const escapedName = sanitizeCustomHtml(perMessageProfile.name); + const escapedName = sanitizeText(perMessageProfile.name); const htmlPrefix = `${escapedName}: `; @@ -894,19 +923,23 @@ export const RoomInput = forwardRef( }, [ editor, replyEvent, - isMarkdown, - canSendReaction, mx, roomId, + isMarkdown, + canSendReaction, + pkCompatEnable, replyDraft, silentReply, + pmpProxyingEnable, + pluralkitProxyMessageHandler, scheduledTime, editingScheduledDelayId, nicknames, + room, handleQuickReact, + pluralkitCmdMessageHandler, commands, sendTypingStatus, - room, queryClient, threadRootId, setReplyDraft, diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index 94b1ad696..fb4b33515 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -209,6 +209,14 @@ export function RoomTimeline({ const topSpacerHeightRef = useRef(0); const mountScrollWindowRef = useRef(Date.now() + 3000); const hasInitialScrolledRef = useRef(false); + // Stored in a ref so eventsLength fluctuations (e.g. onLifecycle timeline reset + // firing within the window) cannot cancel it via useLayoutEffect cleanup. + const initialScrollTimerRef = useRef | undefined>(undefined); + // Set to true when the 80 ms timer fires but processedEvents is still empty + // (e.g. the onLifecycle reset cleared the timeline before events refilled it). + // A recovery useLayoutEffect watches for processedEvents becoming non-empty + // and performs the final scroll + setIsReady when this flag is set. + const pendingReadyRef = useRef(false); const currentRoomIdRef = useRef(room.roomId); const [isReady, setIsReady] = useState(false); @@ -217,6 +225,11 @@ export function RoomTimeline({ hasInitialScrolledRef.current = false; mountScrollWindowRef.current = Date.now() + 3000; currentRoomIdRef.current = room.roomId; + pendingReadyRef.current = false; + if (initialScrollTimerRef.current !== undefined) { + clearTimeout(initialScrollTimerRef.current); + initialScrollTimerRef.current = undefined; + } setIsReady(false); } @@ -272,18 +285,45 @@ export function RoomTimeline({ !eventId && !hasInitialScrolledRef.current && timelineSync.eventsLength > 0 && + // Guard: only scroll once the timeline reflects the current room's live + // timeline. Without this, a render with stale data from the previous room + // (before the room-change reset propagates) fires the scroll at the wrong + // position and marks hasInitialScrolledRef = true, preventing the correct + // scroll when the right data arrives. + timelineSync.liveTimelineLinked && vListRef.current ) { vListRef.current.scrollToIndex(processedEventsRef.current.length - 1, { align: 'end' }); - const t = setTimeout(() => { - vListRef.current?.scrollToIndex(processedEventsRef.current.length - 1, { align: 'end' }); - setIsReady(true); + // Store in a ref rather than a local so subsequent eventsLength changes + // (e.g. the onLifecycle timeline reset firing within 80 ms) do NOT + // cancel this timer through the useLayoutEffect cleanup. + initialScrollTimerRef.current = setTimeout(() => { + initialScrollTimerRef.current = undefined; + if (processedEventsRef.current.length > 0) { + vListRef.current?.scrollToIndex(processedEventsRef.current.length - 1, { align: 'end' }); + // Only mark ready once we've successfully scrolled. If processedEvents + // was empty when the timer fired (e.g. the onLifecycle reset cleared the + // timeline within the 80 ms window), defer setIsReady until the recovery + // effect below fires once events repopulate. + setIsReady(true); + } else { + pendingReadyRef.current = true; + } }, 80); hasInitialScrolledRef.current = true; - return () => clearTimeout(t); } - return () => {}; - }, [timelineSync.eventsLength, eventId, room.roomId]); + // No cleanup return — the timer must survive eventsLength fluctuations. + // It is cancelled on unmount by the dedicated effect below. + }, [timelineSync.eventsLength, timelineSync.liveTimelineLinked, eventId, room.roomId]); + + // Cancel the initial-scroll timer on unmount (the useLayoutEffect above + // intentionally does not cancel it when deps change). + useEffect( + () => () => { + if (initialScrollTimerRef.current !== undefined) clearTimeout(initialScrollTimerRef.current); + }, + [] + ); const recalcTopSpacer = useCallback(() => { const v = vListRef.current; @@ -357,6 +397,11 @@ export function RoomTimeline({ useEffect(() => { if (eventId) return; + // Guard: once the timeline is visible to the user, do not override their + // scroll position. Without this, a later timeline refresh (e.g. the + // onLifecycle reset delivering a new linkedTimelines reference) can fire + // this effect after isReady and snap the view back to the read marker. + if (isReady) return; const { readUptoEventId, inLiveTimeline, scrollTo } = unreadInfo ?? {}; if (readUptoEventId && inLiveTimeline && scrollTo) { const evtTimeline = getEventTimeline(room, readUptoEventId); @@ -368,12 +413,16 @@ export function RoomTimeline({ ) : undefined; - if (absoluteIndex !== undefined && vListRef.current) { + if (absoluteIndex !== undefined) { const processedIndex = getRawIndexToProcessedIndex(absoluteIndex); - if (processedIndex !== undefined) { + if (processedIndex !== undefined && vListRef.current) { vListRef.current.scrollToIndex(processedIndex, { align: 'start' }); - setUnreadInfo((prev) => (prev ? { ...prev, scrollTo: false } : prev)); } + // Always consume the scroll intent once the event is located in the + // linked timelines, even if its processedIndex is undefined (filtered + // event). Without this, each linkedTimelines reference change retries + // the scroll indefinitely. + setUnreadInfo((prev) => (prev ? { ...prev, scrollTo: false } : prev)); } } }, [ @@ -381,6 +430,7 @@ export function RoomTimeline({ unreadInfo, timelineSync.timeline.linkedTimelines, eventId, + isReady, getRawIndexToProcessedIndex, ]); @@ -674,6 +724,18 @@ export function RoomTimeline({ processedEventsRef.current = processedEvents; + // Recovery: if the 80 ms initial-scroll timer fired while processedEvents was + // empty (timeline was mid-reset), scroll to bottom and reveal the timeline once + // events repopulate. Fires on every processedEvents.length change but is + // guarded by pendingReadyRef so it only acts once per initial-scroll attempt. + useLayoutEffect(() => { + if (!pendingReadyRef.current) return; + if (processedEvents.length === 0) return; + pendingReadyRef.current = false; + vListRef.current?.scrollToIndex(processedEvents.length - 1, { align: 'end' }); + setIsReady(true); + }, [processedEvents.length]); + useEffect(() => { if (!onEditLastMessageRef) return; const ref = onEditLastMessageRef; diff --git a/src/app/features/room/message/MessageEditor.tsx b/src/app/features/room/message/MessageEditor.tsx index 22c63ce26..ad25ba45f 100644 --- a/src/app/features/room/message/MessageEditor.tsx +++ b/src/app/features/room/message/MessageEditor.tsx @@ -72,7 +72,7 @@ import { HTMLReactParserOptions } from 'html-react-parser'; import { useMediaAuthentication } from '$hooks/useMediaAuthentication'; import { Opts as LinkifyOpts } from 'linkifyjs'; import { GetContentCallback } from '$types/matrix/room'; -import { sanitizeCustomHtml } from '$utils/sanitize'; +import { sanitizeText } from '$utils/sanitize'; type MessageEditorProps = { roomId: string; @@ -204,7 +204,7 @@ export const MessageEditor = as<'div', MessageEditorProps>( plainText = bodyPrefix + plainText; } - const escapedName = sanitizeCustomHtml(pmpDisplayname); + const escapedName = sanitizeText(pmpDisplayname); const htmlPrefix = `${escapedName}: `; if (!customHtml.startsWith(htmlPrefix)) { customHtml = htmlPrefix + customHtml; diff --git a/src/app/features/settings/Persona/PKCompat.tsx b/src/app/features/settings/Persona/PKCompat.tsx new file mode 100644 index 000000000..f69644df0 --- /dev/null +++ b/src/app/features/settings/Persona/PKCompat.tsx @@ -0,0 +1,52 @@ +import { SequenceCard } from '$components/sequence-card'; +import { SettingTile } from '$components/setting-tile'; +import { useSetting } from '$state/hooks/settings'; +import { settingsAtom } from '$state/settings'; +import { Box, Switch, Text } from 'folds'; +import { SequenceCardStyle } from '../styles.css'; + +export function PKCompatSettings() { + const [usePKCompat, setUsePKCompat] = useSetting(settingsAtom, 'pkCompat'); + const [usePmpProxying, setUsePmpProxying] = useSetting(settingsAtom, 'pmpProxying'); + + return ( + + Limited Compatibility with PluralKit-like functions + + + } + /> + + } + /> + + + ); +} diff --git a/src/app/features/settings/Persona/PerMessageProfileOverview.tsx b/src/app/features/settings/Persona/PerMessageProfileOverview.tsx index 6ed0dcef0..7a3ba574a 100644 --- a/src/app/features/settings/Persona/PerMessageProfileOverview.tsx +++ b/src/app/features/settings/Persona/PerMessageProfileOverview.tsx @@ -6,6 +6,7 @@ import { } from '$hooks/usePerMessageProfile'; import { useEffect, useState } from 'react'; import { Box, Button, Text } from 'folds'; +import { generateShortId } from '$utils/shortIdGen'; import { PerMessageProfileEditor } from './PerMessageProfileEditor'; /** @@ -36,7 +37,7 @@ export function PerMessageProfileOverview() {