Commit Graph
7244 Commits
Author SHA1 Message Date
Quentin Gliech 4be94f54bb admin-api: filter user list by presence of active OAuth2 session 2026-06-01 17:30:14 +02:00
Quentin Gliech ee9a7ccaef admin-api: filter user list by presence of active compat session
Adds `filter[has-active-compat-session]=true|false` to
`GET /api/admin/v1/users`. When `true` (resp. `false`), only users with
(resp. without) at least one active (non-finished) compatibility session
are returned.
2026-06-01 17:30:14 +02:00
Quentin Gliech be96582e9e admin-api: filter user list by active OAuth2 session with given clients
Adds `filter[active-oauth2-client]` to `GET /api/admin/v1/users`. The
filter is a repeatable ULID query parameter; the semantics are OR across
the supplied clients (a user matches if they have an active OAuth2
session belonging to any of them).

Each supplied client ID is validated up front: a missing client returns
404 (mirroring the pattern in `oauth2-sessions/list`).
2026-06-01 17:30:14 +02:00
Quentin Gliech 8ef0793031 storage: filter users by presence of an active OAuth2 session 2026-06-01 17:30:13 +02:00
Quentin Gliech 58b3a2e9f0 storage: filter users by presence of an active compat session
Adds `UserFilter::with_active_compat_session(has: bool)` and its
PostgreSQL implementation (an `EXISTS` / `NOT EXISTS` subquery against
`compat_sessions` on `user_id` with `finished_at IS NULL`).

Also adds a partial index `compat_sessions (user_id) WHERE finished_at IS
NULL` so that on installations with many finished compat sessions the
existence/non-existence check stays cheap.
2026-06-01 17:30:13 +02:00
Quentin Gliech 9a89e52d00 storage: filter users by active OAuth2 session with given clients
Adds `UserFilter::with_active_oauth2_session_for_any_of_clients` and its
PostgreSQL implementation (an `EXISTS` sub-query joining `oauth2_sessions`
on `user_id`, restricting to `finished_at IS NULL` and
`oauth2_client_id = ANY(...)`). The semantics are OR across the supplied
clients.

Also adds a partial composite index `oauth2_sessions (user_id,
oauth2_client_id) WHERE finished_at IS NULL` so that on installations with a
lot of churn we don't need to walk through finished sessions when answering
"does this user have an active session for any of these clients?". The
existing FK indexes can answer the query, but visit finished rows too.
2026-06-01 17:30:13 +02:00
Eric EastwoodandGitHub 427f8dd4fe Enforce clippy::allow_attributes (prefer #[expect] over #[allow]) (#5691)
For example, `#[expect(unused_mut)]` is better because it will complain about the lint being unused if there is not `mut` usage anymore.

> Example
> ```rust
> #[allow(unused_mut)]
> fn foo() -> usize {
>     let mut a = Vec::new();
>     a.len()
> }
> ```
> 
> Use instead:
> ```rust
> #[expect(unused_mut)]
> fn foo() -> usize {
>     let mut a = Vec::new();
>     a.len()
> }
> ```

Spawning from https://github.com/element-hq/matrix-authentication-service/pull/5670#discussion_r3244177988
2026-05-26 10:26:59 -05:00
Quentin GliechandGitHub e23b3067b7 Migrate to Tailwind v4 (#5702) 2026-05-26 17:09:55 +02:00
Quentin GliechandGitHub e18b596fb2 Update Compound to the latest version (#5703) 2026-05-26 17:09:50 +02:00
Quentin Gliech 8e65bf198e frontend: migrate to Tailwind 4
Tailwind 4 ships its own Vite plugin and no longer needs PostCSS plumbing.
Drop postcss/autoprefixer/postcss-import/postcss-nesting and the .postcssrc.json,
wire @tailwindcss/vite into vite.config.ts, replace the @tailwind directives
with @import "tailwindcss", and convert the JS tailwind.config.cjs theme
into a CSS @theme block in shared.css. An @source directive points back at
the SSR templates so the Jinja-rendered HTML in templates/ still gets scanned
for utility classes.

The third-party CSS (compound design tokens, compound-web, fontsource) moves
into a new vendor.css entrypoint, loaded ahead of shared.css from main.tsx,
storybook, and base.html. Tailwind v4's @import bundler silently drops the
nested `@import url(...) layer(cpd-base) screen` statements inside the
compound-design-tokens.css barrel, so we have to keep those imports out of
any file that contains Tailwind directives and let Vite's normal CSS pipeline
resolve them instead.
2026-05-25 16:31:36 +02:00
Quentin Gliech 08898b10da biome: enable CSS tailwind directives parser
Tailwind 4 introduces new at-rules (@import "tailwindcss", @source, @theme)
that Biome's CSS parser doesn't recognise by default. Enable the
tailwindDirectives parser option so frontend/src/entrypoints/shared.css
lints cleanly.
2026-05-25 16:31:36 +02:00
Quentin Gliech e03c953945 Adjust the button sizes to the new t-shirt size. 2026-05-25 16:28:42 +02:00
Quentin Gliech 5ea68e0bc3 Update the Compound icons in the server-side generated templates 2026-05-25 16:28:42 +02:00
Quentin Gliech 6f626ca0d3 Update Compound to the latest version 2026-05-25 16:28:42 +02:00
Quentin GliechandGitHub c9d1e60182 Bump the tracing group across 1 directory with 2 updates (#5676) 2026-05-25 15:58:38 +02:00
Quentin GliechandGitHub cb043e2cd9 build(deps): bump actions/upload-artifact from 7.0.0 to 7.0.1 (#5629) 2026-05-25 13:01:00 +02:00
Quentin GliechandGitHub a02fb6e14f build(deps): bump peter-evans/create-pull-request from 8.1.0 to 8.1.1 (#5628) 2026-05-25 13:00:49 +02:00
Quentin GliechandGitHub 6043fa729c build(deps): bump softprops/action-gh-release from 2.6.1 to 3.0.0 (#5627) 2026-05-25 13:00:40 +02:00
Quentin GliechandGitHub 73060d1819 build(deps): bump actions/upload-pages-artifact from 4.0.0 to 5.0.0 (#5626) 2026-05-25 13:00:27 +02:00
Quentin GliechandGitHub b05ca0e1fb Bump most frontend dependencies (#5699) 2026-05-25 12:57:16 +02:00
Quentin Gliech 99395c9e64 Make sure the footer is loaded before rendering the page 2026-05-25 12:46:00 +02:00
Quentin Gliech 41e8929ba5 Stop using the unsupported 'createFileRoute' typescript magic
Support for this ware removed from TanStack Router, so we need to explicitly set a route name when calling 'createFileRoute'.
2026-05-25 12:37:01 +02:00
Quentin Gliech 4bc2bc0e77 Update use of generated GraphQL types 2026-05-25 12:37:01 +02:00
Quentin Gliech ef6ecbbea0 Regenerate GraphQL types 2026-05-25 12:37:01 +02:00
Quentin Gliech 0cb2ea49be Update the typescript config for TypeScript 6 2026-05-25 12:37:01 +02:00
Quentin Gliech f339a10485 Run formatter 2026-05-25 12:37:01 +02:00
Quentin Gliech 9ae07db85a Bump all frontend dependencies 2026-05-25 12:36:56 +02:00
dependabot[bot]andGitHub 50177e6ad0 Bump the tracing group across 1 directory with 2 updates
Bumps the tracing group with 2 updates in the / directory: [tracing-subscriber](https://github.com/tokio-rs/tracing) and [tracing-appender](https://github.com/tokio-rs/tracing).


Updates `tracing-subscriber` from 0.3.22 to 0.3.23
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.3.22...tracing-subscriber-0.3.23)

Updates `tracing-appender` from 0.2.4 to 0.2.5
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-appender-0.2.4...tracing-appender-0.2.5)

---
updated-dependencies:
- dependency-name: tracing-appender
  dependency-version: 0.2.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tracing
- dependency-name: tracing-subscriber
  dependency-version: 0.3.23
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tracing
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-25 09:33:53 +00:00
Quentin GliechandGitHub 929f40d4f5 Switch to pnpm (#5674) 2026-05-25 11:32:12 +02:00
Quentin Gliech c7654248ab Inline the browser icons
They are very small and don't need an extra request to load. This is useful as
well for making the snapshots not dependant on where the project is installed
2026-05-25 11:16:55 +02:00
Quentin GliechandGitHub f78917ecbf Merge branch 'main' into quenting/pnpm 2026-05-25 11:12:18 +02:00
Eric Eastwood a79433e9ce Update test-only code to be gated behind #[cfg(test)]
See https://github.com/element-hq/matrix-authentication-service/pull/5691#discussion_r3284557046
2026-05-21 17:13:14 -05:00
Eric Eastwood 6dd5615119 Better exception comment 2026-05-21 16:45:56 -05:00
Eric Eastwood ee88379fc4 Remove unused lint ignores 2026-05-21 16:44:20 -05:00
Eric Eastwood fa23689962 #[allow -> #[expect 2026-05-21 16:37:47 -05:00
Eric Eastwood f2941fc6be Merge branch 'main' into madlittlemods/allow-to-expect-clippy-lint 2026-05-21 16:36:03 -05:00
Quentin GliechandGitHub 07c352ee2e Admin API - User - Add displayname and avatar url when adding user (#5671) 2026-05-21 10:22:30 +02:00
Eric EastwoodandGitHub 724e3024c5 Fix compatibility typo in session_limit config (#5692) 2026-05-20 17:51:46 -05:00
Eric Eastwood e57e5e41ce Fix compatibility typo 2026-05-20 17:36:49 -05:00
Eric EastwoodandGitHub a42737aab4 Add max_session_threshold configuration (only apply session_limit to people under the threshold) (#5670)
Add `max_session_threshold` configuration to prevent new users from passing
session limits while not disrupting the people already past the limit.

> This is most applicable in scenarios where your homeserver has many legacy
> bots/scripts that login over and over (which ideally should be using
> [personal access tokens]
> (https://github.com/element-hq/matrix-authentication-service/issues/4492))
> and you want to avoid breaking their operation while maintaining some level
> of sanity with the number of devices that people can have. This will
> prevent anyone else from crossing the limit.

Spawning from https://github.com/element-hq/matrix-authentication-service/pull/5607#discussion_r3150765827

Part of https://github.com/element-hq/matrix-authentication-service/issues/4339 / https://github.com/element-hq/backend-internal/issues/199 tracking work to limit number of devices.
2026-05-20 16:59:56 -05:00
Eric Eastwood d38d0cd366 Add interactive tests 2026-05-20 16:36:39 -05:00
Eric Eastwood e8f664e480 Merge branch 'main' into madlittlemods/max-session-threshold 2026-05-20 16:19:09 -05:00
Eric EastwoodandGitHub 94e35f03cf Show session/device limit errors on account page (#5644)
Part of https://github.com/element-hq/matrix-authentication-service/issues/4339 / https://github.com/element-hq/backend-internal/issues/199 tracking work to limit number of devices.

Follow-up to https://github.com/element-hq/matrix-authentication-service/pull/5639
2026-05-20 16:18:24 -05:00
Eric Eastwood a17e53297d Merge branch 'main' into madlittlemods/max-session-threshold
Conflicts:
	crates/handlers/src/compat/login.rs
2026-05-20 16:16:22 -05:00
Eric EastwoodandGitHub e3af5fbbe5 Interactive compat m.login.sso test for session soft_limit (#5675)
Follow-up to https://github.com/element-hq/matrix-authentication-service/pull/5607

Part of https://github.com/element-hq/matrix-authentication-service/issues/4339 / https://github.com/element-hq/backend-internal/issues/199 tracking work to limit number of devices.
2026-05-20 16:09:25 -05:00
Eric Eastwood d4e33f5121 Fix lints 2026-05-20 15:48:56 -05:00
Eric Eastwood c16eebdc6a Fix potentially typo 2026-05-20 15:47:58 -05:00
Eric Eastwood 1c648edb87 Use safer num_sessions_filtered_header pluralization
See https://github.com/element-hq/matrix-authentication-service/pull/5644#discussion_r3227855225
2026-05-20 15:47:09 -05:00
Eric Eastwood 62b2bf9a78 Add note on doing better than data-testid 2026-05-20 15:43:27 -05:00
Eric Eastwood e65237b8f9 Merge branch 'main' into madlittlemods/soft-limit-account-session-management 2026-05-20 15:06:24 -05:00