strapi-plugin-magic-sessionmanager 4.10.0 → 4.12.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +92 -6
  2. package/README.md +263 -72
  3. package/dist/admin/{Analytics-PRqsLMEx.mjs → Analytics-C_c24Uzq.mjs} +45 -75
  4. package/dist/admin/{Analytics-CdmRsigN.js → Analytics-lP0-RsVd.js} +45 -75
  5. package/dist/admin/{App-BSeYF7KA.mjs → App-DCyNPn1k.mjs} +162 -119
  6. package/dist/admin/{App-DUMCbuCr.js → App-miWDdmdX.js} +162 -119
  7. package/dist/admin/{OnlineUsersWidget-CDZ19_PT.js → OnlineUsersWidget-C6b7e4jb.js} +18 -26
  8. package/dist/admin/{OnlineUsersWidget-B5pXzqM9.mjs → OnlineUsersWidget-C6wlwENC.mjs} +18 -26
  9. package/dist/admin/{Settings-CrLzRXrA.js → Settings-D9zyn5xn.js} +9 -3
  10. package/dist/admin/{Settings-B-GRuWjT.mjs → Settings-DssYw2W4.mjs} +8 -2
  11. package/dist/admin/{de-DwUCBY1b.mjs → de--yNl7MPl.mjs} +4 -48
  12. package/dist/admin/{de-Dzo1tVoJ.js → de-DjPEATFf.js} +4 -48
  13. package/dist/admin/{en-Dd0wXfgR.mjs → en-5U7g51cH.mjs} +4 -48
  14. package/dist/admin/{en-CL5llI55.js → en-BoO12UQw.js} +4 -48
  15. package/dist/admin/{es-Cl5IwDA4.mjs → es-BJR-zCXL.mjs} +4 -48
  16. package/dist/admin/{es-CiNDwv_f.js → es-BLpEuycJ.js} +4 -48
  17. package/dist/admin/{fr-DBOQ-UDm.js → fr-BE828R9Q.js} +4 -48
  18. package/dist/admin/{fr-DhADj8Zs.mjs → fr-CeeCYQCs.mjs} +4 -48
  19. package/dist/admin/{index-CaLVyCio.js → index-CfQOMZVX.js} +9 -56
  20. package/dist/admin/{index-CHACmZsg.mjs → index-rbxJZcLv.mjs} +35 -82
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +2 -2
  23. package/dist/admin/{pt-m73K1nJ0.js → pt-BWEFiuvo.js} +4 -48
  24. package/dist/admin/{pt-CT6VpDMM.mjs → pt-CorrU3yG.mjs} +4 -48
  25. package/dist/server/index.js +815 -628
  26. package/dist/server/index.mjs +815 -628
  27. package/package.json +29 -13
  28. package/dist/admin/License-BeD7Du6r.js +0 -443
  29. package/dist/admin/License-D5W_l35e.mjs +0 -443
  30. package/dist/admin/maskSensitiveValue-BWcSjow7.js +0 -9
  31. package/dist/admin/maskSensitiveValue-lLRhN_S7.mjs +0 -10
package/CHANGELOG.md CHANGED
@@ -1,3 +1,91 @@
1
+ # [4.12.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.11.0...v4.12.0) (2026-11-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * **sessions:** page, filter and count sessions on the server ([#9](https://github.com/Schero94/Magic-Sessionmanager/issues/9)) ([c389614](https://github.com/Schero94/Magic-Sessionmanager/commit/c38961432d4415ded4b9c37c80414dbe787e518a))
7
+
8
+ ## [Unreleased]
9
+
10
+ Release type: minor (`feat`), no breaking change. Callers of `GET /sessions` without paging parameters get the same response as before.
11
+
12
+ ### Changed
13
+
14
+ * **No 1,000-session limit in the admin.** The dashboard used to load the latest 1,000 sessions and filter, search and page them in the browser, so counts, filters and exports stopped at 1,000 and every load read and enriched all of them. The list is now paged, filtered, searched and sorted on the server with exact totals; only the 25 to 100 rows on the screen are loaded and enriched.
15
+ * **The homepage widget loads counts only** (`GET /sessions/stats`) instead of the whole session list every 30 seconds.
16
+ * **Analytics covers every session** (`GET /sessions/analytics`): counts, sessions per device and browser, distinct users and the average length are computed in SQL and cached for 30 seconds.
17
+ * **Export covers every matching session** up to 50,000 (newest first), read in batches of 1,000 with a cursor. A larger result says so.
18
+ * **In `refresh` mode** the list reconciles the rows on the page with one query on Strapi's session table instead of listing the sessions of every user. Open Strapi sessions without session details from this plugin are counted in a notice; they stay listed on each user's sessions panel.
19
+
20
+ ### Added
21
+
22
+ * `GET /sessions` and `GET /sessions/active` accept `page`, `pageSize` (1-100), `status`, `reason`, `search` (up to 100 characters) and `sort` (whitelisted values). Unknown or out-of-range parameters return 400; pages that start after the first 50,000 matching sessions return 400.
23
+ * `GET /sessions/stats`, `GET /sessions/analytics` and `GET /sessions/export`, protected like every admin route (`plugin::magic-sessionmanager.access`).
24
+ * Database indexes for the list, counts and export (`login_time`, `last_active`, `is_active` with `last_active`, `login_time` or `termination_reason`, and `native_session_id`), created at startup if missing.
25
+
26
+ ### Security
27
+
28
+ * The list, statistics, analytics, export and `/users/stats` routes use the read rate limit (120 per minute per admin, raised with `rateLimitReadMax`).
29
+ * CSV exports neutralise cells that start with `=`, `+`, `-`, `@`, a tab or a carriage return (spreadsheet formula injection).
30
+
31
+ ### Performance
32
+
33
+ Measured on PostgreSQL 16 with 50,000 sessions over 10,000 users (Strapi 5.61, synthetic data):
34
+
35
+ | Request | 4.11.0 | This release |
36
+ | --- | --- | --- |
37
+ | Dashboard (`legacy-support` mode) | 30 ms, 1,000 rows (730 KB), counts capped at 1,000 | 7 ms for a page of 25 (18 KB); 12 ms page plus exact counts |
38
+ | Dashboard (`refresh` mode) | 892 ms, 10,319 queries | 16 ms page plus counts, 13 queries |
39
+ | Widget (`refresh` mode) | 814 ms, 10,328 queries | 10 ms, 10 queries, counts only |
40
+ | Analytics | latest 1,000 sessions only | every session; 5 ms when cached (30 s) |
41
+
42
+ Most remaining queries per request are Strapi's admin authentication, permission check and the rate limiter; the plugin's own list work is a COUNT, the page and one user lookup. Admin requests no longer run the end-user "last seen" lookup (three queries each).
43
+
44
+ ### Migration
45
+
46
+ 1. Nothing to do. Rebuild the admin (`npm run build`) after upgrading.
47
+ 2. Scripts that call `GET /magic-sessionmanager/sessions` without `page` keep working unchanged; add `?page=1&pageSize=100` to page through every session.
48
+
49
+ # [4.11.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.10.0...v4.11.0) (2026-11-07)
50
+
51
+
52
+ ### Features
53
+
54
+ * remove the license feature and every license server call ([#8](https://github.com/Schero94/Magic-Sessionmanager/issues/8)) ([c5ba2ef](https://github.com/Schero94/Magic-Sessionmanager/commit/c5ba2ef6b3e32f11cfadaed479a6d2e5688b3415))
55
+
56
+ ## 4.11.0 details (written before the release)
57
+
58
+ Release type: minor. `feat:` removes the license feature; `fix:` corrects the package metadata. No `BREAKING CHANGE` footer, see "Version decision" below.
59
+
60
+ ### Removed
61
+
62
+ * **The License page and the license feature.** Settings › Session Manager now has two links, **Configuration** and **Analytics**. The License page, its settings link, the pass-through `LicenseGuard` wrapper and the 42 `license.*` messages in each of the five admin languages are gone.
63
+ * **All calls to the license server** (`magicapi.fitlex.me`). The plugin makes no install, license or telemetry request of any kind. The only outbound requests are the ones you turn on: ipapi.co lookups, Discord or Slack webhooks, emails through your Email provider and the MaxMind database download.
64
+ * **Admin routes** `GET /magic-sessionmanager/license/status` and `POST /magic-sessionmanager/license/auto-create`, `/license/create`, `/license/ping`, `/license/store-key`, with their controller and the `license-guard` service.
65
+ * **Environment variables** `MAGIC_LICENSE_SERVER_URL` and `MAGIC_LICENSE_TIMEOUT_MS` (no longer read).
66
+
67
+ ### Changed
68
+
69
+ * **Stored license data is deleted at startup.** The plugin store keys `licenseKey`, `lastValidated` and `deviceId` (a hash of the server's MAC addresses and host name) are removed with one `deleteMany` statement. It is idempotent and safe when several instances start at once; a failure is logged by error name and retried on the next start. MaxMind GeoIP credentials and all settings are kept.
70
+ * **No install warnings from the plugin.** `@strapi/utils` (used by the server code) moved from `peerDependencies` to `dependencies`. `@strapi/design-system`, `@strapi/icons` and `react-intl`, which a Strapi app gets through `@strapi/strapi`, are optional peers (`peerDependenciesMeta`). `@strapi/plugin-users-permissions ^5.0.0` is now a declared peer, because sessions relate to its user type. `react` and `react-dom` peers are `^18.0.0`, as in the Strapi 5 app template.
71
+ * **Package metadata:** plain description, `homepage` is the project site (https://schero94.github.io/Magic-Sessionmanager/), `repository.url` uses the `git+https` form that `npm pkg fix` expects, and the keywords describe what the plugin does.
72
+ * **README and project site** rewritten: features, a one-minute quick start, examples, performance notes, FAQ and migration notes.
73
+
74
+ ### Fixed
75
+
76
+ * A unit test for revocation expiry read the clock twice and failed when a second boundary passed in between.
77
+ * The first start on a new database no longer logs the warning "Authenticated role not found - skipping permission setup". Users & Permissions can create its roles after the plugin's bootstrap, and the plugin already finished the setup before the first Session Manager API request. The message is now an info line that says so.
78
+
79
+ ### Version decision
80
+
81
+ Minor, not major. The removed routes were admin routes (admin JWT plus `plugin::magic-sessionmanager.access`) that only the plugin's own License page called, and that page ships in the same package and is removed with them. No feature was ever gated by a key, and the Content API, permissions, settings and session data are unchanged. Anyone who scripted the license routes with an admin token gets 404 or 405 now; see Migration.
82
+
83
+ ### Migration
84
+
85
+ 1. Nothing to do for most apps. Rebuild the admin (`npm run build`) after upgrading, as for every release.
86
+ 2. Remove scripts that call `/magic-sessionmanager/license/*`, and the variables `MAGIC_LICENSE_SERVER_URL` and `MAGIC_LICENSE_TIMEOUT_MS` if you set them.
87
+ 3. Bookmarks to `/admin/settings/magic-sessionmanager/license` open an empty settings page, as any unknown settings route does in Strapi 5.61; use Configuration or Analytics.
88
+
1
89
  # [4.10.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.9.1...v4.10.0) (2026-11-07)
2
90
 
3
91
 
@@ -12,11 +100,9 @@
12
100
  * **admin:** send the settings revision and explain a concurrent save ([ef4e08a](https://github.com/Schero94/Magic-Sessionmanager/commit/ef4e08a19ac853e37c0affda27c54d1024879ab1))
13
101
  * **server:** keep lockout, rate limits, jobs and settings consistent across instances ([976fa67](https://github.com/Schero94/Magic-Sessionmanager/commit/976fa67e5299fcb3d02f1852645fecd85bb4419c))
14
102
 
15
- ## [Unreleased]
103
+ ### Release notes: multi-instance deployments (pm2 cluster, Railway replicas)
16
104
 
17
- Release type: minor (`feat` commits, no breaking change; API clients that send no settings `revision` behave as before).
18
-
19
- ### Multi-instance deployments (pm2 cluster, Railway replicas)
105
+ These notes were written as `[Unreleased]` on the branch and shipped in 4.10.0 (minor: `feat` commits, no breaking change; API clients that send no settings `revision` behave as before).
20
106
 
21
107
  Every hazard from the multi-instance audit (SM-MI-01 to SM-MI-14) is addressed for several Node processes sharing one database:
22
108
 
@@ -37,7 +123,7 @@ Every hazard from the multi-instance audit (SM-MI-01 to SM-MI-14) is addressed f
37
123
  * **Fix: a shortened cleanup interval could wait for the old job lease.** The idle-cleanup lease lasts one interval; a lease taken under the 30-minute default (for example by the process that ran before a restart) kept blocking the cleanup for up to 30 minutes after the interval was set to 5. A lease that ends more than 60 seconds later than a fresh one would may now be taken over. After a restart without a settings change the job keeps its schedule, so the first run on the new process can come up to one interval after the last run on the old one.
38
124
  * **Fix: parallel "log out other devices" calls could answer 500.** Two requests (on one or several instances) revoked the same native session; the one that lost the race treated "already revoked" as a failure. A native revoke that is not confirmed now succeeds when the session is no longer active, and still fails when it is.
39
125
 
40
- ### Migration
126
+ ### Migration to 4.10.0
41
127
 
42
128
  * On start the plugin creates three tables: `magic_sm_counters`, `magic_sm_leases`, `magic_sm_cache`. The database user needs the `CREATE` privilege once. Strapi's schema sync does not touch these tables.
43
129
  * New optional config `coordination: { enabled, counterStore }`. `enabled: false` restores per-process state.
@@ -254,7 +340,7 @@ The native Strapi Users & Permissions end-user session support from 2f00880 cove
254
340
 
255
341
  ### Bug Fixes
256
342
 
257
- * **deps:** bump devDependencies (sdk-plugin v6, design-system 2.2, styled-components 6.4) ([bf9a743](https://github.com/Schero94/Magic-Sessionmanager/commit/bf9a7433995dc96c23f8f4a149081fe858b7332f)), closes [package.json#exports](https://github.com/package.json/issues/exports)
343
+ * **deps:** bump devDependencies (sdk-plugin v6, design-system 2.2, styled-components 6.4) ([bf9a743](https://github.com/Schero94/Magic-Sessionmanager/commit/bf9a7433995dc96c23f8f4a149081fe858b7332f))
258
344
 
259
345
  ## [4.5.6](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.5.5...v4.5.6) (2026-04-20)
260
346