strapi-plugin-magic-sessionmanager 1.0.0 → 2.0.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/README.md +3 -3
- package/dist/_chunks/{Analytics-ZQSBqi6k.mjs → Analytics-DTuknP1D.mjs} +22 -19
- package/dist/_chunks/{Analytics-BSvvI-Hg.js → Analytics-zP5M1bL_.js} +21 -18
- package/dist/_chunks/{App-DUVizmi_.js → App-Dg24Nes6.js} +8 -8
- package/dist/_chunks/{App-MPqlEJVm.mjs → App-Dwvy5bk_.mjs} +9 -9
- package/dist/_chunks/{License-BI7jDjPV.js → License-Bued-4ZT.js} +3 -3
- package/dist/_chunks/{License-WSbNrJuz.mjs → License-Zwaqa_nk.mjs} +4 -4
- package/dist/_chunks/{Settings-L1ryVQMS.js → Settings-3X3pwVSs.js} +3 -3
- package/dist/_chunks/{Settings-Ds8IhBiX.mjs → Settings-Bq4AqREf.mjs} +4 -4
- package/dist/_chunks/{index-Dd_SkI79.js → index-CtgGzpvo.js} +4 -4
- package/dist/_chunks/{index-BGCs2pNv.mjs → index-F2xT--Of.mjs} +4 -4
- package/dist/_chunks/{useLicense-Bw66_4CW.js → useLicense-B1AqCjRa.js} +1 -1
- package/dist/_chunks/{useLicense-Dw_-SJHP.mjs → useLicense-CMUZkg6j.mjs} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +19 -19
- package/dist/server/index.mjs +19 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
### Non-Invasive Architecture
|
|
54
54
|
✅ **No Core Modifications** - Pure plugin, zero changes to Strapi core
|
|
55
55
|
✅ **Runtime Injection** - Middleware-based architecture
|
|
56
|
-
✅ **DB-Backed** - Uses `
|
|
56
|
+
✅ **DB-Backed** - Uses `plugin::magic-sessionmanager.session` content type
|
|
57
57
|
✅ **License-Based** - Premium features via license key
|
|
58
58
|
|
|
59
59
|
---
|
|
@@ -185,7 +185,7 @@ Extract from response:
|
|
|
185
185
|
Block? NO → Continue ✅
|
|
186
186
|
Block? YES → Return 403 Forbidden ❌
|
|
187
187
|
↓
|
|
188
|
-
Create
|
|
188
|
+
Create plugin::magic-sessionmanager.session record:
|
|
189
189
|
{
|
|
190
190
|
user: userId,
|
|
191
191
|
token: jwt, // Access Token
|
|
@@ -936,7 +936,7 @@ curl http://localhost:1337/api/users \
|
|
|
936
936
|
# Look for: [magic-sessionmanager] ✅ Login/Logout interceptor middleware mounted
|
|
937
937
|
```
|
|
938
938
|
|
|
939
|
-
3. Check `
|
|
939
|
+
3. Check `plugin::magic-sessionmanager.session` collection exists:
|
|
940
940
|
- Go to Admin → Content Manager
|
|
941
941
|
- Look for "Session" collection
|
|
942
942
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
4
|
-
import styled, { keyframes } from "styled-components";
|
|
4
|
+
import styled, { css, keyframes } from "styled-components";
|
|
5
5
|
import { Loader, Typography, Box, Flex, Badge } from "@strapi/design-system";
|
|
6
6
|
import { ChartBubble, Crown, User, Clock, Monitor } from "@strapi/icons";
|
|
7
|
-
import { a as pluginId } from "./index-
|
|
8
|
-
import { u as useLicense } from "./useLicense-
|
|
7
|
+
import { a as pluginId } from "./index-F2xT--Of.mjs";
|
|
8
|
+
import { u as useLicense } from "./useLicense-CMUZkg6j.mjs";
|
|
9
9
|
const theme = {
|
|
10
10
|
colors: {
|
|
11
11
|
primary: { 100: "#E0F2FE", 500: "#0EA5E9", 600: "#0284C7" },
|
|
@@ -52,7 +52,7 @@ const growBar = keyframes`
|
|
|
52
52
|
to { width: var(--bar-width); }
|
|
53
53
|
`;
|
|
54
54
|
const Container = styled(Box)`
|
|
55
|
-
animation: ${fadeIn} 0.6s
|
|
55
|
+
${css`animation: ${fadeIn} 0.6s;`}
|
|
56
56
|
min-height: 100vh;
|
|
57
57
|
max-width: 1440px;
|
|
58
58
|
margin: 0 auto;
|
|
@@ -75,7 +75,7 @@ const Header = styled(Box)`
|
|
|
75
75
|
width: 200%;
|
|
76
76
|
height: 100%;
|
|
77
77
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
|
|
78
|
-
animation: ${shimmer} 3s infinite
|
|
78
|
+
${css`animation: ${shimmer} 3s infinite;`}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
&::after {
|
|
@@ -108,7 +108,7 @@ const Title = styled(Typography)`
|
|
|
108
108
|
svg {
|
|
109
109
|
width: 32px;
|
|
110
110
|
height: 32px;
|
|
111
|
-
animation: ${float} 3s ease-in-out infinite
|
|
111
|
+
${css`animation: ${float} 3s ease-in-out infinite;`}
|
|
112
112
|
}
|
|
113
113
|
`;
|
|
114
114
|
const Subtitle = styled(Typography)`
|
|
@@ -130,7 +130,7 @@ const StatCard = styled(Box)`
|
|
|
130
130
|
position: relative;
|
|
131
131
|
overflow: hidden;
|
|
132
132
|
transition: all ${theme.transitions.normal};
|
|
133
|
-
animation: ${fadeIn} ${theme.transitions.slow} backwards
|
|
133
|
+
${css`animation: ${fadeIn} ${theme.transitions.slow} backwards;`}
|
|
134
134
|
animation-delay: ${(props) => props.$delay || "0s"};
|
|
135
135
|
box-shadow: ${theme.shadows.sm};
|
|
136
136
|
border: 1px solid ${theme.colors.neutral[200]};
|
|
@@ -195,7 +195,7 @@ const ChartCard = styled(Box)`
|
|
|
195
195
|
box-shadow: ${theme.shadows.md};
|
|
196
196
|
border: 1px solid ${theme.colors.neutral[200]};
|
|
197
197
|
margin-bottom: 28px;
|
|
198
|
-
animation: ${slideIn} ${theme.transitions.slow}
|
|
198
|
+
${css`animation: ${slideIn} ${theme.transitions.slow};`}
|
|
199
199
|
transition: all ${theme.transitions.normal};
|
|
200
200
|
|
|
201
201
|
&:hover {
|
|
@@ -227,7 +227,7 @@ const BarRow = styled.div`
|
|
|
227
227
|
display: flex;
|
|
228
228
|
align-items: center;
|
|
229
229
|
gap: 20px;
|
|
230
|
-
animation: ${fadeIn} 0.6s backwards
|
|
230
|
+
${css`animation: ${fadeIn} 0.6s backwards;`}
|
|
231
231
|
animation-delay: ${(props) => props.$delay || "0s"};
|
|
232
232
|
`;
|
|
233
233
|
const BarLabel = styled(Typography)`
|
|
@@ -250,7 +250,7 @@ const BarFill = styled.div`
|
|
|
250
250
|
background: linear-gradient(90deg, ${(props) => props.$color1 || theme.colors.primary[500]}, ${(props) => props.$color2 || theme.colors.primary[600]});
|
|
251
251
|
border-radius: 10px;
|
|
252
252
|
--bar-width: ${(props) => props.$percentage || 0}%;
|
|
253
|
-
animation: ${growBar} 1s cubic-bezier(0.4, 0, 0.2, 1) forwards
|
|
253
|
+
${css`animation: ${growBar} 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;`}
|
|
254
254
|
animation-delay: ${(props) => props.$delay || "0s"};
|
|
255
255
|
display: flex;
|
|
256
256
|
align-items: center;
|
|
@@ -273,9 +273,19 @@ const LoadingOverlay = styled.div`
|
|
|
273
273
|
gap: 24px;
|
|
274
274
|
|
|
275
275
|
.loader-icon {
|
|
276
|
-
animation: ${pulse} 2s ease-in-out infinite
|
|
276
|
+
${css`animation: ${pulse} 2s ease-in-out infinite;`}
|
|
277
277
|
}
|
|
278
278
|
`;
|
|
279
|
+
const AnimatedIcon = styled.div`
|
|
280
|
+
${css`animation: ${float} 3s ease-in-out infinite;`}
|
|
281
|
+
width: 96px;
|
|
282
|
+
height: 96px;
|
|
283
|
+
color: #d97706;
|
|
284
|
+
margin: 0 auto 32px;
|
|
285
|
+
display: flex;
|
|
286
|
+
align-items: center;
|
|
287
|
+
justify-content: center;
|
|
288
|
+
`;
|
|
279
289
|
const AnalyticsPage = () => {
|
|
280
290
|
const { get } = useFetchClient();
|
|
281
291
|
const { isPremium, loading: licenseLoading } = useLicense();
|
|
@@ -401,14 +411,7 @@ const AnalyticsPage = () => {
|
|
|
401
411
|
zIndex: 0
|
|
402
412
|
} }),
|
|
403
413
|
/* @__PURE__ */ jsxs("div", { style: { position: "relative", zIndex: 1 }, children: [
|
|
404
|
-
/* @__PURE__ */ jsx(
|
|
405
|
-
width: "96px",
|
|
406
|
-
height: "96px",
|
|
407
|
-
color: "#d97706",
|
|
408
|
-
margin: "0 auto 32px",
|
|
409
|
-
display: "block",
|
|
410
|
-
animation: `${float} 3s ease-in-out infinite`
|
|
411
|
-
} }),
|
|
414
|
+
/* @__PURE__ */ jsx(AnimatedIcon, { as: Crown }),
|
|
412
415
|
/* @__PURE__ */ jsx(
|
|
413
416
|
Typography,
|
|
414
417
|
{
|
|
@@ -6,8 +6,8 @@ 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-
|
|
10
|
-
const useLicense = require("./useLicense-
|
|
9
|
+
const index = require("./index-CtgGzpvo.js");
|
|
10
|
+
const useLicense = require("./useLicense-B1AqCjRa.js");
|
|
11
11
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
12
12
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
13
13
|
const theme = {
|
|
@@ -56,7 +56,7 @@ const growBar = styled.keyframes`
|
|
|
56
56
|
to { width: var(--bar-width); }
|
|
57
57
|
`;
|
|
58
58
|
const Container = styled__default.default(designSystem.Box)`
|
|
59
|
-
animation: ${fadeIn} 0.6s
|
|
59
|
+
${styled.css`animation: ${fadeIn} 0.6s;`}
|
|
60
60
|
min-height: 100vh;
|
|
61
61
|
max-width: 1440px;
|
|
62
62
|
margin: 0 auto;
|
|
@@ -79,7 +79,7 @@ const Header = styled__default.default(designSystem.Box)`
|
|
|
79
79
|
width: 200%;
|
|
80
80
|
height: 100%;
|
|
81
81
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
|
|
82
|
-
animation: ${shimmer} 3s infinite
|
|
82
|
+
${styled.css`animation: ${shimmer} 3s infinite;`}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
&::after {
|
|
@@ -112,7 +112,7 @@ const Title = styled__default.default(designSystem.Typography)`
|
|
|
112
112
|
svg {
|
|
113
113
|
width: 32px;
|
|
114
114
|
height: 32px;
|
|
115
|
-
animation: ${float} 3s ease-in-out infinite
|
|
115
|
+
${styled.css`animation: ${float} 3s ease-in-out infinite;`}
|
|
116
116
|
}
|
|
117
117
|
`;
|
|
118
118
|
const Subtitle = styled__default.default(designSystem.Typography)`
|
|
@@ -134,7 +134,7 @@ const StatCard = styled__default.default(designSystem.Box)`
|
|
|
134
134
|
position: relative;
|
|
135
135
|
overflow: hidden;
|
|
136
136
|
transition: all ${theme.transitions.normal};
|
|
137
|
-
animation: ${fadeIn} ${theme.transitions.slow} backwards
|
|
137
|
+
${styled.css`animation: ${fadeIn} ${theme.transitions.slow} backwards;`}
|
|
138
138
|
animation-delay: ${(props) => props.$delay || "0s"};
|
|
139
139
|
box-shadow: ${theme.shadows.sm};
|
|
140
140
|
border: 1px solid ${theme.colors.neutral[200]};
|
|
@@ -199,7 +199,7 @@ const ChartCard = styled__default.default(designSystem.Box)`
|
|
|
199
199
|
box-shadow: ${theme.shadows.md};
|
|
200
200
|
border: 1px solid ${theme.colors.neutral[200]};
|
|
201
201
|
margin-bottom: 28px;
|
|
202
|
-
animation: ${slideIn} ${theme.transitions.slow}
|
|
202
|
+
${styled.css`animation: ${slideIn} ${theme.transitions.slow};`}
|
|
203
203
|
transition: all ${theme.transitions.normal};
|
|
204
204
|
|
|
205
205
|
&:hover {
|
|
@@ -231,7 +231,7 @@ const BarRow = styled__default.default.div`
|
|
|
231
231
|
display: flex;
|
|
232
232
|
align-items: center;
|
|
233
233
|
gap: 20px;
|
|
234
|
-
animation: ${fadeIn} 0.6s backwards
|
|
234
|
+
${styled.css`animation: ${fadeIn} 0.6s backwards;`}
|
|
235
235
|
animation-delay: ${(props) => props.$delay || "0s"};
|
|
236
236
|
`;
|
|
237
237
|
const BarLabel = styled__default.default(designSystem.Typography)`
|
|
@@ -254,7 +254,7 @@ const BarFill = styled__default.default.div`
|
|
|
254
254
|
background: linear-gradient(90deg, ${(props) => props.$color1 || theme.colors.primary[500]}, ${(props) => props.$color2 || theme.colors.primary[600]});
|
|
255
255
|
border-radius: 10px;
|
|
256
256
|
--bar-width: ${(props) => props.$percentage || 0}%;
|
|
257
|
-
animation: ${growBar} 1s cubic-bezier(0.4, 0, 0.2, 1) forwards
|
|
257
|
+
${styled.css`animation: ${growBar} 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;`}
|
|
258
258
|
animation-delay: ${(props) => props.$delay || "0s"};
|
|
259
259
|
display: flex;
|
|
260
260
|
align-items: center;
|
|
@@ -277,9 +277,19 @@ const LoadingOverlay = styled__default.default.div`
|
|
|
277
277
|
gap: 24px;
|
|
278
278
|
|
|
279
279
|
.loader-icon {
|
|
280
|
-
animation: ${pulse} 2s ease-in-out infinite
|
|
280
|
+
${styled.css`animation: ${pulse} 2s ease-in-out infinite;`}
|
|
281
281
|
}
|
|
282
282
|
`;
|
|
283
|
+
const AnimatedIcon = styled__default.default.div`
|
|
284
|
+
${styled.css`animation: ${float} 3s ease-in-out infinite;`}
|
|
285
|
+
width: 96px;
|
|
286
|
+
height: 96px;
|
|
287
|
+
color: #d97706;
|
|
288
|
+
margin: 0 auto 32px;
|
|
289
|
+
display: flex;
|
|
290
|
+
align-items: center;
|
|
291
|
+
justify-content: center;
|
|
292
|
+
`;
|
|
283
293
|
const AnalyticsPage = () => {
|
|
284
294
|
const { get } = admin.useFetchClient();
|
|
285
295
|
const { isPremium, loading: licenseLoading } = useLicense.useLicense();
|
|
@@ -405,14 +415,7 @@ const AnalyticsPage = () => {
|
|
|
405
415
|
zIndex: 0
|
|
406
416
|
} }),
|
|
407
417
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", zIndex: 1 }, children: [
|
|
408
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
409
|
-
width: "96px",
|
|
410
|
-
height: "96px",
|
|
411
|
-
color: "#d97706",
|
|
412
|
-
margin: "0 auto 32px",
|
|
413
|
-
display: "block",
|
|
414
|
-
animation: `${float} 3s ease-in-out infinite`
|
|
415
|
-
} }),
|
|
418
|
+
/* @__PURE__ */ jsxRuntime.jsx(AnimatedIcon, { as: icons.Crown }),
|
|
416
419
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
417
420
|
designSystem.Typography,
|
|
418
421
|
{
|
|
@@ -6,8 +6,8 @@ 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-
|
|
10
|
-
const useLicense = require("./useLicense-
|
|
9
|
+
const index = require("./index-CtgGzpvo.js");
|
|
10
|
+
const useLicense = require("./useLicense-B1AqCjRa.js");
|
|
11
11
|
const reactRouterDom = require("react-router-dom");
|
|
12
12
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
13
13
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
@@ -440,13 +440,13 @@ const FloatingEmoji = styled__default.default.div`
|
|
|
440
440
|
right: 40px;
|
|
441
441
|
font-size: 72px;
|
|
442
442
|
opacity: 0.08;
|
|
443
|
-
animation: ${float} 4s ease-in-out infinite
|
|
443
|
+
${styled.css`animation: ${float} 4s ease-in-out infinite;`}
|
|
444
444
|
`;
|
|
445
445
|
const breakpoints = {
|
|
446
446
|
mobile: "768px"
|
|
447
447
|
};
|
|
448
448
|
const Container = styled__default.default(designSystem.Box)`
|
|
449
|
-
animation: ${fadeIn$1} ${theme.transitions.slow}
|
|
449
|
+
${styled.css`animation: ${fadeIn$1} ${theme.transitions.slow};`}
|
|
450
450
|
min-height: 100vh;
|
|
451
451
|
max-width: 1440px;
|
|
452
452
|
margin: 0 auto;
|
|
@@ -486,7 +486,7 @@ const Header = styled__default.default(designSystem.Box)`
|
|
|
486
486
|
rgba(255, 255, 255, 0.15),
|
|
487
487
|
transparent
|
|
488
488
|
);
|
|
489
|
-
animation: ${shimmer} 3s infinite
|
|
489
|
+
${styled.css`animation: ${shimmer} 3s infinite;`}
|
|
490
490
|
}
|
|
491
491
|
|
|
492
492
|
&::after {
|
|
@@ -518,7 +518,7 @@ const Title = styled__default.default(designSystem.Typography)`
|
|
|
518
518
|
svg {
|
|
519
519
|
width: 28px;
|
|
520
520
|
height: 28px;
|
|
521
|
-
animation: ${float} 3s ease-in-out infinite
|
|
521
|
+
${styled.css`animation: ${float} 3s ease-in-out infinite;`}
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
@media screen and (max-width: ${breakpoints.mobile}) {
|
|
@@ -564,7 +564,7 @@ const StatCard = styled__default.default(designSystem.Box)`
|
|
|
564
564
|
position: relative;
|
|
565
565
|
overflow: hidden;
|
|
566
566
|
transition: all ${theme.transitions.normal};
|
|
567
|
-
animation: ${fadeIn$1} ${theme.transitions.slow} backwards
|
|
567
|
+
${styled.css`animation: ${fadeIn$1} ${theme.transitions.slow} backwards;`}
|
|
568
568
|
animation-delay: ${(props) => props.$delay || "0s"};
|
|
569
569
|
box-shadow: ${theme.shadows.sm};
|
|
570
570
|
border: 1px solid ${theme.colors.neutral[200]};
|
|
@@ -707,7 +707,7 @@ const OnlineIndicator = styled__default.default.div`
|
|
|
707
707
|
background: ${(props) => props.$online ? theme.colors.success[500] : theme.colors.neutral[400]};
|
|
708
708
|
display: inline-block;
|
|
709
709
|
margin-right: 8px;
|
|
710
|
-
animation: ${(props) => props.$online ? pulse : "none"} 2s ease-in-out infinite
|
|
710
|
+
${styled.css`animation: ${(props) => props.$online ? pulse : "none"} 2s ease-in-out infinite;`}
|
|
711
711
|
`;
|
|
712
712
|
const FilterBar = styled__default.default(designSystem.Flex)`
|
|
713
713
|
background: ${theme.colors.neutral[0]};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
4
|
-
import styled, { keyframes } from "styled-components";
|
|
4
|
+
import styled, { css, keyframes } from "styled-components";
|
|
5
5
|
import { Modal, Flex, Box, Typography, Badge, Divider, Button, Loader, SingleSelect, SingleSelectOption, Thead, Tr, Th, Tbody, Td, Table, TextInput } from "@strapi/design-system";
|
|
6
6
|
import { Check, Information, Monitor, Server, Clock, Cross, Earth, Shield, Crown, Phone, Download, User, Eye, Trash, Search, Key } from "@strapi/icons";
|
|
7
|
-
import { p as parseUserAgent, a as pluginId } from "./index-
|
|
8
|
-
import { u as useLicense } from "./useLicense-
|
|
7
|
+
import { p as parseUserAgent, a as pluginId } from "./index-F2xT--Of.mjs";
|
|
8
|
+
import { u as useLicense } from "./useLicense-CMUZkg6j.mjs";
|
|
9
9
|
import { useNavigate } from "react-router-dom";
|
|
10
10
|
const TwoColumnGrid = styled.div`
|
|
11
11
|
display: grid;
|
|
@@ -436,13 +436,13 @@ const FloatingEmoji = styled.div`
|
|
|
436
436
|
right: 40px;
|
|
437
437
|
font-size: 72px;
|
|
438
438
|
opacity: 0.08;
|
|
439
|
-
animation: ${float} 4s ease-in-out infinite
|
|
439
|
+
${css`animation: ${float} 4s ease-in-out infinite;`}
|
|
440
440
|
`;
|
|
441
441
|
const breakpoints = {
|
|
442
442
|
mobile: "768px"
|
|
443
443
|
};
|
|
444
444
|
const Container = styled(Box)`
|
|
445
|
-
animation: ${fadeIn$1} ${theme.transitions.slow}
|
|
445
|
+
${css`animation: ${fadeIn$1} ${theme.transitions.slow};`}
|
|
446
446
|
min-height: 100vh;
|
|
447
447
|
max-width: 1440px;
|
|
448
448
|
margin: 0 auto;
|
|
@@ -482,7 +482,7 @@ const Header = styled(Box)`
|
|
|
482
482
|
rgba(255, 255, 255, 0.15),
|
|
483
483
|
transparent
|
|
484
484
|
);
|
|
485
|
-
animation: ${shimmer} 3s infinite
|
|
485
|
+
${css`animation: ${shimmer} 3s infinite;`}
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
&::after {
|
|
@@ -514,7 +514,7 @@ const Title = styled(Typography)`
|
|
|
514
514
|
svg {
|
|
515
515
|
width: 28px;
|
|
516
516
|
height: 28px;
|
|
517
|
-
animation: ${float} 3s ease-in-out infinite
|
|
517
|
+
${css`animation: ${float} 3s ease-in-out infinite;`}
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
@media screen and (max-width: ${breakpoints.mobile}) {
|
|
@@ -560,7 +560,7 @@ const StatCard = styled(Box)`
|
|
|
560
560
|
position: relative;
|
|
561
561
|
overflow: hidden;
|
|
562
562
|
transition: all ${theme.transitions.normal};
|
|
563
|
-
animation: ${fadeIn$1} ${theme.transitions.slow} backwards
|
|
563
|
+
${css`animation: ${fadeIn$1} ${theme.transitions.slow} backwards;`}
|
|
564
564
|
animation-delay: ${(props) => props.$delay || "0s"};
|
|
565
565
|
box-shadow: ${theme.shadows.sm};
|
|
566
566
|
border: 1px solid ${theme.colors.neutral[200]};
|
|
@@ -703,7 +703,7 @@ const OnlineIndicator = styled.div`
|
|
|
703
703
|
background: ${(props) => props.$online ? theme.colors.success[500] : theme.colors.neutral[400]};
|
|
704
704
|
display: inline-block;
|
|
705
705
|
margin-right: 8px;
|
|
706
|
-
animation: ${(props) => props.$online ? pulse : "none"} 2s ease-in-out infinite
|
|
706
|
+
${css`animation: ${(props) => props.$online ? pulse : "none"} 2s ease-in-out infinite;`}
|
|
707
707
|
`;
|
|
708
708
|
const FilterBar = styled(Flex)`
|
|
709
709
|
background: ${theme.colors.neutral[0]};
|
|
@@ -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-
|
|
9
|
+
const index = require("./index-CtgGzpvo.js");
|
|
10
10
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
11
11
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
12
12
|
const theme = {
|
|
@@ -25,7 +25,7 @@ const shimmer = styled.keyframes`
|
|
|
25
25
|
100% { background-position: 200% 0; }
|
|
26
26
|
`;
|
|
27
27
|
const Container = styled__default.default(designSystem.Box)`
|
|
28
|
-
animation: ${fadeIn} 0.5s
|
|
28
|
+
${styled.css`animation: ${fadeIn} 0.5s;`}
|
|
29
29
|
max-width: 1400px;
|
|
30
30
|
margin: 0 auto;
|
|
31
31
|
`;
|
|
@@ -60,7 +60,7 @@ const LicenseKeyBanner = styled__default.default(designSystem.Box)`
|
|
|
60
60
|
rgba(255, 255, 255, 0.08),
|
|
61
61
|
transparent
|
|
62
62
|
);
|
|
63
|
-
animation: ${shimmer} 3s infinite
|
|
63
|
+
${styled.css`animation: ${shimmer} 3s infinite;`}
|
|
64
64
|
pointer-events: none;
|
|
65
65
|
z-index: 0;
|
|
66
66
|
}
|
|
@@ -3,8 +3,8 @@ import { useState, useEffect } from "react";
|
|
|
3
3
|
import { Loader, Box, Alert, Flex, Typography, Button, Badge, Accordion } from "@strapi/design-system";
|
|
4
4
|
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
5
5
|
import { ArrowClockwise, Duplicate, Download, User, Shield, Sparkle, ChartBubble } from "@strapi/icons";
|
|
6
|
-
import styled, { keyframes } from "styled-components";
|
|
7
|
-
import { a as pluginId } from "./index-
|
|
6
|
+
import styled, { css, keyframes } from "styled-components";
|
|
7
|
+
import { a as pluginId } from "./index-F2xT--Of.mjs";
|
|
8
8
|
const theme = {
|
|
9
9
|
colors: {
|
|
10
10
|
neutral: { 200: "#E5E7EB" }
|
|
@@ -21,7 +21,7 @@ const shimmer = keyframes`
|
|
|
21
21
|
100% { background-position: 200% 0; }
|
|
22
22
|
`;
|
|
23
23
|
const Container = styled(Box)`
|
|
24
|
-
animation: ${fadeIn} 0.5s
|
|
24
|
+
${css`animation: ${fadeIn} 0.5s;`}
|
|
25
25
|
max-width: 1400px;
|
|
26
26
|
margin: 0 auto;
|
|
27
27
|
`;
|
|
@@ -56,7 +56,7 @@ const LicenseKeyBanner = styled(Box)`
|
|
|
56
56
|
rgba(255, 255, 255, 0.08),
|
|
57
57
|
transparent
|
|
58
58
|
);
|
|
59
|
-
animation: ${shimmer} 3s infinite
|
|
59
|
+
${css`animation: ${shimmer} 3s infinite;`}
|
|
60
60
|
pointer-events: none;
|
|
61
61
|
z-index: 0;
|
|
62
62
|
}
|
|
@@ -6,8 +6,8 @@ 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-
|
|
10
|
-
const useLicense = require("./useLicense-
|
|
9
|
+
const index = require("./index-CtgGzpvo.js");
|
|
10
|
+
const useLicense = require("./useLicense-B1AqCjRa.js");
|
|
11
11
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
12
12
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
13
13
|
const theme = {
|
|
@@ -29,7 +29,7 @@ styled.keyframes`
|
|
|
29
29
|
100% { background-position: 200% 0; }
|
|
30
30
|
`;
|
|
31
31
|
const Container = styled__default.default(designSystem.Box)`
|
|
32
|
-
animation: ${fadeIn} 0.5s
|
|
32
|
+
${styled.css`animation: ${fadeIn} 0.5s;`}
|
|
33
33
|
max-width: 1400px;
|
|
34
34
|
margin: 0 auto;
|
|
35
35
|
`;
|
|
@@ -3,9 +3,9 @@ import { useState, useEffect } from "react";
|
|
|
3
3
|
import { Flex, Loader, Typography, Button, Box, Badge, Accordion, Grid, SingleSelect, SingleSelectOption, Divider, Toggle, NumberInput, Checkbox, Tabs, TextInput } from "@strapi/design-system";
|
|
4
4
|
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
5
5
|
import { Check, Information, Cog, Trash, Shield, Mail, Code } from "@strapi/icons";
|
|
6
|
-
import styled, { keyframes } from "styled-components";
|
|
7
|
-
import { a as pluginId } from "./index-
|
|
8
|
-
import { u as useLicense } from "./useLicense-
|
|
6
|
+
import styled, { css, keyframes } from "styled-components";
|
|
7
|
+
import { a as pluginId } from "./index-F2xT--Of.mjs";
|
|
8
|
+
import { u as useLicense } from "./useLicense-CMUZkg6j.mjs";
|
|
9
9
|
const theme = {
|
|
10
10
|
colors: {
|
|
11
11
|
primary: { 600: "#0284C7", 700: "#075985" },
|
|
@@ -25,7 +25,7 @@ keyframes`
|
|
|
25
25
|
100% { background-position: 200% 0; }
|
|
26
26
|
`;
|
|
27
27
|
const Container = styled(Box)`
|
|
28
|
-
animation: ${fadeIn} 0.5s
|
|
28
|
+
${css`animation: ${fadeIn} 0.5s;`}
|
|
29
29
|
max-width: 1400px;
|
|
30
30
|
margin: 0 auto;
|
|
31
31
|
`;
|
|
@@ -404,7 +404,7 @@ const index = {
|
|
|
404
404
|
id: `${pluginId}.plugin.name`,
|
|
405
405
|
defaultMessage: pluginPkg.strapi.displayName
|
|
406
406
|
},
|
|
407
|
-
Component: () => Promise.resolve().then(() => require("./App-
|
|
407
|
+
Component: () => Promise.resolve().then(() => require("./App-Dg24Nes6.js"))
|
|
408
408
|
});
|
|
409
409
|
app.createSettingSection(
|
|
410
410
|
{
|
|
@@ -420,7 +420,7 @@ const index = {
|
|
|
420
420
|
},
|
|
421
421
|
id: "general",
|
|
422
422
|
to: `/settings/${pluginId}/general`,
|
|
423
|
-
Component: () => Promise.resolve().then(() => require("./Settings-
|
|
423
|
+
Component: () => Promise.resolve().then(() => require("./Settings-3X3pwVSs.js"))
|
|
424
424
|
},
|
|
425
425
|
{
|
|
426
426
|
intlLabel: {
|
|
@@ -429,7 +429,7 @@ const index = {
|
|
|
429
429
|
},
|
|
430
430
|
id: "analytics",
|
|
431
431
|
to: `/settings/${pluginId}/analytics`,
|
|
432
|
-
Component: () => Promise.resolve().then(() => require("./Analytics-
|
|
432
|
+
Component: () => Promise.resolve().then(() => require("./Analytics-zP5M1bL_.js"))
|
|
433
433
|
},
|
|
434
434
|
{
|
|
435
435
|
intlLabel: {
|
|
@@ -438,7 +438,7 @@ const index = {
|
|
|
438
438
|
},
|
|
439
439
|
id: "license",
|
|
440
440
|
to: `/settings/${pluginId}/license`,
|
|
441
|
-
Component: () => Promise.resolve().then(() => require("./License-
|
|
441
|
+
Component: () => Promise.resolve().then(() => require("./License-Bued-4ZT.js"))
|
|
442
442
|
}
|
|
443
443
|
]
|
|
444
444
|
);
|
|
@@ -403,7 +403,7 @@ const index = {
|
|
|
403
403
|
id: `${pluginId}.plugin.name`,
|
|
404
404
|
defaultMessage: pluginPkg.strapi.displayName
|
|
405
405
|
},
|
|
406
|
-
Component: () => import("./App-
|
|
406
|
+
Component: () => import("./App-Dwvy5bk_.mjs")
|
|
407
407
|
});
|
|
408
408
|
app.createSettingSection(
|
|
409
409
|
{
|
|
@@ -419,7 +419,7 @@ const index = {
|
|
|
419
419
|
},
|
|
420
420
|
id: "general",
|
|
421
421
|
to: `/settings/${pluginId}/general`,
|
|
422
|
-
Component: () => import("./Settings-
|
|
422
|
+
Component: () => import("./Settings-Bq4AqREf.mjs")
|
|
423
423
|
},
|
|
424
424
|
{
|
|
425
425
|
intlLabel: {
|
|
@@ -428,7 +428,7 @@ const index = {
|
|
|
428
428
|
},
|
|
429
429
|
id: "analytics",
|
|
430
430
|
to: `/settings/${pluginId}/analytics`,
|
|
431
|
-
Component: () => import("./Analytics-
|
|
431
|
+
Component: () => import("./Analytics-DTuknP1D.mjs")
|
|
432
432
|
},
|
|
433
433
|
{
|
|
434
434
|
intlLabel: {
|
|
@@ -437,7 +437,7 @@ const index = {
|
|
|
437
437
|
},
|
|
438
438
|
id: "license",
|
|
439
439
|
to: `/settings/${pluginId}/license`,
|
|
440
|
-
Component: () => import("./License-
|
|
440
|
+
Component: () => import("./License-Zwaqa_nk.mjs")
|
|
441
441
|
}
|
|
442
442
|
]
|
|
443
443
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const react = require("react");
|
|
3
3
|
const admin = require("@strapi/strapi/admin");
|
|
4
|
-
const index = require("./index-
|
|
4
|
+
const index = require("./index-CtgGzpvo.js");
|
|
5
5
|
const useLicense = () => {
|
|
6
6
|
const { get } = admin.useFetchClient();
|
|
7
7
|
const [isPremium, setIsPremium] = react.useState(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
3
|
-
import { a as pluginId } from "./index-
|
|
3
|
+
import { a as pluginId } from "./index-F2xT--Of.mjs";
|
|
4
4
|
const useLicense = () => {
|
|
5
5
|
const { get } = useFetchClient();
|
|
6
6
|
const [isPremium, setIsPremium] = useState(false);
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -92,7 +92,7 @@ var lastSeen = ({ strapi: strapi2, sessionService }) => {
|
|
|
92
92
|
if (ctx.state.user && ctx.state.user.id) {
|
|
93
93
|
try {
|
|
94
94
|
const userId = ctx.state.user.id;
|
|
95
|
-
const activeSessions = await strapi2.entityService.findMany("
|
|
95
|
+
const activeSessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
96
96
|
filters: {
|
|
97
97
|
user: { id: userId },
|
|
98
98
|
isActive: true
|
|
@@ -190,7 +190,7 @@ var bootstrap$1 = async ({ strapi: strapi2 }) => {
|
|
|
190
190
|
ctx.body = { message: "Logged out successfully" };
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
|
-
const sessions = await strapi2.entityService.findMany("
|
|
193
|
+
const sessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
194
194
|
filters: {
|
|
195
195
|
token,
|
|
196
196
|
isActive: true
|
|
@@ -331,7 +331,7 @@ var bootstrap$1 = async ({ strapi: strapi2 }) => {
|
|
|
331
331
|
);
|
|
332
332
|
strapi2.log.info("[magic-sessionmanager] ✅ LastSeen middleware mounted");
|
|
333
333
|
strapi2.log.info("[magic-sessionmanager] ✅ Bootstrap complete");
|
|
334
|
-
strapi2.log.info("[magic-sessionmanager] 🎉 Session Manager ready! Sessions stored in
|
|
334
|
+
strapi2.log.info("[magic-sessionmanager] 🎉 Session Manager ready! Sessions stored in plugin::magic-sessionmanager.session");
|
|
335
335
|
} catch (err) {
|
|
336
336
|
strapi2.log.error("[magic-sessionmanager] ❌ Bootstrap error:", err);
|
|
337
337
|
}
|
|
@@ -633,7 +633,7 @@ var session$3 = {
|
|
|
633
633
|
return ctx.throw(401, "Unauthorized");
|
|
634
634
|
}
|
|
635
635
|
const sessionService = strapi.plugin("magic-sessionmanager").service("session");
|
|
636
|
-
const sessions = await strapi.entityService.findMany("
|
|
636
|
+
const sessions = await strapi.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
637
637
|
filters: {
|
|
638
638
|
user: { id: userId },
|
|
639
639
|
token,
|
|
@@ -1150,7 +1150,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1150
1150
|
async createSession({ userId, ip = "unknown", userAgent = "unknown", token }) {
|
|
1151
1151
|
try {
|
|
1152
1152
|
const now = /* @__PURE__ */ new Date();
|
|
1153
|
-
const session2 = await strapi2.entityService.create("
|
|
1153
|
+
const session2 = await strapi2.entityService.create("plugin::magic-sessionmanager.session", {
|
|
1154
1154
|
data: {
|
|
1155
1155
|
user: userId,
|
|
1156
1156
|
ipAddress: ip.substring(0, 45),
|
|
@@ -1178,7 +1178,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1178
1178
|
try {
|
|
1179
1179
|
const now = /* @__PURE__ */ new Date();
|
|
1180
1180
|
if (sessionId) {
|
|
1181
|
-
await strapi2.entityService.update("
|
|
1181
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", sessionId, {
|
|
1182
1182
|
data: {
|
|
1183
1183
|
isActive: false,
|
|
1184
1184
|
logoutTime: now
|
|
@@ -1186,14 +1186,14 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1186
1186
|
});
|
|
1187
1187
|
strapi2.log.info(`[magic-sessionmanager] Session ${sessionId} terminated`);
|
|
1188
1188
|
} else if (userId) {
|
|
1189
|
-
const activeSessions = await strapi2.entityService.findMany("
|
|
1189
|
+
const activeSessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1190
1190
|
filters: {
|
|
1191
1191
|
user: { id: userId },
|
|
1192
1192
|
isActive: true
|
|
1193
1193
|
}
|
|
1194
1194
|
});
|
|
1195
1195
|
for (const session2 of activeSessions) {
|
|
1196
|
-
await strapi2.entityService.update("
|
|
1196
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", session2.id, {
|
|
1197
1197
|
data: {
|
|
1198
1198
|
isActive: false,
|
|
1199
1199
|
logoutTime: now
|
|
@@ -1213,7 +1213,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1213
1213
|
*/
|
|
1214
1214
|
async getAllSessions() {
|
|
1215
1215
|
try {
|
|
1216
|
-
const sessions = await strapi2.entityService.findMany("
|
|
1216
|
+
const sessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1217
1217
|
populate: { user: { fields: ["id", "email", "username"] } },
|
|
1218
1218
|
sort: { loginTime: "desc" },
|
|
1219
1219
|
limit: 1e3
|
|
@@ -1245,7 +1245,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1245
1245
|
*/
|
|
1246
1246
|
async getActiveSessions() {
|
|
1247
1247
|
try {
|
|
1248
|
-
const sessions = await strapi2.entityService.findMany("
|
|
1248
|
+
const sessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1249
1249
|
filters: { isActive: true },
|
|
1250
1250
|
populate: { user: { fields: ["id", "email", "username"] } },
|
|
1251
1251
|
sort: { loginTime: "desc" }
|
|
@@ -1277,7 +1277,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1277
1277
|
*/
|
|
1278
1278
|
async getUserSessions(userId) {
|
|
1279
1279
|
try {
|
|
1280
|
-
const sessions = await strapi2.entityService.findMany("
|
|
1280
|
+
const sessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1281
1281
|
filters: { user: { id: userId } },
|
|
1282
1282
|
sort: { loginTime: "desc" }
|
|
1283
1283
|
});
|
|
@@ -1312,17 +1312,17 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1312
1312
|
const config2 = strapi2.config.get("plugin::magic-sessionmanager") || {};
|
|
1313
1313
|
const rateLimit = config2.lastSeenRateLimit || 3e4;
|
|
1314
1314
|
if (sessionId) {
|
|
1315
|
-
const session2 = await strapi2.entityService.findOne("
|
|
1315
|
+
const session2 = await strapi2.entityService.findOne("plugin::magic-sessionmanager.session", sessionId);
|
|
1316
1316
|
if (session2 && session2.lastActive) {
|
|
1317
1317
|
const lastActiveTime = new Date(session2.lastActive).getTime();
|
|
1318
1318
|
const currentTime = now.getTime();
|
|
1319
1319
|
if (currentTime - lastActiveTime > rateLimit) {
|
|
1320
|
-
await strapi2.entityService.update("
|
|
1320
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", sessionId, {
|
|
1321
1321
|
data: { lastActive: now }
|
|
1322
1322
|
});
|
|
1323
1323
|
}
|
|
1324
1324
|
} else if (session2) {
|
|
1325
|
-
await strapi2.entityService.update("
|
|
1325
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", sessionId, {
|
|
1326
1326
|
data: { lastActive: now }
|
|
1327
1327
|
});
|
|
1328
1328
|
}
|
|
@@ -1342,7 +1342,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1342
1342
|
const now = /* @__PURE__ */ new Date();
|
|
1343
1343
|
const cutoffTime = new Date(now.getTime() - inactivityTimeout);
|
|
1344
1344
|
strapi2.log.info(`[magic-sessionmanager] 🧹 Cleaning up sessions inactive since before ${cutoffTime.toISOString()}`);
|
|
1345
|
-
const activeSessions = await strapi2.entityService.findMany("
|
|
1345
|
+
const activeSessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1346
1346
|
filters: { isActive: true },
|
|
1347
1347
|
fields: ["id", "lastActive", "loginTime"]
|
|
1348
1348
|
});
|
|
@@ -1350,7 +1350,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1350
1350
|
for (const session2 of activeSessions) {
|
|
1351
1351
|
const lastActiveTime = session2.lastActive ? new Date(session2.lastActive) : new Date(session2.loginTime);
|
|
1352
1352
|
if (lastActiveTime < cutoffTime) {
|
|
1353
|
-
await strapi2.entityService.update("
|
|
1353
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", session2.id, {
|
|
1354
1354
|
data: { isActive: false }
|
|
1355
1355
|
});
|
|
1356
1356
|
deactivatedCount++;
|
|
@@ -1371,7 +1371,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1371
1371
|
*/
|
|
1372
1372
|
async deleteSession(sessionId) {
|
|
1373
1373
|
try {
|
|
1374
|
-
await strapi2.entityService.delete("
|
|
1374
|
+
await strapi2.entityService.delete("plugin::magic-sessionmanager.session", sessionId);
|
|
1375
1375
|
strapi2.log.info(`[magic-sessionmanager] 🗑️ Session ${sessionId} permanently deleted`);
|
|
1376
1376
|
return true;
|
|
1377
1377
|
} catch (err) {
|
|
@@ -1387,13 +1387,13 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1387
1387
|
async deleteInactiveSessions() {
|
|
1388
1388
|
try {
|
|
1389
1389
|
strapi2.log.info("[magic-sessionmanager] 🗑️ Deleting all inactive sessions...");
|
|
1390
|
-
const inactiveSessions = await strapi2.entityService.findMany("
|
|
1390
|
+
const inactiveSessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1391
1391
|
filters: { isActive: false },
|
|
1392
1392
|
fields: ["id"]
|
|
1393
1393
|
});
|
|
1394
1394
|
let deletedCount = 0;
|
|
1395
1395
|
for (const session2 of inactiveSessions) {
|
|
1396
|
-
await strapi2.entityService.delete("
|
|
1396
|
+
await strapi2.entityService.delete("plugin::magic-sessionmanager.session", session2.id);
|
|
1397
1397
|
deletedCount++;
|
|
1398
1398
|
}
|
|
1399
1399
|
strapi2.log.info(`[magic-sessionmanager] ✅ Deleted ${deletedCount} inactive sessions`);
|
package/dist/server/index.mjs
CHANGED
|
@@ -88,7 +88,7 @@ var lastSeen = ({ strapi: strapi2, sessionService }) => {
|
|
|
88
88
|
if (ctx.state.user && ctx.state.user.id) {
|
|
89
89
|
try {
|
|
90
90
|
const userId = ctx.state.user.id;
|
|
91
|
-
const activeSessions = await strapi2.entityService.findMany("
|
|
91
|
+
const activeSessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
92
92
|
filters: {
|
|
93
93
|
user: { id: userId },
|
|
94
94
|
isActive: true
|
|
@@ -186,7 +186,7 @@ var bootstrap$1 = async ({ strapi: strapi2 }) => {
|
|
|
186
186
|
ctx.body = { message: "Logged out successfully" };
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
|
-
const sessions = await strapi2.entityService.findMany("
|
|
189
|
+
const sessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
190
190
|
filters: {
|
|
191
191
|
token,
|
|
192
192
|
isActive: true
|
|
@@ -327,7 +327,7 @@ var bootstrap$1 = async ({ strapi: strapi2 }) => {
|
|
|
327
327
|
);
|
|
328
328
|
strapi2.log.info("[magic-sessionmanager] ✅ LastSeen middleware mounted");
|
|
329
329
|
strapi2.log.info("[magic-sessionmanager] ✅ Bootstrap complete");
|
|
330
|
-
strapi2.log.info("[magic-sessionmanager] 🎉 Session Manager ready! Sessions stored in
|
|
330
|
+
strapi2.log.info("[magic-sessionmanager] 🎉 Session Manager ready! Sessions stored in plugin::magic-sessionmanager.session");
|
|
331
331
|
} catch (err) {
|
|
332
332
|
strapi2.log.error("[magic-sessionmanager] ❌ Bootstrap error:", err);
|
|
333
333
|
}
|
|
@@ -629,7 +629,7 @@ var session$3 = {
|
|
|
629
629
|
return ctx.throw(401, "Unauthorized");
|
|
630
630
|
}
|
|
631
631
|
const sessionService = strapi.plugin("magic-sessionmanager").service("session");
|
|
632
|
-
const sessions = await strapi.entityService.findMany("
|
|
632
|
+
const sessions = await strapi.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
633
633
|
filters: {
|
|
634
634
|
user: { id: userId },
|
|
635
635
|
token,
|
|
@@ -1146,7 +1146,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1146
1146
|
async createSession({ userId, ip = "unknown", userAgent = "unknown", token }) {
|
|
1147
1147
|
try {
|
|
1148
1148
|
const now = /* @__PURE__ */ new Date();
|
|
1149
|
-
const session2 = await strapi2.entityService.create("
|
|
1149
|
+
const session2 = await strapi2.entityService.create("plugin::magic-sessionmanager.session", {
|
|
1150
1150
|
data: {
|
|
1151
1151
|
user: userId,
|
|
1152
1152
|
ipAddress: ip.substring(0, 45),
|
|
@@ -1174,7 +1174,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1174
1174
|
try {
|
|
1175
1175
|
const now = /* @__PURE__ */ new Date();
|
|
1176
1176
|
if (sessionId) {
|
|
1177
|
-
await strapi2.entityService.update("
|
|
1177
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", sessionId, {
|
|
1178
1178
|
data: {
|
|
1179
1179
|
isActive: false,
|
|
1180
1180
|
logoutTime: now
|
|
@@ -1182,14 +1182,14 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1182
1182
|
});
|
|
1183
1183
|
strapi2.log.info(`[magic-sessionmanager] Session ${sessionId} terminated`);
|
|
1184
1184
|
} else if (userId) {
|
|
1185
|
-
const activeSessions = await strapi2.entityService.findMany("
|
|
1185
|
+
const activeSessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1186
1186
|
filters: {
|
|
1187
1187
|
user: { id: userId },
|
|
1188
1188
|
isActive: true
|
|
1189
1189
|
}
|
|
1190
1190
|
});
|
|
1191
1191
|
for (const session2 of activeSessions) {
|
|
1192
|
-
await strapi2.entityService.update("
|
|
1192
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", session2.id, {
|
|
1193
1193
|
data: {
|
|
1194
1194
|
isActive: false,
|
|
1195
1195
|
logoutTime: now
|
|
@@ -1209,7 +1209,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1209
1209
|
*/
|
|
1210
1210
|
async getAllSessions() {
|
|
1211
1211
|
try {
|
|
1212
|
-
const sessions = await strapi2.entityService.findMany("
|
|
1212
|
+
const sessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1213
1213
|
populate: { user: { fields: ["id", "email", "username"] } },
|
|
1214
1214
|
sort: { loginTime: "desc" },
|
|
1215
1215
|
limit: 1e3
|
|
@@ -1241,7 +1241,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1241
1241
|
*/
|
|
1242
1242
|
async getActiveSessions() {
|
|
1243
1243
|
try {
|
|
1244
|
-
const sessions = await strapi2.entityService.findMany("
|
|
1244
|
+
const sessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1245
1245
|
filters: { isActive: true },
|
|
1246
1246
|
populate: { user: { fields: ["id", "email", "username"] } },
|
|
1247
1247
|
sort: { loginTime: "desc" }
|
|
@@ -1273,7 +1273,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1273
1273
|
*/
|
|
1274
1274
|
async getUserSessions(userId) {
|
|
1275
1275
|
try {
|
|
1276
|
-
const sessions = await strapi2.entityService.findMany("
|
|
1276
|
+
const sessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1277
1277
|
filters: { user: { id: userId } },
|
|
1278
1278
|
sort: { loginTime: "desc" }
|
|
1279
1279
|
});
|
|
@@ -1308,17 +1308,17 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1308
1308
|
const config2 = strapi2.config.get("plugin::magic-sessionmanager") || {};
|
|
1309
1309
|
const rateLimit = config2.lastSeenRateLimit || 3e4;
|
|
1310
1310
|
if (sessionId) {
|
|
1311
|
-
const session2 = await strapi2.entityService.findOne("
|
|
1311
|
+
const session2 = await strapi2.entityService.findOne("plugin::magic-sessionmanager.session", sessionId);
|
|
1312
1312
|
if (session2 && session2.lastActive) {
|
|
1313
1313
|
const lastActiveTime = new Date(session2.lastActive).getTime();
|
|
1314
1314
|
const currentTime = now.getTime();
|
|
1315
1315
|
if (currentTime - lastActiveTime > rateLimit) {
|
|
1316
|
-
await strapi2.entityService.update("
|
|
1316
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", sessionId, {
|
|
1317
1317
|
data: { lastActive: now }
|
|
1318
1318
|
});
|
|
1319
1319
|
}
|
|
1320
1320
|
} else if (session2) {
|
|
1321
|
-
await strapi2.entityService.update("
|
|
1321
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", sessionId, {
|
|
1322
1322
|
data: { lastActive: now }
|
|
1323
1323
|
});
|
|
1324
1324
|
}
|
|
@@ -1338,7 +1338,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1338
1338
|
const now = /* @__PURE__ */ new Date();
|
|
1339
1339
|
const cutoffTime = new Date(now.getTime() - inactivityTimeout);
|
|
1340
1340
|
strapi2.log.info(`[magic-sessionmanager] 🧹 Cleaning up sessions inactive since before ${cutoffTime.toISOString()}`);
|
|
1341
|
-
const activeSessions = await strapi2.entityService.findMany("
|
|
1341
|
+
const activeSessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1342
1342
|
filters: { isActive: true },
|
|
1343
1343
|
fields: ["id", "lastActive", "loginTime"]
|
|
1344
1344
|
});
|
|
@@ -1346,7 +1346,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1346
1346
|
for (const session2 of activeSessions) {
|
|
1347
1347
|
const lastActiveTime = session2.lastActive ? new Date(session2.lastActive) : new Date(session2.loginTime);
|
|
1348
1348
|
if (lastActiveTime < cutoffTime) {
|
|
1349
|
-
await strapi2.entityService.update("
|
|
1349
|
+
await strapi2.entityService.update("plugin::magic-sessionmanager.session", session2.id, {
|
|
1350
1350
|
data: { isActive: false }
|
|
1351
1351
|
});
|
|
1352
1352
|
deactivatedCount++;
|
|
@@ -1367,7 +1367,7 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1367
1367
|
*/
|
|
1368
1368
|
async deleteSession(sessionId) {
|
|
1369
1369
|
try {
|
|
1370
|
-
await strapi2.entityService.delete("
|
|
1370
|
+
await strapi2.entityService.delete("plugin::magic-sessionmanager.session", sessionId);
|
|
1371
1371
|
strapi2.log.info(`[magic-sessionmanager] 🗑️ Session ${sessionId} permanently deleted`);
|
|
1372
1372
|
return true;
|
|
1373
1373
|
} catch (err) {
|
|
@@ -1383,13 +1383,13 @@ var session$1 = ({ strapi: strapi2 }) => ({
|
|
|
1383
1383
|
async deleteInactiveSessions() {
|
|
1384
1384
|
try {
|
|
1385
1385
|
strapi2.log.info("[magic-sessionmanager] 🗑️ Deleting all inactive sessions...");
|
|
1386
|
-
const inactiveSessions = await strapi2.entityService.findMany("
|
|
1386
|
+
const inactiveSessions = await strapi2.entityService.findMany("plugin::magic-sessionmanager.session", {
|
|
1387
1387
|
filters: { isActive: false },
|
|
1388
1388
|
fields: ["id"]
|
|
1389
1389
|
});
|
|
1390
1390
|
let deletedCount = 0;
|
|
1391
1391
|
for (const session2 of inactiveSessions) {
|
|
1392
|
-
await strapi2.entityService.delete("
|
|
1392
|
+
await strapi2.entityService.delete("plugin::magic-sessionmanager.session", session2.id);
|
|
1393
1393
|
deletedCount++;
|
|
1394
1394
|
}
|
|
1395
1395
|
strapi2.log.info(`[magic-sessionmanager] ✅ Deleted ${deletedCount} inactive sessions`);
|
package/package.json
CHANGED