strapi-plugin-magic-sessionmanager 4.16.1 → 4.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +49 -15
- package/dist/admin/{Analytics-FcRt0X62.mjs → Analytics-B-p2Q7th.mjs} +1 -1
- package/dist/admin/{Analytics-CMR62DiD.js → Analytics-BTIByTUY.js} +1 -1
- package/dist/admin/{App-CmytGbze.js → App-CH6635JB.js} +33 -170
- package/dist/admin/{App-DBieSWB0.mjs → App-DmesuM2g.mjs} +3 -140
- package/dist/admin/{OnlineUsersWidget-zP9Hl_it.mjs → OnlineUsersWidget-CuqeQ0tb.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-Lzx9XB74.js → OnlineUsersWidget-TlOp8nie.js} +1 -1
- package/dist/admin/{Settings-CZOPusQK.mjs → Settings-C4IgGBjQ.mjs} +1163 -56
- package/dist/admin/{Settings-1v--SXC0.js → Settings-DtP_H4JS.js} +1167 -60
- package/dist/admin/dashboardModel-0ROcWcB1.mjs +189 -0
- package/dist/admin/dashboardModel-BSJhZdXI.js +188 -0
- package/dist/admin/{de-D3TSA066.mjs → de-BoahnYIP.mjs} +110 -9
- package/dist/admin/{de-y_9mdVT7.js → de-C_ooq6EF.js} +110 -9
- package/dist/admin/{en-CIQB8nfI.js → en-CuUVE2K0.js} +110 -9
- package/dist/admin/{en-B60I97bK.mjs → en-DHme92L-.mjs} +110 -9
- package/dist/admin/{es-CJEL_iGC.mjs → es-CjcTgS9Z.mjs} +110 -9
- package/dist/admin/{es-DHhHzlRY.js → es-lbDNXcQi.js} +110 -9
- package/dist/admin/{fr-BfBK_iuV.mjs → fr-BPwnrSaC.mjs} +110 -9
- package/dist/admin/{fr-D86FTt1w.js → fr-RtypjgGp.js} +110 -9
- package/dist/admin/{index-tt61o2VH.mjs → index-B102RF2H.mjs} +40 -38
- package/dist/admin/{index-CSJJn4qy.js → index-w0OuPYFm.js} +12 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-BE-FT-L8.js → pt-BMCAKRQ4.js} +110 -9
- package/dist/admin/{pt-C3PSvC7z.mjs → pt-D5FHSP2y.mjs} +110 -9
- package/dist/server/index.js +1519 -78
- package/dist/server/index.mjs +1519 -78
- package/package.json +1 -1
- package/dist/admin/riskData-BVs9GpgD.js +0 -26
- package/dist/admin/riskData-CI1gm2yI.mjs +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
# [4.17.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.16.1...v4.17.0) (2026-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* account and IP lockout with unlock, session limits, sign-out on password change and per-role rules ([#35](https://github.com/Schero94/Magic-Sessionmanager/issues/35)) ([faeac7c](https://github.com/Schero94/Magic-Sessionmanager/commit/faeac7cc1a299043c3b9d6c03c54cfec96f9fa43))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Release type: minor (`feat`). Additive: three new admin routes, one new permission and new settings keys; no existing route, response or setting changes meaning. One default differs between new and existing installations (see Migration).
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
* **Account lockout** next to the IP lockout (Configuration › Login protection › Failed sign-ins): **Lock an account after** N failed sign-ins for one account from any address (0 = off, the default). Counted by a SHA-256 hash of the lower-cased identifier; the typed identifier is never stored. An unknown account is locked and answered exactly like an existing one.
|
|
14
|
+
* **Configurable window and lock duration** (`lockoutWindowMinutes` 1-1440, `lockoutDurationMinutes` 1-10080; both default 15, as before). `Retry-After` follows the lock. When a lock ends, the failures that caused it no longer count.
|
|
15
|
+
* **Trusted addresses** (`lockoutTrustedAddresses`, up to 100 IPs or CIDR ranges, IPv4 and IPv6): never locked by IP; their accounts can still be locked.
|
|
16
|
+
* **Locked now** card with **Unlock**: lists locked IP addresses (as the security log stores IPs: full, shortened or hidden) and locked accounts with their user. Seeing it needs plugin access; **Unlock** needs the new permission **Unlock locked sign-ins** (`plugin::magic-sessionmanager.lockouts.unlock`, Super Admin only at first). Every unlock is recorded with the admin who did it. Admin routes `GET /lockouts`, `POST /lockouts/unlock` (`{ id }`, write rate limit) and `GET /roles`.
|
|
17
|
+
* **Lockout email** (`lockoutNotifyUser`, off by default): the account owner gets the new **Account locked** template (editable under Alerts › Email templates) through Strapi's email plugin, so Magic Mail delivers it when installed.
|
|
18
|
+
* **Security log events for app users** (switch **Record failed and refused sign-ins**, `recordUserSignInEvents`, on by default): `user.sign-in.failed`, `user.sign-in.refused` (`meta.reason`: lockout, too-many-attempts, session-limit, country, risk, location-unavailable), `user.lockout`, plus `user.lockout.lifted` (actor = admin), `user.session.limit` and `user.password-change.ended-others`. A client that keeps hitting a lock is logged once per minute; sign-ins naming an account that does not exist are aggregated to one event per anonymised address per 5 minutes (`meta.unknownAccount`), and no typed identifier or title is stored. Deleting a user deletes their events.
|
|
19
|
+
* The new policy settings are **protected settings**: changing them needs **Change protected settings** (`settings.update`, from 4.16.1) as well as plugin access; roles without it see them read-only and can still save the rest of the form.
|
|
20
|
+
* **Concurrent session limit** (Sessions › Concurrent sessions, `maxSessionsPerUser`, 0 = off by default): **End the oldest session** (default) or **Refuse the new sign-in**. A refused sign-in answers `403` with `error.details.code: "SESSION_LIMIT_REACHED"` and `details.limit`; no token or refresh cookie leaves the server and the new session is ended. Idle and over-age sessions do not count. Applied in one cluster-wide critical section per user.
|
|
21
|
+
* **End other sessions after a password change** (`endOtherSessionsOnPasswordChange`) for `POST /auth/change-password` in both JWT modes; the session that made the change stays. A failure fails closed (503) like the password reset.
|
|
22
|
+
* **Different rules for some roles** (Sessions › Roles, collapsed): per Users & Permissions role an own session limit, inactivity timeout and account lockout threshold (`roleRules`, up to 50). The token check and the idle check apply the role's timeout; the overview still classifies "idle" by the general timeout.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
* The IP lockout settings are labelled "Lock an IP address after" and the Login protection intro no longer says refused sign-ins are not recorded.
|
|
27
|
+
* With a role rule for the inactivity timeout, the idle check uses the Document Service path even when "Direct SQL" is selected (it needs each session's role).
|
|
28
|
+
|
|
29
|
+
### Migration
|
|
30
|
+
|
|
31
|
+
* **Existing installations keep their behaviour.** On the first start of this version, an installation that ran an earlier version gets `endOtherSessionsOnPasswordChange: false` stored once, so a password change keeps the other sessions as before. New installations end them by default. Turn it on under Sessions › Password change.
|
|
32
|
+
* Every other new setting is off or keeps the earlier value: IP lockout 5 failures / 15 minutes / 15 minutes, no account lockout, no session limit, no role rules. Failed and refused app-user sign-ins are now written to the security log; turn off **Record failed and refused sign-ins** to keep the previous behaviour.
|
|
33
|
+
* A custom `coordination.counterStore` receives a third `block(key, untilMs, { windowStart })` argument; a store that ignores it keeps working, but a client may get "Too many login attempts at once" until the counting window ends after a lock.
|
|
34
|
+
* `X-Session-Terminated-Reason` keeps its five values: sessions ended by the session limit report `manual`, by a password change `logout`.
|
|
35
|
+
|
|
36
|
+
### Tests
|
|
37
|
+
|
|
38
|
+
* `tests/isolated-policies-http.test.js` boots Strapi from this checkout and covers IP and account lockout across addresses, trusted addresses, Retry-After, the lock email (fake email plugin), Locked now with RBAC (401/403/200), Unlock with the actor in the log, the recording switch, session limit (end oldest, refuse with 403 and no tokens), per-role limit and idle timeout, ending other sessions after a password change and the switch, and event deletion with the user. CI runs it on SQLite and PostgreSQL in legacy and refresh mode, and on the Strapi 5.50 floor.
|
|
39
|
+
* The multi-process check (8 processes, SQLite and PostgreSQL) now drives the real lockout engine: exact per-IP and per-account limits across processes, one shared lock list and a cluster-wide unlock.
|
|
40
|
+
* Unit tests for the policy settings, the lockout engine, upgrade defaults, the session limit and the lock email; StrictMode tests for the Locked now card (states, RBAC, keyboard, unlock round trip) and the role rules editor.
|
|
41
|
+
|
|
1
42
|
## [4.16.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.16.0...v4.16.1) (2026-11-25)
|
|
2
43
|
|
|
3
44
|
|
package/README.md
CHANGED
|
@@ -498,17 +498,46 @@ Saved settings are not changed: a switch that was on stays stored and applies on
|
|
|
498
498
|
|
|
499
499
|
## Login protection
|
|
500
500
|
|
|
501
|
-
Configuration › Login protection checks **new sign-ins only**. Existing sessions are not affected
|
|
501
|
+
Configuration › Login protection checks **new sign-ins only**. Existing sessions are not affected. Failed and refused sign-ins are written to the [security log](#admin-activity-and-sign-in-history) while **Record failed and refused sign-ins** is on (default).
|
|
502
502
|
|
|
503
|
-
| Rule | Response | Notes
|
|
504
|
-
| ----------------------------- | ----------------------------------- |
|
|
505
|
-
|
|
|
506
|
-
| Reject suspicious sign-ins | 403 | VPN, proxy or Tor address, or, with security scoring on, a score below 50. Needs a [risk data source](#risk-data-vpn-proxy-tor); without one this rule refuses nothing.
|
|
507
|
-
| Country rules | 403 | Allow only listed countries, or reject listed countries. With "Allow only listed countries", an empty list allows every country.
|
|
508
|
-
| Location cannot be determined | 403 "Login temporarily unavailable" | When `geoLookupFailureMode` says reject (`auto` rejects only when "Reject suspicious sign-ins" is on).
|
|
503
|
+
| Rule | Response | Notes |
|
|
504
|
+
| ----------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
505
|
+
| IP and account lockout | 429 with `Retry-After` | After `maxFailedLogins` failed sign-ins from one IP address, or `maxFailedLoginsPerAccount` for one account from any address (off by default), within `lockoutWindowMinutes` (15), that address or account is refused for `lockoutDurationMinutes` (15). Shared by all server processes. Each attempt is counted before the password check, so a parallel burst cannot exceed the limit; extra attempts running at once get 429 with `Retry-After: 1` and no lock. See [Lockout, trusted addresses and Locked now](#lockout-trusted-addresses-and-locked-now). |
|
|
506
|
+
| Reject suspicious sign-ins | 403 | VPN, proxy or Tor address, or, with security scoring on, a score below 50. Needs a [risk data source](#risk-data-vpn-proxy-tor); without one this rule refuses nothing. |
|
|
507
|
+
| Country rules | 403 | Allow only listed countries, or reject listed countries. With "Allow only listed countries", an empty list allows every country. |
|
|
508
|
+
| Location cannot be determined | 403 "Login temporarily unavailable" | When `geoLookupFailureMode` says reject (`auto` rejects only when "Reject suspicious sign-ins" is on). |
|
|
509
|
+
| Session limit (policy Refuse) | 403 `SESSION_LIMIT_REACHED` | The user already has `maxSessionsPerUser` open sessions. See [Concurrent session limit](#concurrent-session-limit). |
|
|
509
510
|
|
|
510
511
|
Requests with an ended session get **401** with the header `X-Session-Terminated-Reason` (`logout`, `manual`, `idle`, `expired` or `blocked`).
|
|
511
512
|
|
|
513
|
+
### Lockout, trusted addresses and Locked now
|
|
514
|
+
|
|
515
|
+
- **Per IP** (`maxFailedLogins`, default 5) and **per account** (`maxFailedLoginsPerAccount`, default 0 = off). The account counter uses a SHA-256 hash of the lower-cased identifier (`identifier` of `/auth/local`, `email` of the Magic Link routes); the typed identifier is never stored. An unknown account is counted and answered exactly like an existing one, so the response does not reveal which accounts exist.
|
|
516
|
+
- Anyone who knows an account name can lock that account. Keep the account threshold higher than the IP threshold; admins can lift a lock at once.
|
|
517
|
+
- **Window and duration**: `lockoutWindowMinutes` (1-1440) and `lockoutDurationMinutes` (1-10080). When a lock ends, the failures that caused it no longer count.
|
|
518
|
+
- **Trusted addresses** (`lockoutTrustedAddresses`, up to 100 IPs or CIDR ranges such as `192.0.2.0/24` or `2001:db8::/32`) are never locked by IP. Their accounts can still be locked. Use it for an office NAT or a backend that signs in for many users.
|
|
519
|
+
- **Locked now** (same tab) lists every active lock: IP addresses as the security log stores them (full, shortened or hidden) and accounts with their user. **Unlock** needs the permission **Unlock locked sign-ins** and is recorded with the admin who did it.
|
|
520
|
+
- **Lockout email** (`lockoutNotifyUser`, off by default) tells the account owner about an account lock, through Strapi's email plugin (Magic Mail delivers it when installed). The text is the **Account locked** template under Alerts › Email templates (`{{user.email}}`, `{{user.username}}`, `{{lock.minutes}}`, `{{lock.until}}`).
|
|
521
|
+
|
|
522
|
+
### Concurrent session limit
|
|
523
|
+
|
|
524
|
+
Sessions › Concurrent sessions: `maxSessionsPerUser` (0 = no limit, the default). Sessions that are idle or past their maximum age do not count.
|
|
525
|
+
|
|
526
|
+
| Policy (`sessionLimitPolicy`) | What happens at the limit |
|
|
527
|
+
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
528
|
+
| `end-oldest` (default) | The new sign-in succeeds; the oldest open sessions end (`X-Session-Terminated-Reason: manual`). |
|
|
529
|
+
| `refuse` | The sign-in answers `403` with `{ error: { name: 'ForbiddenError', details: { code: 'SESSION_LIMIT_REACHED', limit } } }`. No token or refresh cookie is sent; Strapi's new session is ended at once. |
|
|
530
|
+
|
|
531
|
+
The check and the session creation run in one cluster-wide critical section per user, so parallel sign-ins on several processes cannot pass the limit together.
|
|
532
|
+
|
|
533
|
+
### Password change
|
|
534
|
+
|
|
535
|
+
Sessions › Password change › **End other sessions after a password change** (`endOtherSessionsOnPasswordChange`): after `POST /auth/change-password` every other session of the user ends (`logout`), in legacy and refresh mode; the session that made the change stays. On by default for new installations; installations upgraded from 4.16 or earlier keep the previous behaviour (off) until it is turned on. A password reset always ends the other sessions.
|
|
536
|
+
|
|
537
|
+
### Different rules for some roles
|
|
538
|
+
|
|
539
|
+
Sessions › Roles › **Different rules for some roles** (collapsed): per Users & Permissions role an own session limit, inactivity timeout and account lockout threshold (`roleRules`: `[{ role: '<role documentId>', maxSessionsPerUser, inactivityTimeout, maxFailedLoginsPerAccount }]`, `null` = general value, up to 50 rules). The token check and the idle check use the role's timeout. The dashboard's Active/Idle counts still use the general timeout.
|
|
540
|
+
|
|
512
541
|
---
|
|
513
542
|
|
|
514
543
|
## Alerts
|
|
@@ -684,16 +713,17 @@ Prefix `/magic-sessionmanager` (Strapi admin API). Every route requires an authe
|
|
|
684
713
|
|
|
685
714
|
The **Admin panel sessions** routes need two more permissions, which only the Super Admin role has by default (Settings › Administration Panel › Roles › Plugins › Session Manager › Admin panel):
|
|
686
715
|
|
|
687
|
-
| Permission | Name in the role editor
|
|
688
|
-
| ---------------------------------------------------- |
|
|
689
|
-
| `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions
|
|
690
|
-
| `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins
|
|
691
|
-
| `plugin::magic-sessionmanager.admin-activity.read` | View admin activity
|
|
692
|
-
| `plugin::magic-sessionmanager.settings.update` | Change protected settings (location lookup, webhooks, security log) | Changing IP location lookup, provider, lookup failure mode and database file, team notification webhooks, and (with View admin activity) the security log settings. Since 4.17; Super Admin only by default |
|
|
716
|
+
| Permission | Name in the role editor | Allows |
|
|
717
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
718
|
+
| `plugin::magic-sessionmanager.admin-sessions.read` | Read admin panel sessions | The Admin panel view and its two GET routes |
|
|
719
|
+
| `plugin::magic-sessionmanager.admin-sessions.revoke` | Sign out admins | **Sign out** and **Sign out everywhere** (also needs read) |
|
|
720
|
+
| `plugin::magic-sessionmanager.admin-activity.read` | View admin activity | Sign-in history, Activity, Recent sign-in activity, CSV exports and changing the Admin activity settings (also needs read) |
|
|
721
|
+
| `plugin::magic-sessionmanager.settings.update` | Change protected settings (location lookup, webhooks, security log, sign-in policies) | Changing IP location lookup, provider, lookup failure mode and database file, team notification webhooks, the sign-in and session policies (lockout, trusted addresses, session limit, password-change sign-out, role rules), and (with View admin activity) the security log settings. Since 4.17; Super Admin only by default |
|
|
722
|
+
| `plugin::magic-sessionmanager.lockouts.unlock` | Unlock locked sign-ins | **Unlock** in Login protection › Locked now (also needs `access`) |
|
|
693
723
|
|
|
694
724
|
**What the admin panel view shows about other admins (4.17).** Names, emails and roles of admins are Strapi's own user data. The Admin panel view and the sign-in history return them only to roles that may also read them in Settings › Users: email and name need Strapi's **Read** permission on Users (`admin::users.read`), role names need it or **Read** on Roles (`admin::roles.read`). Without them the list shows "Admin #12", "Email hidden" and "Hidden" (roles), and the search matches the admin id only. Every admin always sees their own row. Grant `admin::users.read` to roles that should keep seeing names and emails.
|
|
695
725
|
|
|
696
|
-
**Protected settings (4.17).** `PUT /settings` still needs only `access`, so roles that change the session, login-protection, alert-email and retention options keep working. Changing a protected key needs **Change protected settings** as well, else 403 with `error.details.reason: "settings-update-permission"`: `enableGeolocation`, `geoIpProvider`, `geoLookupFailureMode`, `geoIpDatabasePath`, `enableWebhooks`, `discordWebhookUrl`, `slackWebhookUrl
|
|
726
|
+
**Protected settings (4.17).** `PUT /settings` still needs only `access`, so roles that change the session, login-protection, alert-email and retention options keep working. Changing a protected key needs **Change protected settings** as well, else 403 with `error.details.reason: "settings-update-permission"`: `enableGeolocation`, `geoIpProvider`, `geoLookupFailureMode`, `geoIpDatabasePath`, `enableWebhooks`, `discordWebhookUrl`, `slackWebhookUrl`, every security log key (those also keep needing **View admin activity**, reason `admin-activity-permission`) and the sign-in and session policy keys (`maxFailedLoginsPerAccount`, `lockoutWindowMinutes`, `lockoutDurationMinutes`, `lockoutTrustedAddresses`, `lockoutNotifyUser`, `recordUserSignInEvents`, `maxSessionsPerUser`, `sessionLimitPolicy`, `endOtherSessionsOnPasswordChange`, `roleRules`). Sending a protected key back with its stored value is not a change, so these roles can still save the whole form. The admin UI shows these controls read-only for them.
|
|
697
727
|
|
|
698
728
|
| Method | Path | Admin UI action |
|
|
699
729
|
| -------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -725,6 +755,9 @@ The **Admin panel sessions** routes need two more permissions, which only the Su
|
|
|
725
755
|
| GET | `/admin-activity/sign-ins/export` | CSV export batches of 500 rows, newest first; same filters plus `cursor`; follow `meta.nextCursor` |
|
|
726
756
|
| GET | `/admin-activity/content` | **Activity**: `adminId`, `action` (`all`, `view`, `create`, `update`, `publish`, `unpublish`, `discard`, `delete`, `clone`), `contentType` (uid), `from`, `to`, `page`, `pageSize`; needs `admin-activity.read` |
|
|
727
757
|
| GET | `/admin-activity/content/export` | CSV export batches of 500 rows; same filters plus `cursor` |
|
|
758
|
+
| GET | `/lockouts` | **Locked now**: `{ data: [{ id, kind: 'ip' \| 'account', ip, user, failures, lockedAt, until }] }`; read rate limit |
|
|
759
|
+
| POST | `/lockouts/unlock` | **Unlock**: body `{ id }` from the list; needs `lockouts.unlock`; 404 when the lock already ended; 10 per minute |
|
|
760
|
+
| GET | `/roles` | Users & Permissions roles (without Public) for **Different rules for some roles** |
|
|
728
761
|
|
|
729
762
|
**Session list parameters.** `page` (from 1), `pageSize` (1-100), `status` (`all`, `open`, `active`, `idle`, `ended`), `reason` (with `status=ended`: `logout`, `idle`, `expired`, `manual`, `blocked`, `unrecorded`), `search` (up to 100 characters; matches email, username, IP address, browser, operating system and device type) and `sort` (`loginTime:desc`, `loginTime:asc`, `lastActive:desc`, `lastActive:asc`). The response is `{ data, meta: { pagination: { page, pageSize, total, pageCount } } }` with exact totals. Unknown or out-of-range parameters return 400. Pages that start after the first 50,000 matching sessions return 400; narrow the filter or use the export, which walks every row with a cursor. Without `page` and `pageSize`, `GET /sessions` keeps the 4.x response (latest 1,000 rows, `meta.truncated`) for existing scripts.
|
|
730
763
|
|
|
@@ -1001,7 +1034,8 @@ The plugin sits in the request path of every authenticated Content API call, so
|
|
|
1001
1034
|
|
|
1002
1035
|
- **Ownership.** Content API routes only return or end the caller's own sessions. A foreign session ID answers exactly like a missing one, so IDs cannot be probed.
|
|
1003
1036
|
- **Revocation.** Ended, expired and revoked sessions and blocked users are rejected on every Content API request, in both token check modes. Tokens of deleted records stay on a revocation list.
|
|
1004
|
-
- **Password reset.** A successful password reset ends every older session of the user in both JWT modes.
|
|
1037
|
+
- **Password reset and change.** A successful password reset ends every older session of the user in both JWT modes; a password change does the same when **End other sessions after a password change** is on.
|
|
1038
|
+
- **Lockout data.** Lock counters store SHA-256 hashes of IPs and identifiers, never the typed identifier. The Locked now list shows IPs as the security log stores them and expires with the lock. Failed and refused app-user sign-ins go to the security log (switch **Record failed and refused sign-ins**); deleting a user deletes their events.
|
|
1005
1039
|
- **Privacy.** Session records contain IP addresses, user agents and location data. With the `auto` or `ipapi` provider, IP addresses can be sent to ipapi.co; use `local-mmdb` or turn off IP location lookup to avoid that. The details dialog never looks up a location unless you click **Look up location**. Set **Keep ended sessions for** to match your retention policy, and use **Delete ended sessions** or **Delete record** to remove history.
|
|
1006
1040
|
- **What leaves your server.** Only what you turn on: IP lookups of end-user sign-ins at ipapi.co (provider `auto` without a local database, or `ipapi`; admin security events only with **Look up the location of security events** and the explicit `ipapi` provider, and then only the anonymised address), Discord or Slack webhooks (Team notifications), emails through your own Email provider (Security emails) and the MaxMind database download when you click **Update database** or run the updater. There is no telemetry, no install ping and no license check.
|
|
1007
1041
|
- **Reporting a vulnerability.** Please do not post exploit details in a public issue. Open an issue that asks for a private contact, or use the email address on the maintainer's GitHub profile, and you will get a reply before anything is published.
|
|
@@ -7,7 +7,7 @@ import styled from "styled-components";
|
|
|
7
7
|
import { Typography, Flex, LinkButton, Button, EmptyStateLayout, VisuallyHidden } from "@strapi/design-system";
|
|
8
8
|
import { ArrowClockwise, ChartBubble, User, Clock, Calendar } from "@strapi/icons";
|
|
9
9
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
10
|
-
import { K as normalizeDeviceType, u as useSessionFormatters,
|
|
10
|
+
import { K as normalizeDeviceType, u as useSessionFormatters, f as pluginId, n as isCancelledRequest, l as logSafeAdminError, h as PersistentAlert, R as ReadableText, q as PageShell, r as StatGrid, s as StatCard, z as EqualGrid, b as getTranslation, L as getDeviceTypeMessage } from "./index-B102RF2H.mjs";
|
|
11
11
|
import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
|
|
12
12
|
const ANALYTICS_UNKNOWN_KEY = "unknown";
|
|
13
13
|
const VERSION_TOKEN = /^v?\d[\w.]*$/i;
|
|
@@ -9,7 +9,7 @@ const styled = require("styled-components");
|
|
|
9
9
|
const designSystem = require("@strapi/design-system");
|
|
10
10
|
const icons = require("@strapi/icons");
|
|
11
11
|
const symbols = require("@strapi/icons/symbols");
|
|
12
|
-
const index = require("./index-
|
|
12
|
+
const index = require("./index-w0OuPYFm.js");
|
|
13
13
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
14
14
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
15
15
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
@@ -9,8 +9,8 @@ const designSystem = require("@strapi/design-system");
|
|
|
9
9
|
const icons = require("@strapi/icons");
|
|
10
10
|
const symbols = require("@strapi/icons/symbols");
|
|
11
11
|
const styled = require("styled-components");
|
|
12
|
-
const index = require("./index-
|
|
13
|
-
const
|
|
12
|
+
const index = require("./index-w0OuPYFm.js");
|
|
13
|
+
const dashboardModel = require("./dashboardModel-BSJhZdXI.js");
|
|
14
14
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
15
15
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
16
16
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
@@ -25,7 +25,6 @@ const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800
|
|
|
25
25
|
});
|
|
26
26
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant, textColor, "data-end-reason": presentation.reason, children: translate(presentation) });
|
|
27
27
|
};
|
|
28
|
-
const RowActions = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", alignItems: "center", gap: 1, "data-row-actions": "", ...props, children });
|
|
29
28
|
const MAX_EXPORT_ROWS = 5e4;
|
|
30
29
|
const EXPORT_BATCH_SIZE = 1e3;
|
|
31
30
|
const EMPTY_SESSION_STATS = Object.freeze({
|
|
@@ -260,23 +259,6 @@ function useBreakpoint() {
|
|
|
260
259
|
isBelowLarge: isBelowBreakpoint(breakpoint, "large")
|
|
261
260
|
};
|
|
262
261
|
}
|
|
263
|
-
function useElementWidth() {
|
|
264
|
-
const [width, setWidth] = react.useState(0);
|
|
265
|
-
const observerRef = react.useRef(null);
|
|
266
|
-
const ref = react.useCallback((node) => {
|
|
267
|
-
observerRef.current?.disconnect();
|
|
268
|
-
observerRef.current = null;
|
|
269
|
-
if (!node || typeof ResizeObserver === "undefined") return;
|
|
270
|
-
const observer = new ResizeObserver((entries) => {
|
|
271
|
-
const next = Math.round(entries[0]?.contentRect?.width || 0);
|
|
272
|
-
setWidth((previous) => previous === next ? previous : next);
|
|
273
|
-
});
|
|
274
|
-
observer.observe(node);
|
|
275
|
-
observerRef.current = observer;
|
|
276
|
-
}, []);
|
|
277
|
-
react.useEffect(() => () => observerRef.current?.disconnect(), []);
|
|
278
|
-
return [ref, width];
|
|
279
|
-
}
|
|
280
262
|
const RISK_LEVEL_MESSAGES = Object.freeze({
|
|
281
263
|
none: Object.freeze({ messageId: "modal.security.risk.none", defaultMessage: "None" }),
|
|
282
264
|
low: Object.freeze({ messageId: "modal.security.risk.low", defaultMessage: "Low" }),
|
|
@@ -307,7 +289,7 @@ function normalizeGeoData(geo, fallback = {}) {
|
|
|
307
289
|
const city = index.presentText(geo.city);
|
|
308
290
|
const timezone = index.presentText(geo.timezone);
|
|
309
291
|
if (!country && !city && !timezone) return null;
|
|
310
|
-
const riskSource =
|
|
292
|
+
const riskSource = dashboardModel.isRiskSource(geo.riskSource) ? geo.riskSource : null;
|
|
311
293
|
const rawScore = typeof geo.securityScore === "number" ? geo.securityScore : fallback?.securityScore;
|
|
312
294
|
const securityScore = riskSource && typeof rawScore === "number" && Number.isFinite(rawScore) ? rawScore : null;
|
|
313
295
|
return {
|
|
@@ -353,125 +335,6 @@ function interpretLookupResult(payload) {
|
|
|
353
335
|
const geo = normalizeGeoData(data);
|
|
354
336
|
return geo ? { status: "ok", geo } : { status: "failed", geo: null };
|
|
355
337
|
}
|
|
356
|
-
const PAGE_SIZE_OPTIONS = Object.freeze(["10", "25", "50", "100"]);
|
|
357
|
-
const DEFAULT_PAGE_SIZE = "25";
|
|
358
|
-
const DASHBOARD_TABLE_COLUMNS = 7;
|
|
359
|
-
const DASHBOARD_COMPACT_TABLE_COLUMNS = 5;
|
|
360
|
-
const AUTO_REFRESH_INTERVAL_MS = 10 * 60 * 1e3;
|
|
361
|
-
const HOW_IT_WORKS_STORAGE_KEY = "magic-sessionmanager.dashboard.howSessionsWork";
|
|
362
|
-
const USER_EDIT_PATH = "/content-manager/collection-types/plugin::users-permissions.user/";
|
|
363
|
-
const readQueryText = (value) => {
|
|
364
|
-
if (typeof value !== "string") return "";
|
|
365
|
-
try {
|
|
366
|
-
return decodeURIComponent(value).trim();
|
|
367
|
-
} catch {
|
|
368
|
-
return value.trim();
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
function parseDashboardQuery(query = {}) {
|
|
372
|
-
const source = query || {};
|
|
373
|
-
const page = Number.parseInt(String(source.page ?? "1"), 10);
|
|
374
|
-
const pageSize = PAGE_SIZE_OPTIONS.includes(String(source.pageSize)) ? String(source.pageSize) : DEFAULT_PAGE_SIZE;
|
|
375
|
-
const status = index.isSessionFilter(source.status) ? (
|
|
376
|
-
/** @type {string} */
|
|
377
|
-
source.status
|
|
378
|
-
) : index.DEFAULT_SESSION_FILTER;
|
|
379
|
-
const reason = status === "ended" && index.isEndReasonFilter(source.reason) ? (
|
|
380
|
-
/** @type {string} */
|
|
381
|
-
source.reason
|
|
382
|
-
) : index.DEFAULT_END_REASON_FILTER;
|
|
383
|
-
const search = readQueryText(source.search) || readQueryText(source._q);
|
|
384
|
-
return { page: Number.isFinite(page) && page >= 1 ? page : 1, pageSize, status, reason, search };
|
|
385
|
-
}
|
|
386
|
-
function encodeSearchQuery(value) {
|
|
387
|
-
const text = typeof value === "string" ? value.trim() : "";
|
|
388
|
-
return text ? encodeURIComponent(text) : void 0;
|
|
389
|
-
}
|
|
390
|
-
function hasActiveFilters(state) {
|
|
391
|
-
if (!state) return false;
|
|
392
|
-
return state.status !== index.DEFAULT_SESSION_FILTER || Boolean(state.reason) && state.reason !== index.DEFAULT_END_REASON_FILTER || Boolean(state.search);
|
|
393
|
-
}
|
|
394
|
-
function getSessionUserLabels(session) {
|
|
395
|
-
const username = index.presentText(session?.user?.username);
|
|
396
|
-
const email = index.presentText(session?.user?.email);
|
|
397
|
-
const primary = username || email;
|
|
398
|
-
return {
|
|
399
|
-
primary,
|
|
400
|
-
secondary: username && email ? email : "",
|
|
401
|
-
accessible: primary || index.presentText(session?.id)
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
function getUserEditPath(session) {
|
|
405
|
-
const documentId = index.presentText(session?.user?.documentId);
|
|
406
|
-
return documentId ? `${USER_EDIT_PATH}${encodeURIComponent(documentId)}` : null;
|
|
407
|
-
}
|
|
408
|
-
function getExportDeviceInfo(session, unavailableValue = "") {
|
|
409
|
-
const device = index.getDevicePresentation(session);
|
|
410
|
-
return {
|
|
411
|
-
device: device.deviceType || unavailableValue,
|
|
412
|
-
browser: device.browser || unavailableValue,
|
|
413
|
-
browserVersion: device.browserVersion || "",
|
|
414
|
-
os: device.os || unavailableValue
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
function readDisclosureOpen(storage) {
|
|
418
|
-
try {
|
|
419
|
-
return storage?.getItem(HOW_IT_WORKS_STORAGE_KEY) === "open";
|
|
420
|
-
} catch {
|
|
421
|
-
return false;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
function writeDisclosureOpen(storage, open) {
|
|
425
|
-
try {
|
|
426
|
-
storage?.setItem(HOW_IT_WORKS_STORAGE_KEY, open ? "open" : "closed");
|
|
427
|
-
} catch {
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
function getBrowserStorage() {
|
|
431
|
-
try {
|
|
432
|
-
return typeof window !== "undefined" ? window.localStorage : null;
|
|
433
|
-
} catch {
|
|
434
|
-
return null;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
function shouldIsolateActionKey(key, fromInsideGroup) {
|
|
438
|
-
if (!fromInsideGroup) return true;
|
|
439
|
-
return key === "Enter" || key === " " || key === "Spacebar";
|
|
440
|
-
}
|
|
441
|
-
const FULL_TABLE_MIN_WIDTH = 1200;
|
|
442
|
-
function shouldUseCompactTable(listWidth, isBelowLarge) {
|
|
443
|
-
if (isBelowLarge) return true;
|
|
444
|
-
if (!Number.isFinite(listWidth) || listWidth <= 0) return false;
|
|
445
|
-
return listWidth < FULL_TABLE_MIN_WIDTH;
|
|
446
|
-
}
|
|
447
|
-
function shouldRedispatchEscape(key, fromInsideGroup) {
|
|
448
|
-
return !fromInsideGroup && key === "Escape";
|
|
449
|
-
}
|
|
450
|
-
function pickFocusSessionId(previousIds, currentIds, sessionId) {
|
|
451
|
-
const current = Array.isArray(currentIds) ? currentIds.map(String) : [];
|
|
452
|
-
if (current.length === 0) return null;
|
|
453
|
-
const target = String(sessionId);
|
|
454
|
-
if (current.includes(target)) return target;
|
|
455
|
-
const previous = Array.isArray(previousIds) ? previousIds.map(String) : [];
|
|
456
|
-
const index2 = previous.indexOf(target);
|
|
457
|
-
if (index2 >= 0) {
|
|
458
|
-
for (let next = index2 + 1; next < previous.length; next += 1) {
|
|
459
|
-
if (current.includes(previous[next])) return previous[next];
|
|
460
|
-
}
|
|
461
|
-
for (let before = index2 - 1; before >= 0; before -= 1) {
|
|
462
|
-
if (current.includes(previous[before])) return previous[before];
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
return current[0];
|
|
466
|
-
}
|
|
467
|
-
function getErrorStatus(error) {
|
|
468
|
-
const err = (
|
|
469
|
-
/** @type {any} */
|
|
470
|
-
error
|
|
471
|
-
);
|
|
472
|
-
const status = err?.status ?? err?.response?.status;
|
|
473
|
-
return typeof status === "number" ? status : null;
|
|
474
|
-
}
|
|
475
338
|
const TargetLink = styled__default.default(designSystem.Link)`
|
|
476
339
|
min-height: 3.2rem;
|
|
477
340
|
display: inline-flex;
|
|
@@ -517,8 +380,8 @@ const SessionDetailModal = ({ session, now, onClose, onCloseAutoFocus, onEndSess
|
|
|
517
380
|
const userAgent = index.presentText(session.userAgent);
|
|
518
381
|
const sessionId = index.presentText(session.id);
|
|
519
382
|
const ipAddress = index.presentText(session.ipAddress);
|
|
520
|
-
const user = getSessionUserLabels(session);
|
|
521
|
-
const userEditPath = getUserEditPath(session);
|
|
383
|
+
const user = dashboardModel.getSessionUserLabels(session);
|
|
384
|
+
const userEditPath = dashboardModel.getUserEditPath(session);
|
|
522
385
|
const storedGeo = getStoredGeoData(session);
|
|
523
386
|
const liveGeo = lookup.status === "ok" ? lookup.geo : null;
|
|
524
387
|
const geo = liveGeo || storedGeo;
|
|
@@ -750,7 +613,7 @@ const SessionDetailModal = ({ session, now, onClose, onCloseAutoFocus, onEndSess
|
|
|
750
613
|
"modal.security.riskUnavailableNote",
|
|
751
614
|
"Needs a risk data source. Location data alone cannot tell VPNs, proxies or Tor apart, so no score was calculated."
|
|
752
615
|
) }),
|
|
753
|
-
/* @__PURE__ */ jsxRuntime.jsx(TargetLink, { tag: reactRouterDom.NavLink, to:
|
|
616
|
+
/* @__PURE__ */ jsxRuntime.jsx(TargetLink, { tag: reactRouterDom.NavLink, to: dashboardModel.RISK_SETTINGS_PATH, children: t("modal.security.riskSetup", "Set up risk data") })
|
|
754
617
|
] }) : null,
|
|
755
618
|
lookupControls
|
|
756
619
|
] }),
|
|
@@ -893,9 +756,9 @@ const isolateActionKeys = (event) => {
|
|
|
893
756
|
/** @type {Node} */
|
|
894
757
|
event.target
|
|
895
758
|
);
|
|
896
|
-
if (!shouldIsolateActionKey(event.key, fromInsideGroup)) return;
|
|
759
|
+
if (!dashboardModel.shouldIsolateActionKey(event.key, fromInsideGroup)) return;
|
|
897
760
|
event.stopPropagation();
|
|
898
|
-
if (shouldRedispatchEscape(event.key, fromInsideGroup)) {
|
|
761
|
+
if (dashboardModel.shouldRedispatchEscape(event.key, fromInsideGroup)) {
|
|
899
762
|
const { ownerDocument } = event.currentTarget;
|
|
900
763
|
ownerDocument.dispatchEvent(
|
|
901
764
|
new KeyboardEvent("keydown", { key: "Escape", bubbles: true, cancelable: true })
|
|
@@ -943,7 +806,7 @@ const SessionActions = ({
|
|
|
943
806
|
const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
|
|
944
807
|
const [deleteOpen, setDeleteOpen] = react.useState(false);
|
|
945
808
|
const moreRef = react.useRef(null);
|
|
946
|
-
const user = getSessionUserLabels(session).accessible;
|
|
809
|
+
const user = dashboardModel.getSessionUserLabels(session).accessible;
|
|
947
810
|
const canEnd = session.isActive === true;
|
|
948
811
|
const device = deviceSummary(session) || deviceTypeLabel(session);
|
|
949
812
|
const copy = getConfirmationCopy(t, { user, device, isOpen: canEnd });
|
|
@@ -970,7 +833,7 @@ const SessionActions = ({
|
|
|
970
833
|
);
|
|
971
834
|
const endKey = `end-${session.id}-${canEnd ? "open" : "ended"}`;
|
|
972
835
|
if (layout === "table") {
|
|
973
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RowActions, { onKeyDown: isolateActionKeys, onClick: (event) => event.stopPropagation(), children: [
|
|
836
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(dashboardModel.RowActions, { onKeyDown: isolateActionKeys, onClick: (event) => event.stopPropagation(), children: [
|
|
974
837
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
975
838
|
designSystem.IconButton,
|
|
976
839
|
{
|
|
@@ -1111,7 +974,7 @@ const SessionTable = ({
|
|
|
1111
974
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1112
975
|
designSystem.Table,
|
|
1113
976
|
{
|
|
1114
|
-
colCount: compact ? DASHBOARD_COMPACT_TABLE_COLUMNS : DASHBOARD_TABLE_COLUMNS,
|
|
977
|
+
colCount: compact ? dashboardModel.DASHBOARD_COMPACT_TABLE_COLUMNS : dashboardModel.DASHBOARD_TABLE_COLUMNS,
|
|
1115
978
|
rowCount: sessions.length + 1,
|
|
1116
979
|
"aria-labelledby": labelledBy,
|
|
1117
980
|
"aria-busy": busy,
|
|
@@ -1126,7 +989,7 @@ const SessionTable = ({
|
|
|
1126
989
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: t("homepage.table.actions", "Actions") }) })
|
|
1127
990
|
] }) }),
|
|
1128
991
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: sessions.map((session) => {
|
|
1129
|
-
const user = getSessionUserLabels(session);
|
|
992
|
+
const user = dashboardModel.getSessionUserLabels(session);
|
|
1130
993
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1131
994
|
designSystem.Tr,
|
|
1132
995
|
{
|
|
@@ -1202,7 +1065,7 @@ const SessionCardList = ({
|
|
|
1202
1065
|
mutationPending,
|
|
1203
1066
|
getFocusFallback
|
|
1204
1067
|
}) => /* @__PURE__ */ jsxRuntime.jsx(CardList, { "aria-labelledby": labelledBy, "aria-busy": busy, children: sessions.map((session) => {
|
|
1205
|
-
const user = getSessionUserLabels(session);
|
|
1068
|
+
const user = dashboardModel.getSessionUserLabels(session);
|
|
1206
1069
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1207
1070
|
designSystem.Box,
|
|
1208
1071
|
{
|
|
@@ -1338,12 +1201,12 @@ const Legend = styled__default.default.ul`
|
|
|
1338
1201
|
const HowSessionsWork = () => {
|
|
1339
1202
|
const { formatMessage } = reactIntl.useIntl();
|
|
1340
1203
|
const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
|
|
1341
|
-
const [open, setOpen] = react.useState(() => readDisclosureOpen(getBrowserStorage()));
|
|
1204
|
+
const [open, setOpen] = react.useState(() => dashboardModel.readDisclosureOpen(dashboardModel.getBrowserStorage()));
|
|
1342
1205
|
const contentId = `how-sessions-work-${react.useId().replace(/:/g, "")}`;
|
|
1343
1206
|
const toggle = () => {
|
|
1344
1207
|
setOpen((previous) => {
|
|
1345
1208
|
const next = !previous;
|
|
1346
|
-
writeDisclosureOpen(getBrowserStorage(), next);
|
|
1209
|
+
dashboardModel.writeDisclosureOpen(dashboardModel.getBrowserStorage(), next);
|
|
1347
1210
|
return next;
|
|
1348
1211
|
});
|
|
1349
1212
|
};
|
|
@@ -1844,10 +1707,10 @@ const HomePage = () => {
|
|
|
1844
1707
|
const { toggleNotification } = StrapiAdmin.useNotification();
|
|
1845
1708
|
const formatters = index.useSessionFormatters();
|
|
1846
1709
|
const { isBelowSmall, isBelowMedium, isBelowLarge } = useBreakpoint();
|
|
1847
|
-
const [listWidthRef, listWidth] = useElementWidth();
|
|
1710
|
+
const [listWidthRef, listWidth] = dashboardModel.useElementWidth();
|
|
1848
1711
|
const [{ query }, setQuery] = StrapiAdmin.useQueryParams();
|
|
1849
1712
|
const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
|
|
1850
|
-
const dashboard = parseDashboardQuery(query);
|
|
1713
|
+
const dashboard = dashboardModel.parseDashboardQuery(query);
|
|
1851
1714
|
const [sessions, setSessions] = react.useState([]);
|
|
1852
1715
|
const [pagination, setPagination] = react.useState({ total: 0, pageCount: 1 });
|
|
1853
1716
|
const [stats, setStats] = react.useState(EMPTY_SESSION_STATS);
|
|
@@ -1924,7 +1787,7 @@ const HomePage = () => {
|
|
|
1924
1787
|
if (showDetailModal || mutationPending) return void 0;
|
|
1925
1788
|
const interval = setInterval(() => {
|
|
1926
1789
|
fetchSessions();
|
|
1927
|
-
}, AUTO_REFRESH_INTERVAL_MS);
|
|
1790
|
+
}, dashboardModel.AUTO_REFRESH_INTERVAL_MS);
|
|
1928
1791
|
return () => clearInterval(interval);
|
|
1929
1792
|
}, [showDetailModal, mutationPending, fetchSessions]);
|
|
1930
1793
|
const handleTerminateSession = async (session) => {
|
|
@@ -1941,7 +1804,7 @@ const HomePage = () => {
|
|
|
1941
1804
|
});
|
|
1942
1805
|
} catch (err) {
|
|
1943
1806
|
index.logSafeAdminError("dashboard.terminateSession", err);
|
|
1944
|
-
if (getErrorStatus(err) === 404) {
|
|
1807
|
+
if (dashboardModel.getErrorStatus(err) === 404) {
|
|
1945
1808
|
await fetchSessions();
|
|
1946
1809
|
toggleNotification({
|
|
1947
1810
|
type: "warning",
|
|
@@ -1981,7 +1844,7 @@ const HomePage = () => {
|
|
|
1981
1844
|
});
|
|
1982
1845
|
} catch (err) {
|
|
1983
1846
|
index.logSafeAdminError("dashboard.deleteSession", err);
|
|
1984
|
-
if (getErrorStatus(err) === 404) {
|
|
1847
|
+
if (dashboardModel.getErrorStatus(err) === 404) {
|
|
1985
1848
|
await fetchSessions();
|
|
1986
1849
|
toggleNotification({
|
|
1987
1850
|
type: "warning",
|
|
@@ -2037,7 +1900,7 @@ const HomePage = () => {
|
|
|
2037
1900
|
if (format === "csv") {
|
|
2038
1901
|
const csvContent = buildSessionCsv(rows, {
|
|
2039
1902
|
unavailableValue: "",
|
|
2040
|
-
getDeviceInfo: getExportDeviceInfo,
|
|
1903
|
+
getDeviceInfo: dashboardModel.getExportDeviceInfo,
|
|
2041
1904
|
getSessionStatus: index.getSessionStatus
|
|
2042
1905
|
});
|
|
2043
1906
|
downloadFile(csvContent, "text/csv;charset=utf-8;", "csv");
|
|
@@ -2047,7 +1910,7 @@ const HomePage = () => {
|
|
|
2047
1910
|
totalSessions: stats.total,
|
|
2048
1911
|
exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2049
1912
|
unavailableValue: "",
|
|
2050
|
-
getDeviceInfo: getExportDeviceInfo,
|
|
1913
|
+
getDeviceInfo: dashboardModel.getExportDeviceInfo,
|
|
2051
1914
|
getSessionStatus: index.getSessionStatus,
|
|
2052
1915
|
truncated: capped
|
|
2053
1916
|
});
|
|
@@ -2089,7 +1952,7 @@ const HomePage = () => {
|
|
|
2089
1952
|
const getFocusFallback = react.useCallback(
|
|
2090
1953
|
(sessionId) => ({
|
|
2091
1954
|
get current() {
|
|
2092
|
-
const targetId = pickFocusSessionId(
|
|
1955
|
+
const targetId = dashboardModel.pickFocusSessionId(
|
|
2093
1956
|
mutationSnapshotRef.current,
|
|
2094
1957
|
visibleIdsRef.current,
|
|
2095
1958
|
sessionId
|
|
@@ -2120,7 +1983,7 @@ const HomePage = () => {
|
|
|
2120
1983
|
};
|
|
2121
1984
|
const handleSearch = react.useCallback(
|
|
2122
1985
|
(value) => {
|
|
2123
|
-
setQuery({ search: encodeSearchQuery(value), _q: void 0, page: "1" }, "push", true);
|
|
1986
|
+
setQuery({ search: dashboardModel.encodeSearchQuery(value), _q: void 0, page: "1" }, "push", true);
|
|
2124
1987
|
},
|
|
2125
1988
|
[setQuery]
|
|
2126
1989
|
);
|
|
@@ -2131,7 +1994,7 @@ const HomePage = () => {
|
|
|
2131
1994
|
const showSessionData = !loading && hasData;
|
|
2132
1995
|
const showToolbar = showSessionData && stats.total > 0;
|
|
2133
1996
|
const canExport = showSessionData && pageResult.total > 0 && !exporting;
|
|
2134
|
-
const filtersActive = hasActiveFilters(dashboard);
|
|
1997
|
+
const filtersActive = dashboardModel.hasActiveFilters(dashboard);
|
|
2135
1998
|
const exportValues = { count: Math.min(pageResult.total, MAX_EXPORT_ROWS) };
|
|
2136
1999
|
const exportMenu = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2137
2000
|
designSystem.SimpleMenu,
|
|
@@ -2382,7 +2245,7 @@ const HomePage = () => {
|
|
|
2382
2245
|
SessionTable,
|
|
2383
2246
|
{
|
|
2384
2247
|
...listProps,
|
|
2385
|
-
compact: shouldUseCompactTable(listWidth, isBelowLarge)
|
|
2248
|
+
compact: dashboardModel.shouldUseCompactTable(listWidth, isBelowLarge)
|
|
2386
2249
|
}
|
|
2387
2250
|
),
|
|
2388
2251
|
/* @__PURE__ */ jsxRuntime.jsx(PaginationTargets$1, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2390,9 +2253,9 @@ const HomePage = () => {
|
|
|
2390
2253
|
{
|
|
2391
2254
|
pageCount: pageResult.pageCount,
|
|
2392
2255
|
total: pageResult.total,
|
|
2393
|
-
defaultPageSize: Number(DEFAULT_PAGE_SIZE),
|
|
2256
|
+
defaultPageSize: Number(dashboardModel.DEFAULT_PAGE_SIZE),
|
|
2394
2257
|
children: [
|
|
2395
|
-
/* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Pagination.PageSize, { options: [...PAGE_SIZE_OPTIONS] }),
|
|
2258
|
+
/* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Pagination.PageSize, { options: [...dashboardModel.PAGE_SIZE_OPTIONS] }),
|
|
2396
2259
|
/* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Pagination.Links, {})
|
|
2397
2260
|
]
|
|
2398
2261
|
}
|
|
@@ -2582,7 +2445,7 @@ function withEventAdminNames(row, placeholderName) {
|
|
|
2582
2445
|
}
|
|
2583
2446
|
const HIGHLIGHT_BADGE = { backgroundColor: "primary100", textColor: "neutral800" };
|
|
2584
2447
|
const keepActionKeys = (event) => {
|
|
2585
|
-
if (shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
2448
|
+
if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
2586
2449
|
};
|
|
2587
2450
|
const SHRINKING_ADMIN_CELL = { maxWidth: 0, width: "34%" };
|
|
2588
2451
|
const SHRINKING_ROLES_CELL = { maxWidth: 0, width: "22%" };
|
|
@@ -2653,7 +2516,7 @@ const AdminTable = ({
|
|
|
2653
2516
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: SHRINKING_ROLES_CELL, children: /* @__PURE__ */ jsxRuntime.jsx(AdminRoles, { admin }) }),
|
|
2654
2517
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(AdminStatus, { admin }) }),
|
|
2655
2518
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(LastActive, { value: admin.lastActiveAt }) }),
|
|
2656
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(RowActions, { onKeyDown: keepActionKeys, children: [
|
|
2519
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: [
|
|
2657
2520
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2658
2521
|
designSystem.IconButton,
|
|
2659
2522
|
{
|
|
@@ -3863,7 +3726,7 @@ const AdminPanelPage = () => {
|
|
|
3863
3726
|
setQuery({ filter: filter === "all" ? void 0 : filter, page: "1" });
|
|
3864
3727
|
};
|
|
3865
3728
|
const handleSearch = react.useCallback(
|
|
3866
|
-
(value) => setQuery({ search: encodeSearchQuery(value), page: "1" }, "push", true),
|
|
3729
|
+
(value) => setQuery({ search: dashboardModel.encodeSearchQuery(value), page: "1" }, "push", true),
|
|
3867
3730
|
[setQuery]
|
|
3868
3731
|
);
|
|
3869
3732
|
const handleClearFilters = () => {
|
|
@@ -3906,10 +3769,10 @@ const AdminPanelPage = () => {
|
|
|
3906
3769
|
index.logSafeAdminError("adminPanel.signOut", err);
|
|
3907
3770
|
const message2 = getSignOutErrorMessage(err);
|
|
3908
3771
|
toggleNotification({
|
|
3909
|
-
type: getErrorStatus(err) === 404 ? "warning" : "danger",
|
|
3772
|
+
type: dashboardModel.getErrorStatus(err) === 404 ? "warning" : "danger",
|
|
3910
3773
|
message: t(message2.messageId, message2.defaultMessage)
|
|
3911
3774
|
});
|
|
3912
|
-
if (getErrorStatus(err) === 404) {
|
|
3775
|
+
if (dashboardModel.getErrorStatus(err) === 404) {
|
|
3913
3776
|
await Promise.all([fetchAdmins(), selected ? fetchDialogSessions(selected) : null]);
|
|
3914
3777
|
return;
|
|
3915
3778
|
}
|