strapi-plugin-magic-sessionmanager 4.6.2 → 4.6.4

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [4.6.4](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.6.3...v4.6.4) (2026-07-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * harden geoip and session handling ([22729d4](https://github.com/Schero94/Magic-Sessionmanager/commit/22729d4fde406d62fe6f61e0a048903c7071b062))
7
+
8
+ ## [4.6.3](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.6.2...v4.6.3) (2026-06-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **session:** avoid touching sessions after logout ([a1791e5](https://github.com/Schero94/Magic-Sessionmanager/commit/a1791e5e953dc6075cd2d5a76ca1266f15f1dad2))
14
+
1
15
  ## [4.6.2](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.6.1...v4.6.2) (2026-06-23)
2
16
 
3
17
 
package/README.md CHANGED
@@ -491,7 +491,7 @@ Authorization: Bearer <JWT>
491
491
  {
492
492
  "data": [
493
493
  {
494
- "id": 41,
494
+ "id": "abc123xyz",
495
495
  "documentId": "abc123xyz",
496
496
  "sessionId": "sess_m5k2h_8a3b1c2d_f9e8d7c6",
497
497
  "ipAddress": "192.168.1.100",
@@ -510,7 +510,7 @@ Authorization: Bearer <JWT>
510
510
  "minutesSinceActive": 2
511
511
  },
512
512
  {
513
- "id": 40,
513
+ "id": "def456uvw",
514
514
  "documentId": "def456uvw",
515
515
  "sessionId": "sess_m5k1g_7b2a0c1d_e8d7c6b5",
516
516
  "ipAddress": "10.0.0.50",
@@ -549,7 +549,7 @@ Authorization: Bearer <JWT>
549
549
  ```json
550
550
  {
551
551
  "data": {
552
- "id": 41,
552
+ "id": "abc123xyz",
553
553
  "documentId": "abc123xyz",
554
554
  "sessionId": "sess_m5k2h_8a3b1c2d_f9e8d7c6",
555
555
  "ipAddress": "192.168.1.100",
@@ -605,9 +605,10 @@ Authorization: Bearer <JWT>
605
605
  ### Terminate Specific Session
606
606
 
607
607
  Terminates a specific session (not the current one). Useful for "Log out other devices".
608
+ Use the `id` / `documentId` value from the session response. The separate `sessionId` field is a tracking identifier stored on the session record.
608
609
 
609
610
  ```bash
610
- DELETE /api/magic-sessionmanager/my-sessions/:sessionId
611
+ DELETE /api/magic-sessionmanager/my-sessions/:documentId
611
612
  Authorization: Bearer <JWT>
612
613
  ```
613
614
 
@@ -4,7 +4,7 @@ import { useFetchClient } from "@strapi/strapi/admin";
4
4
  import styled, { css, keyframes } from "styled-components";
5
5
  import { Loader, Flex, Box, Badge, Typography } from "@strapi/design-system";
6
6
  import { ChartBubble, User, Clock, Monitor } from "@strapi/icons";
7
- import { a as pluginId } from "./index-UTLA1r40.mjs";
7
+ import { a as pluginId } from "./index-CpMDG2XI.mjs";
8
8
  const theme = {
9
9
  shadows: {
10
10
  sm: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
@@ -6,7 +6,7 @@ const admin = require("@strapi/strapi/admin");
6
6
  const styled = require("styled-components");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
- const index = require("./index-DTskQVDl.js");
9
+ const index = require("./index-DJHhzin_.js");
10
10
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
11
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
12
12
  const theme = {
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
  import { useIntl } from "react-intl";
4
4
  import { useFetchClient, useNotification, Page } from "@strapi/strapi/admin";
5
5
  import styled, { css, keyframes } from "styled-components";
6
- import { p as parseUserAgent, a as pluginId$1, g as getTranslation } from "./index-UTLA1r40.mjs";
6
+ import { p as parseUserAgent, a as pluginId$1, g as getTranslation } from "./index-CpMDG2XI.mjs";
7
7
  import { Modal, Flex, Box, Typography, Divider, Button, Loader, SingleSelect, SingleSelectOption, Thead, Tr, Th, Tbody, Td, Table } from "@strapi/design-system";
8
8
  import { Check, Information, Monitor, Server, Clock, Cross, Earth, Shield, Phone, Download, User, Eye, Trash, Search } from "@strapi/icons";
9
9
  import { S as ShowHideButton, T as TertiaryButton, D as DangerButton, I as IconButtonPrimary, a as IconButtonWarning, b as IconButtonDanger } from "./StyledButtons-Cz8oYhmc.mjs";
@@ -94,11 +94,33 @@ const StatusDot$1 = styled.span`
94
94
  background: var(--colors-neutral500);
95
95
  `}
96
96
 
97
- @keyframes pulse-green {
98
- 0%, 100% { opacity: 1; transform: scale(1); }
99
- 50% { opacity: 0.7; transform: scale(1.15); }
97
+ @keyframes pulse-green {
98
+ 0%, 100% { opacity: 1; transform: scale(1); }
99
+ 50% { opacity: 0.7; transform: scale(1.15); }
100
+ }
101
+ `;
102
+ const getStoredGeoData = (session) => {
103
+ let geoLocation = session?.geoLocation;
104
+ if (typeof geoLocation === "string") {
105
+ try {
106
+ geoLocation = JSON.parse(geoLocation);
107
+ } catch {
108
+ geoLocation = null;
109
+ }
100
110
  }
101
- `;
111
+ if (!geoLocation || typeof geoLocation !== "object") return null;
112
+ if (!geoLocation.country && !geoLocation.country_code && !geoLocation.city) return null;
113
+ return {
114
+ country_flag: geoLocation.country_flag || "",
115
+ country: geoLocation.country || geoLocation.country_code || "Unknown",
116
+ city: geoLocation.city || "Unknown",
117
+ timezone: geoLocation.timezone || "Unknown",
118
+ securityScore: typeof session.securityScore === "number" ? session.securityScore : 100,
119
+ riskLevel: typeof session.securityScore === "number" && session.securityScore < 50 ? "High" : "Low",
120
+ isVpn: false,
121
+ isProxy: false
122
+ };
123
+ };
102
124
  const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
103
125
  const { formatMessage } = useIntl();
104
126
  const { get, post } = useFetchClient();
@@ -111,6 +133,7 @@ const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
111
133
  useEffect(() => {
112
134
  let cancelled = false;
113
135
  const ipAddress = session?.ipAddress;
136
+ const storedGeoData = getStoredGeoData(session);
114
137
  if (!ipAddress) {
115
138
  setGeoData(null);
116
139
  setGeoLoading(false);
@@ -118,6 +141,13 @@ const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
118
141
  cancelled = true;
119
142
  };
120
143
  }
144
+ if (storedGeoData) {
145
+ setGeoData(storedGeoData);
146
+ setGeoLoading(false);
147
+ return () => {
148
+ cancelled = true;
149
+ };
150
+ }
121
151
  const fetchGeolocationData = async () => {
122
152
  setGeoData(null);
123
153
  setGeoLoading(true);
@@ -150,7 +180,7 @@ const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
150
180
  return () => {
151
181
  cancelled = true;
152
182
  };
153
- }, [get, session?.ipAddress]);
183
+ }, [get, session]);
154
184
  if (!session) return null;
155
185
  const deviceInfo = parseUserAgent(session.userAgent);
156
186
  const isOnline = session.isTrulyActive;
@@ -5,7 +5,7 @@ const react = require("react");
5
5
  const reactIntl = require("react-intl");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const styled = require("styled-components");
8
- const index = require("./index-DTskQVDl.js");
8
+ const index = require("./index-DJHhzin_.js");
9
9
  const designSystem = require("@strapi/design-system");
10
10
  const icons = require("@strapi/icons");
11
11
  const StyledButtons = require("./StyledButtons-DDuxnYz8.js");
@@ -98,11 +98,33 @@ const StatusDot$1 = styled__default.default.span`
98
98
  background: var(--colors-neutral500);
99
99
  `}
100
100
 
101
- @keyframes pulse-green {
102
- 0%, 100% { opacity: 1; transform: scale(1); }
103
- 50% { opacity: 0.7; transform: scale(1.15); }
101
+ @keyframes pulse-green {
102
+ 0%, 100% { opacity: 1; transform: scale(1); }
103
+ 50% { opacity: 0.7; transform: scale(1.15); }
104
+ }
105
+ `;
106
+ const getStoredGeoData = (session) => {
107
+ let geoLocation = session?.geoLocation;
108
+ if (typeof geoLocation === "string") {
109
+ try {
110
+ geoLocation = JSON.parse(geoLocation);
111
+ } catch {
112
+ geoLocation = null;
113
+ }
104
114
  }
105
- `;
115
+ if (!geoLocation || typeof geoLocation !== "object") return null;
116
+ if (!geoLocation.country && !geoLocation.country_code && !geoLocation.city) return null;
117
+ return {
118
+ country_flag: geoLocation.country_flag || "",
119
+ country: geoLocation.country || geoLocation.country_code || "Unknown",
120
+ city: geoLocation.city || "Unknown",
121
+ timezone: geoLocation.timezone || "Unknown",
122
+ securityScore: typeof session.securityScore === "number" ? session.securityScore : 100,
123
+ riskLevel: typeof session.securityScore === "number" && session.securityScore < 50 ? "High" : "Low",
124
+ isVpn: false,
125
+ isProxy: false
126
+ };
127
+ };
106
128
  const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
107
129
  const { formatMessage } = reactIntl.useIntl();
108
130
  const { get, post } = admin.useFetchClient();
@@ -115,6 +137,7 @@ const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
115
137
  react.useEffect(() => {
116
138
  let cancelled = false;
117
139
  const ipAddress = session?.ipAddress;
140
+ const storedGeoData = getStoredGeoData(session);
118
141
  if (!ipAddress) {
119
142
  setGeoData(null);
120
143
  setGeoLoading(false);
@@ -122,6 +145,13 @@ const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
122
145
  cancelled = true;
123
146
  };
124
147
  }
148
+ if (storedGeoData) {
149
+ setGeoData(storedGeoData);
150
+ setGeoLoading(false);
151
+ return () => {
152
+ cancelled = true;
153
+ };
154
+ }
125
155
  const fetchGeolocationData = async () => {
126
156
  setGeoData(null);
127
157
  setGeoLoading(true);
@@ -154,7 +184,7 @@ const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
154
184
  return () => {
155
185
  cancelled = true;
156
186
  };
157
- }, [get, session?.ipAddress]);
187
+ }, [get, session]);
158
188
  if (!session) return null;
159
189
  const deviceInfo = index.parseUserAgent(session.userAgent);
160
190
  const isOnline = session.isTrulyActive;
@@ -4,7 +4,7 @@ import { Loader, Box, Alert, Flex, Typography, Button, Badge, Accordion } from "
4
4
  import { useFetchClient, useNotification } from "@strapi/strapi/admin";
5
5
  import { ArrowClockwise, Duplicate, Download, User, Shield, Sparkle, ChartBubble } from "@strapi/icons";
6
6
  import styled, { css, keyframes } from "styled-components";
7
- import { a as pluginId } from "./index-UTLA1r40.mjs";
7
+ import { a as pluginId } from "./index-CpMDG2XI.mjs";
8
8
  const theme = {
9
9
  borderRadius: { lg: "12px" }
10
10
  };
@@ -6,7 +6,7 @@ const designSystem = require("@strapi/design-system");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const icons = require("@strapi/icons");
8
8
  const styled = require("styled-components");
9
- const index = require("./index-DTskQVDl.js");
9
+ const index = require("./index-DJHhzin_.js");
10
10
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
11
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
12
12
  const theme = {
@@ -4,7 +4,7 @@ import { useIntl } from "react-intl";
4
4
  import { Box, Typography, Flex, Grid } from "@strapi/design-system";
5
5
  import { Check, Cross, Clock, User } from "@strapi/icons";
6
6
  import { useFetchClient } from "@strapi/strapi/admin";
7
- import { g as getTranslation } from "./index-UTLA1r40.mjs";
7
+ import { g as getTranslation } from "./index-CpMDG2XI.mjs";
8
8
  function getSessionUserKey(session) {
9
9
  return session?.user?.documentId || session?.user?.id || session?.user?.email || session?.user?.username || null;
10
10
  }
@@ -6,7 +6,7 @@ const reactIntl = require("react-intl");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
8
  const admin = require("@strapi/strapi/admin");
9
- const index = require("./index-DTskQVDl.js");
9
+ const index = require("./index-DJHhzin_.js");
10
10
  function getSessionUserKey(session) {
11
11
  return session?.user?.documentId || session?.user?.id || session?.user?.email || session?.user?.username || null;
12
12
  }
@@ -5,7 +5,7 @@ import { Flex, Loader, Typography, Button, Box, Accordion, Grid, SingleSelect, S
5
5
  import { useFetchClient, useNotification } from "@strapi/strapi/admin";
6
6
  import { Check, Cog, Trash, Shield, Code, Duplicate, Clock, Mail } from "@strapi/icons";
7
7
  import styled, { css, keyframes } from "styled-components";
8
- import { a as pluginId, g as getTranslation } from "./index-UTLA1r40.mjs";
8
+ import { a as pluginId, g as getTranslation } from "./index-CpMDG2XI.mjs";
9
9
  import { D as DangerButton, S as ShowHideButton, G as GradientButton, C as CopyButton, T as TertiaryButton, c as SecondaryButton } from "./StyledButtons-Cz8oYhmc.mjs";
10
10
  const COUNTRIES = [
11
11
  { code: "DE", name: "Germany", flag: "🇩🇪" },
@@ -813,11 +813,6 @@ const SettingsPage = () => {
813
813
  message: t("notifications.success.saved", "Settings saved successfully to database!")
814
814
  });
815
815
  setHasChanges(false);
816
- try {
817
- localStorage.setItem(`${pluginId}-settings`, JSON.stringify(settings));
818
- } catch (localErr) {
819
- console.warn("[Settings] Could not save to localStorage:", localErr);
820
- }
821
816
  } else {
822
817
  throw new Error("Save failed");
823
818
  }
@@ -7,7 +7,7 @@ const designSystem = require("@strapi/design-system");
7
7
  const admin = require("@strapi/strapi/admin");
8
8
  const icons = require("@strapi/icons");
9
9
  const styled = require("styled-components");
10
- const index = require("./index-DTskQVDl.js");
10
+ const index = require("./index-DJHhzin_.js");
11
11
  const StyledButtons = require("./StyledButtons-DDuxnYz8.js");
12
12
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
13
13
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -817,11 +817,6 @@ const SettingsPage = () => {
817
817
  message: t("notifications.success.saved", "Settings saved successfully to database!")
818
818
  });
819
819
  setHasChanges(false);
820
- try {
821
- localStorage.setItem(`${index.pluginId}-settings`, JSON.stringify(settings));
822
- } catch (localErr) {
823
- console.warn("[Settings] Could not save to localStorage:", localErr);
824
- }
825
820
  } else {
826
821
  throw new Error("Save failed");
827
822
  }
@@ -438,7 +438,7 @@ const index = {
438
438
  id: `${pluginId}.plugin.name`,
439
439
  defaultMessage: pluginPkg.strapi.displayName
440
440
  },
441
- Component: () => import("./App-Sk0F9UEN.mjs"),
441
+ Component: () => import("./App-BEniJePD.mjs"),
442
442
  permissions: pluginPermissions
443
443
  });
444
444
  app.createSettingSection(
@@ -455,7 +455,7 @@ const index = {
455
455
  },
456
456
  id: "general",
457
457
  to: `${pluginId}/general`,
458
- Component: () => import("./Settings-BA7S_8DF.mjs"),
458
+ Component: () => import("./Settings-CnO501iu.mjs"),
459
459
  permissions: pluginPermissions
460
460
  },
461
461
  {
@@ -465,7 +465,7 @@ const index = {
465
465
  },
466
466
  id: "analytics",
467
467
  to: `${pluginId}/analytics`,
468
- Component: () => import("./Analytics-CwNJ3TNI.mjs"),
468
+ Component: () => import("./Analytics-B5IR0Awr.mjs"),
469
469
  permissions: pluginPermissions
470
470
  },
471
471
  {
@@ -475,7 +475,7 @@ const index = {
475
475
  },
476
476
  id: "license",
477
477
  to: `${pluginId}/license`,
478
- Component: () => import("./License-6SIpR7Rk.mjs"),
478
+ Component: () => import("./License-BjP7GvCt.mjs"),
479
479
  permissions: pluginPermissions
480
480
  }
481
481
  ]
@@ -494,7 +494,7 @@ const index = {
494
494
  defaultMessage: "Online Users"
495
495
  },
496
496
  component: async () => {
497
- const component = await import("./OnlineUsersWidget-Qq_uCTi1.mjs");
497
+ const component = await import("./OnlineUsersWidget-Cm9O0Fjb.mjs");
498
498
  return component.default;
499
499
  },
500
500
  id: "online-users-widget",
@@ -441,7 +441,7 @@ const index = {
441
441
  id: `${pluginId}.plugin.name`,
442
442
  defaultMessage: pluginPkg.strapi.displayName
443
443
  },
444
- Component: () => Promise.resolve().then(() => require("./App-DazHh7Zi.js")),
444
+ Component: () => Promise.resolve().then(() => require("./App-DisCm99X.js")),
445
445
  permissions: pluginPermissions
446
446
  });
447
447
  app.createSettingSection(
@@ -458,7 +458,7 @@ const index = {
458
458
  },
459
459
  id: "general",
460
460
  to: `${pluginId}/general`,
461
- Component: () => Promise.resolve().then(() => require("./Settings-CCYScjxv.js")),
461
+ Component: () => Promise.resolve().then(() => require("./Settings-DoLec2MD.js")),
462
462
  permissions: pluginPermissions
463
463
  },
464
464
  {
@@ -468,7 +468,7 @@ const index = {
468
468
  },
469
469
  id: "analytics",
470
470
  to: `${pluginId}/analytics`,
471
- Component: () => Promise.resolve().then(() => require("./Analytics-BMkhiuRX.js")),
471
+ Component: () => Promise.resolve().then(() => require("./Analytics-BJlc-yE3.js")),
472
472
  permissions: pluginPermissions
473
473
  },
474
474
  {
@@ -478,7 +478,7 @@ const index = {
478
478
  },
479
479
  id: "license",
480
480
  to: `${pluginId}/license`,
481
- Component: () => Promise.resolve().then(() => require("./License-BwbmzbP_.js")),
481
+ Component: () => Promise.resolve().then(() => require("./License-DqDBPjZH.js")),
482
482
  permissions: pluginPermissions
483
483
  }
484
484
  ]
@@ -497,7 +497,7 @@ const index = {
497
497
  defaultMessage: "Online Users"
498
498
  },
499
499
  component: async () => {
500
- const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-BIfnbFcZ.js"));
500
+ const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-DXdeGmfV.js"));
501
501
  return component.default;
502
502
  },
503
503
  id: "online-users-widget",
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-DTskQVDl.js");
3
+ const index = require("./index-DJHhzin_.js");
4
4
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "./index-UTLA1r40.mjs";
1
+ import { i } from "./index-CpMDG2XI.mjs";
2
2
  export {
3
3
  i as default
4
4
  };