diff --git a/.changeset/add_graceful_fail_if_msc4140_event_delay_exceeded.md b/.changeset/add_graceful_fail_if_msc4140_event_delay_exceeded.md new file mode 100644 index 000000000..f7c79c885 --- /dev/null +++ b/.changeset/add_graceful_fail_if_msc4140_event_delay_exceeded.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +Add graceful fail if MSC4140 event delay exceeded diff --git a/.changeset/fix-matrix-to-link-wrapping.md b/.changeset/fix-matrix-to-link-wrapping.md new file mode 100644 index 000000000..ef186b922 --- /dev/null +++ b/.changeset/fix-matrix-to-link-wrapping.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +Matrix.to links sent without explicit markdown formatting are sent as raw links instead of html links. diff --git a/.github/workflows/flake-lock-fix.yml b/.github/workflows/flake-lock-fix.yml new file mode 100644 index 000000000..6ec90be35 --- /dev/null +++ b/.github/workflows/flake-lock-fix.yml @@ -0,0 +1,46 @@ +name: Fix flake hashes + +on: + push: + branches: [dev] + paths: ['pnpm-lock.yaml'] + +jobs: + fix: + name: Fix flake hashes + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + steps: + - name: Checkout dev + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: dev + persist-credentials: true + + - name: Install Determinate Nix + uses: DeterminateSystems/determinate-nix-action@bafaa638b9d5ec0e7e3ac1a7fc80453ef1fd265f # v3.20.0 + + - id: check + run: nix flake check -L + continue-on-error: true + + - name: Fix hash mismatches + if: steps.check.outcome == 'failure' + run: determinate-nixd fix hashes --auto-apply + + - name: Commit and push if changed + if: steps.check.outcome == 'failure' + shell: bash + run: | + set -euo pipefail + if git diff --quiet; then + echo "No changes after fix hashes; nothing to commit." + exit 0 + fi + git config user.name "sable-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add --update --ignore-removal . + git commit -m "chore(nix): auto-fix nix hashes" + git push origin HEAD:dev --force-with-lease diff --git a/.gitignore b/.gitignore index 7ec719709..76af75542 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,12 @@ build.sh # the following line was added with nvim by Shea because its annoying to clear every so often .vscode/bookmarks.json + +# Nix things +## nix build output +result +## direnv config + local state +.envrc +.direnv +## auto-generated pre-commit config +.pre-commit-config.yaml diff --git a/.vscode/settings.json b/.vscode/settings.json index f2ceb43b5..60018f71d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,5 +12,7 @@ }, "[json]": { "editor.defaultFormatter": "oxc.oxc-vscode" - } + }, + "nixEnvSelector.nixFile": "${workspaceFolder}/flake.nix", + "nixEnvSelector.useFlakes": true } diff --git a/CHANGELOG.md b/CHANGELOG.md index dba3ee6c1..973d89b59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Sable Client Changelog +## 1.15.3 (2026-05-09) + +### Fixes + +* Self-hosted deployments can set optional `settingsDefaults` in `config.json` to override built-in client settings. See the README for details. ([#785]() by @7w1) +* Updated the math detection to avoid accidental detection when talking about math or spamming dollar signs. ([#779]() by @7w1) +* Added a couple new settings for max incoming inline image height and default height for unspecified. http://localhost:8080/settings/appearance?focus=incoming-inline-images-default-height&moe.sable.client.action=settings ([#772]() by @7w1) +* Fixed links with suppressed previews not having the arrow brackets readded when editing a message. ([#772]() by @7w1) +* Added the ability to cap preview embed size. http://localhost:8080/settings/appearance?focus=link-preview-image-max-height&moe.sable.client.action=settings ([#783]() by @7w1) +* Fix the inconsistent sizing for the read receipt dialog boxes. ([#772]() by @7w1) +* Fixed room avatars set in the settings cosmetics menu not applying. ([#772]() by @7w1) +* Fix room names being overriden when only 1 other person is in a room. ([#784]() by @7w1) +* Fix small text being parsed in code blocks and not being escapeable. ([#782]() by @7w1) +* Fixed the hang when a message that replies to a message has a reply, and you attempt to start a thread on that message. ([#778]() by @7w1) +* Fix RTL/LTR mixed text formatting and alignment in messages ([#743]() by @sinasadeghi83) +* Readded various missing settings from the settings sharing list. ([#765]() by @7w1) +* Various small adjustments to the themed profiles for better consistency. ([#777]() by @7w1) + ## 1.15.2 (2026-05-07) ### Fixes diff --git a/README.md b/README.md index 2a1f7d853..6a2434955 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,28 @@ After that, you can copy the dist/ directory to your server and serve it. * In the [`config.json`](config.json), you can modify the default homeservers, feature rooms/spaces, toggle the account switcher, and toggle experimental simplified slilding sync support. +#### Optional default client settings + +While the default settings are recommended for most users, you can optionally add a top-level `"settingsDefaults"` object whose keys match [client settings](src/app/state/settings.ts) (only fields you want to override) to override them. The default settings for any new logins will match these. Existing keys in local storage or users who chose to sync settings with their account data will still have their settings set. + +For example: + +```json +{ + "settingsDefaults": { + "hour24Clock": true, + "pageZoom": 110, + "messageLayout": 2, + "rightSwipeAction": "members", + "captionPosition": "below", + "renderUserCards": "both", + "jumboEmojiSize": "large" + } +} +``` + +Invalid or unknown keys are ignored. + * To deploy on subdirectory, you need to rebuild the app youself after updating the `base` path in [`build.config.ts`](build.config.ts). * For example, if you want to deploy on `https://sable.moe/app`, then set `base: '/app'`. diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..536adabd7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,142 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1777988971, + "narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776796298, + "narHash": "sha256-PcRvlWayisPSjd0UcRQbhG8Oqw78AcPE6x872cPRHN8=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "3cfd774b0a530725a077e17354fbdb87ea1c4aad", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1777954456, + "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1777168982, + "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775636079, + "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..822e02de3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,181 @@ +# SPDX-License-Identifier: AGPL-3.0 +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + git-hooks.url = "github:cachix/git-hooks.nix"; + git-hooks.inputs.nixpkgs.follows = "nixpkgs"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = + inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + inputs.git-hooks.flakeModule + inputs.treefmt-nix.flakeModule + ]; + + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + perSystem = + { + config, + pkgs, + lib, + ... + }: + let + self = inputs.self; + + packageJson = builtins.fromJSON (builtins.readFile ./package.json); + + nodejs = pkgs.nodejs_24; + pnpm = pkgs.pnpm_10; + pnpmConfigHook = pkgs.pnpmConfigHook.override { inherit pnpm; }; + + pnpmNativeBuildInputs = [ + nodejs + pnpm + pnpmConfigHook + ]; + + mkPnpmDeps = + { + src, + version, + pnpmInstallFlags, + }: + pkgs.fetchPnpmDeps { + inherit + pnpm + src + version + pnpmInstallFlags + ; + pname = "sable"; + fetcherVersion = 3; + hash = "sha256-9QIBOF1d7Z086IsOAHpOayKA3uNY0e5imYQixHKFXxw="; + }; + + mkPnpmCheck = + name: script: + pkgs.stdenv.mkDerivation (finalAttrs: { + pname = "sable-${name}"; + inherit (packageJson) version; + src = lib.cleanSource ./.; + + pnpmInstallFlags = [ "--ignore-scripts" ]; + + pnpmDeps = mkPnpmDeps { + inherit (finalAttrs) src version pnpmInstallFlags; + }; + + nativeBuildInputs = pnpmNativeBuildInputs; + + buildPhase = '' + runHook preBuild + pnpm run ${script} + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + touch $out + runHook postInstall + ''; + + doCheck = false; + }); + in + { + treefmt = { + projectRootFile = "flake.nix"; + programs = { + nixfmt.enable = true; + oxfmt.enable = true; + }; + settings.global.excludes = [ + "dist" + "node_modules" + "pnpm-lock.yaml" + "pnpm-workspace.yaml" + "package.json" + "LICENSE" + "CHANGELOG.md" + "./changeset" + ]; + }; + pre-commit.settings.hooks = { + treefmt = { + enable = true; + package = config.treefmt.build.wrapper; + }; + }; + + packages.sable = pkgs.stdenv.mkDerivation (finalAttrs: { + pname = "sable"; + inherit (packageJson) version; + src = lib.cleanSource ./.; + + # ignoring knope for building + pnpmInstallFlags = [ "--ignore-scripts" ]; + + pnpmDeps = mkPnpmDeps { + inherit (finalAttrs) src version pnpmInstallFlags; + }; + + nativeBuildInputs = pnpmNativeBuildInputs; + + env.VITE_BUILD_HASH = self.shortRev or self.dirtyShortRev or ""; + env.VITE_IS_RELEASE_TAG = "false"; + + buildPhase = '' + runHook preBuild + pnpm run build + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + cp -r dist $out + runHook postInstall + ''; + }); + + packages.default = config.packages.sable; + + checks = { + build = config.packages.sable; + lint = mkPnpmCheck "lint" "lint"; + fmt = mkPnpmCheck "fmt" "fmt:check"; + test = mkPnpmCheck "test" "test:run"; + typecheck = mkPnpmCheck "typecheck" "typecheck"; + knip = mkPnpmCheck "knip" "knip"; + }; + + devShells.default = pkgs.mkShell { + packages = [ + nodejs + pnpm + pkgs.corepack + pkgs.vitejs + pkgs.oxlint + pkgs.oxfmt + pkgs.knope + pkgs.typescript + pkgs.typescript-language-server + pkgs.nil + pkgs.nixd + ]; + shellHook = config.pre-commit.installationScript; + }; + }; + }; +} diff --git a/oxfmt.config.ts b/oxfmt.config.ts index 593c2425c..c193a0268 100644 --- a/oxfmt.config.ts +++ b/oxfmt.config.ts @@ -1,6 +1,6 @@ -import { defineConfig } from 'oxfmt'; +import type { OxfmtConfig } from 'oxfmt'; -export default defineConfig({ +export default { printWidth: 100, tabWidth: 2, singleQuote: true, @@ -15,4 +15,4 @@ export default defineConfig({ 'CHANGELOG.md', './changeset', ], -}); +} satisfies OxfmtConfig; diff --git a/package.json b/package.json index cdcb0dea1..2438fcddf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sable", - "version": "1.15.2", + "version": "1.15.3", "description": "An almost stable Matrix client", "type": "module", "packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b5c82dbe2..ee7836185 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.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) + version: 5.1.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2))(yaml@2.8.2) await-to-js: specifier: ^3.0.0 version: 3.0.0 @@ -207,7 +207,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.1)(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.47.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) @@ -258,7 +258,7 @@ importers: 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.1)(yaml@2.8.2)) + version: 5.1.4(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2)) '@vitest/coverage-v8': specifier: ^4.1.0 version: 4.1.0(vitest@4.1.0) @@ -291,25 +291,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.1)(yaml@2.8.2) + version: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.1)(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.47.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.1)(yaml@2.8.2)) + version: 3.2.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.1)(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.47.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.1)(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.47.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.1)(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.47.1)(yaml@2.8.2)) wrangler: specifier: ^4.70.0 version: 4.72.0 @@ -319,8 +319,8 @@ packages: '@adobe/css-tools@4.4.4': resolution: {integrity: sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg==} - '@apideck/better-ajv-errors@0.3.6': - resolution: {integrity: sha512-P+ZygBLZtkp0qqOAJJVX4oX/sFo5JR3eBWwwuqHHhK0GIgQOKWrAfiAaWX0aArHkRWHMuggFEgAZNxVPwPZYaA==} + '@apideck/better-ajv-errors@0.3.7': + resolution: {integrity: sha512-TajUJwGWbDwkCx/CZi7tRE8PVB7simCvKJfHUsSdvps+aTM/PDPP4gkLmKnc+x3CE//y9i/nj74GqdL/hwk7Iw==} engines: {node: '>=10'} peerDependencies: ajv: '>=8' @@ -356,6 +356,10 @@ packages: resolution: {integrity: sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==} engines: {node: '>=6.9.0'} + '@babel/compat-data@7.29.3': + resolution: {integrity: sha512-LIVqM46zQWZhj17qA8wb4nW/ixr2y1Nw+r1etiAWgRM6U1IqP+LNhL1yg440jYZR72jCWcWbLWzIosH+uP1fqg==} + engines: {node: '>=6.9.0'} + '@babel/core@7.29.0': resolution: {integrity: sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==} engines: {node: '>=6.9.0'} @@ -372,8 +376,8 @@ packages: resolution: {integrity: sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==} engines: {node: '>=6.9.0'} - '@babel/helper-create-class-features-plugin@7.28.6': - resolution: {integrity: sha512-dTOdvsjnG3xNT9Y0AUg1wAl38y+4Rl4sf9caSQZOXdNqVn+H+HbbJ4IyyHaIqNR6SW9oJpA/RuRjsjCw2IdIow==} + '@babel/helper-create-class-features-plugin@7.29.3': + resolution: {integrity: sha512-RpLYy2sb51oNLjuu1iD3bwBqCBWUzjO0ocp+iaCP/lJtb2CPLcnC2Fftw+4sAzaMELGeWTgExSKADbdo0GFVzA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 @@ -474,6 +478,12 @@ packages: peerDependencies: '@babel/core': ^7.0.0 + '@babel/plugin-bugfix-safari-rest-destructuring-rhs-array@7.29.3': + resolution: {integrity: sha512-SRS46DFR4HqzUzCVgi90/xMoL+zeBDBvWdKYXSEzh79kXswNFEglUpMKxR04//dPqwYXWUBJ3mpUd933ru9Kmg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.27.1': resolution: {integrity: sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw==} engines: {node: '>=6.9.0'} @@ -666,8 +676,8 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-transform-modules-systemjs@7.29.0': - resolution: {integrity: sha512-PrujnVFbOdUpw4UHiVwKvKRLMMic8+eC0CuNlxjsyZUiBjhFdPsewdXCkveh2KqBA9/waD0W1b4hXSOBQJezpQ==} + '@babel/plugin-transform-modules-systemjs@7.29.4': + resolution: {integrity: sha512-N7QmZ0xRZfjHOfZeQLJjwgX2zS9pdGHSVl/cjSGlo4dXMqvurfxXDMKY4RqEKzPozV78VMcd0lxyG13mlbKc4w==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -834,8 +844,8 @@ packages: peerDependencies: '@babel/core': ^7.0.0 - '@babel/preset-env@7.29.2': - resolution: {integrity: sha512-DYD23veRYGvBFhcTY1iUvJnDNpuqNd/BzBwCvzOTKUnJjKg5kpUBh3/u9585Agdkgj+QuygG7jLfOPWMa2KVNw==} + '@babel/preset-env@7.29.5': + resolution: {integrity: sha512-/69t2aEzGKHD76DyLbHysF/QH2LJOB8iFnYO37unDTKBTubzcMRv0f3H5EiN1Q6ajOd/eB7dAInF0qdFVS06kA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -3094,8 +3104,8 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} - ajv@8.18.0: - resolution: {integrity: sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==} + ajv@8.20.0: + resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==} another-json@0.2.0: resolution: {integrity: sha512-/Ndrl68UQLhnCdsAzEXLMFuOR546o2qbYRqCglaNHbjXrwG1ayTcdwr3zkSGOGtGXDyR5X9nCFfnyG2AFJIsqg==} @@ -3189,6 +3199,11 @@ packages: engines: {node: '>=6.0.0'} hasBin: true + baseline-browser-mapping@2.10.27: + resolution: {integrity: sha512-zEs/ufmZoUd7WftKpKyXaT6RFxpQ5Qm9xytKRHvJfxFV9DFJkZph9RvJ1LcOUi0Z1ZVijMte65JbILeV+8QQEA==} + engines: {node: '>=6.0.0'} + hasBin: true + bidi-js@1.0.3: resolution: {integrity: sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==} @@ -3209,6 +3224,10 @@ packages: resolution: {integrity: sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==} engines: {node: 18 || 20 || >=22} + brace-expansion@5.0.6: + resolution: {integrity: sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==} + engines: {node: 18 || 20 || >=22} + braces@3.0.3: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} @@ -3221,6 +3240,11 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true + browserslist@4.28.2: + resolution: {integrity: sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + bs58@6.0.0: resolution: {integrity: sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==} @@ -3238,8 +3262,8 @@ packages: resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} engines: {node: '>= 0.4'} - call-bind@1.0.8: - resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==} + call-bind@1.0.9: + resolution: {integrity: sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==} engines: {node: '>= 0.4'} call-bound@1.0.4: @@ -3257,6 +3281,9 @@ packages: caniuse-lite@1.0.30001777: resolution: {integrity: sha512-tmN+fJxroPndC74efCdp12j+0rk0RHwV5Jwa1zWaFVyw2ZxAuPeG8ZgWC3Wz7uSjT3qMRQ5XHZ4COgQmsCMJAQ==} + caniuse-lite@1.0.30001792: + resolution: {integrity: sha512-hVLMUZFgR4JJ6ACt1uEESvQN1/dBVqPAKY0hgrV70eN3391K6juAfTjKZLKvOMsx8PxA7gsY1/tLMMTcfFLLpw==} + chai@6.2.2: resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==} engines: {node: '>=18'} @@ -3456,6 +3483,9 @@ packages: electron-to-chromium@1.5.307: resolution: {integrity: sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg==} + electron-to-chromium@1.5.352: + resolution: {integrity: sha512-9wHk8x6dyuimoe18EdiDPWKExNdxYqo4fn4FwOVVper6RxT3cmpBwBkWWfSOCYJjQdIco/nPhJhNLmn4Ufg1Yg==} + emojibase-data@15.3.2: resolution: {integrity: sha512-TpDyTDDTdqWIJixV5sTA6OQ0P0JfIIeK2tFRR3q56G9LK65ylAZ7z3KyBXokpvTTJ+mLUXQXbLNyVkjvnTLE+A==} peerDependencies: @@ -3482,8 +3512,8 @@ packages: error-stack-parser-es@1.0.5: resolution: {integrity: sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==} - es-abstract@1.24.1: - resolution: {integrity: sha512-zHXBLhP+QehSSbsS9Pt23Gg964240DPd6QCf8WpkqEXxQ7fhdZzYsocOr5u7apWonsS5EjZDmTF+/slGMyasvw==} + es-abstract@1.24.2: + resolution: {integrity: sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg==} engines: {node: '>= 0.4'} es-define-property@1.0.1: @@ -3559,8 +3589,8 @@ packages: fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - fast-uri@3.1.0: - resolution: {integrity: sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==} + fast-uri@3.1.2: + resolution: {integrity: sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==} fastq@1.20.1: resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==} @@ -3733,8 +3763,8 @@ packages: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} engines: {node: '>= 0.4'} - hasown@2.0.2: - resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + hasown@2.0.3: + resolution: {integrity: sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==} engines: {node: '>= 0.4'} hoist-non-react-statics@3.3.2: @@ -3839,8 +3869,8 @@ packages: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} - is-core-module@2.16.1: - resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==} + is-core-module@2.16.2: + resolution: {integrity: sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==} engines: {node: '>= 0.4'} is-data-view@1.0.2: @@ -4030,16 +4060,13 @@ packages: json-schema-traverse@1.0.0: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - json-schema@0.4.0: - resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==} - json5@2.2.3: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} hasBin: true - jsonfile@6.2.0: - resolution: {integrity: sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==} + jsonfile@6.2.1: + resolution: {integrity: sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==} jsonpointer@5.0.1: resolution: {integrity: sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==} @@ -4094,6 +4121,9 @@ packages: lodash@4.17.23: resolution: {integrity: sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==} + lodash@4.18.1: + resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==} + loglevel@1.9.2: resolution: {integrity: sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg==} engines: {node: '>= 0.6.0'} @@ -4182,6 +4212,10 @@ packages: resolution: {integrity: sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==} engines: {node: 18 || 20 || >=22} + minimatch@10.2.5: + resolution: {integrity: sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==} + engines: {node: 18 || 20 || >=22} + minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} @@ -4231,6 +4265,9 @@ packages: node-releases@2.0.36: resolution: {integrity: sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==} + node-releases@2.0.38: + resolution: {integrity: sha512-3qT/88Y3FbH/Kx4szpQQ4HzUbVrHPKTLVpVocKiLfoYvw9XSGOX2FmD2d6DrXbVYyAQTF2HeF6My8jmzx7/CRw==} + normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -4516,8 +4553,8 @@ packages: regjsgen@0.8.0: resolution: {integrity: sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==} - regjsparser@0.13.0: - resolution: {integrity: sha512-NZQZdC5wOE/H3UT28fVGL+ikOZcEzfMGk/c3iN9UGxzWHMa1op7274oyiUVrAG4B2EuFhus8SvkaYnhvW92p9Q==} + regjsparser@0.13.1: + resolution: {integrity: sha512-dLsljMd9sqwRkby8zhO1gSg3PnJIBFid8f4CQj/sXx+7cKx+E7u0PKhZ+U4wmhx7EfmtvnA318oVaIkAB1lRJw==} hasBin: true require-from-string@2.0.2: @@ -4531,8 +4568,8 @@ packages: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} - resolve@1.22.11: - resolution: {integrity: sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==} + resolve@1.22.12: + resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==} engines: {node: '>= 0.4'} hasBin: true @@ -4548,8 +4585,8 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - safe-array-concat@1.1.3: - resolution: {integrity: sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==} + safe-array-concat@1.1.4: + resolution: {integrity: sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==} engines: {node: '>=0.4'} safe-push-apply@1.0.0: @@ -4611,8 +4648,8 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - side-channel-list@1.0.0: - resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==} + side-channel-list@1.0.1: + resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==} engines: {node: '>= 0.4'} side-channel-map@1.0.1: @@ -4770,8 +4807,8 @@ packages: resolution: {integrity: sha512-G13vtMYPT/J8A4X2SjdtBTphZlrp1gKv6hZiOjw14RCWg6GbHuQBGtjlx75xLbYV/wEc0D7G5K4rxKP/cXk8Bw==} engines: {node: '>=10'} - terser@5.46.1: - resolution: {integrity: sha512-vzCjQO/rgUuK9sf8VJZvjqiqiHFaZLnOiimmUuOKODxWL8mm/xua7viT7aqX7dgPY60otQjUotzFMmCB4VdmqQ==} + terser@5.47.1: + resolution: {integrity: sha512-tPbLXTI6ohPASb/1YViL428oEHu6/qv1OxqYnfaonVCFHqx4+wCd95pHrQWsL5X4pl90CTyW9piSAsS2L0VoMw==} engines: {node: '>=10'} hasBin: true @@ -4919,6 +4956,7 @@ packages: uuid@10.0.0: resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). hasBin: true uuid@13.0.0: @@ -5226,10 +5264,9 @@ snapshots: '@adobe/css-tools@4.4.4': {} - '@apideck/better-ajv-errors@0.3.6(ajv@8.18.0)': + '@apideck/better-ajv-errors@0.3.7(ajv@8.20.0)': dependencies: - ajv: 8.18.0 - json-schema: 0.4.0 + ajv: 8.20.0 jsonpointer: 5.0.1 leven: 3.1.0 @@ -5277,6 +5314,8 @@ snapshots: '@babel/compat-data@7.29.0': {} + '@babel/compat-data@7.29.3': {} + '@babel/core@7.29.0': dependencies: '@babel/code-frame': 7.29.0 @@ -5317,7 +5356,7 @@ snapshots: lru-cache: 5.1.1 semver: 6.3.1 - '@babel/helper-create-class-features-plugin@7.28.6(@babel/core@7.29.0)': + '@babel/helper-create-class-features-plugin@7.29.3(@babel/core@7.29.0)': dependencies: '@babel/core': 7.29.0 '@babel/helper-annotate-as-pure': 7.27.3 @@ -5344,7 +5383,7 @@ snapshots: '@babel/helper-plugin-utils': 7.28.6 debug: 4.4.3 lodash.debounce: 4.0.8 - resolve: 1.22.11 + resolve: 1.22.12 transitivePeerDependencies: - supports-color @@ -5445,6 +5484,14 @@ snapshots: '@babel/core': 7.29.0 '@babel/helper-plugin-utils': 7.28.6 + '@babel/plugin-bugfix-safari-rest-destructuring-rhs-array@7.29.3(@babel/core@7.29.0)': + dependencies: + '@babel/core': 7.29.0 + '@babel/helper-plugin-utils': 7.28.6 + '@babel/helper-skip-transparent-expression-wrappers': 7.27.1 + transitivePeerDependencies: + - supports-color + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.27.1(@babel/core@7.29.0)': dependencies: '@babel/core': 7.29.0 @@ -5523,7 +5570,7 @@ snapshots: '@babel/plugin-transform-class-properties@7.28.6(@babel/core@7.29.0)': dependencies: '@babel/core': 7.29.0 - '@babel/helper-create-class-features-plugin': 7.28.6(@babel/core@7.29.0) + '@babel/helper-create-class-features-plugin': 7.29.3(@babel/core@7.29.0) '@babel/helper-plugin-utils': 7.28.6 transitivePeerDependencies: - supports-color @@ -5531,7 +5578,7 @@ snapshots: '@babel/plugin-transform-class-static-block@7.28.6(@babel/core@7.29.0)': dependencies: '@babel/core': 7.29.0 - '@babel/helper-create-class-features-plugin': 7.28.6(@babel/core@7.29.0) + '@babel/helper-create-class-features-plugin': 7.29.3(@babel/core@7.29.0) '@babel/helper-plugin-utils': 7.28.6 transitivePeerDependencies: - supports-color @@ -5655,7 +5702,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/plugin-transform-modules-systemjs@7.29.0(@babel/core@7.29.0)': + '@babel/plugin-transform-modules-systemjs@7.29.4(@babel/core@7.29.0)': dependencies: '@babel/core': 7.29.0 '@babel/helper-module-transforms': 7.28.6(@babel/core@7.29.0) @@ -5734,7 +5781,7 @@ snapshots: '@babel/plugin-transform-private-methods@7.28.6(@babel/core@7.29.0)': dependencies: '@babel/core': 7.29.0 - '@babel/helper-create-class-features-plugin': 7.28.6(@babel/core@7.29.0) + '@babel/helper-create-class-features-plugin': 7.29.3(@babel/core@7.29.0) '@babel/helper-plugin-utils': 7.28.6 transitivePeerDependencies: - supports-color @@ -5743,7 +5790,7 @@ snapshots: dependencies: '@babel/core': 7.29.0 '@babel/helper-annotate-as-pure': 7.27.3 - '@babel/helper-create-class-features-plugin': 7.28.6(@babel/core@7.29.0) + '@babel/helper-create-class-features-plugin': 7.29.3(@babel/core@7.29.0) '@babel/helper-plugin-utils': 7.28.6 transitivePeerDependencies: - supports-color @@ -5830,9 +5877,9 @@ 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.2(@babel/core@7.29.0)': + '@babel/preset-env@7.29.5(@babel/core@7.29.0)': dependencies: - '@babel/compat-data': 7.29.0 + '@babel/compat-data': 7.29.3 '@babel/core': 7.29.0 '@babel/helper-compilation-targets': 7.28.6 '@babel/helper-plugin-utils': 7.28.6 @@ -5840,6 +5887,7 @@ snapshots: '@babel/plugin-bugfix-firefox-class-in-computed-class-key': 7.28.5(@babel/core@7.29.0) '@babel/plugin-bugfix-safari-class-field-initializer-scope': 7.27.1(@babel/core@7.29.0) '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.27.1(@babel/core@7.29.0) + '@babel/plugin-bugfix-safari-rest-destructuring-rhs-array': 7.29.3(@babel/core@7.29.0) '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.27.1(@babel/core@7.29.0) '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly': 7.28.6(@babel/core@7.29.0) '@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.29.0) @@ -5871,7 +5919,7 @@ snapshots: '@babel/plugin-transform-member-expression-literals': 7.27.1(@babel/core@7.29.0) '@babel/plugin-transform-modules-amd': 7.27.1(@babel/core@7.29.0) '@babel/plugin-transform-modules-commonjs': 7.28.6(@babel/core@7.29.0) - '@babel/plugin-transform-modules-systemjs': 7.29.0(@babel/core@7.29.0) + '@babel/plugin-transform-modules-systemjs': 7.29.4(@babel/core@7.29.0) '@babel/plugin-transform-modules-umd': 7.27.1(@babel/core@7.29.0) '@babel/plugin-transform-named-capturing-groups-regex': 7.29.0(@babel/core@7.29.0) '@babel/plugin-transform-new-target': 7.27.1(@babel/core@7.29.0) @@ -5954,12 +6002,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.1)(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.47.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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2) wrangler: 4.72.0 ws: 8.18.0 transitivePeerDependencies: @@ -7560,7 +7608,7 @@ snapshots: '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-module: 1.0.0 - resolve: 1.22.11 + resolve: 1.22.12 optionalDependencies: rollup: 4.59.0 @@ -7574,7 +7622,7 @@ snapshots: dependencies: serialize-javascript: 7.0.5 smob: 1.6.1 - terser: 5.46.1 + terser: 5.47.1 optionalDependencies: rollup: 4.59.0 @@ -8075,12 +8123,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@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/compiler@0.3.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.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) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2) + vite-node: 3.2.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -8135,11 +8183,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.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)': + '@vanilla-extract/vite-plugin@5.1.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.1)(yaml@2.8.2) + '@vanilla-extract/compiler': 0.3.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -8155,7 +8203,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.1)(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.47.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) @@ -8163,7 +8211,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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2) transitivePeerDependencies: - supports-color @@ -8179,7 +8227,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.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.47.1)(yaml@2.8.2)) '@vitest/expect@4.1.0': dependencies: @@ -8190,13 +8238,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.1)(yaml@2.8.2))': + '@vitest/mocker@4.1.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2) '@vitest/pretty-format@4.1.0': dependencies: @@ -8225,7 +8273,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.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.47.1)(yaml@2.8.2)) '@vitest/utils@4.1.0': dependencies: @@ -8241,10 +8289,10 @@ snapshots: transitivePeerDependencies: - supports-color - ajv@8.18.0: + ajv@8.20.0: dependencies: fast-deep-equal: 3.1.3 - fast-uri: 3.1.0 + fast-uri: 3.1.2 json-schema-traverse: 1.0.0 require-from-string: 2.0.2 @@ -8275,9 +8323,9 @@ snapshots: arraybuffer.prototype.slice@1.0.4: dependencies: array-buffer-byte-length: 1.0.2 - call-bind: 1.0.8 + call-bind: 1.0.9 define-properties: 1.2.1 - es-abstract: 1.24.1 + es-abstract: 1.24.2 es-errors: 1.3.0 get-intrinsic: 1.3.0 is-array-buffer: 3.0.5 @@ -8304,7 +8352,7 @@ snapshots: babel-plugin-polyfill-corejs2@0.4.17(@babel/core@7.29.0): dependencies: - '@babel/compat-data': 7.29.0 + '@babel/compat-data': 7.29.3 '@babel/core': 7.29.0 '@babel/helper-define-polyfill-provider': 0.6.8(@babel/core@7.29.0) semver: 6.3.1 @@ -8336,6 +8384,8 @@ snapshots: baseline-browser-mapping@2.10.0: {} + baseline-browser-mapping@2.10.27: {} + bidi-js@1.0.3: dependencies: require-from-string: 2.0.2 @@ -8352,6 +8402,10 @@ snapshots: dependencies: balanced-match: 4.0.4 + brace-expansion@5.0.6: + dependencies: + balanced-match: 4.0.4 + braces@3.0.3: dependencies: fill-range: 7.1.1 @@ -8366,6 +8420,14 @@ snapshots: node-releases: 2.0.36 update-browserslist-db: 1.2.3(browserslist@4.28.1) + browserslist@4.28.2: + dependencies: + baseline-browser-mapping: 2.10.27 + caniuse-lite: 1.0.30001792 + electron-to-chromium: 1.5.352 + node-releases: 2.0.38 + update-browserslist-db: 1.2.3(browserslist@4.28.2) + bs58@6.0.0: dependencies: base-x: 5.0.1 @@ -8384,7 +8446,7 @@ snapshots: es-errors: 1.3.0 function-bind: 1.1.2 - call-bind@1.0.8: + call-bind@1.0.9: dependencies: call-bind-apply-helpers: 1.0.2 es-define-property: 1.0.1 @@ -8402,6 +8464,8 @@ snapshots: caniuse-lite@1.0.30001777: {} + caniuse-lite@1.0.30001792: {} + chai@6.2.2: {} chokidar@3.6.0: @@ -8442,7 +8506,7 @@ snapshots: core-js-compat@3.49.0: dependencies: - browserslist: 4.28.1 + browserslist: 4.28.2 cosmiconfig@8.3.6(typescript@5.9.3): dependencies: @@ -8582,6 +8646,8 @@ snapshots: electron-to-chromium@1.5.307: {} + electron-to-chromium@1.5.352: {} + emojibase-data@15.3.2(emojibase@15.3.1): dependencies: emojibase: 15.3.1 @@ -8600,12 +8666,12 @@ snapshots: error-stack-parser-es@1.0.5: {} - es-abstract@1.24.1: + es-abstract@1.24.2: dependencies: array-buffer-byte-length: 1.0.2 arraybuffer.prototype.slice: 1.0.4 available-typed-arrays: 1.0.7 - call-bind: 1.0.8 + call-bind: 1.0.9 call-bound: 1.0.4 data-view-buffer: 1.0.2 data-view-byte-length: 1.0.2 @@ -8624,7 +8690,7 @@ snapshots: has-property-descriptors: 1.0.2 has-proto: 1.2.0 has-symbols: 1.1.0 - hasown: 2.0.2 + hasown: 2.0.3 internal-slot: 1.1.0 is-array-buffer: 3.0.5 is-callable: 1.2.7 @@ -8642,7 +8708,7 @@ snapshots: object.assign: 4.1.7 own-keys: 1.0.1 regexp.prototype.flags: 1.5.4 - safe-array-concat: 1.1.3 + safe-array-concat: 1.1.4 safe-push-apply: 1.0.0 safe-regex-test: 1.1.0 set-proto: 1.0.0 @@ -8674,7 +8740,7 @@ snapshots: es-errors: 1.3.0 get-intrinsic: 1.3.0 has-tostringtag: 1.0.2 - hasown: 2.0.2 + hasown: 2.0.3 es-to-primitive@1.3.0: dependencies: @@ -8746,7 +8812,7 @@ snapshots: fast-json-stable-stringify@2.1.0: {} - fast-uri@3.1.0: {} + fast-uri@3.1.2: {} fastq@1.20.1: dependencies: @@ -8766,7 +8832,7 @@ snapshots: filelist@1.0.6: dependencies: - minimatch: 10.2.4 + minimatch: 10.2.5 fill-range@7.1.1: dependencies: @@ -8825,7 +8891,7 @@ snapshots: dependencies: at-least-node: 1.0.0 graceful-fs: 4.2.11 - jsonfile: 6.2.0 + jsonfile: 6.2.1 universalify: 2.0.1 fsevents@2.3.3: @@ -8835,11 +8901,11 @@ snapshots: function.prototype.name@1.1.8: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 call-bound: 1.0.4 define-properties: 1.2.1 functions-have-names: 1.2.3 - hasown: 2.0.2 + hasown: 2.0.3 is-callable: 1.2.7 functions-have-names@1.2.3: {} @@ -8858,7 +8924,7 @@ snapshots: get-proto: 1.0.1 gopd: 1.2.0 has-symbols: 1.1.0 - hasown: 2.0.2 + hasown: 2.0.3 math-intrinsics: 1.1.0 get-own-enumerable-property-symbols@3.0.2: {} @@ -8882,7 +8948,7 @@ snapshots: dependencies: foreground-child: 3.3.1 jackspeak: 4.2.3 - minimatch: 10.2.4 + minimatch: 10.2.5 minipass: 7.1.3 package-json-from-dist: 1.0.1 path-scurry: 2.0.2 @@ -8920,7 +8986,7 @@ snapshots: dependencies: has-symbols: 1.1.0 - hasown@2.0.2: + hasown@2.0.3: dependencies: function-bind: 1.1.2 @@ -9013,7 +9079,7 @@ snapshots: internal-slot@1.1.0: dependencies: es-errors: 1.3.0 - hasown: 2.0.2 + hasown: 2.0.3 side-channel: 1.1.0 intl-messageformat@10.7.18: @@ -9025,7 +9091,7 @@ snapshots: is-array-buffer@3.0.5: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 call-bound: 1.0.4 get-intrinsic: 1.3.0 @@ -9054,9 +9120,9 @@ snapshots: is-callable@1.2.7: {} - is-core-module@2.16.1: + is-core-module@2.16.2: dependencies: - hasown: 2.0.2 + hasown: 2.0.3 is-data-view@1.0.2: dependencies: @@ -9115,7 +9181,7 @@ snapshots: call-bound: 1.0.4 gopd: 1.2.0 has-tostringtag: 1.0.2 - hasown: 2.0.2 + hasown: 2.0.3 is-regexp@1.0.0: {} @@ -9231,11 +9297,9 @@ snapshots: json-schema-traverse@1.0.0: {} - json-schema@0.4.0: {} - json5@2.2.3: {} - jsonfile@6.2.0: + jsonfile@6.2.1: dependencies: universalify: 2.0.1 optionalDependencies: @@ -9289,6 +9353,8 @@ snapshots: lodash@4.17.23: {} + lodash@4.18.1: {} + loglevel@1.9.2: {} loose-envify@1.4.0: @@ -9388,6 +9454,10 @@ snapshots: dependencies: brace-expansion: 5.0.4 + minimatch@10.2.5: + dependencies: + brace-expansion: 5.0.6 + minimist@1.2.8: {} minipass@7.1.3: {} @@ -9427,6 +9497,8 @@ snapshots: node-releases@2.0.36: {} + node-releases@2.0.38: {} + normalize-path@3.0.0: {} object-assign@4.1.1: {} @@ -9437,7 +9509,7 @@ snapshots: object.assign@4.1.7: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 call-bound: 1.0.4 define-properties: 1.2.1 es-object-atoms: 1.1.1 @@ -9762,9 +9834,9 @@ snapshots: reflect.getprototypeof@1.0.10: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 define-properties: 1.2.1 - es-abstract: 1.24.1 + es-abstract: 1.24.2 es-errors: 1.3.0 es-object-atoms: 1.1.1 get-intrinsic: 1.3.0 @@ -9779,7 +9851,7 @@ snapshots: regexp.prototype.flags@1.5.4: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 define-properties: 1.2.1 es-errors: 1.3.0 get-proto: 1.0.1 @@ -9791,13 +9863,13 @@ snapshots: regenerate: 1.4.2 regenerate-unicode-properties: 10.2.2 regjsgen: 0.8.0 - regjsparser: 0.13.0 + regjsparser: 0.13.1 unicode-match-property-ecmascript: 2.0.0 unicode-match-property-value-ecmascript: 2.2.1 regjsgen@0.8.0: {} - regjsparser@0.13.0: + regjsparser@0.13.1: dependencies: jsesc: 3.1.0 @@ -9807,9 +9879,10 @@ snapshots: resolve-from@4.0.0: {} - resolve@1.22.11: + resolve@1.22.12: dependencies: - is-core-module: 2.16.1 + es-errors: 1.3.0 + is-core-module: 2.16.2 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 @@ -9850,9 +9923,9 @@ snapshots: dependencies: queue-microtask: 1.2.3 - safe-array-concat@1.1.3: + safe-array-concat@1.1.4: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 call-bound: 1.0.4 get-intrinsic: 1.3.0 has-symbols: 1.1.0 @@ -9948,7 +10021,7 @@ snapshots: shebang-regex@3.0.0: {} - side-channel-list@1.0.0: + side-channel-list@1.0.1: dependencies: es-errors: 1.3.0 object-inspect: 1.13.4 @@ -9972,7 +10045,7 @@ snapshots: dependencies: es-errors: 1.3.0 object-inspect: 1.13.4 - side-channel-list: 1.0.0 + side-channel-list: 1.0.1 side-channel-map: 1.0.1 side-channel-weakmap: 1.0.2 @@ -10052,10 +10125,10 @@ snapshots: string.prototype.matchall@4.0.12: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 call-bound: 1.0.4 define-properties: 1.2.1 - es-abstract: 1.24.1 + es-abstract: 1.24.2 es-errors: 1.3.0 es-object-atoms: 1.1.1 get-intrinsic: 1.3.0 @@ -10068,24 +10141,24 @@ snapshots: string.prototype.trim@1.2.10: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 call-bound: 1.0.4 define-data-property: 1.1.4 define-properties: 1.2.1 - es-abstract: 1.24.1 + es-abstract: 1.24.2 es-object-atoms: 1.1.1 has-property-descriptors: 1.0.2 string.prototype.trimend@1.0.9: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 call-bound: 1.0.4 define-properties: 1.2.1 es-object-atoms: 1.1.1 string.prototype.trimstart@1.0.8: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 define-properties: 1.2.1 es-object-atoms: 1.1.1 @@ -10136,7 +10209,7 @@ snapshots: type-fest: 0.16.0 unique-string: 2.0.0 - terser@5.46.1: + terser@5.47.1: dependencies: '@jridgewell/source-map': 0.3.11 acorn: 8.16.0 @@ -10196,7 +10269,7 @@ snapshots: typed-array-byte-length@1.0.3: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 for-each: 0.3.5 gopd: 1.2.0 has-proto: 1.2.0 @@ -10205,7 +10278,7 @@ snapshots: typed-array-byte-offset@1.0.4: dependencies: available-typed-arrays: 1.0.7 - call-bind: 1.0.8 + call-bind: 1.0.9 for-each: 0.3.5 gopd: 1.2.0 has-proto: 1.2.0 @@ -10214,7 +10287,7 @@ snapshots: typed-array-length@1.0.7: dependencies: - call-bind: 1.0.8 + call-bind: 1.0.9 for-each: 0.3.5 gopd: 1.2.0 is-typed-array: 1.1.15 @@ -10269,6 +10342,12 @@ snapshots: escalade: 3.2.0 picocolors: 1.1.1 + update-browserslist-db@1.2.3(browserslist@4.28.2): + dependencies: + browserslist: 4.28.2 + escalade: 3.2.0 + picocolors: 1.1.1 + use-sync-external-store@1.6.0(react@18.3.1): dependencies: react: 18.3.1 @@ -10282,13 +10361,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.1)(yaml@2.8.2): + vite-node@3.2.4(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2) transitivePeerDependencies: - '@types/node' - jiti @@ -10310,48 +10389,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.1)(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.47.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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.1)(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.47.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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.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.47.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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.1)(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.47.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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.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.1)(yaml@2.8.2): + vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2): dependencies: esbuild: 0.27.3 fdir: 6.5.0(picomatch@4.0.3) @@ -10363,13 +10442,13 @@ snapshots: '@types/node': 24.10.13 fsevents: 2.3.3 jiti: 2.6.1 - terser: 5.46.1 + terser: 5.47.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.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.47.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.1)(yaml@2.8.2)) + '@vitest/mocker': 4.1.0(vite@7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2)) '@vitest/pretty-format': 4.1.0 '@vitest/runner': 4.1.0 '@vitest/snapshot': 4.1.0 @@ -10386,7 +10465,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.1)(yaml@2.8.2) + vite: 7.3.1(@types/node@24.10.13)(jiti@2.6.1)(terser@5.47.1)(yaml@2.8.2) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 24.10.13 @@ -10464,7 +10543,7 @@ snapshots: which-typed-array@1.1.20: dependencies: available-typed-arrays: 1.0.7 - call-bind: 1.0.8 + call-bind: 1.0.9 call-bound: 1.0.4 for-each: 0.3.5 get-proto: 1.0.1 @@ -10491,21 +10570,21 @@ snapshots: workbox-build@7.4.0(@types/babel__core@7.20.5): dependencies: - '@apideck/better-ajv-errors': 0.3.6(ajv@8.18.0) + '@apideck/better-ajv-errors': 0.3.7(ajv@8.20.0) '@babel/core': 7.29.0 - '@babel/preset-env': 7.29.2(@babel/core@7.29.0) + '@babel/preset-env': 7.29.5(@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) '@rollup/plugin-terser': 0.4.4(rollup@4.59.0) '@surma/rollup-plugin-off-main-thread': 2.2.3 - ajv: 8.18.0 + ajv: 8.20.0 common-tags: 1.8.2 fast-json-stable-stringify: 2.1.0 fs-extra: 9.1.0 glob: 11.1.0 - lodash: 4.17.23 + lodash: 4.18.1 pretty-bytes: 5.6.0 rollup: 4.59.0 source-map: 0.8.0-beta.0 diff --git a/src/app/components/editor/output.test.ts b/src/app/components/editor/output.test.ts new file mode 100644 index 000000000..72b5ac033 --- /dev/null +++ b/src/app/components/editor/output.test.ts @@ -0,0 +1,30 @@ +import { describe, expect, it } from 'vitest'; +import { toMatrixCustomHTML, trimCustomHtml } from '$components/editor/output'; +import { BlockType } from '$components/editor/types'; + +describe('toMatrixCustomHTML emoticons', () => { + it('always serializes custom emoji images with height=32', () => { + const html = trimCustomHtml( + toMatrixCustomHTML( + [ + { + type: BlockType.Paragraph, + children: [ + { + type: BlockType.Emoticon, + key: 'mxc://example.org/emote', + shortcode: 'blobcat', + children: [{ text: '' }], + } as never, + ], + } as never, + ], + {} + ) + ); + + expect(html).toContain('data-mx-emoticon'); + expect(html).toContain('mxc://example.org/emote'); + expect(html).toContain('height="32"'); + }); +}); diff --git a/src/app/components/event-readers/EventReaders.css.ts b/src/app/components/event-readers/EventReaders.css.ts index 36f47b56e..fa56c221b 100644 --- a/src/app/components/event-readers/EventReaders.css.ts +++ b/src/app/components/event-readers/EventReaders.css.ts @@ -5,6 +5,7 @@ export const EventReaders = style([ DefaultReset, { height: '100%', + width: '280px', }, ]); @@ -18,4 +19,6 @@ export const Header = style({ export const Content = style({ paddingLeft: config.space.S200, paddingBottom: config.space.S400, + width: '100%', + minWidth: 0, }); diff --git a/src/app/components/event-readers/EventReaders.tsx b/src/app/components/event-readers/EventReaders.tsx index c253be54e..88f7eac57 100644 --- a/src/app/components/event-readers/EventReaders.tsx +++ b/src/app/components/event-readers/EventReaders.tsx @@ -58,9 +58,14 @@ export const EventReaders = as<'div', EventReadersProps>( - - - + + + {latestEventReaders.map((readerId) => { const name = getName(readerId); const avatarMxcUrl = room.getMember(readerId)?.getMxcAvatarUrl(); @@ -79,7 +84,7 @@ export const EventReaders = as<'div', EventReadersProps>( return ( { openProfile( diff --git a/src/app/components/member-tile/MemberTile.tsx b/src/app/components/member-tile/MemberTile.tsx index f6cb1cc94..c74433eb7 100644 --- a/src/app/components/member-tile/MemberTile.tsx +++ b/src/app/components/member-tile/MemberTile.tsx @@ -29,7 +29,7 @@ export const MemberTile = as<'button', MemberTileProps>( const name = getName(room, member, nicknames); const presence = useUserPresence(member.userId ?? ''); - const avatarMxcUrl = member.getMxcAvatarUrl(); + const avatarMxcUrl = member.getMxcAvatarUrl() ?? mx.getUser(member.userId)?.avatarUrl; const avatarUrl = avatarMxcUrl ? mx.mxcUrlToHttp(avatarMxcUrl, 100, 100, 'crop', undefined, false, useAuthentication) : undefined; diff --git a/src/app/components/message/Reply.tsx b/src/app/components/message/Reply.tsx index 1c2fd8ddb..86abbacb9 100644 --- a/src/app/components/message/Reply.tsx +++ b/src/app/components/message/Reply.tsx @@ -26,6 +26,8 @@ import { useIgnoredUsers } from '$hooks/useIgnoredUsers'; import { nicknamesAtom } from '$state/nicknames'; import { useMatrixClient } from '$hooks/useMatrixClient'; import { useMemberEventParser } from '$hooks/useMemberEventParser'; +import { useSetting } from '$state/hooks/settings'; +import { settingsAtom } from '$state/settings'; import { useMentionClickHandler } from '$hooks/useMentionClickHandler'; import { useTranslation } from 'react-i18next'; @@ -139,6 +141,14 @@ export const Reply = as<'div', ReplyProps>( const nicknames = useAtomValue(nicknamesAtom); const useAuthentication = useMediaAuthentication(); const settingsLinkBaseUrl = useSettingsLinkBaseUrl(); + const [incomingInlineImagesDefaultHeight] = useSetting( + settingsAtom, + 'incomingInlineImagesDefaultHeight' + ); + const [incomingInlineImagesMaxHeight] = useSetting( + settingsAtom, + 'incomingInlineImagesMaxHeight' + ); const fallbackBody = isRedacted ? : ; @@ -190,6 +200,8 @@ export const Reply = as<'div', ReplyProps>( useAuthentication, nicknames, handleMentionClick: mentionClickHandler, + incomingInlineImagesDefaultHeight, + incomingInlineImagesMaxHeight, }); bodyJSX = parse(sanitizedHtml, parserOpts) as JSX.Element; } else if (hasPlainTextReply) { @@ -280,7 +292,7 @@ export const Reply = as<'div', ReplyProps>( onClick={replyEvent !== null && !isBlockedSender ? onClick : undefined} > {replyEvent !== undefined && !isPendingDecrypt ? ( - + {replyContent} ) : ( diff --git a/src/app/components/message/content/ImageContent.tsx b/src/app/components/message/content/ImageContent.tsx index 183cb35f5..13868c4bf 100644 --- a/src/app/components/message/content/ImageContent.tsx +++ b/src/app/components/message/content/ImageContent.tsx @@ -19,6 +19,7 @@ import { TooltipProvider, as, config, + toRem, } from 'folds'; import classNames from 'classnames'; import { BlurhashCanvas } from 'react-blurhash'; @@ -37,6 +38,23 @@ import { validBlurHash } from '$utils/blurHash'; import * as css from './style.css'; import { MATRIX_UNSTABLE_BLUR_HASH_PROPERTY_NAME } from '../../../../unstable/prefixes'; +function thumbnailDimsForMaxEdge( + maxEdge: number, + w?: number, + h?: number +): { tw: number; th: number } { + const safeEdge = Math.max(1, Math.round(maxEdge)); + const iw = typeof w === 'number' && Number.isFinite(w) && w > 0 ? w : safeEdge; + const ih = typeof h === 'number' && Number.isFinite(h) && h > 0 ? h : safeEdge; + const longest = Math.max(iw, ih); + if (longest <= safeEdge) return { tw: Math.round(iw), th: Math.round(ih) }; + const scale = safeEdge / longest; + return { + tw: Math.max(1, Math.round(iw * scale)), + th: Math.max(1, Math.round(ih * scale)), + }; +} + type RenderViewerProps = { src: string; alt: string; @@ -62,6 +80,10 @@ export type ImageContentProps = { spoilerReason?: string; renderViewer: (props: RenderViewerProps) => ReactNode; renderImage: (props: RenderImageProps) => ReactNode; + matrixThumbnailMaxEdge?: number; + mediaLayout?: 'default' | 'contained'; + containedStripMinPx?: number; + fillsPreviewSlot?: boolean; }; export const ImageContent = as<'div', ImageContentProps>( ( @@ -78,6 +100,10 @@ export const ImageContent = as<'div', ImageContentProps>( spoilerReason, renderViewer, renderImage, + matrixThumbnailMaxEdge, + mediaLayout = 'default', + containedStripMinPx, + fillsPreviewSlot, ...props }, ref @@ -89,6 +115,7 @@ export const ImageContent = as<'div', ImageContentProps>( const [load, setLoad] = useState(false); const [error, setError] = useState(false); const [viewer, setViewer] = useState(false); + const [viewerFullSrc, setViewerFullSrc] = useState(null); const [blurred, setBlurred] = useState(markedAsSpoiler ?? false); const [isHovered, setIsHovered] = useState(false); @@ -96,6 +123,12 @@ export const ImageContent = as<'div', ImageContentProps>( useCallback(async () => { if (url.startsWith('http')) return url; + if (typeof matrixThumbnailMaxEdge === 'number' && matrixThumbnailMaxEdge > 0 && !encInfo) { + const { tw, th } = thumbnailDimsForMaxEdge(matrixThumbnailMaxEdge, info?.w, info?.h); + const thumbUrl = mxcUrlToHttp(mx, url, useAuthentication, tw, th, 'scale', false); + if (thumbUrl) return thumbUrl; + } + const mediaUrl = mxcUrlToHttp(mx, url, useAuthentication); if (!mediaUrl) throw new Error('Invalid media URL'); if (encInfo) { @@ -105,9 +138,33 @@ export const ImageContent = as<'div', ImageContentProps>( return URL.createObjectURL(fileContent); } return mediaUrl; - }, [mx, url, useAuthentication, mimeType, encInfo]) + }, [mx, url, useAuthentication, mimeType, encInfo, matrixThumbnailMaxEdge, info?.w, info?.h]) ); + useEffect(() => { + if (!viewer) { + setViewerFullSrc(null); + return; + } + if ( + typeof matrixThumbnailMaxEdge !== 'number' || + matrixThumbnailMaxEdge <= 0 || + encInfo || + url.startsWith('http') + ) { + return; + } + let cancelled = false; + void (async () => { + const mediaUrl = mxcUrlToHttp(mx, url, useAuthentication); + if (!mediaUrl || cancelled) return; + setViewerFullSrc(mediaUrl); + })(); + return () => { + cancelled = true; + }; + }, [viewer, matrixThumbnailMaxEdge, encInfo, url, mx, useAuthentication]); + const handleLoad = () => { setLoad(true); }; @@ -126,12 +183,36 @@ export const ImageContent = as<'div', ImageContentProps>( }, [autoPlay, loadSrc]); const hasDimensions = typeof info?.w === 'number' && typeof info?.h === 'number'; + const isContained = mediaLayout === 'contained'; + const fillsSlot = Boolean(fillsPreviewSlot && isContained); + const containedReserveStrip = + !fillsSlot && + isContained && + (srcState.status === AsyncStatus.Loading || + srcState.status === AsyncStatus.Error || + error || + (srcState.status === AsyncStatus.Success && !load)); + + const rootClass = isContained ? css.ContainedMediaRoot : css.RelativeBase; + const stripMin = containedStripMinPx ?? 56; + const intrinsicSizingStyle = fillsSlot + ? {} + : isContained + ? { minHeight: containedReserveStrip ? toRem(stripMin) : undefined } + : hasDimensions + ? { aspectRatio: `${info!.w} / ${info!.h}` } + : { minHeight: '150px' }; + + const fillPreviewSlotStyle = fillsSlot + ? ({ width: '100%', height: '100%' } as const) + : undefined; return ( ( onContextMenu={(evt: React.MouseEvent) => evt.stopPropagation()} > {renderViewer({ - src: srcState.data, + src: viewerFullSrc ?? srcState.data, alt: body, requestClose: () => setViewer(false), })} @@ -196,7 +277,7 @@ export const ImageContent = as<'div', ImageContentProps>( {srcState.status === AsyncStatus.Success && ( {children} diff --git a/src/app/components/message/layout/layout.css.ts b/src/app/components/message/layout/layout.css.ts index e30e4c8c3..3d1368d20 100644 --- a/src/app/components/message/layout/layout.css.ts +++ b/src/app/components/message/layout/layout.css.ts @@ -229,6 +229,8 @@ export const PronounPill = style({ export const MessageTextBody = recipe({ base: { + unicodeBidi: 'plaintext', + alignSelf: 'start', wordBreak: 'break-word', fontSize: '1rem !important', // Override folds Text component to enable page zoom scaling }, diff --git a/src/app/components/upload-card/UploadCardRenderer.tsx b/src/app/components/upload-card/UploadCardRenderer.tsx index 24166507e..633babdaa 100644 --- a/src/app/components/upload-card/UploadCardRenderer.tsx +++ b/src/app/components/upload-card/UploadCardRenderer.tsx @@ -31,6 +31,8 @@ import { roomUploadAtomFamily } from '$state/room/roomInputDrafts'; import { useObjectURL } from '$hooks/useObjectURL'; import { useMediaConfig } from '$hooks/useMediaConfig'; import { useSettingsLinkBaseUrl } from '$features/settings/useSettingsLinkBaseUrl'; +import { useSetting } from '$state/hooks/settings'; +import { settingsAtom } from '$state/settings'; import { UploadCard, UploadCardError, UploadCardProgress } from './UploadCard'; import * as css from './UploadCard.css'; import { DescriptionEditor } from './UploadDescriptionEditor'; @@ -397,6 +399,11 @@ export function UploadCardRenderer({ const spoilerClickHandler = useSpoilerClickHandler(); const useAuthentication = useMediaAuthentication(); const settingsLinkBaseUrl = useSettingsLinkBaseUrl(); + const [incomingInlineImagesDefaultHeight] = useSetting( + settingsAtom, + 'incomingInlineImagesDefaultHeight' + ); + const [incomingInlineImagesMaxHeight] = useSetting(settingsAtom, 'incomingInlineImagesMaxHeight'); const htmlReactParserOptions = useMemo( () => getReactCustomHtmlParser(mx, roomId, { @@ -404,8 +411,19 @@ export function UploadCardRenderer({ linkifyOpts, useAuthentication, handleSpoilerClick: spoilerClickHandler, + incomingInlineImagesDefaultHeight, + incomingInlineImagesMaxHeight, }), - [linkifyOpts, mx, roomId, settingsLinkBaseUrl, spoilerClickHandler, useAuthentication] + [ + linkifyOpts, + mx, + roomId, + settingsLinkBaseUrl, + spoilerClickHandler, + useAuthentication, + incomingInlineImagesDefaultHeight, + incomingInlineImagesMaxHeight, + ] ); return ( { window.open(blobUrl, '_blank'); }; +function ogPositiveDimension(value: unknown): number | undefined { + if (typeof value === 'number' && Number.isFinite(value) && value > 0) return value; + if (typeof value === 'string') { + const n = Number.parseFloat(value); + if (Number.isFinite(n) && n > 0) return n; + } + return undefined; +} + +function isLikelyPlayableOgVideo(prev: IPreviewUrlResponse): boolean { + const raw = prev['og:video']; + if (typeof raw !== 'string') return false; + const url = raw.trim(); + if (!url) return false; + const mime = + typeof prev['og:video:type'] === 'string' ? prev['og:video:type'].toLowerCase().trim() : ''; + if (mime.startsWith('video/')) return true; + if (/^mxc:\/\//i.test(url)) { + return mime.startsWith('video/') || /\.(mp4|webm|ogg|mov|m4v)(\?|$)/i.test(url); + } + if (/^https?:\/\//i.test(url)) { + return /\.(mp4|webm|ogg|mov|m4v)(\?|$)/i.test(url) || mime.startsWith('video/'); + } + return false; +} + export const UrlPreviewCard = as< 'div', { @@ -54,6 +97,7 @@ export const UrlPreviewCard = as< >(({ urlPreview, url, ts, mediaType, bundle, ...props }, ref) => { const mx = useMatrixClient(); const useAuthentication = useMediaAuthentication(); + const [linkPreviewImageMaxHeight] = useSetting(settingsAtom, 'linkPreviewImageMaxHeight'); const isDirect = !!mediaType; @@ -109,14 +153,49 @@ export const UrlPreviewCard = as< } }; - const ogW = ((prev['og:video'] && prev['og:video:width']) || - (prev['og:image'] && prev['og:image:width']) || - 1) as number; - const ogH = ((prev['og:video'] && prev['og:video:height']) || - (prev['og:image'] && prev['og:image:height']) || - 1) as number; + const videoW = prev['og:video'] ? ogPositiveDimension(prev['og:video:width']) : undefined; + const videoH = prev['og:video'] ? ogPositiveDimension(prev['og:video:height']) : undefined; + const ogImgW = ogPositiveDimension(prev['og:image:width']); + const ogImgH = ogPositiveDimension(prev['og:image:height']); - const aspectRatio = ogW && ogH ? `${ogW} / ${ogH}` : undefined; + const aspectRatio = + videoW && videoH + ? `${videoW} / ${videoH}` + : ogImgW && ogImgH + ? `${ogImgW} / ${ogImgH}` + : undefined; + + const previewBlurRaw = + typeof prev['matrix:image:blurhash'] === 'string' ? prev['matrix:image:blurhash'].trim() : ''; + + const ogImageInfo: IImageInfo | undefined = (() => { + const matrixSize = prev['matrix:image:size']; + const size = + typeof matrixSize === 'number' && Number.isFinite(matrixSize) ? matrixSize : undefined; + if (ogImgW && ogImgH) { + return { + w: ogImgW, + h: ogImgH, + ...(size !== undefined ? { size } : {}), + ...(previewBlurRaw ? { [MATRIX_UNSTABLE_BLUR_HASH_PROPERTY_NAME]: previewBlurRaw } : {}), + }; + } + if (previewBlurRaw || size !== undefined) { + return { + w: 16, + h: 9, + ...(size !== undefined ? { size } : {}), + ...(previewBlurRaw ? { [MATRIX_UNSTABLE_BLUR_HASH_PROPERTY_NAME]: previewBlurRaw } : {}), + }; + } + return undefined; + })(); + + const previewThumbMaxEdge = Math.min( + 2048, + Math.max(1, Math.round(Math.max(1, linkPreviewImageMaxHeight) * 2)) + ); + const showOgVideo = isLikelyPlayableOgVideo(prev); return ( )} - {prev['og:video'] && ( - + )} + {!showOgVideo && prev['og:image'] && ( + + } + renderImage={(p) => ( + + )} + /> + + )} + {!showOgVideo && !prev['og:image'] && prev['og:audio'] && ( { @@ -93,6 +103,8 @@ export function CreatorChip({ } > : undefined} onClick={open} aria-pressed={!!cords} - className={css.UserHeroChip} - style={{ - backgroundColor: cardColor, - borderColor: backgroundColor, - color: textColor, - }} + className={cardColor ? css.UserHeroChipThemed : css.UserHeroBrightnessHover} + style={heroMenuItemStyle( + cardColor && chipSurfaceStyle ? chipSurfaceStyle : {}, + chipHoverBrightness + )} > {tag.name} diff --git a/src/app/components/user-profile/PowerChip.tsx b/src/app/components/user-profile/PowerChip.tsx index 58a54bd19..dbb6ae579 100644 --- a/src/app/components/user-profile/PowerChip.tsx +++ b/src/app/components/user-profile/PowerChip.tsx @@ -20,6 +20,7 @@ import { Text, toRem, } from 'folds'; +import type { CSSProperties } from 'react'; import type { MouseEventHandler } from 'react'; import { useCallback, useState } from 'react'; import FocusTrap from 'focus-trap-react'; @@ -45,6 +46,7 @@ import { useMemberPowerCompare } from '$hooks/useMemberPowerCompare'; import { CutoutCard } from '$components/cutout-card'; import { PowerColorBadge, PowerIcon } from '$components/power'; import { EventType } from '$types/matrix-sdk'; +import { heroMenuItemStyle } from './heroMenuItemStyle'; import * as css from './styles.css'; type SelfDemoteAlertProps = { @@ -149,17 +151,22 @@ function SharedPowerAlert({ power, onCancel, onChange }: SharedPowerAlertProps) export function PowerChip({ userId, - backgroundColor, innerColor, cardColor, textColor, + chipSurfaceStyle, + chipFillColor, + chipHoverBrightness, }: { userId: string; - backgroundColor?: string; innerColor?: string; cardColor?: string; textColor?: string; + chipSurfaceStyle?: CSSProperties; + chipFillColor?: string; + chipHoverBrightness?: number; }) { + const menuItemBg = chipFillColor ?? cardColor; const mx = useMatrixClient(); const room = useRoom(); const space = useSpaceOptionally(); @@ -288,7 +295,10 @@ export function PowerChip({ aria-disabled={changing || !canChangePowers || !canAssignPower} aria-pressed={selected} className={css.UserHeroMenuItem} - style={{ backgroundColor: cardColor, color: textColor }} + style={heroMenuItemStyle( + { backgroundColor: menuItemBg, color: textColor }, + chipHoverBrightness + )} before={} after={ powerTagIconSrc ? ( @@ -314,7 +324,10 @@ export function PowerChip({ size="300" radii="300" className={css.UserHeroMenuItem} - style={{ backgroundColor: cardColor, color: textColor }} + style={heroMenuItemStyle( + { backgroundColor: menuItemBg, color: textColor }, + chipHoverBrightness + )} onClick={() => { if (room.isSpaceRoom()) { openSpaceSettings( @@ -340,14 +353,19 @@ export function PowerChip({ } > diff --git a/src/app/components/user-profile/UserChips.tsx b/src/app/components/user-profile/UserChips.tsx index c57532dd6..168a973e5 100644 --- a/src/app/components/user-profile/UserChips.tsx +++ b/src/app/components/user-profile/UserChips.tsx @@ -1,4 +1,5 @@ import type { KeyboardEventHandler, MouseEventHandler } from 'react'; +import type { CSSProperties } from 'react'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import FocusTrap from 'focus-trap-react'; @@ -22,6 +23,7 @@ import { Avatar, } from 'folds'; import { useMatrixClient } from '$hooks/useMatrixClient'; +import { getMxIdServer } from '$utils/mxIdHelper'; import { useCloseUserRoomProfile } from '$state/hooks/userRoomProfile'; import { stopPropagation } from '$utils/keyboard'; import { copyToClipboard } from '$utils/dom'; @@ -42,6 +44,7 @@ import { useNickname, useSetNickname } from '$hooks/useNickname'; import { CutoutCard } from '$components/cutout-card'; import { SettingTile } from '$components/setting-tile'; import { RoomAvatar, RoomIcon } from '$components/room-avatar'; +import { heroMenuItemStyle } from './heroMenuItemStyle'; import * as css from './styles.css'; export function ServerChip({ @@ -49,14 +52,21 @@ export function ServerChip({ innerColor, cardColor, textColor, - backgroundColor, + chipSurfaceStyle, + chipFillColor, + chipHoverBrightness, }: { server: string; innerColor?: string; cardColor?: string; textColor?: string; - backgroundColor?: string; + chipSurfaceStyle?: CSSProperties; + chipFillColor?: string; + chipHoverBrightness?: number; }) { + const menuItemBg = chipFillColor ?? cardColor; + const mx = useMatrixClient(); + const myServer = getMxIdServer(mx.getSafeUserId()); const navigate = useNavigate(); const closeProfile = useCloseUserRoomProfile(); const [copied, setCopied] = useTimeoutToggle(); @@ -89,71 +99,89 @@ export function ServerChip({
- { - copyToClipboard(server); - setCopied(); - close(); - }} - className={css.UserHeroMenuItem} - style={{ - backgroundColor: cardColor, - color: textColor, - }} - > - Copy Server - - { - navigate(getExploreServerPath(server)); - closeProfile(); - }} - className={css.UserHeroMenuItem} - style={{ - backgroundColor: cardColor, - color: textColor, - }} - > - Explore Community - + + { + copyToClipboard(server); + setCopied(); + close(); + }} + className={css.UserHeroMenuItem} + style={heroMenuItemStyle( + { + backgroundColor: menuItemBg, + color: textColor, + }, + chipHoverBrightness + )} + > + Copy Server + + { + navigate(getExploreServerPath(server)); + closeProfile(); + }} + className={css.UserHeroMenuItem} + style={heroMenuItemStyle( + { + backgroundColor: menuItemBg, + color: textColor, + }, + chipHoverBrightness + )} + > + Explore Community + +
- { - window.open(`https://${server}`, '_blank'); - close(); - }} - className={css.UserHeroMenuItem} - style={{ - backgroundColor: cardColor, - color: textColor, - }} - > - Open in Browser - + + { + window.open(`https://${server}`, '_blank'); + close(); + }} + className={css.UserHeroMenuItem} + style={heroMenuItemStyle( + { + backgroundColor: menuItemBg, + color: textColor, + }, + chipHoverBrightness + )} + > + Open in Browser + +
} > {server} @@ -184,14 +211,19 @@ export function ShareChip({ innerColor, cardColor, textColor, - backgroundColor, + chipSurfaceStyle, + chipFillColor, + chipHoverBrightness, }: { userId: string; innerColor?: string; cardColor?: string; textColor?: string; - backgroundColor?: string; + chipSurfaceStyle?: CSSProperties; + chipFillColor?: string; + chipHoverBrightness?: number; }) { + const menuItemBg = chipFillColor ?? cardColor; const [cords, setCords] = useState(); const [copied, setCopied] = useTimeoutToggle(); @@ -220,48 +252,56 @@ export function ShareChip({ }} > -
- { - copyToClipboard(userId); - setCopied(); - close(); - }} - > - Copy User ID - - { - copyToClipboard(getMatrixToUser(userId)); - setCopied(); - close(); - }} - > - Copy User Link - +
+ + { + copyToClipboard(userId); + setCopied(); + close(); + }} + > + Copy User ID + + { + copyToClipboard(getMatrixToUser(userId)); + setCopied(); + close(); + }} + > + Copy User Link + +
} > Share @@ -295,17 +334,22 @@ type MutualRoomsData = { export function MutualRoomsChip({ userId, - backgroundColor, innerColor, cardColor, textColor, + chipSurfaceStyle, + chipFillColor, + chipHoverBrightness, }: { userId: string; - backgroundColor?: string; innerColor?: string; cardColor?: string; textColor?: string; + chipSurfaceStyle?: CSSProperties; + chipFillColor?: string; + chipHoverBrightness?: number; }) { + const menuItemBg = chipFillColor ?? cardColor; const mx = useMatrixClient(); const mutualRoomSupported = useMutualRoomsSupport(); const mutualRoomsState = useMutualRooms(userId); @@ -372,11 +416,14 @@ export function MutualRoomsChip({ size="300" radii="300" className={css.UserHeroMenuItem} - style={{ - paddingLeft: config.space.S100, - backgroundColor: cardColor, - color: textColor, - }} + style={heroMenuItemStyle( + { + paddingLeft: config.space.S100, + backgroundColor: menuItemBg, + color: textColor, + }, + chipHoverBrightness + )} onClick={() => { if (room.isSpaceRoom()) { navigateSpace(roomId); @@ -486,6 +533,7 @@ export function MutualRoomsChip({ } > } disabled={ @@ -493,12 +541,11 @@ export function MutualRoomsChip({ } onClick={open} aria-pressed={!!cords} - className={css.UserHeroChip} - style={{ - backgroundColor: cardColor, - borderColor: backgroundColor, - color: textColor, - }} + className={cardColor ? css.UserHeroChipThemed : css.UserHeroBrightnessHover} + style={heroMenuItemStyle( + cardColor && chipSurfaceStyle ? chipSurfaceStyle : {}, + chipHoverBrightness + )} > {mutualRoomsState.status === AsyncStatus.Success && @@ -529,17 +576,22 @@ export function IgnoredUserAlert() { export function OptionsChip({ userId, - backgroundColor, innerColor, cardColor, textColor, + chipSurfaceStyle, + chipFillColor, + chipHoverBrightness, }: { userId: string; - backgroundColor?: string; innerColor?: string; cardColor?: string; textColor?: string; + chipSurfaceStyle?: CSSProperties; + chipFillColor?: string; + chipHoverBrightness?: number; }) { + const menuItemBg = chipFillColor ?? cardColor; const mx = useMatrixClient(); const [cords, setCords] = useState(); const [editingNick, setEditingNick] = useState(false); @@ -604,122 +656,129 @@ export function OptionsChip({ }} > -
- {editingNick ? ( - - Nickname - - - + + {editingNick ? ( + + Nickname + - Save - - {currentNick && ( + /> + { - setNickname(userId, undefined); - close(); - }} - style={{ - backgroundColor: cardColor, - color: textColor, - }} + style={heroMenuItemStyle( + { + backgroundColor: menuItemBg, + color: textColor, + }, + chipHoverBrightness + )} > - Clear + Save - )} + {currentNick && ( + { + setNickname(userId, undefined); + close(); + }} + style={heroMenuItemStyle( + { + backgroundColor: menuItemBg, + color: textColor, + }, + chipHoverBrightness + )} + > + Clear + + )} + - - ) : ( + ) : ( + } + onClick={() => setEditingNick(true)} + className={css.UserHeroMenuItem} + style={heroMenuItemStyle( + { + backgroundColor: menuItemBg, + color: textColor, + }, + chipHoverBrightness + )} + > + {currentNick ? 'Edit Nickname' : 'Set Nickname'} + + )} } - onClick={() => setEditingNick(true)} - className={css.UserHeroMenuItem} - style={{ - backgroundColor: cardColor, - color: textColor, + onClick={() => { + toggleIgnore(); + close(); }} + className={css.UserHeroMenuItem} + style={heroMenuItemStyle({ backgroundColor: menuItemBg }, chipHoverBrightness)} + before={ + ignoring ? ( + + ) : ( + + ) + } + disabled={ignoring} > - {currentNick ? 'Edit Nickname' : 'Set Nickname'} + + {ignored ? 'Unblock User' : 'Block User'} + - )} - { - toggleIgnore(); - close(); - }} - className={css.UserHeroMenuItem} - style={{ backgroundColor: cardColor }} - before={ - ignoring ? ( - - ) : ( - - ) - } - disabled={ignoring} - > - - {ignored ? 'Unblock User' : 'Block User'} - - +
} > {ignoring ? ( diff --git a/src/app/components/user-profile/UserHero.tsx b/src/app/components/user-profile/UserHero.tsx index f284296b2..746a5d1e3 100644 --- a/src/app/components/user-profile/UserHero.tsx +++ b/src/app/components/user-profile/UserHero.tsx @@ -1,4 +1,5 @@ import { useMemo, useState } from 'react'; +import type { CSSProperties } from 'react'; import { Avatar, Box, @@ -78,10 +79,14 @@ export function UserHero({ userId, avatarUrl, bannerUrl, presence, autoplayGifs const isBackgroundDark = fetchedBrightness ? fetchedBrightness === 'dark' : undefined; const cardColor = shadeColor(backgroundColor, isBackgroundDark ? -80 : 80) ?? standardColors.Background.Container; + const innerColor = shadeColor(backgroundColor, isBackgroundDark ? -50 : 50) ?? backgroundColor; + const statusSurfaceColor = + shadeColor(innerColor, fetchedBrightness === 'light' ? -14 : 32) ?? cardColor; const textColor = ((fetchedBrightness === 'dark' || areColorsTooSimilar('#000000', cardColor)) && '#FFFFFF') || ((fetchedBrightness === 'light' || areColorsTooSimilar('#FFFFFF', cardColor)) && '#000000') || undefined; + const statusHoverBrightness = fetchedBrightness === 'light' ? 0.94 : 1.08; return ( @@ -153,16 +158,29 @@ export function UserHero({ userId, avatarUrl, bannerUrl, presence, autoplayGifs {status && status.length > 0 && (
setIsFullStatus(!isFullStatus) : undefined} - className={css.UserHeroStatusTooltip} + className={classNames( + css.UserHeroStatusTooltip, + isExpandable && css.UserHeroStatusTooltipInteractive + )} style={{ maxHeight: isFullStatus ? toRem(105) : toRem(48), cursor: isExpandable ? 'pointer' : 'default', transform: 'none', transition: 'none', display: 'flex', - backgroundColor: cardColor, + padding: `${toRem(8)} ${toRem(12)}`, + backgroundColor: statusSurfaceColor, color: textColor, + borderStyle: 'none', + borderWidth: 0, + outline: 'none', + boxShadow: 'inset 0 1px 1px rgba(0, 0, 0, 0.05)', + ...({ + '--user-hero-status-hover-brightness': String(statusHoverBrightness), + } as CSSProperties), }} > diff --git a/src/app/components/user-profile/UserRoomProfile.tsx b/src/app/components/user-profile/UserRoomProfile.tsx index 59ca01b3e..0b914d813 100644 --- a/src/app/components/user-profile/UserRoomProfile.tsx +++ b/src/app/components/user-profile/UserRoomProfile.tsx @@ -11,7 +11,7 @@ import { Text, toRem, } from 'folds'; -import type { SyntheticEvent } from 'react'; +import type { CSSProperties, SyntheticEvent } from 'react'; import { useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { useAtomValue } from 'jotai'; @@ -52,6 +52,8 @@ import { useSettingsLinkBaseUrl } from '$features/settings/useSettingsLinkBaseUr import { getMxIdServer } from '$utils/mxIdHelper'; import { TextViewerContent } from '$components/text-viewer'; import { areColorsTooSimilar, shadeColor } from '$utils/shadeColor'; +import { ThemeKind, useTheme } from '$hooks/useTheme'; +import { heroMenuItemStyle } from './heroMenuItemStyle'; import { CreatorChip } from './CreatorChip'; import { UserInviteAlert, UserBanAlert, UserModeration, UserKickAlert } from './UserModeration'; import { PowerChip } from './PowerChip'; @@ -80,7 +82,6 @@ type UserExtendedSectionProps = { profile: UserProfile; htmlReactParserOptions: HTMLReactParserOptions; linkifyOpts: LinkifyOpts; - backgroundColor?: string; innerColor?: string; cardColor?: string; textColor?: string; @@ -97,7 +98,6 @@ function UserExtendedSection({ profile, htmlReactParserOptions, linkifyOpts, - backgroundColor, innerColor, cardColor, textColor, @@ -228,11 +228,13 @@ function UserExtendedSection({ () => ( - {avatarUrl && - avatarUrl !== - mxcUrlToHttp(mx, profile.avatarUrl ?? '', useAuthentication, 96, 96, 'crop') && ( - - )} + {hasRoomAvatarOverride && ( + + )} )} diff --git a/src/app/features/message-search/SearchResultGroup.tsx b/src/app/features/message-search/SearchResultGroup.tsx index cd244af71..93e8db401 100644 --- a/src/app/features/message-search/SearchResultGroup.tsx +++ b/src/app/features/message-search/SearchResultGroup.tsx @@ -56,6 +56,8 @@ import { import { useRoomCreators } from '$hooks/useRoomCreators'; import { useRoomCreatorsTag } from '$hooks/useRoomCreatorsTag'; import { useSettingsLinkBaseUrl } from '$features/settings/useSettingsLinkBaseUrl'; +import { useSetting } from '$state/hooks/settings'; +import { settingsAtom } from '$state/settings'; import type { ResultItem } from './useMessageSearch'; type SearchResultGroupProps = { @@ -95,6 +97,11 @@ export function SearchResultGroup({ const accessibleTagColors = useAccessiblePowerTagColors(theme.kind, creatorsTag, powerLevelTags); const nicknames = useAtomValue(nicknamesAtom); const settingsLinkBaseUrl = useSettingsLinkBaseUrl(); + const [incomingInlineImagesDefaultHeight] = useSetting( + settingsAtom, + 'incomingInlineImagesDefaultHeight' + ); + const [incomingInlineImagesMaxHeight] = useSetting(settingsAtom, 'incomingInlineImagesMaxHeight'); const mentionClickHandler = useMentionClickHandler(room.roomId); const spoilerClickHandler = useSpoilerClickHandler(); @@ -127,6 +134,8 @@ export function SearchResultGroup({ handleSpoilerClick: spoilerClickHandler, handleMentionClick: mentionClickHandler, nicknames, + incomingInlineImagesDefaultHeight, + incomingInlineImagesMaxHeight, }), [ mx, @@ -138,6 +147,8 @@ export function SearchResultGroup({ useAuthentication, nicknames, settingsLinkBaseUrl, + incomingInlineImagesDefaultHeight, + incomingInlineImagesMaxHeight, ] ); diff --git a/src/app/features/room/RoomInput.tsx b/src/app/features/room/RoomInput.tsx index 36469c3c6..c6b2ab2f4 100644 --- a/src/app/features/room/RoomInput.tsx +++ b/src/app/features/room/RoomInput.tsx @@ -1,6 +1,7 @@ import type { KeyboardEventHandler, MouseEvent, RefObject } from 'react'; import { forwardRef, useCallback, useEffect, useRef, useState, useMemo } from 'react'; -import { useAtom, useAtomValue } from 'jotai'; +import { useAtom, useAtomValue, useSetAtom } from 'jotai'; + import { isKeyHotkey } from 'is-hotkey'; import type { IContent, @@ -10,6 +11,7 @@ import type { RoomMessageEventContent, StickerEventContent, } from '$types/matrix-sdk'; +import { MatrixError } from '$types/matrix-sdk'; import { EventType, MsgType, RelationType } from '$types/matrix-sdk'; import { ReactEditor } from 'slate-react'; import { Editor, Point, Range, Transforms } from 'slate'; @@ -89,7 +91,7 @@ import { safeFile } from '$utils/mimeTypes'; import { fulfilledPromiseSettledResult } from '$utils/common'; import { useSetting } from '$state/hooks/settings'; import { settingsAtom } from '$state/settings'; -import { getMentionContent, reactionOrEditEvent } from '$utils/room'; +import { getMentionContent, isThreadRelationEvent, reactionOrEditEvent } from '$utils/room'; import { Command, SHRUG, TABLEFLIP, UNFLIP, useCommands } from '$hooks/useCommands'; import { mobileOrTablet } from '$utils/user-agent'; import { useElementSizeObserver } from '$hooks/useElementSizeObserver'; @@ -108,6 +110,7 @@ import { delayedEventsSupportedAtom, roomIdToScheduledTimeAtomFamily, roomIdToEditingScheduledDelayIdAtomFamily, + serverMaxDelayMsAtom, } from '$state/scheduledMessages'; import { sendDelayedMessage, @@ -115,7 +118,7 @@ import { computeDelayMs, cancelDelayedEvent, } from '$utils/delayedEvents'; -import { timeHourMinute, timeDayMonthYear } from '$utils/time'; +import { timeHourMinute, timeDayMonthYear, daysToMs } from '$utils/time'; import { stopPropagation } from '$utils/keyboard'; import { usePowerLevelsContext } from '$hooks/usePowerLevels'; @@ -128,6 +131,7 @@ import { } from '$hooks/usePerMessageProfile'; import { Microphone, Stop } from '@phosphor-icons/react'; import { getSupportedAudioExtension } from '$plugins/voice-recorder-kit/supportedCodec'; +import { ErrorCode } from '../../cs-errorcode'; import { sanitizeText } from '$utils/sanitize'; import { PKitCommandMessageHandler } from '$plugins/pluralkit-handler/PKitCommandMessageHandler'; import { PKitProxyMessageHandler } from '$plugins/pluralkit-handler/PKitProxyMessageHandler'; @@ -162,7 +166,10 @@ const getLatestThreadEventId = (room: Room, threadRootId: string): string => { const thread = room.getThread(threadRootId); const threadEvents: MatrixEvent[] = thread?.events ?? []; const filtered = threadEvents.filter( - (ev) => ev.getId() !== threadRootId && !reactionOrEditEvent(ev) + (ev) => + ev.getId() !== threadRootId && + !reactionOrEditEvent(ev) && + isThreadRelationEvent(ev, threadRootId) ); if (filtered.length > 0) { return filtered[filtered.length - 1]!.getId() ?? threadRootId; @@ -174,7 +181,9 @@ const getLatestThreadEventId = (room: Room, threadRootId: string): string => { .getEvents() .filter( (ev) => - ev.threadRootId === threadRootId && ev.getId() !== threadRootId && !reactionOrEditEvent(ev) + ev.getId() !== threadRootId && + !reactionOrEditEvent(ev) && + isThreadRelationEvent(ev, threadRootId) ); if (liveEvents.length > 0) { return liveEvents.at(-1)!.getId() ?? threadRootId; @@ -192,10 +201,11 @@ const getReplyContent = (replyDraft: IReplyDraft | undefined, room?: Room): IEve relatesTo.event_id = replyDraft.relation.event_id; relatesTo.rel_type = RelationType.Thread; - // Check if this is a reply to a specific message in the thread + // If the user explicitly clicked "reply" on a message (including the thread root), + // we must set is_falling_back=false and target that message directly. // (replyDraft.body being empty means it's just a seeded thread draft) - if (replyDraft.body && replyDraft.eventId !== replyDraft.relation.event_id) { - // Explicit reply to a specific message — per spec, is_falling_back must be false + if (replyDraft.body) { + // Explicit reply — per spec, is_falling_back must be false relatesTo['m.in_reply_to'] = { event_id: replyDraft.eventId, }; @@ -305,7 +315,7 @@ export const RoomInput = forwardRef( useState>(); const [isQuickTextReact, setQuickTextReact] = useState(false); - const sendTypingStatus = useTypingStatusUpdater(mx, roomId); + const sendTypingStatus = useTypingStatusUpdater(mx, roomId, { disabled: !!threadRootId }); const [inputKey, setInputKey] = useState(0); const getUploadItemKey = useCallback((fileItem: TUploadItem): string => { @@ -375,6 +385,8 @@ export const RoomInput = forwardRef( const [showSchedulePicker, setShowSchedulePicker] = useState(false); const [silentReply, setSilentReply] = useState(!mentionInReplies); const [hour24Clock] = useSetting(settingsAtom, 'hour24Clock'); + const setServerMaxDelayMs = useSetAtom(serverMaxDelayMsAtom); + const [sendError, setSendError] = useState(); const isEncrypted = room.hasEncryptionStateEvent(); useElementSizeObserver( @@ -953,12 +965,28 @@ export const RoomInput = forwardRef( } else { await sendDelayedMessage(mx, roomId, content as RoomMessageEventContent, delayMs); } + setSendError(undefined); invalidate(); setEditingScheduledDelayId(null); setScheduledTime(null); resetInput(); - } catch { - // Network/server error — leave editor and scheduled state intact for retry + } catch (e: unknown) { + if ( + e instanceof MatrixError && + (e.errcode === ErrorCode.M_MAX_DELAY_EXCEEDED || + e.data?.['org.matrix.msc4140.errcode'] === 'M_MAX_DELAY_EXCEEDED') + ) { + const maxDelay = + (e.data as { max_delay?: number })?.max_delay ?? + e.data?.['org.matrix.msc4140.max_delay']; + if (typeof maxDelay === 'number') setServerMaxDelayMs(maxDelay); + const maxDelayDays = maxDelay / daysToMs(1); + setSendError( + `Scheduled time exceeds the maximum delay allowed by this server. Please choose an earlier time. The Maximum Delay is of ${maxDelayDays} day${maxDelayDays > 1 ? 's' : ''}.` + ); + } else { + setSendError('Failed to schedule message. Please try again.'); + } } } else if (editingScheduledDelayId) { try { @@ -1049,6 +1077,7 @@ export const RoomInput = forwardRef( isEncrypted, setEditingScheduledDelayId, setScheduledTime, + setServerMaxDelayMs, ]); const handleKeyDown: KeyboardEventHandler = useCallback( @@ -1379,6 +1408,7 @@ export const RoomInput = forwardRef( onClick={() => { setScheduledTime(null); setEditingScheduledDelayId(null); + setSendError(undefined); }} variant="SurfaceVariant" size="300" @@ -1397,6 +1427,19 @@ export const RoomInput = forwardRef(
)} + {sendError && ( +
+ + + {sendError} + + +
+ )} {replyDraft && (!threadRootId || replyDraft.body) && (
( onSubmit={(date) => { setScheduledTime(date); setShowSchedulePicker(false); + setSendError(undefined); }} /> )} diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx index 812f2043c..d63faa989 100644 --- a/src/app/features/room/RoomTimeline.tsx +++ b/src/app/features/room/RoomTimeline.tsx @@ -155,6 +155,11 @@ export function RoomTimeline({ const [dateFormatString] = useSetting(settingsAtom, 'dateFormatString'); const [autoplayStickers] = useSetting(settingsAtom, 'autoplayStickers'); const [autoplayEmojis] = useSetting(settingsAtom, 'autoplayEmojis'); + const [incomingInlineImagesDefaultHeight] = useSetting( + settingsAtom, + 'incomingInlineImagesDefaultHeight' + ); + const [incomingInlineImagesMaxHeight] = useSetting(settingsAtom, 'incomingInlineImagesMaxHeight'); const [hideMemberInReadOnly] = useSetting(settingsAtom, 'hideMembershipInReadOnly'); const showUrlPreview = room.hasEncryptionStateEvent() ? encUrlPreview : urlPreview; @@ -567,6 +572,8 @@ export function RoomTimeline({ handleMentionClick: mentionClickHandler, nicknames, autoplayEmojis, + incomingInlineImagesDefaultHeight, + incomingInlineImagesMaxHeight, replaceTextNode: buildAbbrReplaceTextNode(abbrMap, linkifyOpts), }), [ @@ -574,6 +581,8 @@ export function RoomTimeline({ room.roomId, linkifyOpts, autoplayEmojis, + incomingInlineImagesDefaultHeight, + incomingInlineImagesMaxHeight, mentionClickHandler, nicknames, mediaAuthentication, diff --git a/src/app/features/room/RoomViewFollowing.tsx b/src/app/features/room/RoomViewFollowing.tsx index e33101b19..979ee6507 100644 --- a/src/app/features/room/RoomViewFollowing.tsx +++ b/src/app/features/room/RoomViewFollowing.tsx @@ -1,28 +1,15 @@ -import { useState } from 'react'; -import { - Box, - Icon, - Icons, - Modal, - Overlay, - OverlayBackdrop, - OverlayCenter, - Text, - as, - config, -} from 'folds'; +import { useAtomValue } from 'jotai'; +import { Box, Icon, Icons, Text, as, config } from 'folds'; import type { Room } from '$types/matrix-sdk'; import classNames from 'classnames'; -import FocusTrap from 'focus-trap-react'; -import { useAtomValue } from 'jotai'; +import { useAtom } from 'jotai'; import { getMemberDisplayName } from '$utils/room'; import { getMxIdLocalPart } from '$utils/matrix'; import { useMatrixClient } from '$hooks/useMatrixClient'; import { useRoomLatestRenderedEvent } from '$hooks/useRoomLatestRenderedEvent'; import { useRoomEventReaders } from '$hooks/useRoomEventReaders'; -import { EventReaders } from '$components/event-readers'; -import { stopPropagation } from '$utils/keyboard'; +import { modalAtom, ModalType } from '$state/modal'; import { nicknamesAtom } from '$state/nicknames'; import * as css from './RoomViewFollowing.css'; @@ -38,7 +25,7 @@ export type RoomViewFollowingProps = { export const RoomViewFollowing = as<'div', RoomViewFollowingProps>( ({ className, room, threadEventId, participantIds, ...props }, ref) => { const mx = useMatrixClient(); - const [open, setOpen] = useState(false); + const [, setModal] = useAtom(modalAtom); const latestEvent = useRoomLatestRenderedEvent(room); const resolvedEventId = threadEventId ?? latestEvent?.getId(); const latestEventReaders = useRoomEventReaders(room, resolvedEventId); @@ -54,150 +41,138 @@ export const RoomViewFollowing = as<'div', RoomViewFollowingProps>( const eventId = resolvedEventId; return ( - <> - {eventId && ( - }> - - setOpen(false), - clickOutsideDeactivates: true, - escapeDeactivates: stopPropagation, - }} - > - - setOpen(false)} /> - - - - + 0 ? 'button' : 'div'} + onClick={ + names.length > 0 + ? () => { + if (eventId) { + setModal({ type: ModalType.ReadReceipts, room, eventId }); + } + } + : undefined + } + className={classNames(css.RoomViewFollowing({ clickable: names.length > 0 }), className)} + alignItems="Center" + justifyContent="End" + gap="200" + {...props} + ref={ref} + > + {names.length > 0 && ( + <> + + + {names.length === 1 && ( + <> + {names[0]} + + {' is following the conversation.'} + + + )} + {names.length === 2 && ( + <> + {names[0]} + + {' and '} + + {names[1]} + + {' are following the conversation.'} + + + )} + {names.length === 3 && ( + <> + {names[0]} + + {', '} + + {names[1]} + + {' and '} + + {names[2]} + + {' are following the conversation.'} + + + )} + {names.length > 3 && ( + <> + {names[0]} + + {', '} + + {names[1]} + + {', '} + + {names[2]} + + {' and '} + + {names.length - 3} others + + {' are following the conversation.'} + + + )} + + )} - 0 ? 'button' : 'div'} - onClick={names.length > 0 ? () => setOpen(true) : undefined} - className={classNames(css.RoomViewFollowing({ clickable: names.length > 0 }), className)} - alignItems="Center" - justifyContent="End" - gap="200" - {...props} - ref={ref} - > - {names.length > 0 && ( - <> - - - {names.length === 1 && ( - <> - {names[0]} - - {' is following the conversation.'} - - - )} - {names.length === 2 && ( - <> - {names[0]} - - {' and '} - - {names[1]} - - {' are following the conversation.'} - - - )} - {names.length === 3 && ( - <> - {names[0]} - - {', '} - - {names[1]} - - {' and '} - - {names[2]} - - {' are following the conversation.'} - - - )} - {names.length > 3 && ( - <> - {names[0]} - - {', '} - - {names[1]} - - {', '} - - {names[2]} - - {' and '} - - {names.length - 3} others - - {' are following the conversation.'} - - - )} - - - )} - - + ); } ); diff --git a/src/app/features/room/RoomViewHeader.tsx b/src/app/features/room/RoomViewHeader.tsx index c804f54ab..f45e6172f 100644 --- a/src/app/features/room/RoomViewHeader.tsx +++ b/src/app/features/room/RoomViewHeader.tsx @@ -82,6 +82,7 @@ import { useRoomPermissions } from '$hooks/useRoomPermissions'; import { InviteUserPrompt } from '$components/invite-user-prompt'; import { ContainerColor } from '$styles/ContainerColor.css'; import { useRoomWidgets } from '$hooks/useRoomWidgets'; +import { hasThreadRootAggregation, isThreadRelationEvent } from '$utils/room'; import { DirectInvitePrompt } from '$components/direct-invite-prompt'; import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback'; @@ -439,8 +440,9 @@ export function RoomViewHeader({ callView }: Readonly<{ callView?: boolean }>) { // 1. Events that ARE thread roots (have isThreadRoot = true or have replies) // 2. Events that are IN threads (have threadRootId) events.forEach((event: MatrixEvent) => { - // Check if this event is a thread root - if (event.isThreadRoot) { + // Check if this event is an actual thread root. `isThreadRoot` can be + // polluted by locally-created Thread shells, so require the server bundle. + if (hasThreadRootAggregation(event)) { const rootId = event.getId(); if (rootId && !room.getThread(rootId)) { threadRoots.add(rootId); @@ -449,7 +451,11 @@ export function RoomViewHeader({ callView }: Readonly<{ callView?: boolean }>) { // Check if this event is a reply in a thread const { threadRootId } = event; - if (threadRootId && !room.getThread(threadRootId)) { + if ( + threadRootId && + isThreadRelationEvent(event, threadRootId) && + !room.getThread(threadRootId) + ) { threadRoots.add(threadRootId); } }); @@ -476,8 +482,9 @@ export function RoomViewHeader({ callView }: Readonly<{ callView?: boolean }>) { // Listen for new timeline events (including pagination) const handleTimelineEvent = (mEvent: MatrixEvent) => { - // Check if this event is a thread root - if (mEvent.isThreadRoot) { + // Check if this event is an actual thread root. `isThreadRoot` can be + // polluted by locally-created Thread shells, so require the server bundle. + if (hasThreadRootAggregation(mEvent)) { const rootId = mEvent.getId(); if (rootId && !room.getThread(rootId)) { const rootEvent = room.findEventById(rootId); @@ -489,7 +496,11 @@ export function RoomViewHeader({ callView }: Readonly<{ callView?: boolean }>) { // Check if this is a reply in a thread const { threadRootId } = mEvent; - if (threadRootId && !room.getThread(threadRootId)) { + if ( + threadRootId && + isThreadRelationEvent(mEvent, threadRootId) && + !room.getThread(threadRootId) + ) { const rootEvent = room.findEventById(threadRootId); if (rootEvent) { room.createThread(threadRootId, rootEvent, [], false); diff --git a/src/app/features/room/ThreadDrawer.test.ts b/src/app/features/room/ThreadDrawer.test.ts index 51eebd904..fc4263a04 100644 --- a/src/app/features/room/ThreadDrawer.test.ts +++ b/src/app/features/room/ThreadDrawer.test.ts @@ -23,13 +23,16 @@ type EventInit = { threadRootId?: string; /** When set, the event is treated as a reaction/annotation */ relType?: string; + /** Relation target event id */ + relEventId?: string; }; -function makeEvent({ id, threadRootId, relType }: EventInit) { +function makeEvent({ id, threadRootId, relType, relEventId }: EventInit) { return { getId: () => id, threadRootId, - getRelation: () => (relType ? { rel_type: relType } : null), + getRelation: () => (relType ? { rel_type: relType, event_id: relEventId } : null), + getWireContent: () => ({}), getContent: () => ({}), }; } @@ -61,7 +64,12 @@ const REACTION_ID = '$reaction-event-id'; describe('getThreadReplyEvents', () => { it('returns thread events minus the root when the Thread object has replies', () => { const rootEvent = makeEvent({ id: ROOT_ID, threadRootId: ROOT_ID }); - const replyEvent = makeEvent({ id: REPLY_ID, threadRootId: ROOT_ID }); + const replyEvent = makeEvent({ + id: REPLY_ID, + threadRootId: ROOT_ID, + relType: RelationType.Thread, + relEventId: ROOT_ID, + }); const room = makeRoom({ thread: { events: [rootEvent, replyEvent] as any }, @@ -76,11 +84,17 @@ describe('getThreadReplyEvents', () => { it('excludes reactions from thread events', () => { const rootEvent = makeEvent({ id: ROOT_ID, threadRootId: ROOT_ID }); - const replyEvent = makeEvent({ id: REPLY_ID, threadRootId: ROOT_ID }); + const replyEvent = makeEvent({ + id: REPLY_ID, + threadRootId: ROOT_ID, + relType: RelationType.Thread, + relEventId: ROOT_ID, + }); const reactionEvent = makeEvent({ id: REACTION_ID, threadRootId: ROOT_ID, relType: RelationType.Annotation, + relEventId: REPLY_ID, }); const room = makeRoom({ @@ -99,7 +113,12 @@ describe('getThreadReplyEvents', () => { it('falls back to the live timeline when thread.events contains only the root (classic-sync case)', () => { // classic sync: thread created with no initialEvents → events = [rootEvent] const rootEvent = makeEvent({ id: ROOT_ID, threadRootId: ROOT_ID }); - const liveReply = makeEvent({ id: REPLY_ID, threadRootId: ROOT_ID }); + const liveReply = makeEvent({ + id: REPLY_ID, + threadRootId: ROOT_ID, + relType: RelationType.Thread, + relEventId: ROOT_ID, + }); const room = makeRoom({ thread: { events: [rootEvent] as any }, @@ -115,7 +134,12 @@ describe('getThreadReplyEvents', () => { }); it('falls back to the live timeline when there is no Thread object at all', () => { - const liveReply = makeEvent({ id: REPLY_ID, threadRootId: ROOT_ID }); + const liveReply = makeEvent({ + id: REPLY_ID, + threadRootId: ROOT_ID, + relType: RelationType.Thread, + relEventId: ROOT_ID, + }); const room = makeRoom({ thread: null, @@ -129,8 +153,18 @@ describe('getThreadReplyEvents', () => { }); it('excludes events from the live timeline that belong to a different thread', () => { - const otherReply = makeEvent({ id: '$other-reply', threadRootId: '$other-root' }); - const ourReply = makeEvent({ id: REPLY_ID, threadRootId: ROOT_ID }); + const otherReply = makeEvent({ + id: '$other-reply', + threadRootId: '$other-root', + relType: RelationType.Thread, + relEventId: '$other-root', + }); + const ourReply = makeEvent({ + id: REPLY_ID, + threadRootId: ROOT_ID, + relType: RelationType.Thread, + relEventId: ROOT_ID, + }); const room = makeRoom({ thread: null, @@ -155,4 +189,25 @@ describe('getThreadReplyEvents', () => { expect(result).toHaveLength(0); }); + + it('excludes non-thread replies even if the SDK has assigned the same threadRootId', () => { + const rootEvent = makeEvent({ id: ROOT_ID, threadRootId: ROOT_ID }); + const plainReply = makeEvent({ id: '$plain-reply', threadRootId: ROOT_ID }); + const threadReply = makeEvent({ + id: REPLY_ID, + threadRootId: ROOT_ID, + relType: RelationType.Thread, + relEventId: ROOT_ID, + }); + + const room = makeRoom({ + thread: { events: [rootEvent] as any }, + liveEvents: [plainReply as any, threadReply as any], + }); + + const result = getThreadReplyEvents(room as any, ROOT_ID); + + expect(result).toHaveLength(1); + expect(result[0]?.getId()).toBe(REPLY_ID); + }); }); diff --git a/src/app/features/room/ThreadDrawer.tsx b/src/app/features/room/ThreadDrawer.tsx index b809a661a..e09b76ec0 100644 --- a/src/app/features/room/ThreadDrawer.tsx +++ b/src/app/features/room/ThreadDrawer.tsx @@ -38,6 +38,7 @@ import { import { getEditedEvent, getMemberDisplayName, + isThreadRelationEvent, reactionOrEditEvent, unwrapRelationJumpTarget, } from '$utils/room'; @@ -93,7 +94,10 @@ export function getThreadReplyEvents(room: Room, threadRootId: string): MatrixEv const thread = room.getThread(threadRootId); const fromThread = thread?.events ?? []; const filteredFromThread = fromThread.filter( - (ev) => ev.getId() !== threadRootId && !reactionOrEditEvent(ev) + (ev) => + ev.getId() !== threadRootId && + !reactionOrEditEvent(ev) && + isThreadRelationEvent(ev, threadRootId) ); if (filteredFromThread.length > 0) { return filteredFromThread; @@ -104,7 +108,9 @@ export function getThreadReplyEvents(room: Room, threadRootId: string): MatrixEv .getEvents() .filter( (ev) => - ev.threadRootId === threadRootId && ev.getId() !== threadRootId && !reactionOrEditEvent(ev) + ev.getId() !== threadRootId && + !reactionOrEditEvent(ev) && + isThreadRelationEvent(ev, threadRootId) ); } @@ -323,7 +329,10 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra // thread.events is still empty (classic sync path; server-side was already // populated by paginateEventTimeline inside updateThreadMetadata). const hasRepliesInThread = currThread.events.some( - (ev) => ev.getId() !== threadRootId && !reactionOrEditEvent(ev) + (ev) => + ev.getId() !== threadRootId && + !reactionOrEditEvent(ev) && + isThreadRelationEvent(ev, threadRootId) ); if (hasRepliesInThread) return; @@ -333,9 +342,9 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra .getEvents() .filter( (ev) => - ev.threadRootId === threadRootId && ev.getId() !== threadRootId && - !reactionOrEditEvent(ev) + !reactionOrEditEvent(ev) && + isThreadRelationEvent(ev, threadRootId) ); if (liveEvents.length > 0) { // thread.addEvents() is typed as void but is internally async; schedule @@ -360,7 +369,7 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra useEffect(() => { const isEventInThread = (mEvent: MatrixEvent): boolean => { // Direct thread message or the root itself - if (mEvent.threadRootId === threadRootId || mEvent.getId() === threadRootId) { + if (mEvent.getId() === threadRootId || isThreadRelationEvent(mEvent, threadRootId)) { return true; } @@ -372,7 +381,8 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra const targetEvent = room.findEventById(targetEventId); if ( targetEvent && - (targetEvent.threadRootId === threadRootId || targetEvent.getId() === threadRootId) + (targetEvent.getId() === threadRootId || + isThreadRelationEvent(targetEvent, threadRootId)) ) { return true; } diff --git a/src/app/features/room/message/Message.tsx b/src/app/features/room/message/Message.tsx index 090d78135..3224480c6 100644 --- a/src/app/features/room/message/Message.tsx +++ b/src/app/features/room/message/Message.tsx @@ -33,7 +33,13 @@ import { Username, UsernameBold, } from '$components/message'; -import { canEditEvent, getEditedEvent, getEventEdits, getMemberAvatarMxc } from '$utils/room'; +import { + canEditEvent, + getEditedEvent, + getEventEdits, + getMemberAvatarMxc, + isThreadRelationEvent, +} from '$utils/room'; import { mxcUrlToHttp } from '$utils/matrix'; import type { MessageSpacing } from '$state/settings'; import { getSettings, MessageLayout, settingsAtom } from '$state/settings'; @@ -447,11 +453,12 @@ function MessageInternal( // Avatars // Prefer the room-scoped member avatar (m.room.member) over the global profile // avatar so per-room avatar overrides are respected in the timeline. + const memberAvatarMxc = getMemberAvatarMxc(room, senderId); const avatarUrl = useMemo(() => { if (collapse) return undefined; - const mxc = pmp?.avatar_url || getMemberAvatarMxc(room, senderId) || profile.avatarUrl; + const mxc = pmp?.avatar_url || memberAvatarMxc || profile.avatarUrl; return mxc ? mxcUrlToHttp(mx, mxc, useAuthentication, 48, 48, 'crop') : undefined; - }, [pmp, collapse, profile.avatarUrl, senderId, mx, room, useAuthentication]); + }, [pmp, collapse, memberAvatarMxc, profile.avatarUrl, mx, useAuthentication]); const cachedAvatar = useBlobCache(avatarUrl ?? undefined); @@ -839,7 +846,7 @@ function MessageInternal( setMobileOptionsOpen(true); }); - const isThreadedMessage = mEvent.threadRootId !== undefined; + const isThreadedMessage = isThreadRelationEvent(mEvent, mEvent.threadRootId); const isStickerMessage = mEvent.getType() === 'm.sticker'; const evtId = mEvent.getId()!; diff --git a/src/app/features/room/message/MessageEditor.tsx b/src/app/features/room/message/MessageEditor.tsx index a00ece576..0dd5f13e5 100644 --- a/src/app/features/room/message/MessageEditor.tsx +++ b/src/app/features/room/message/MessageEditor.tsx @@ -60,6 +60,10 @@ import type { Opts as LinkifyOpts } from 'linkifyjs'; import type { GetContentCallback } from '$types/matrix/room'; import { sanitizeText } from '$utils/sanitize'; import type { BundleContent } from '$components/message'; +import { + readdAngleBracketsForHiddenPreviews, + stripMarkdownEscapesForHiddenPreviews, +} from './hiddenLinkPreviews'; type MessageEditorProps = { roomId: string; @@ -120,6 +124,9 @@ export const MessageEditor = as<'div', MessageEditorProps>( const bundleContent = content['com.beeper.linkpreviews'] as BundleContent[]; const markHiddenLinks = (original: string, isHTML?: boolean) => { if (!bundleContent) return original; + if (!isHTML) { + return readdAngleBracketsForHiddenPreviews(original, bundleContent); + } /* Split according to the following fule: - if its not HTML just break it by spaces, newLines, and parans - if it is HTML @@ -129,31 +136,27 @@ export const MessageEditor = as<'div', MessageEditorProps>( - then for every non portion find regular links as though it is plaintext * this is not recursive but needs flattening */ - let splitBody = original.split( - isHTML ? /(?=^.+<)|(?=)|(?=)/gi : /(?=[ \n()])/gi - ); - if (isHTML) - splitBody = splitBody - .map((item) => (item.startsWith(' acc.concat(current), []); + const splitBody = original.split(/(?=^.+<)|(?=)|(?=)/gi); let newBody = ''; - splitBody.map((s) => { - // the length is from the fact that a link is necessarily longer than 6 - if (s.length < 6 || s.startsWith('')) { - newBody += s; - return; - } - // since the way that the match works the key is at the start of the string, - // it needs to be separated such that it can be reintroduced before the < in case of regular text - // or after it in case that it is matching a tag - const strippedS = s.substring(1); - const isHidden = - (bundleContent?.length === 0 || - bundleContent.filter((b) => s.includes(b.matched_url)).length === 0) && - strippedS.match(LINKINPUTREGEX) !== null && - strippedS.startsWith('https://matrix.to/'); - newBody += `${isHidden ? (isHTML && ((s.startsWith('' : ''}`; - }); + splitBody + .map((item) => (item.startsWith(' acc.concat(current), []) + .map((s) => { + // the length is from the fact that a link is necessarily longer than 6 + if (s.length < 6 || s.startsWith('')) { + newBody += s; + return; + } + // since the way that the match works the key is at the start of the string, + // it needs to be separated such that it can be reintroduced before the < in case of regular text + // or after it in case that it is matching a tag + const strippedS = s.substring(1); + const isHidden = + (bundleContent?.length === 0 || + bundleContent.filter((b) => s.includes(b.matched_url)).length === 0) && + strippedS.match(LINKINPUTREGEX) !== null; + newBody += `${isHidden ? (isHTML && ((s.startsWith('' : ''}`; + }); return newBody; }; @@ -351,7 +354,11 @@ export const MessageEditor = as<'div', MessageEditorProps>( const [body, customHtml] = getPrevBodyAndFormattedBody(); const initialValue = plainToEditorInput( - customHtml ? htmlToMarkdown(customHtml) : typeof body === 'string' ? body : '' + customHtml + ? stripMarkdownEscapesForHiddenPreviews(htmlToMarkdown(customHtml)) + : typeof body === 'string' + ? body + : '' ); Transforms.select(editor, { @@ -373,6 +380,14 @@ export const MessageEditor = as<'div', MessageEditorProps>( const settingsLinkBaseUrl = useSettingsLinkBaseUrl(); const linkifyOpts = useMemo(() => ({ ...LINKIFY_OPTS }), []); const spoilerClickHandler = useSpoilerClickHandler(); + const [incomingInlineImagesDefaultHeight] = useSetting( + settingsAtom, + 'incomingInlineImagesDefaultHeight' + ); + const [incomingInlineImagesMaxHeight] = useSetting( + settingsAtom, + 'incomingInlineImagesMaxHeight' + ); const htmlReactParserOptions = useMemo( () => getReactCustomHtmlParser(mx, mEvent.getRoomId(), { @@ -380,8 +395,19 @@ export const MessageEditor = as<'div', MessageEditorProps>( linkifyOpts, useAuthentication, handleSpoilerClick: spoilerClickHandler, + incomingInlineImagesDefaultHeight, + incomingInlineImagesMaxHeight, }), - [linkifyOpts, mEvent, mx, settingsLinkBaseUrl, spoilerClickHandler, useAuthentication] + [ + linkifyOpts, + mEvent, + mx, + settingsLinkBaseUrl, + spoilerClickHandler, + useAuthentication, + incomingInlineImagesDefaultHeight, + incomingInlineImagesMaxHeight, + ] ); const getContent = (() => mEvent.getContent()) as GetContentCallback; const msgType = mEvent.getContent().msgtype; diff --git a/src/app/features/room/message/hiddenLinkPreviews.test.ts b/src/app/features/room/message/hiddenLinkPreviews.test.ts new file mode 100644 index 000000000..60ff23d0d --- /dev/null +++ b/src/app/features/room/message/hiddenLinkPreviews.test.ts @@ -0,0 +1,50 @@ +import { describe, expect, it } from 'vitest'; +import { + readdAngleBracketsForHiddenPreviews, + stripMarkdownEscapesForHiddenPreviews, +} from './hiddenLinkPreviews'; + +describe('stripMarkdownEscapesForHiddenPreviews', () => { + it('removes backslashes around suppressor wrappers', () => { + expect( + stripMarkdownEscapesForHiddenPreviews(String.raw`hello \ world`) + ).toBe('hello world'); + }); + + it('handles paren-adjacent variants produced by link matching', () => { + expect(stripMarkdownEscapesForHiddenPreviews(String.raw`(\)`)).toBe( + '()' + ); + expect(stripMarkdownEscapesForHiddenPreviews(String.raw`(\) and more`)).toBe( + '() and more' + ); + }); + + it('does not touch unrelated markdown escapes', () => { + expect(stripMarkdownEscapesForHiddenPreviews(String.raw`keep \*this\* and \`)).toBe( + String.raw`keep \*this\* and \` + ); + }); +}); + +describe('readdAngleBracketsForHiddenPreviews', () => { + it('wraps URLs in angle brackets when they are not previewed', () => { + expect(readdAngleBracketsForHiddenPreviews('see https://example.org/ thanks', [])).toBe( + 'see thanks' + ); + }); + + it('does not wrap URLs that are present in link previews', () => { + expect( + readdAngleBracketsForHiddenPreviews('see https://example.org/ thanks', [ + { matched_url: 'https://example.org/' } as never, + ]) + ).toBe('see https://example.org/ thanks'); + }); + + it('does not double-wrap already bracketed URLs', () => { + expect(readdAngleBracketsForHiddenPreviews('see ', [])).toBe( + 'see ' + ); + }); +}); diff --git a/src/app/features/room/message/hiddenLinkPreviews.ts b/src/app/features/room/message/hiddenLinkPreviews.ts new file mode 100644 index 000000000..7ca3111dc --- /dev/null +++ b/src/app/features/room/message/hiddenLinkPreviews.ts @@ -0,0 +1,49 @@ +import type { BundleContent } from '$components/message'; + +const LINK_URL = `(https?:\\/\\/.[A-Za-z0-9-._~:/?#[\\]()@!$&'*+,;%=]+)`; +const LINKINPUTREGEX = new RegExp(`\\(?(${LINK_URL})\\)?`, 'g'); + +/** + * `htmlToMarkdown()` escapes `<` and `>` into `\<` and `\>` in text nodes. + * + * We deliberately inject angle brackets around URLs to suppress link previews. Those backslashes + * are correct internally for markdown escaping, but should not be shown to the user when editing. + * + * This helper removes *only* the backslashes that wrap our `` suppressor pattern. + */ +export function stripMarkdownEscapesForHiddenPreviews(markdown: string): string { + // Handle: \ + // Also handle common surrounding parens: (\), (\) + const WRAPPED = new RegExp(String.raw`\\<(${LINK_URL})\\>`, 'g'); + const OPEN_ONLY = new RegExp(String.raw`\\<(${LINK_URL})`, 'g'); + const CLOSE_ONLY = new RegExp(String.raw`(${LINK_URL})\\>`, 'g'); + + return markdown.replace(WRAPPED, '<$1>').replace(OPEN_ONLY, '<$1').replace(CLOSE_ONLY, '$1>'); +} + +export function readdAngleBracketsForHiddenPreviews( + body: string, + linkPreviews: BundleContent[] | undefined +): string { + if (!linkPreviews) return body; + + const previewed = new Set(linkPreviews.map((b) => b.matched_url)); + + LINKINPUTREGEX.lastIndex = 0; + return body.replace(LINKINPUTREGEX, (full, url: string, offset: number) => { + if (!url || previewed.has(url)) return full; + + // If the URL is already wrapped as , leave it alone. + const urlIndex = body.indexOf(url, offset); + if (urlIndex !== -1 && body.slice(urlIndex - 1, urlIndex + url.length + 1) === `<${url}>`) { + return full; + } + + // Keep any surrounding parens emitted by LINKINPUTREGEX. + if (full.startsWith('(') && full.endsWith(')')) return `(<${url}>)`; + if (full.startsWith('(')) return `(<${url}`; + if (full.endsWith(')')) return `<${url}>)`; + + return `<${url}>`; + }); +} diff --git a/src/app/features/room/schedule-send/SchedulePickerDialog.tsx b/src/app/features/room/schedule-send/SchedulePickerDialog.tsx index bf0e2689a..f699e2567 100644 --- a/src/app/features/room/schedule-send/SchedulePickerDialog.tsx +++ b/src/app/features/room/schedule-send/SchedulePickerDialog.tsx @@ -1,5 +1,7 @@ import type { MouseEventHandler } from 'react'; import { useState } from 'react'; +import { useAtomValue } from 'jotai'; +import { serverMaxDelayMsAtom } from '$state/scheduledMessages'; import FocusTrap from 'focus-trap-react'; import type { RectCords } from 'folds'; import { @@ -39,7 +41,9 @@ export function SchedulePickerDialog({ onSubmit, }: SchedulePickerDialogProps) { const now = Date.now(); - const maxDelay = daysToMs(30); + const serverMaxDelayMs = useAtomValue(serverMaxDelayMsAtom); + const maxDelay = serverMaxDelayMs ?? daysToMs(30); + const maxDays = Math.round(maxDelay / daysToMs(1)); const defaultTs = initialTime ?? now + hoursToMs(1); const [ts, setTs] = useState(() => Math.max(defaultTs, now + 60000)); const [error, setError] = useState(); @@ -67,7 +71,7 @@ export function SchedulePickerDialog({ return; } if (delay > maxDelay) { - setError('Cannot schedule more than 30 days in advance'); + setError(`Cannot schedule more than ${maxDays} day${maxDays !== 1 ? 's' : ''} in advance`); return; } setError(undefined); diff --git a/src/app/features/settings/cosmetics/Themes.test.tsx b/src/app/features/settings/cosmetics/Themes.test.tsx index 769cc503c..9e769f74b 100644 --- a/src/app/features/settings/cosmetics/Themes.test.tsx +++ b/src/app/features/settings/cosmetics/Themes.test.tsx @@ -25,6 +25,9 @@ type SettingsShape = { autoplayGifs: boolean; autoplayStickers: boolean; autoplayEmojis: boolean; + incomingInlineImagesDefaultHeight: number; + incomingInlineImagesMaxHeight: number; + linkPreviewImageMaxHeight: number; twitterEmoji: boolean; showEasterEggs: boolean; subspaceHierarchyLimit: number; @@ -90,6 +93,9 @@ beforeEach(() => { autoplayGifs: true, autoplayStickers: true, autoplayEmojis: true, + incomingInlineImagesDefaultHeight: 32, + incomingInlineImagesMaxHeight: 64, + linkPreviewImageMaxHeight: 320, twitterEmoji: true, showEasterEggs: true, subspaceHierarchyLimit: 3, diff --git a/src/app/features/settings/cosmetics/Themes.tsx b/src/app/features/settings/cosmetics/Themes.tsx index 25cc2612a..b67a30ae5 100644 --- a/src/app/features/settings/cosmetics/Themes.tsx +++ b/src/app/features/settings/cosmetics/Themes.tsx @@ -39,6 +39,8 @@ import { useShowRoomIcon } from '$hooks/useShowRoomIcon'; import type { PanelSizetItem } from '$hooks/usePanelSizes'; import { usePanelSizeItems } from '$hooks/usePanelSizes'; +const clampIncomingInlineImageHeight = (n: number) => Math.max(1, Math.min(4096, n)); + function makeArboriumThemeOptions(kind?: 'light' | 'dark') { const themes = kind ? getArboriumThemeOptions(kind) @@ -214,6 +216,61 @@ function ThemeVisualPreferences() { const [autoplayGifs, setAutoplayGifs] = useSetting(settingsAtom, 'autoplayGifs'); const [autoplayStickers, setAutoplayStickers] = useSetting(settingsAtom, 'autoplayStickers'); const [autoplayEmojis, setAutoplayEmojis] = useSetting(settingsAtom, 'autoplayEmojis'); + const [incomingInlineImagesDefaultHeight, setIncomingInlineImagesDefaultHeight] = useSetting( + settingsAtom, + 'incomingInlineImagesDefaultHeight' + ); + const [incomingInlineImagesMaxHeight, setIncomingInlineImagesMaxHeight] = useSetting( + settingsAtom, + 'incomingInlineImagesMaxHeight' + ); + const [linkPreviewImageMaxHeight, setLinkPreviewImageMaxHeight] = useSetting( + settingsAtom, + 'linkPreviewImageMaxHeight' + ); + const [incomingDefaultHeightInput, setIncomingDefaultHeightInput] = useState( + incomingInlineImagesDefaultHeight.toString() + ); + const [incomingMaxHeightInput, setIncomingMaxHeightInput] = useState( + incomingInlineImagesMaxHeight.toString() + ); + const [linkPreviewMaxHeightInput, setLinkPreviewMaxHeightInput] = useState( + linkPreviewImageMaxHeight.toString() + ); + + const handleIncomingDefaultHeightChange: ChangeEventHandler = (evt) => { + const val = evt.target.value; + setIncomingDefaultHeightInput(val); + const parsed = Number.parseInt(val, 10); + if (!Number.isNaN(parsed)) + setIncomingInlineImagesDefaultHeight(clampIncomingInlineImageHeight(parsed)); + }; + const handleIncomingMaxHeightChange: ChangeEventHandler = (evt) => { + const val = evt.target.value; + setIncomingMaxHeightInput(val); + const parsed = Number.parseInt(val, 10); + if (!Number.isNaN(parsed)) + setIncomingInlineImagesMaxHeight(clampIncomingInlineImageHeight(parsed)); + }; + const handleLinkPreviewMaxHeightChange: ChangeEventHandler = (evt) => { + const val = evt.target.value; + setLinkPreviewMaxHeightInput(val); + const parsed = Number.parseInt(val, 10); + if (!Number.isNaN(parsed)) setLinkPreviewImageMaxHeight(clampIncomingInlineImageHeight(parsed)); + }; + + const onNumberInputKeyDown = + (reset: () => void): KeyboardEventHandler => + (evt) => { + if (isKeyHotkey('escape', evt)) { + evt.stopPropagation(); + reset(); + (evt.target as HTMLInputElement).blur(); + } + if (isKeyHotkey('enter', evt)) { + (evt.target as HTMLInputElement).blur(); + } + }; return ( @@ -287,6 +344,97 @@ function ThemeVisualPreferences() { after={} /> + + + + setIncomingDefaultHeightInput(incomingInlineImagesDefaultHeight.toString()) + )} + after={px} + outlined + /> + } + /> + + + + + setIncomingMaxHeightInput(incomingInlineImagesMaxHeight.toString()) + )} + after={px} + outlined + /> + } + /> + + + + + setLinkPreviewMaxHeightInput(linkPreviewImageMaxHeight.toString()) + )} + after={px} + outlined + /> + } + /> + ); } diff --git a/src/app/features/settings/settingsLink.test.ts b/src/app/features/settings/settingsLink.test.ts index 37b1e9921..529ee1401 100644 --- a/src/app/features/settings/settingsLink.test.ts +++ b/src/app/features/settings/settingsLink.test.ts @@ -34,6 +34,12 @@ describe('settingsLink', () => { 'https://app.example/settings/appearance/?focus=message-link-preview' ) ).toEqual({ section: 'appearance', focus: 'message-link-preview' }); + expect( + parseSettingsLink( + 'https://app.example', + `https://app.example/settings/general?focus=composer-formatting-toolbar&${SETTINGS_LINK_ACTION_PARAM}=${SETTINGS_LINK_ACTION_SETTINGS}` + ) + ).toEqual({ section: 'general', focus: 'composer-formatting-toolbar' }); expect( parseSettingsLink( 'https://app.example', @@ -44,6 +50,36 @@ describe('settingsLink', () => { expect(parseSettingsLink('https://app.example', 'https://app.example/home/')).toBeUndefined(); }); + it('accepts the incoming inline image height focus ids', () => { + expect( + parseSettingsLink( + 'https://app.example', + 'https://app.example/settings/appearance?focus=incoming-inline-images-default-height' + ) + ).toEqual({ + section: 'appearance', + focus: 'incoming-inline-images-default-height', + }); + expect( + parseSettingsLink( + 'https://app.example', + 'https://app.example/settings/appearance?focus=incoming-inline-images-max-height' + ) + ).toEqual({ + section: 'appearance', + focus: 'incoming-inline-images-max-height', + }); + expect( + parseSettingsLink( + 'https://app.example', + 'https://app.example/settings/appearance?focus=link-preview-image-max-height' + ) + ).toEqual({ + section: 'appearance', + focus: 'link-preview-image-max-height', + }); + }); + it('parses cross-base settings links only when the explicit action marker is present', () => { expect( parseSettingsLink( diff --git a/src/app/features/settings/settingsLink.ts b/src/app/features/settings/settingsLink.ts index cf5aa5828..32a705c29 100644 --- a/src/app/features/settings/settingsLink.ts +++ b/src/app/features/settings/settingsLink.ts @@ -18,10 +18,12 @@ const settingsSectionLabel = Object.fromEntries( const settingsLinkFocusIdsBySection: Record = { general: [ 'client-side-embeds', + 'composer-formatting-toolbar', 'custom-date-format', 'date-format', 'disable-media-auto-load', 'display-bundled-embeds', + 'display-multiple-embeds', 'embed-youtube-links', 'emoji-selector-threshold', 'enable-swiping', @@ -62,6 +64,7 @@ const settingsLinkFocusIdsBySection: Record ev.getId() !== mEventId && !reactionOrEditEvent(ev) + (ev) => + ev.getId() !== mEventId && !reactionOrEditEvent(ev) && isThreadRelationEvent(ev, mEventId) ); if (fromThread.length > 0) return fromThread; } @@ -138,7 +140,8 @@ function ThreadReplyChip({ return linkedTimelines .flatMap((tl) => tl.getEvents()) .filter( - (ev) => ev.threadRootId === mEventId && ev.getId() !== mEventId && !reactionOrEditEvent(ev) + (ev) => + ev.getId() !== mEventId && !reactionOrEditEvent(ev) && isThreadRelationEvent(ev, mEventId) ); }, [room, mEventId, thread, counter]); @@ -354,12 +357,18 @@ export function useTimelineEventRenderer({ { [EventType.RoomMessage]: (mEventId, mEvent, item, timelineSet, collapse) => { const { replyEventId: rawReplyEventId, threadRootId } = mEvent; + const isThreadRel = isThreadRelationEvent(mEvent, threadRootId); + const actualThreadRootId = isThreadRel ? threadRootId : undefined; + const explicitInReplyTo = mEvent.getWireContent()?.['m.relates_to']?.['m.in_reply_to'] + ?.event_id as unknown; + const threadReplyTargetId = + isThreadRel && typeof explicitInReplyTo === 'string' ? explicitInReplyTo : undefined; // In the thread drawer (hideThreadChip=true), suppress reply headers for events // that only have m.in_reply_to as a non-thread-client fallback (is_falling_back: true). const replyEventId = hideThreadChip && mEvent.getWireContent()?.['m.relates_to']?.is_falling_back ? undefined - : rawReplyEventId; + : (threadReplyTargetId ?? rawReplyEventId); const reactionRelations = getEventReactions(timelineSet, mEventId); const reactions = reactionRelations?.getSortedAnnotationsByKey(); @@ -446,7 +455,7 @@ export function useTimelineEventRenderer({ room={room} timelineSet={timelineSet} replyEventId={replyEventId} - threadRootId={hideThreadChip ? undefined : threadRootId} + threadRootId={hideThreadChip ? undefined : actualThreadRootId} mentions={baseContent['m.mentions']} onClick={handleOpenReply} /> @@ -509,10 +518,16 @@ export function useTimelineEventRenderer({ }, [EventType.RoomMessageEncrypted]: (mEventId, mEvent, item, timelineSet, collapse) => { const { replyEventId: rawReplyEventId, threadRootId } = mEvent; + const isThreadRel = isThreadRelationEvent(mEvent, threadRootId); + const actualThreadRootId = isThreadRel ? threadRootId : undefined; + const explicitInReplyTo = mEvent.getWireContent()?.['m.relates_to']?.['m.in_reply_to'] + ?.event_id as unknown; + const threadReplyTargetId = + isThreadRel && typeof explicitInReplyTo === 'string' ? explicitInReplyTo : undefined; const replyEventId = hideThreadChip && mEvent.getWireContent()?.['m.relates_to']?.is_falling_back ? undefined - : rawReplyEventId; + : (threadReplyTargetId ?? rawReplyEventId); const reactionRelations = getEventReactions(timelineSet, mEventId); const reactions = reactionRelations?.getSortedAnnotationsByKey(); @@ -563,7 +578,7 @@ export function useTimelineEventRenderer({ room={room} timelineSet={timelineSet} replyEventId={replyEventId} - threadRootId={hideThreadChip ? undefined : threadRootId} + threadRootId={hideThreadChip ? undefined : actualThreadRootId} onClick={handleOpenReply} /> ) @@ -673,10 +688,16 @@ export function useTimelineEventRenderer({ }, [EventType.Sticker]: (mEventId, mEvent, item, timelineSet, collapse) => { const { replyEventId: rawReplyEventId, threadRootId } = mEvent; + const isThreadRel = isThreadRelationEvent(mEvent, threadRootId); + const actualThreadRootId = isThreadRel ? threadRootId : undefined; + const explicitInReplyTo = mEvent.getWireContent()?.['m.relates_to']?.['m.in_reply_to'] + ?.event_id as unknown; + const threadReplyTargetId = + isThreadRel && typeof explicitInReplyTo === 'string' ? explicitInReplyTo : undefined; const replyEventId = hideThreadChip && mEvent.getWireContent()?.['m.relates_to']?.is_falling_back ? undefined - : rawReplyEventId; + : (threadReplyTargetId ?? rawReplyEventId); const reactionRelations = getEventReactions(timelineSet, mEventId); const reactions = reactionRelations?.getSortedAnnotationsByKey(); @@ -719,7 +740,7 @@ export function useTimelineEventRenderer({ room={room} timelineSet={timelineSet} replyEventId={replyEventId} - threadRootId={hideThreadChip ? undefined : threadRootId} + threadRootId={hideThreadChip ? undefined : actualThreadRootId} mentions={content['m.mentions']} onClick={handleOpenReply} /> diff --git a/src/app/hooks/useClientConfig.ts b/src/app/hooks/useClientConfig.ts index 4a47ae868..6cb2a9ad3 100644 --- a/src/app/hooks/useClientConfig.ts +++ b/src/app/hooks/useClientConfig.ts @@ -1,5 +1,7 @@ import { createContext, useContext } from 'react'; +import type { Settings } from '$state/settings'; + export type HashRouterConfig = { enabled?: boolean; basename?: string; @@ -46,6 +48,8 @@ export type ClientConfig = { themeCatalogBaseUrl?: string; themeCatalogManifestUrl?: string; themeCatalogApprovedHostPrefixes?: string[]; + + settingsDefaults?: Partial; }; const ClientConfigContext = createContext(null); diff --git a/src/app/hooks/useCommands.ts b/src/app/hooks/useCommands.ts index 94a12f8a6..c4987f6ba 100644 --- a/src/app/hooks/useCommands.ts +++ b/src/app/hooks/useCommands.ts @@ -639,21 +639,34 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => { name: Command.MyRoomAvatar, description: 'Change profile picture in current room. Example /myroomavatar mxc://xyzabc', exe: async (payload) => { - let newAvatar: string | undefined = payload.trim(); - if (newAvatar.length === 0) { - // no avatar, reset to global - newAvatar = profile.avatarUrl; - } else if (!newAvatar.match(/^mxc:\/\/\S+$/)) { - // bad mxc - return; - } + const trimmed = payload.trim(); + const isRemove = trimmed.length === 0; const mEvent = room .getLiveTimeline() .getState(EventTimeline.FORWARDS) ?.getStateEvents(EventType.RoomMember, mx.getSafeUserId()); const content = mEvent?.getContent(); if (!content) return; - await mx.sendStateEvent(room.roomId, EventType.RoomMember, content, mx.getSafeUserId()); + const updatedContent: RoomMemberEventContent = { ...content }; + if (isRemove) { + // Reset to global avatar + const globalAvatar = mx.getUser(mx.getSafeUserId())?.avatarUrl ?? undefined; + (updatedContent as RoomMemberEventContent & { avatar_url?: string }).avatar_url = + globalAvatar; + } else { + if (!trimmed.match(/^mxc:\/\/\S+$/)) { + // bad mxc + return; + } + (updatedContent as RoomMemberEventContent & { avatar_url?: string }).avatar_url = + trimmed; + } + await mx.sendStateEvent( + room.roomId, + EventType.RoomMember, + updatedContent, + mx.getSafeUserId() + ); }, }, [Command.ConvertToDm]: { @@ -1595,7 +1608,6 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => { navigateRoom, room, profile.displayName, - profile.avatarUrl, pkitcmdHandler, developerTools, enableMSC4268CMD, diff --git a/src/app/hooks/useRoomMembers.ts b/src/app/hooks/useRoomMembers.ts index 4705bbf65..46640040e 100644 --- a/src/app/hooks/useRoomMembers.ts +++ b/src/app/hooks/useRoomMembers.ts @@ -1,5 +1,5 @@ import type { MatrixClient, MatrixEvent, RoomMember } from '$types/matrix-sdk'; -import { RoomMemberEvent } from '$types/matrix-sdk'; +import { EventType, RoomMemberEvent, RoomStateEvent } from '$types/matrix-sdk'; import { useEffect, useState } from 'react'; export const useRoomMembers = (mx: MatrixClient, roomId: string): RoomMember[] => { @@ -25,12 +25,20 @@ export const useRoomMembers = (mx: MatrixClient, roomId: string): RoomMember[] = }); } + const handleStateEvent = (event: MatrixEvent) => { + if (event.getRoomId() !== roomId) return; + if (event.getType() !== (EventType.RoomMember as string)) return; + updateMemberList(event); + }; + mx.on(RoomMemberEvent.Membership, updateMemberList); mx.on(RoomMemberEvent.PowerLevel, updateMemberList); + mx.on(RoomStateEvent.Events, handleStateEvent); return () => { disposed = true; mx.removeListener(RoomMemberEvent.Membership, updateMemberList); mx.removeListener(RoomMemberEvent.PowerLevel, updateMemberList); + mx.removeListener(RoomStateEvent.Events, handleStateEvent); }; }, [mx, roomId]); diff --git a/src/app/hooks/useRoomMeta.ts b/src/app/hooks/useRoomMeta.ts index c158dc13a..486f3ad14 100644 --- a/src/app/hooks/useRoomMeta.ts +++ b/src/app/hooks/useRoomMeta.ts @@ -1,7 +1,9 @@ +import { useAtomValue } from 'jotai'; import { useEffect, useState } from 'react'; import type { RoomJoinRulesEventContent, Room } from '$types/matrix-sdk'; import { RoomEvent, RoomStateEvent, EventType } from '$types/matrix-sdk'; +import { mDirectAtom } from '$state/mDirectList'; import { useStateEvent } from './useStateEvent'; import { useNickname } from './useNickname'; @@ -20,6 +22,8 @@ export const useRoomAvatar = (room: Room, dm?: boolean): string | undefined => { export const useRoomName = (room: Room): string => { const dmUserId = room.guessDMUserId(); const dmNickname = useNickname(dmUserId || ''); + const mDirects = useAtomValue(mDirectAtom); + const isDmTagged = mDirects.has(room.roomId); const [name, setName] = useState(room.name); useEffect(() => { @@ -28,11 +32,7 @@ export const useRoomName = (room: Room): string => { room.recalculate(); } - // small room = dm i promise trust - const memberCount = room.getJoinedMemberCount(); - const isSmallRoom = memberCount <= 2; - - const nextName = isSmallRoom && dmNickname ? dmNickname : room.name; + const nextName = isDmTagged && dmNickname ? dmNickname : room.name; setName((prev) => (prev !== nextName ? nextName : prev)); }; @@ -45,7 +45,7 @@ export const useRoomName = (room: Room): string => { room.removeListener(RoomEvent.Name, updateName); room.removeListener(RoomStateEvent.Members, updateName); }; - }, [room, dmNickname]); + }, [room, dmNickname, isDmTagged]); return name; }; diff --git a/src/app/hooks/useTypingStatusUpdater.ts b/src/app/hooks/useTypingStatusUpdater.ts index 88851f8f2..bd35b5609 100644 --- a/src/app/hooks/useTypingStatusUpdater.ts +++ b/src/app/hooks/useTypingStatusUpdater.ts @@ -4,12 +4,22 @@ import { TYPING_TIMEOUT_MS } from '$state/typingMembers'; type TypingStatusUpdater = (typing: boolean) => void; -export const useTypingStatusUpdater = (mx: MatrixClient, roomId: string): TypingStatusUpdater => { +type TypingStatusUpdaterOptions = { + disabled?: boolean; +}; + +export const useTypingStatusUpdater = ( + mx: MatrixClient, + roomId: string, + options?: TypingStatusUpdaterOptions +): TypingStatusUpdater => { const statusSentTsRef = useRef(0); + const disabled = options?.disabled ?? false; const sendTypingStatus: TypingStatusUpdater = useMemo(() => { statusSentTsRef.current = 0; return (typing) => { + if (disabled) return; if (typing) { if (Date.now() - statusSentTsRef.current < TYPING_TIMEOUT_MS) { return; @@ -35,7 +45,7 @@ export const useTypingStatusUpdater = (mx: MatrixClient, roomId: string): Typing } statusSentTsRef.current = 0; }; - }, [mx, roomId]); + }, [mx, roomId, disabled]); return sendTypingStatus; }; diff --git a/src/app/pages/App.tsx b/src/app/pages/App.tsx index 60424b924..e4bf0d773 100644 --- a/src/app/pages/App.tsx +++ b/src/app/pages/App.tsx @@ -1,13 +1,16 @@ -import { lazy, Suspense } from 'react'; +import { lazy, Suspense, useRef } from 'react'; import { Provider as JotaiProvider } from 'jotai'; +import { createStore } from 'jotai/vanilla'; import { OverlayContainerProvider, PopOutContainerProvider, TooltipContainerProvider } from 'folds'; import { RouterProvider } from 'react-router-dom'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import * as Sentry from '@sentry/react'; import { ClientConfigLoader } from '$components/ClientConfigLoader'; +import type { ClientConfig } from '$hooks/useClientConfig'; import { ClientConfigProvider } from '$hooks/useClientConfig'; import { setMatrixToBase } from '$plugins/matrix-to'; +import type { ScreenSize } from '$hooks/useScreenSize'; import { ScreenSizeProvider, useScreenSize } from '$hooks/useScreenSize'; import { useCompositionEndTracking } from '$hooks/useComposingCheck'; import { ErrorPage } from '$components/DefaultErrorPage'; @@ -15,6 +18,7 @@ import { ConfigConfigError, ConfigConfigLoading } from './ConfigConfig'; import { FeatureCheck } from './FeatureCheck'; import { createRouter } from './Router'; import { isReactQueryDevtoolsEnabled } from './reactQueryDevtoolsGate'; +import { bootstrapSettingsStore } from '$state/settings'; const queryClient = new QueryClient(); const ReactQueryDevtools = lazy(async () => { @@ -23,11 +27,38 @@ const ReactQueryDevtools = lazy(async () => { return { default: Devtools }; }); +type BootstrappedAppShellProps = { + clientConfig: ClientConfig; + screenSize: ScreenSize; +}; + +function BootstrappedAppShell({ clientConfig, screenSize }: BootstrappedAppShellProps) { + const jotaiStoreRef = useRef>(); + if (!jotaiStoreRef.current) { + jotaiStoreRef.current = createStore(); + } + bootstrapSettingsStore(jotaiStoreRef.current, clientConfig.settingsDefaults); + const reactQueryDevtoolsEnabled = isReactQueryDevtoolsEnabled(); + + return ( + + + + + + {reactQueryDevtoolsEnabled && ( + + + + )} + + + ); +} + function App() { const screenSize = useScreenSize(); useCompositionEndTracking(); - const reactQueryDevtoolsEnabled = isReactQueryDevtoolsEnabled(); - const portalContainer = document.getElementById('portalContainer') ?? undefined; return ( @@ -53,18 +84,7 @@ function App() { {(clientConfig) => { setMatrixToBase(clientConfig.matrixToBaseUrl); return ( - - - - - - {reactQueryDevtoolsEnabled && ( - - - - )} - - + ); }} diff --git a/src/app/plugins/markdown/bidirectional.test.ts b/src/app/plugins/markdown/bidirectional.test.ts index 216ad9d05..56c036121 100644 --- a/src/app/plugins/markdown/bidirectional.test.ts +++ b/src/app/plugins/markdown/bidirectional.test.ts @@ -107,6 +107,16 @@ describe('bidirectional round-trip', () => { expect(result).toContain('||hidden message||'); }); + it('round-trips literal line-start -# (escaped) in a paragraph', () => { + const markdown = '\\-# not small text'; + const html = markdownToHtml(markdown); + expect(html).not.toContain(' { const markdown = '$E = mc^2$'; const html = markdownToHtml(markdown); diff --git a/src/app/plugins/markdown/extensions/matrix-math.ts b/src/app/plugins/markdown/extensions/matrix-math.ts index 7ceece744..da94783fa 100644 --- a/src/app/plugins/markdown/extensions/matrix-math.ts +++ b/src/app/plugins/markdown/extensions/matrix-math.ts @@ -1,8 +1,24 @@ import type { TokenizerExtension, RendererExtension } from 'marked'; -/** Private-use char so math extensions do not match `$` / `$$` inside code spans. Not U+E000–U+E002 (emoticon placeholders). */ +/** Private-use char so math extensions do not match `$` / `$$` inside code spans. Not U+E000–U+E002 (emoticon placeholders). {@link shieldDollarRunsForMarked} uses U+E021–U+E022. */ export const MATH_CODE_DOLLAR_MASK = '\uE020'; +/** + * Replaces the `-` of line-start `-# …` inside markdown code so the Matrix subscript block + * extension does not match before marked's `fences` rule (custom block extensions run first). + * {@link unmaskSubscriptCodeLinePlaceholders} restores output HTML. + */ +export const SUBSCRIPT_CODE_LINE_MASK = '\uE023'; + +function maskSubscriptLineStartsInCodeInner(inner: string): string { + return inner.replace(/(^|\n)-#( +)/g, `$1${SUBSCRIPT_CODE_LINE_MASK}#$2`); +} + +/** Applies {@link MATH_CODE_DOLLAR_MASK} and subscript masking inside a fence or inline-code region. */ +function maskMathAndSubscriptInCodeInner(inner: string): string { + return maskSubscriptLineStartsInCodeInner(inner.replace(/\$/g, MATH_CODE_DOLLAR_MASK)); +} + function findSameLineFenceClose(md: string, from: number, tick: string, minLen: number): number { let j = from; while (j < md.length && md[j] !== '\n') { @@ -62,11 +78,11 @@ function tryConsumeFence(md: string, i: number): { text: string; end: number } | const close = findMultilineFenceEnd(md, contentStart, tick, openLen); if (!close) { const inner = md.slice(contentStart, md.length); - const masked = inner.replace(/\$/g, MATH_CODE_DOLLAR_MASK); + const masked = maskMathAndSubscriptInCodeInner(inner); return { text: md.slice(i, contentStart) + masked, end: md.length }; } const inner = md.slice(contentStart, close.contentEnd); - const maskedInner = inner.replace(/\$/g, MATH_CODE_DOLLAR_MASK); + const maskedInner = maskMathAndSubscriptInCodeInner(inner); return { text: md.slice(i, contentStart) + maskedInner + md.slice(close.contentEnd, close.blockEnd), end: close.blockEnd, @@ -80,7 +96,7 @@ function tryConsumeFence(md: string, i: number): { text: string; end: number } | while (closeIdx + closeRun < md.length && md[closeIdx + closeRun] === tick) closeRun++; const inner = md.slice(afterOpen, closeIdx); - const maskedInner = inner.replace(/\$/g, MATH_CODE_DOLLAR_MASK); + const maskedInner = maskMathAndSubscriptInCodeInner(inner); return { text: md.slice(i, afterOpen) + maskedInner + md.slice(closeIdx, closeIdx + closeRun), end: closeIdx + closeRun, @@ -99,7 +115,7 @@ function tryConsumeInlineCode(md: string, i: number): { text: string; end: numbe while (j + cr < md.length && md[j + cr] === '`') cr++; if (cr === run) { const inner = md.slice(contentStart, j); - const maskedInner = inner.replace(/\$/g, MATH_CODE_DOLLAR_MASK); + const maskedInner = maskMathAndSubscriptInCodeInner(inner); return { text: md.slice(i, contentStart) + maskedInner + md.slice(j, j + run), end: j + run, @@ -155,6 +171,35 @@ export function unmaskMathCodeDollarPlaceholders(html: string): string { return html.replaceAll(MATH_CODE_DOLLAR_MASK, '$'); } +export function unmaskSubscriptCodeLinePlaceholders(html: string): string { + return html.replaceAll(`${SUBSCRIPT_CODE_LINE_MASK}#`, '-#'); +} + +const MARKED_MATH_BLOCK_SHIELD = '\uE021'; +const MARKED_MATH_BLOCK_SHIELD_END = '\uE022'; + +export function shieldDollarRunsForMarked(markdown: string): string { + const blocks: string[] = []; + const blockRe = /\$\$([^$]+)\$\$\n?/g; + let m: RegExpExecArray | null; + let shielded = ''; + let last = 0; + while ((m = blockRe.exec(markdown)) !== null) { + shielded += markdown.slice(last, m.index); + blocks.push(m[0]); + shielded += `${MARKED_MATH_BLOCK_SHIELD}${blocks.length - 1}${MARKED_MATH_BLOCK_SHIELD_END}`; + last = m.index + m[0].length; + } + shielded += markdown.slice(last); + + shielded = shielded.replace(/\${2,}/g, (run) => run.replace(/\$/g, () => '\\$')); + + return shielded.replace( + new RegExp(`${MARKED_MATH_BLOCK_SHIELD}(\\d+)${MARKED_MATH_BLOCK_SHIELD_END}`, 'g'), + (_, i) => blocks[parseInt(i, 10)] ?? '' + ); +} + function escapeHtml(text: string): string { return text .replace(/&/g, '&') @@ -163,6 +208,49 @@ function escapeHtml(text: string): string { .replace(/"/g, '"'); } +function isIgnorableMathContent(latex: string): boolean { + const t = latex.replace(/[\u200B-\u200D\uFEFF]/g, '').trim(); + if (t === '') return true; + return /^\$+$/.test(t); +} + +/** + * Inline math delimiters use `$...$` but must not greedily pair across dollar amounts + * (e.g. "$10 ... $20"). We only treat a pair as math when: + * - the opening `$` is not followed by whitespace, and + * - the closing `$` is not preceded by whitespace, and + * - the closing `$` is not immediately followed by an ASCII digit. + */ +function tryTokenizeInlineMath( + src: string +): { type: 'math'; raw: string; latex: string } | undefined { + if (!src.startsWith('$')) { + return undefined; + } + if (src.startsWith('$$') && (src.length < 3 || src.charAt(2) !== '$')) { + return undefined; + } + if (src.length < 3 || /\s/.test(src.charAt(1))) { + return undefined; + } + for (let j = 1; j < src.length; j++) { + if (src.charAt(j) !== '$') continue; + const before = src.charAt(j - 1); + if (/\s/.test(before)) continue; + const after = j + 1 < src.length ? src.charAt(j + 1) : ''; + if (after !== '' && /[0-9]/.test(after)) continue; + const latex = src.slice(1, j); + if (isIgnorableMathContent(latex)) continue; + if (latex.trimStart().startsWith('$$')) continue; + return { + type: 'math', + raw: src.slice(0, j + 1), + latex, + }; + } + return undefined; +} + // Inline math: $...$ export const matrixMathExtension = { name: 'math', @@ -171,15 +259,7 @@ export const matrixMathExtension = { return src.indexOf('$'); }, tokenizer(src: string) { - const match = /^\$([^$]+)\$/.exec(src); - if (match) { - return { - type: 'math', - raw: match[0], - latex: match[1], - }; - } - return undefined; + return tryTokenizeInlineMath(src); }, renderer(token) { return `${token.latex}`; @@ -196,10 +276,12 @@ export const matrixMathBlockExtension = { tokenizer(src: string) { const match = /^\$\$([^$]+)\$\$\n?/.exec(src); if (match) { + const latex = match[1]?.trim() ?? ''; + if (isIgnorableMathContent(latex)) return undefined; return { type: 'mathBlock', raw: match[0], - latex: match[1]?.trim() ?? '', + latex, }; } return undefined; diff --git a/src/app/plugins/markdown/extensions/matrix-subscript.ts b/src/app/plugins/markdown/extensions/matrix-subscript.ts index 922f9377d..9a804f888 100644 --- a/src/app/plugins/markdown/extensions/matrix-subscript.ts +++ b/src/app/plugins/markdown/extensions/matrix-subscript.ts @@ -4,25 +4,24 @@ import type { TokenizerExtension, RendererExtension, Tokens } from 'marked'; export const matrixSubscriptExtension = { name: 'subscript', level: 'block', - start(src: string) { - return src.indexOf('-#'); - }, tokenizer( - this: { lexer: { inlineTokens: (t: string, tokens: Tokens.Generic[]) => void } }, + this: { + lexer: { inlineTokens: (t: string, tokens: Tokens.Generic[]) => void }; + }, src: string ) { - const match = /^-# +(.+)/.exec(src); - if (match) { - const token = { - type: 'subscript', - raw: match[0], - text: match[1], - tokens: [] as Tokens.Generic[], - }; - this.lexer.inlineTokens(token.text!, token.tokens); - return token; + const match = /^-# +([^\n]+)/.exec(src); + if (!match) { + return undefined; } - return undefined; + const token = { + type: 'subscript', + raw: match[0], + text: match[1], + tokens: [] as Tokens.Generic[], + }; + this.lexer.inlineTokens(token.text!, token.tokens); + return token; }, renderer( this: { parser: { parseInline: (tokens: Tokens.Generic[]) => string } }, diff --git a/src/app/plugins/markdown/extensions/matrix.test.ts b/src/app/plugins/markdown/extensions/matrix.test.ts index ed1b254a8..707a3f003 100644 --- a/src/app/plugins/markdown/extensions/matrix.test.ts +++ b/src/app/plugins/markdown/extensions/matrix.test.ts @@ -1,7 +1,11 @@ import { describe, expect, it } from 'vitest'; import { marked } from 'marked'; import { matrixSpoilerExtension } from './matrix-spoiler'; -import { matrixMathExtension, matrixMathBlockExtension } from './matrix-math'; +import { + matrixMathBlockExtension, + matrixMathExtension, + shieldDollarRunsForMarked, +} from './matrix-math'; import { matrixSubscriptExtension } from './matrix-subscript'; function parse(input: string): string { @@ -13,7 +17,7 @@ function parse(input: string): string { matrixSubscriptExtension, ], }); - return processor.parse(input) as string; + return processor.parse(shieldDollarRunsForMarked(input)) as string; } describe('matrixSpoilerExtension', () => { @@ -48,6 +52,36 @@ describe('matrixMathExtension (inline)', () => { it('does not parse unmatched $', () => { expect(parse('No $ math here')).not.toContain('data-mx-maths'); }); + + it('does not parse dollar amounts in a sentence as inline math', () => { + const input = 'I just bought something for $10 on sale, it was originally $20!'; + const result = parse(input); + expect(result).not.toContain('data-mx-maths'); + expect(result).toContain('$10'); + expect(result).toContain('$20'); + }); + + it('does not treat $ as math when the opening is followed by whitespace', () => { + expect(parse('$ E = mc^2$')).not.toContain('data-mx-maths'); + }); + + it('still parses valid inline math', () => { + expect(parse('$E = mc^2$')).toContain('data-mx-maths'); + expect(parse('$2+2$')).toContain('data-mx-maths'); + }); + + it('does not parse inline math when inner trims to empty (e.g. zero-width only)', () => { + expect(parse(`empty $\u200B$ here`)).not.toContain('data-mx-maths'); + }); + + it('does not parse long runs of dollar signs as inline math', () => { + expect(parse('hey $$$$$$$ there')).not.toContain('data-mx-maths'); + }); + + it('does not parse block math when inner is only whitespace or dollars', () => { + expect(parse('$$ $$')).not.toContain('data-mx-maths'); + expect(parse('$$ $ $$')).not.toContain('data-mx-maths'); + }); }); describe('matrixMathBlockExtension (block)', () => { diff --git a/src/app/plugins/markdown/htmlToMarkdown.test.ts b/src/app/plugins/markdown/htmlToMarkdown.test.ts index a48dd28a9..6899b2a6a 100644 --- a/src/app/plugins/markdown/htmlToMarkdown.test.ts +++ b/src/app/plugins/markdown/htmlToMarkdown.test.ts @@ -62,6 +62,11 @@ describe('htmlToMarkdown', () => { ); }); + it('converts hidden-preview wrapped links to markdown with ', () => { + const html = '

<https://example.org/>

'; + expect(htmlToMarkdown(html)).toBe('[https://example.org/]()'); + }); + it('converts spoiler spans', () => { expect(htmlToMarkdown('hidden')).toContain('||hidden||'); }); diff --git a/src/app/plugins/markdown/htmlToMarkdown.ts b/src/app/plugins/markdown/htmlToMarkdown.ts index 94c7381bf..9e22f48cf 100644 --- a/src/app/plugins/markdown/htmlToMarkdown.ts +++ b/src/app/plugins/markdown/htmlToMarkdown.ts @@ -176,7 +176,45 @@ function processInlineElements( listDepth: number = 0, insideCode: boolean = false ): string { - return node.children.map((c) => processNode(c, listDepth, insideCode)).join(''); + return processChildren(node.children, listDepth, insideCode); +} + +function processChildren( + children: ChildNode[], + listDepth: number = 0, + insideCode: boolean = false +): string { + const out: string[] = []; + + for (let i = 0; i < children.length; i += 1) { + const cur = children[i]; + const next = children[i + 1]; + const next2 = children[i + 2]; + + if ( + cur && + next && + next2 && + isText(cur) && + cur.data === '<' && + isTag(next) && + next.name.toLowerCase() === 'a' && + isText(next2) && + next2.data === '>' + ) { + const href = next.attribs.href ?? ''; + const content = next.children.map((c) => processNode(c, listDepth, insideCode)).join(''); + out.push(`[${content}](<${href}>)`); + i += 2; + continue; + } + + if (cur) { + out.push(processNode(cur, listDepth, insideCode)); + } + } + + return out.join(''); } function processInlineWrapper( @@ -185,7 +223,7 @@ function processInlineWrapper( listDepth: number = 0, insideCode: boolean = false ): string { - const content = node.children.map((c) => processNode(c, listDepth, insideCode)).join(''); + const content = processChildren(node.children, listDepth, insideCode); return `${marker}${content}${marker}`; } @@ -222,7 +260,7 @@ function processHeading( insideCode: boolean = false ): string { const level = tag.charAt(1); - const content = node.children.map((c) => processNode(c, listDepth, insideCode)).join(''); + const content = processChildren(node.children, listDepth, insideCode); return `${'#'.repeat(parseInt(level, 10))} ${content}\n`; } @@ -231,7 +269,7 @@ function processParagraph( listDepth: number = 0, insideCode: boolean = false ): string { - const content = node.children.map((c) => processNode(c, listDepth, insideCode)).join(''); + const content = processChildren(node.children, listDepth, insideCode); return `${content}\n`; } diff --git a/src/app/plugins/markdown/markdownToHtml.test.ts b/src/app/plugins/markdown/markdownToHtml.test.ts index 93fc71321..20ea8186e 100644 --- a/src/app/plugins/markdown/markdownToHtml.test.ts +++ b/src/app/plugins/markdown/markdownToHtml.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest'; +import { htmlToMarkdown } from './htmlToMarkdown'; import { markdownToHtml } from './markdownToHtml'; describe('markdownToHtml', () => { @@ -48,6 +49,26 @@ describe('markdownToHtml', () => { expect(result).toContain('E = mc^2'); }); + it('does not mangle messages with dollar amounts', () => { + const result = markdownToHtml( + 'I just bought something for $10 on sale, it was originally $20!' + ); + expect(result).not.toContain('data-mx-maths'); + expect(result).toContain('$10'); + expect(result).toContain('$20'); + }); + + it('does not treat empty or dollar-only block math as KaTeX', () => { + expect(markdownToHtml('$$ $$')).not.toContain('data-mx-maths'); + expect(markdownToHtml('$$ $ $$')).not.toContain('data-mx-maths'); + }); + + it('does not parse five consecutive dollar signs in a sentence as math', () => { + const result = markdownToHtml('hey $$$$$ there'); + expect(result).not.toContain('data-mx-maths'); + expect(result).toContain('$$$$$'); + }); + it('does not parse dollars inside fenced code as math', () => { expect(markdownToHtml('```\n$$test$$\n```')).not.toContain('data-mx-maths'); expect(markdownToHtml('```\n$$test$$\n```')).toContain('$$test$$'); @@ -69,6 +90,41 @@ describe('markdownToHtml', () => { expect(result).toContain('$$test$$'); }); + it('converts -# small/sub syntax outside code', () => { + const result = markdownToHtml('-# caption'); + expect(result).toContain(' { + expect(markdownToHtml('```\n-# not sub\n```')).not.toContain(' { + expect(markdownToHtml('`-# lit`')).not.toContain(' { + const html = markdownToHtml('-# caption\n```\nfenced\n```'); + expect(html).toContain('caption'); + expect(html).toContain('
');
+    expect(html).toContain('fenced');
+  });
+
+  it('does not parse escaped \\-# as small/sub', () => {
+    const result = markdownToHtml('\\-# literal caption');
+    expect(result).not.toContain(' {
+    expect(htmlToMarkdown('

-# plain words

')).toContain('\\-#'); + }); + it('converts block math syntax', () => { const result = markdownToHtml('$$\\frac{a}{b}$$'); expect(result).toContain('data-mx-maths'); @@ -134,6 +190,7 @@ describe('markdownToHtml', () => { const result = markdownToHtml(html); expect(result).toContain('mxc://example.org/emote'); expect(result).toContain('data-mx-emoticon'); + expect(result).toContain('height="32"'); }); it('rejects img tags with non-mxc protocols', () => { diff --git a/src/app/plugins/markdown/markdownToHtml.ts b/src/app/plugins/markdown/markdownToHtml.ts index f0b1397fe..c58c0a22e 100644 --- a/src/app/plugins/markdown/markdownToHtml.ts +++ b/src/app/plugins/markdown/markdownToHtml.ts @@ -5,7 +5,9 @@ import { matrixMathExtension, matrixMathBlockExtension, maskDollarSignsInsideMarkdownCode, + shieldDollarRunsForMarked, unmaskMathCodeDollarPlaceholders, + unmaskSubscriptCodeLinePlaceholders, } from './extensions/matrix-math'; import { matrixSubscriptExtension } from './extensions/matrix-subscript'; import { matrixEmoticonExtension, preprocessEmoticon } from './extensions/matrix-emoticon'; @@ -48,6 +50,39 @@ const decodeHtmlEntities = (text: string): string => { return result; }; +const MATRIX_TO_PLACEHOLDER_PREFIX = 'MATRIXTORAWLINKTOKEN'; + +const escapeHtml = (text: string): string => + text + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + +const shieldBareMatrixToLinks = ( + input: string +): { shielded: string; placeholders: Map } => { + const placeholders = new Map(); + let index = 0; + + const shielded = input.replace(/(? { + const key = `${MATRIX_TO_PLACEHOLDER_PREFIX}${index++}X`; + placeholders.set(key, url); + return key; + }); + + return { shielded, placeholders }; +}; + +const unshieldBareMatrixToLinks = (html: string, placeholders: Map): string => { + let result = html; + for (const [key, url] of placeholders.entries()) { + result = result.split(key).join(escapeHtml(url)); + } + return result; +}; + /** * Converts markdown string to sanitized Matrix-compatible HTML. * Uses marked for parsing and DOMPurify for sanitization per Matrix spec. @@ -65,7 +100,10 @@ export function markdownToHtml(markdown: string): string { const preprocessed = preprocessEmoticon(blockquotePrefixed); - const mathInput = maskDollarSignsInsideMarkdownCode(preprocessed); + const { shielded: matrixToShielded, placeholders: matrixToPlaceholders } = + shieldBareMatrixToLinks(preprocessed); + + const mathInput = shieldDollarRunsForMarked(maskDollarSignsInsideMarkdownCode(matrixToShielded)); // Parse markdown to HTML using marked with our Matrix extensions const html = processor.parse(mathInput) as string; @@ -139,8 +177,9 @@ export function markdownToHtml(markdown: string): string { 'type', 'open', ], - // Allow safe rel attributes for links - ADD_ATTR: ['target', 'rel'], + // Ensure these safe attrs survive sanitization even when the input HTML + // originates from markdown-embedded tags (e.g. custom emoji ). + ADD_ATTR: ['target', 'rel', 'height', 'width'], // Force all links to have safe rel attribute FORCE_BODY: false, ALLOWED_URI_REGEXP: /^(?:https?|ftp|mailto|magnet|mxc):/i, @@ -148,8 +187,23 @@ export function markdownToHtml(markdown: string): string { DOMPurify.removeHook('afterSanitizeAttributes'); - return unmaskMathCodeDollarPlaceholders(sanitized).replace( - /
  • (

    <\/p>)?<\/li>/gi, - '


  • ' + const unmasked = unmaskSubscriptCodeLinePlaceholders(unmaskMathCodeDollarPlaceholders(sanitized)); + + // DOMPurify's Node/JSdom build can drop size attributes even when allowlisted. + // For Matrix custom emojis, always emit a stable height so outgoing messages have + // consistent layout across clients. + const restoredMxEmoticonHeight = unmasked.replace( + /]*\bdata-mx-emoticon\b[^>]*)>/gi, + (full, attrs: string) => { + if (/\bheight\s*=/i.test(attrs)) return full; + return ``; + } ); + + const unshieldedMatrixTo = unshieldBareMatrixToLinks( + restoredMxEmoticonHeight, + matrixToPlaceholders + ); + + return unshieldedMatrixTo.replace(/
  • (

    <\/p>)?<\/li>/gi, '


  • '); } diff --git a/src/app/plugins/markdown/utils.ts b/src/app/plugins/markdown/utils.ts index ddaf66a02..c6ea432a2 100644 --- a/src/app/plugins/markdown/utils.ts +++ b/src/app/plugins/markdown/utils.ts @@ -78,7 +78,12 @@ export const escapeMarkdownInlineSequences = (text: string): string => { (t) => t ); - return parts.join(''); + let out = parts.join(''); + out = out.replace( + /(^|\n)-(# +)/gm, + (_, lineStart: string, hashSp: string) => `${lineStart}\\-${hashSp}` + ); + return out; }; /** diff --git a/src/app/plugins/react-custom-html-parser.test.tsx b/src/app/plugins/react-custom-html-parser.test.tsx index 0ff56dacc..13e8c3088 100644 --- a/src/app/plugins/react-custom-html-parser.test.tsx +++ b/src/app/plugins/react-custom-html-parser.test.tsx @@ -128,6 +128,39 @@ describe('getReactCustomHtmlParser code blocks', () => { }); describe('react custom html parser', () => { + it('defaults custom emoji img height to 32 when missing', () => { + const { container } = renderParsedHtml( + 'blobcat', + { + sanitize: false, + mx: createMatrixClient({ + mxcUrlToHttp: () => 'https://cdn.example/emote.png', + }), + } + ); + + const img = container.querySelector('img'); + expect(img).toBeInTheDocument(); + expect(img).toHaveAttribute('height', '32'); + }); + + it('clamps incoming inline image height to the configured max', () => { + const { container } = renderParsedHtml( + 'blobcat', + { + sanitize: false, + mx: createMatrixClient({ + mxcUrlToHttp: () => 'https://cdn.example/emote.png', + }), + } + ); + + const img = container.querySelector('img'); + expect(img).toBeInTheDocument(); + // Default max is 64 unless overridden by settings. + expect(img).toHaveAttribute('height', '64'); + }); + it('renders same-origin raw settings links as mention-style chips through the factory link render path', () => { const renderLink = factoryRenderLinkifyWithMention( settingsLinkBaseUrl, diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx index d07c7173d..951f9d033 100644 --- a/src/app/plugins/react-custom-html-parser.tsx +++ b/src/app/plugins/react-custom-html-parser.tsx @@ -516,6 +516,8 @@ export const getReactCustomHtmlParser = ( useAuthentication?: boolean; nicknames?: Nicknames; autoplayEmojis?: boolean; + incomingInlineImagesDefaultHeight?: number; + incomingInlineImagesMaxHeight?: number; replaceTextNode?: ( text: string, renderText: (text: string, key?: string) => JSX.Element @@ -524,6 +526,20 @@ export const getReactCustomHtmlParser = ( ): HTMLReactParserOptions => { const { replaceTextNode } = params; + const defaultIncomingImgHeight = params.incomingInlineImagesDefaultHeight ?? 32; + const maxIncomingImgHeight = params.incomingInlineImagesMaxHeight ?? 64; + + const normalizeIncomingImgHeight = (raw: unknown): number => { + const parsed = + typeof raw === 'number' ? raw : typeof raw === 'string' ? Number.parseInt(raw, 10) : NaN; + const fallback = defaultIncomingImgHeight; + const safe = Number.isFinite(parsed) ? parsed : fallback; + // Clamp to sane bounds first, then apply the user max. + const bounded = Math.max(1, Math.min(4096, Math.round(safe))); + const max = Math.max(1, Math.min(4096, Math.round(maxIncomingImgHeight))); + return Math.min(bounded, max); + }; + const decorateText = (text: string) => { let jsx = scaleSystemEmoji(text); @@ -807,6 +823,8 @@ export const getReactCustomHtmlParser = ( ); } + const height = normalizeIncomingImgHeight(props.height); + const siblingCount = domNode.parent?.children.length ?? 0; // seperate style for bundled emojis @@ -821,6 +839,7 @@ export const getReactCustomHtmlParser = ( {...props} src={htmlSrc} className={css.EmoticonImg} + height={height} style={{ verticalAlign: 'middle' }} fallback={ @@ -834,6 +853,7 @@ export const getReactCustomHtmlParser = ( {...props} src={htmlSrc} className={css.EmoticonImg} + height={height} style={{ verticalAlign: 'middle' }} fallback={ @@ -857,6 +877,7 @@ export const getReactCustomHtmlParser = ( {...props} src={htmlSrc} className={css.EmoticonImg} + height={height} fallback={ {props.alt || props.title || '?'} @@ -869,6 +890,7 @@ export const getReactCustomHtmlParser = ( {...props} src={htmlSrc} className={css.EmoticonImg} + height={height} fallback={ {props.alt || props.title || '?'} } @@ -893,6 +915,7 @@ export const getReactCustomHtmlParser = ( {...props} className={css.Img} src={htmlSrc} + height={normalizeIncomingImgHeight(props.height)} fallback={ {props.alt || '[media]'} diff --git a/src/app/state/scheduledMessages.ts b/src/app/state/scheduledMessages.ts index 7bed18572..d9144b2ad 100644 --- a/src/app/state/scheduledMessages.ts +++ b/src/app/state/scheduledMessages.ts @@ -14,3 +14,5 @@ export const roomIdToEditingScheduledDelayIdAtomFamily = atomFamily< string, ReturnType> >(() => atom(null)); + +export const serverMaxDelayMsAtom = atom(null); diff --git a/src/app/state/settings.defaults.test.ts b/src/app/state/settings.defaults.test.ts new file mode 100644 index 000000000..d2b51cd56 --- /dev/null +++ b/src/app/state/settings.defaults.test.ts @@ -0,0 +1,67 @@ +import { describe, it, expect, beforeEach } from 'vitest'; +import { + defaultSettings, + mergePersistedSettings, + sanitizeSettingsDefaults, + resetRuntimeSettingsDefaults, +} from '$state/settings'; + +beforeEach(() => { + localStorage.clear(); + resetRuntimeSettingsDefaults(); +}); + +describe('mergePersistedSettings', () => { + it('layers deployer defaults over code defaults when localStorage is empty', () => { + const merged = mergePersistedSettings(null, { twitterEmoji: false }); + expect(merged.twitterEmoji).toBe(false); + expect(merged.pageZoom).toBe(defaultSettings.pageZoom); + }); + + it('lets localStorage override deployer defaults', () => { + localStorage.setItem('settings', JSON.stringify({ twitterEmoji: true })); + const merged = mergePersistedSettings(localStorage.getItem('settings'), { + twitterEmoji: false, + }); + expect(merged.twitterEmoji).toBe(true); + }); + + it('still applies monochrome migration when layering defaults', () => { + localStorage.setItem('settings', JSON.stringify({ monochromeMode: true })); + const merged = mergePersistedSettings(localStorage.getItem('settings'), {}); + expect(merged.saturationLevel).toBe(0); + }); +}); + +describe('sanitizeSettingsDefaults', () => { + it('keeps known keys with valid types', () => { + expect(sanitizeSettingsDefaults({ twitterEmoji: false })).toEqual({ + twitterEmoji: false, + }); + }); + + it('drops unknown keys', () => { + expect(sanitizeSettingsDefaults({ notARealSetting: true, hour24Clock: true })).toEqual({ + hour24Clock: true, + }); + }); + + it('drops invalid types', () => { + expect(sanitizeSettingsDefaults({ twitterEmoji: 'yes' })).toEqual({}); + }); + + it('accepts messageLayout 0–2 only', () => { + expect(sanitizeSettingsDefaults({ messageLayout: 2 })).toEqual({ + messageLayout: 2, + }); + expect(sanitizeSettingsDefaults({ messageLayout: 9 })).toEqual({}); + expect(sanitizeSettingsDefaults({ messageLayout: 1.5 })).toEqual({}); + }); + + it('accepts rightSwipeAction enum strings', () => { + expect(sanitizeSettingsDefaults({ rightSwipeAction: 'members' })).toEqual({ + rightSwipeAction: 'members', + }); + expect(sanitizeSettingsDefaults({ rightSwipeAction: 'nope' })).toEqual({}); + }); +}); diff --git a/src/app/state/settings.ts b/src/app/state/settings.ts index ff7dd01dd..c492e6ff6 100644 --- a/src/app/state/settings.ts +++ b/src/app/state/settings.ts @@ -1,4 +1,5 @@ import { atom, type WritableAtom } from 'jotai'; +import type { Store } from 'jotai/vanilla/store'; import { mobileOrTablet } from '$utils/user-agent'; const STORAGE_KEY = 'settings'; @@ -145,6 +146,9 @@ export interface Settings { autoplayGifs: boolean; autoplayStickers: boolean; autoplayEmojis: boolean; + incomingInlineImagesDefaultHeight: number; + incomingInlineImagesMaxHeight: number; + linkPreviewImageMaxHeight: number; saveStickerEmojiBandwidth: boolean; subspaceHierarchyLimit: number; alwaysShowCallButton: boolean; @@ -272,6 +276,9 @@ export const defaultSettings: Settings = { autoplayGifs: true, autoplayStickers: true, autoplayEmojis: true, + incomingInlineImagesDefaultHeight: 32, + incomingInlineImagesMaxHeight: 64, + linkPreviewImageMaxHeight: 640, saveStickerEmojiBandwidth: false, subspaceHierarchyLimit: 3, alwaysShowCallButton: false, @@ -311,13 +318,18 @@ export const defaultSettings: Settings = { themeRemoteEnabledTweakFullUrls: [], }; -export const getSettings = () => { - const settings = localStorage.getItem(STORAGE_KEY); - if (settings === null) return defaultSettings; +function cloneDefaultSettings(): Settings { + return { + ...defaultSettings, + themeRemoteFavorites: defaultSettings.themeRemoteFavorites.map((x) => ({ + ...x, + })), + themeRemoteTweakFavorites: defaultSettings.themeRemoteTweakFavorites.map((x) => ({ ...x })), + themeRemoteEnabledTweakFullUrls: [...defaultSettings.themeRemoteEnabledTweakFullUrls], + }; +} - // migration for old keys - // monochrome -> saturation - const parsed = JSON.parse(settings); +function migrateParsedLocalStorage(parsed: Record): void { if (parsed.monochromeMode === true && parsed.saturationLevel === undefined) { parsed.saturationLevel = 0; } else if (parsed.monochromeMode === false && parsed.saturationLevel === undefined) { @@ -336,27 +348,215 @@ export const getSettings = () => { parsed.renderUserCards = 'both'; } - const parsedRecord = parsed as Record; if ( - typeof parsedRecord.themeChatAutoPreviewAnyUrl !== 'boolean' && - typeof parsedRecord.themeChatPreviewAnyUrl === 'boolean' + typeof parsed.themeChatAutoPreviewAnyUrl !== 'boolean' && + typeof parsed.themeChatPreviewAnyUrl === 'boolean' ) { - parsedRecord.themeChatAutoPreviewAnyUrl = parsedRecord.themeChatPreviewAnyUrl; + parsed.themeChatAutoPreviewAnyUrl = parsed.themeChatPreviewAnyUrl; } - delete parsedRecord.themeChatPreviewAnyUrl; - delete parsedRecord.themeChatPreviewApprovedCatalogOnly; + delete parsed.themeChatPreviewAnyUrl; + delete parsed.themeChatPreviewApprovedCatalogOnly; +} + +export function mergePersistedSettings( + rawLocalStorage: string | null, + fileDefaults: Partial +): Settings { + const base = { ...defaultSettings, ...fileDefaults }; + if (rawLocalStorage === null) return base; + + const parsed = JSON.parse(rawLocalStorage) as Record; + migrateParsedLocalStorage(parsed); return { - ...defaultSettings, - ...(parsed as Settings), + ...base, + ...(parsed as unknown as Settings), }; -}; +} + +const MESSAGE_SPACING_VALUES = new Set(['0', '100', '200', '300', '400', '500']); +const JUMBO_EMOJI_VALUES = new Set([ + 'none', + 'extraSmall', + 'small', + 'normal', + 'large', + 'extraLarge', +]); + +function sanitizeStringArray(val: unknown): string[] | undefined { + if (!Array.isArray(val)) return undefined; + const out = val.filter((x): x is string => typeof x === 'string'); + return out; +} + +function sanitizeThemeRemoteFavorites(val: unknown): ThemeRemoteFavorite[] | undefined { + if (!Array.isArray(val)) return undefined; + const out: ThemeRemoteFavorite[] = []; + for (const item of val) { + if (!item || typeof item !== 'object') continue; + const o = item as Record; + if ( + typeof o.fullUrl === 'string' && + typeof o.displayName === 'string' && + typeof o.basename === 'string' && + (o.kind === 'light' || o.kind === 'dark') + ) { + out.push({ + fullUrl: o.fullUrl, + displayName: o.displayName, + basename: o.basename, + kind: o.kind, + pinned: typeof o.pinned === 'boolean' ? o.pinned : undefined, + importedLocal: typeof o.importedLocal === 'boolean' ? o.importedLocal : undefined, + }); + } + } + return out; +} + +function sanitizeThemeRemoteTweakFavorites(val: unknown): ThemeRemoteTweakFavorite[] | undefined { + if (!Array.isArray(val)) return undefined; + const out: ThemeRemoteTweakFavorite[] = []; + for (const item of val) { + if (!item || typeof item !== 'object') continue; + const o = item as Record; + if ( + typeof o.fullUrl === 'string' && + typeof o.displayName === 'string' && + typeof o.basename === 'string' + ) { + out.push({ + fullUrl: o.fullUrl, + displayName: o.displayName, + basename: o.basename, + pinned: typeof o.pinned === 'boolean' ? o.pinned : undefined, + importedLocal: typeof o.importedLocal === 'boolean' ? o.importedLocal : undefined, + }); + } + } + return out; +} + +function isSanitizableSettingsKey(k: string): k is keyof Settings { + return ( + k in defaultSettings || k === 'filterPronounsBasedOnLanguage' || k === 'filterPronounsLanguages' + ); +} + +function sanitizeSettingsKey(key: keyof Settings, val: unknown): unknown { + switch (key) { + case 'filterPronounsBasedOnLanguage': + return typeof val === 'boolean' ? val : undefined; + case 'filterPronounsLanguages': + return sanitizeStringArray(val); + case 'messageLayout': + return typeof val === 'number' && Number.isInteger(val) && val >= 0 && val <= 2 + ? val + : undefined; + case 'messageSpacing': + return typeof val === 'string' && MESSAGE_SPACING_VALUES.has(val as MessageSpacing) + ? val + : undefined; + case 'captionPosition': + return val === CaptionPosition.Above || + val === CaptionPosition.Inline || + val === CaptionPosition.Hidden || + val === CaptionPosition.Below + ? val + : undefined; + case 'rightSwipeAction': + return val === RightSwipeAction.Members || val === RightSwipeAction.Reply ? val : undefined; + case 'renderUserCards': + return val === 'both' || val === 'light' || val === 'dark' || val === 'none' + ? val + : undefined; + case 'jumboEmojiSize': + return typeof val === 'string' && JUMBO_EMOJI_VALUES.has(val as JumboEmojiSize) + ? val + : undefined; + case 'themeRemoteManualKind': + case 'themeRemoteLightKind': + case 'themeRemoteDarkKind': + return val === 'light' || val === 'dark' ? val : undefined; + case 'themeRemoteFavorites': + return sanitizeThemeRemoteFavorites(val); + case 'themeRemoteTweakFavorites': + return sanitizeThemeRemoteTweakFavorites(val); + case 'themeRemoteEnabledTweakFullUrls': + return sanitizeStringArray(val); + default: { + if (!(key in defaultSettings)) return undefined; + const sample = defaultSettings[key]; + if (typeof sample === 'boolean') { + return typeof val === 'boolean' ? val : undefined; + } + if (typeof sample === 'number') { + return typeof val === 'number' && Number.isFinite(val) ? val : undefined; + } + if (typeof sample === 'string') { + return typeof val === 'string' ? val : undefined; + } + if (sample === undefined) { + return typeof val === 'string' ? val : undefined; + } + return undefined; + } + } +} + +export function sanitizeSettingsDefaults(raw: unknown): Partial { + if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return {}; + const src = raw as Record; + const out: Partial = {}; + const warnings: string[] = []; + + for (const k of Object.keys(src)) { + if (!isSanitizableSettingsKey(k)) { + warnings.push(k); + continue; + } + const sanitized = sanitizeSettingsKey(k, src[k]); + if (sanitized !== undefined) { + (out as Record)[k] = sanitized; + } else if (src[k] !== undefined) { + warnings.push(k); + } + } + + if (import.meta.env.DEV && warnings.length > 0) { + console.warn( + '[config.settingsDefaults] ignored unknown or invalid keys:', + [...new Set(warnings)].slice(0, 25).join(', ') + ); + } + + return out; +} + +let runtimeSettingsDefaults: Partial = {}; + +/** @internal Resets deploy-time defaults, only used in tests. */ +export function resetRuntimeSettingsDefaults(): void { + runtimeSettingsDefaults = {}; +} + +export const baseSettings = atom(cloneDefaultSettings()); + +export function bootstrapSettingsStore(store: Store, rawSettingsDefaults: unknown): void { + const sanitized = sanitizeSettingsDefaults(rawSettingsDefaults); + runtimeSettingsDefaults = sanitized; + const merged = mergePersistedSettings(localStorage.getItem(STORAGE_KEY), sanitized); + store.set(baseSettings, merged); +} + +export const getSettings = (): Settings => + mergePersistedSettings(localStorage.getItem(STORAGE_KEY), runtimeSettingsDefaults); export const setSettings = (settings: Settings) => { localStorage.setItem(STORAGE_KEY, JSON.stringify(settings)); }; -const baseSettings = atom(getSettings()); export const settingsAtom = atom( (get) => get(baseSettings), (_get, set, update) => { diff --git a/src/app/utils/room.ts b/src/app/utils/room.ts index f252d95b5..e15630c79 100644 --- a/src/app/utils/room.ts +++ b/src/app/utils/room.ts @@ -7,6 +7,7 @@ import type { IPowerLevelsContent, IPushRule, IPushRules, + IThreadBundledRelationship, MatrixClient, MatrixEvent, Room, @@ -679,6 +680,30 @@ export const reactionOrEditEvent = (mEvent: MatrixEvent): boolean => { return false; }; +export const isThreadRelationEvent = (mEvent: MatrixEvent, threadRootId?: string): boolean => { + const relation = + mEvent.getRelation?.() ?? + ( + mEvent.getWireContent?.() as { + 'm.relates_to'?: { rel_type?: unknown; event_id?: unknown }; + } + )?.['m.relates_to'] ?? + ( + mEvent.getContent?.() as { + 'm.relates_to'?: { rel_type?: unknown; event_id?: unknown }; + } + )?.['m.relates_to']; + + return ( + relation?.rel_type === (RelationType.Thread as string) && + (threadRootId === undefined || relation.event_id === threadRootId) + ); +}; + +export const hasThreadRootAggregation = (mEvent: MatrixEvent): boolean => + (mEvent.getServerAggregatedRelation?.(RelationType.Thread as string) + ?.count ?? 0) > 0; + /** * Timeline rows skip reactions, edits, and other relation-only events. When jumping * to a reply target, unwrap to the event that is actually rendered (root of an diff --git a/src/app/utils/settingsSync.test.ts b/src/app/utils/settingsSync.test.ts index c0d617752..608a94343 100644 --- a/src/app/utils/settingsSync.test.ts +++ b/src/app/utils/settingsSync.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { getSettings } from '$state/settings'; +import { getSettings, resetRuntimeSettingsDefaults } from '$state/settings'; import { NON_SYNCABLE_KEYS, SETTINGS_SYNC_VERSION, @@ -15,6 +15,7 @@ let base: ReturnType; beforeEach(() => { localStorage.clear(); + resetRuntimeSettingsDefaults(); base = getSettings(); }); @@ -141,7 +142,12 @@ describe('deserializeFromSync', () => { developerTools: true, }, }; - const local = { ...base, pageZoom: 100, isPeopleDrawer: true, settingsSyncEnabled: false }; + const local = { + ...base, + pageZoom: 100, + isPeopleDrawer: true, + settingsSyncEnabled: false, + }; const result = deserializeFromSync(remote, local); expect(result).not.toBeNull(); expect(result!.pageZoom).toBe(100); @@ -280,12 +286,21 @@ describe('importSettingsFromJson', () => { }); it('resolves merged settings when a valid JSON file is provided', async () => { - const payload = { v: SETTINGS_SYNC_VERSION, settings: { twitterEmoji: false } }; + const payload = { + v: SETTINGS_SYNC_VERSION, + settings: { twitterEmoji: false }, + }; const fileContent = JSON.stringify(payload); - const file = new File([fileContent], 'settings.json', { type: 'application/json' }); + const file = new File([fileContent], 'settings.json', { + type: 'application/json', + }); // Build a minimal FileList-like object. - const fakeFileList = { 0: file, length: 1, item: () => file } as unknown as FileList; + const fakeFileList = { + 0: file, + length: 1, + item: () => file, + } as unknown as FileList; mockInput.files = fakeFileList; const promise = importSettingsFromJson({ ...base, twitterEmoji: true }); @@ -299,8 +314,14 @@ describe('importSettingsFromJson', () => { }); it('resolves null when the file contains invalid JSON', async () => { - const file = new File(['not json {{'], 'bad.json', { type: 'application/json' }); - const fakeFileList = { 0: file, length: 1, item: () => file } as unknown as FileList; + const file = new File(['not json {{'], 'bad.json', { + type: 'application/json', + }); + const fakeFileList = { + 0: file, + length: 1, + item: () => file, + } as unknown as FileList; mockInput.files = fakeFileList; const promise = importSettingsFromJson(base); @@ -314,7 +335,11 @@ describe('importSettingsFromJson', () => { const file = new File([JSON.stringify(payload)], 'settings.json', { type: 'application/json', }); - const fakeFileList = { 0: file, length: 1, item: () => file } as unknown as FileList; + const fakeFileList = { + 0: file, + length: 1, + item: () => file, + } as unknown as FileList; mockInput.files = fakeFileList; const promise = importSettingsFromJson(base); diff --git a/src/app/utils/timeline.ts b/src/app/utils/timeline.ts index ce99dd7e5..3a8566be8 100644 --- a/src/app/utils/timeline.ts +++ b/src/app/utils/timeline.ts @@ -1,6 +1,11 @@ import type { EventTimeline, MatrixEvent, Room } from '$types/matrix-sdk'; import { Direction } from '$types/matrix-sdk'; -import { roomHaveNotification, roomHaveUnread, reactionOrEditEvent } from '$utils/room'; +import { + isThreadRelationEvent, + reactionOrEditEvent, + roomHaveNotification, + roomHaveUnread, +} from '$utils/room'; export const PAGINATION_LIMIT = 60; @@ -161,7 +166,8 @@ export const getThreadReplyCount = (room: Room, mEventId: string): number => { const threadEvents = tl .getEvents() .filter( - (ev) => ev.threadRootId === mEventId && ev.getId() !== mEventId && !reactionOrEditEvent(ev) + (ev) => + ev.getId() !== mEventId && !reactionOrEditEvent(ev) && isThreadRelationEvent(ev, mEventId) ); return acc + threadEvents.length; }, 0);