strapi-plugin-magic-link-v5 4.0.17 → 4.2.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 (54) hide show
  1. package/COPYRIGHT_NOTICE.txt +20 -0
  2. package/LICENSE +48 -0
  3. package/LICENSE-DUAL.md +37 -0
  4. package/LICENSE_GUARD.md +323 -0
  5. package/README.md +42 -0
  6. package/SECURITY.md +79 -0
  7. package/admin/src/components/Initializer.jsx +3 -3
  8. package/admin/src/components/LanguageProvider.jsx +54 -0
  9. package/admin/src/components/LicenseGuard.jsx +531 -0
  10. package/admin/src/components/PluginIcon/index.jsx +4 -3
  11. package/admin/src/components/PluginIcon.jsx +2 -2
  12. package/admin/src/index.js +49 -26
  13. package/admin/src/pages/License/index.jsx +515 -0
  14. package/admin/src/pages/Settings/SettingsModern.jsx +1139 -0
  15. package/admin/src/pages/Settings/index.jsx +14 -1289
  16. package/admin/src/pages/Settings/index.jsx.old +1289 -0
  17. package/admin/src/pages/Tokens/CreateTokenModal.jsx +325 -0
  18. package/admin/src/pages/Tokens/ExtendTokenModal.jsx +288 -0
  19. package/admin/src/pages/Tokens/IPBans.jsx +758 -0
  20. package/admin/src/pages/Tokens/JWTSessions.jsx +849 -0
  21. package/admin/src/pages/Tokens/TokensProfessional.jsx +1779 -0
  22. package/admin/src/pages/Tokens/TokensRedesign.jsx +801 -0
  23. package/admin/src/pages/Tokens/components/index.js +5 -0
  24. package/admin/src/pages/Tokens/index.jsx +14 -2298
  25. package/admin/src/translations/de.json +293 -184
  26. package/admin/src/translations/en.json +295 -187
  27. package/package.json +23 -6
  28. package/server/bootstrap.js +16 -6
  29. package/server/services/store.js +0 -2
  30. package/server/src/bootstrap.js +60 -2
  31. package/server/src/controllers/auth.js +6 -4
  32. package/server/src/controllers/controller.js +0 -3
  33. package/server/src/controllers/index.js +2 -0
  34. package/server/src/controllers/jwt.js +3 -7
  35. package/server/src/controllers/license.js +289 -0
  36. package/server/src/controllers/tokens.js +8 -15
  37. package/server/src/destroy.js +10 -1
  38. package/server/src/policies/index.js +5 -1
  39. package/server/src/policies/license-check.js +57 -0
  40. package/server/src/routes/admin.js +50 -0
  41. package/server/src/routes/content-api.js +4 -2
  42. package/server/src/services/index.js +6 -2
  43. package/server/src/services/license-guard.js +450 -0
  44. package/server/src/services/magic-link.js +23 -29
  45. package/server/utils/index.js +2 -2
  46. package/admin/src/components/Initializer/index.jsx +0 -20
  47. package/admin/src/components/LazyComponentLoader.jsx +0 -27
  48. package/admin/src/pages/App/index.jsx +0 -50
  49. package/admin/src/pages/App.jsx +0 -15
  50. package/admin/src/pages/HomePage/index.js +0 -2
  51. package/admin/src/pages/HomePage/index.jsx +0 -228
  52. package/admin/src/pages/HomePage.jsx +0 -655
  53. package/admin/src/routes.js +0 -40
  54. package/strapi-admin.js +0 -82
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Magic Link - Passwordless Authentication for Strapi
3
+ *
4
+ * Copyright (c) 2025 [Dein Name/Firma]
5
+ * All Rights Reserved.
6
+ *
7
+ * PROPRIETARY AND CONFIDENTIAL
8
+ *
9
+ * This file is part of Magic Link plugin for Strapi.
10
+ *
11
+ * Unauthorized copying, modification, distribution, or use of this software
12
+ * via any medium is strictly prohibited without prior written permission.
13
+ *
14
+ * This software is licensed under a proprietary commercial license.
15
+ * See LICENSE file for full terms.
16
+ *
17
+ * For licensing inquiries: [Deine Email]
18
+ * Website: [Deine Website]
19
+ */
20
+
package/LICENSE ADDED
@@ -0,0 +1,48 @@
1
+ PROPRIETARY LICENSE AGREEMENT
2
+
3
+ Copyright (c) 2025 [Dein Name/Firma]
4
+
5
+ This software and associated documentation files (the "Software") are proprietary
6
+ and confidential. All rights reserved.
7
+
8
+ TERMS AND CONDITIONS:
9
+
10
+ 1. LICENSE GRANT
11
+ This Software is licensed, not sold. Subject to payment of applicable license
12
+ fees and compliance with these terms, you are granted a limited, non-exclusive,
13
+ non-transferable license to use the Software.
14
+
15
+ 2. RESTRICTIONS
16
+ You may NOT:
17
+ - Copy, modify, or distribute the Software
18
+ - Reverse engineer, decompile, or disassemble the Software
19
+ - Remove or modify any proprietary notices or labels
20
+ - Use the Software for any unlicensed purpose
21
+ - Share your license key with unauthorized parties
22
+ - Host the Software on multiple servers without appropriate licensing
23
+
24
+ 3. INTELLECTUAL PROPERTY
25
+ All title, ownership rights, and intellectual property rights in and to the
26
+ Software remain with the copyright holder. The Software is protected by
27
+ copyright laws and international treaty provisions.
28
+
29
+ 4. TERMINATION
30
+ This license is effective until terminated. Your rights under this license
31
+ will terminate automatically without notice if you fail to comply with any
32
+ term of this license.
33
+
34
+ 5. WARRANTY DISCLAIMER
35
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS
37
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
38
+
39
+ 6. LIMITATION OF LIABILITY
40
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR
41
+ OTHER LIABILITY ARISING FROM THE USE OF THE SOFTWARE.
42
+
43
+ 7. LICENSE PURCHASE
44
+ To obtain a valid license, visit: [Deine Website]
45
+ Each license is subject to separate terms and pricing.
46
+
47
+ For licensing inquiries, contact: [Deine Email]
48
+
@@ -0,0 +1,37 @@
1
+ # DUAL LICENSE
2
+
3
+ This software is available under a dual licensing model.
4
+
5
+ ## 1. GNU AFFERO GENERAL PUBLIC LICENSE (AGPL-3.0)
6
+
7
+ If you are creating an open-source application under a license compatible with
8
+ the GNU AGPL-3.0, you may use this software under those terms.
9
+
10
+ **Key Requirements:**
11
+ - You MUST make your complete source code available
12
+ - You MUST license your application under AGPL-3.0
13
+ - Network use counts as distribution (you must share code even for SaaS)
14
+ - You MUST provide prominent notice and attribution
15
+
16
+ See: https://www.gnu.org/licenses/agpl-3.0.html
17
+
18
+ ## 2. COMMERCIAL LICENSE
19
+
20
+ If you want to use this software in a proprietary/commercial application
21
+ WITHOUT the obligations of AGPL-3.0, you must purchase a commercial license.
22
+
23
+ **Commercial License Benefits:**
24
+ - No obligation to open-source your code
25
+ - Can be used in proprietary/closed-source applications
26
+ - Can be used in SaaS without sharing code
27
+ - Priority support and updates
28
+ - No copyleft requirements
29
+
30
+ **Purchase:** [Deine Website]
31
+ **Contact:** [Deine Email]
32
+
33
+ ---
34
+
35
+ **Note:** Using this software without a valid license (either AGPL-3.0 compliance
36
+ or commercial license) is copyright infringement and will be prosecuted.
37
+
@@ -0,0 +1,323 @@
1
+ # Magic Link License Guard
2
+
3
+ Der License Guard schützt und verwaltet das Magic Link Plugin über das bestehende License API System.
4
+
5
+ ## 🚀 Features
6
+
7
+ - ✅ **Automatische Lizenz-Initialisierung** beim Plugin-Start
8
+ - ✅ **Auto-Ping alle 15 Minuten** für Online-Tracking
9
+ - ✅ **Geräteerkennung** (DeviceID, DeviceName, IP, UserAgent)
10
+ - ✅ **Grace Period Support** (24h Offline-Nutzung)
11
+ - ✅ **Admin-Endpoints** für Lizenzverwaltung
12
+ - ✅ **Automatisches Cleanup** beim Plugin-Stop
13
+
14
+ ## 📋 Wie es funktioniert
15
+
16
+ ### 1. Beim Plugin-Start
17
+
18
+ ```
19
+ Plugin startet → License Guard initialisiert
20
+
21
+ Lizenzschlüssel im Store?
22
+ ↓ JA ↓ NEIN
23
+ Verifizieren Demo-Mode
24
+ ↓ ↓
25
+ Gültig? Warnung anzeigen
26
+ ↓ JA ↓ NEIN
27
+ Ping starten Demo-Mode
28
+ ```
29
+
30
+ ### 2. Automatisches Pinging
31
+
32
+ Alle 15 Minuten sendet der Guard automatisch:
33
+ ```json
34
+ POST /api/licenses/ping
35
+ {
36
+ "licenseKey": "A1B2-C3D4-E5F6-G7H8"
37
+ }
38
+ ```
39
+
40
+ Dies aktualisiert:
41
+ - `lastPingAt` - Aktueller Zeitstempel
42
+ - `lastActiveAt` - Aktivitäts-Tracker
43
+ - `isOnline` - Online-Status basierend auf Grace Period
44
+
45
+ ## 🎯 Verwendung
46
+
47
+ ### Option 1: Lizenz über API erstellen
48
+
49
+ ```bash
50
+ curl -X POST http://localhost:1337/api/licenses/create \
51
+ -H "Content-Type: application/json" \
52
+ -d '{
53
+ "email": "admin@example.com",
54
+ "firstName": "Admin",
55
+ "lastName": "User",
56
+ "deviceName": "Server-01",
57
+ "deviceId": "device-abc-123",
58
+ "ipAddress": "192.168.1.100",
59
+ "userAgent": "Strapi/5.11.2"
60
+ }'
61
+ ```
62
+
63
+ **Response:**
64
+ ```json
65
+ {
66
+ "success": true,
67
+ "message": "License created successfully",
68
+ "data": {
69
+ "id": 1,
70
+ "licenseKey": "A1B2-C3D4-E5F6-G7H8",
71
+ "email": "admin@example.com",
72
+ "isActive": true,
73
+ ...
74
+ }
75
+ }
76
+ ```
77
+
78
+ Der License Guard erkennt automatisch die neue Lizenz beim nächsten Start!
79
+
80
+ ### Option 2: Auto-Create über Admin-Endpoint
81
+
82
+ ```bash
83
+ curl -X POST http://localhost:1337/magic-link/license/auto-create
84
+ ```
85
+
86
+ Erstellt automatisch eine Lizenz mit Standard-Daten und aktiviert sie sofort.
87
+
88
+ ### Option 3: Programmatisch erstellen
89
+
90
+ ```javascript
91
+ // Im Strapi-Code oder Terminal
92
+ await strapi
93
+ .plugin('magic-link')
94
+ .service('license-guard')
95
+ .autoCreateLicense('your@email.com', 'First', 'Last');
96
+ ```
97
+
98
+ ## 📡 Admin-Endpoints
99
+
100
+ Alle Endpoints sind unter `/magic-link/...` verfügbar:
101
+
102
+ | Endpoint | Methode | Beschreibung |
103
+ |----------|---------|--------------|
104
+ | `/license/status` | GET | Aktueller Lizenz-Status |
105
+ | `/license/create` | POST | Lizenz erstellen & aktivieren |
106
+ | `/license/auto-create` | POST | Auto-Lizenz mit Defaults |
107
+ | `/license/ping` | POST | Manueller Ping |
108
+ | `/license/stats` | GET | Online-Statistiken |
109
+ | `/license/deactivate` | POST | Lizenz deaktivieren |
110
+
111
+ ### Beispiele
112
+
113
+ **Status abfragen:**
114
+ ```bash
115
+ curl http://localhost:1337/magic-link/license/status
116
+ ```
117
+
118
+ **Response:**
119
+ ```json
120
+ {
121
+ "success": true,
122
+ "valid": true,
123
+ "data": {
124
+ "licenseKey": "A1B2-C3D4-E5F6-G7H8",
125
+ "isActive": true,
126
+ "isExpired": false,
127
+ "isOnline": true,
128
+ "expiresAt": "2026-10-13T10:00:00.000Z",
129
+ "lastPingAt": "2025-10-13T21:00:00.000Z",
130
+ "deviceName": "MacBook-Pro.local",
131
+ "features": {
132
+ "premium": true,
133
+ "advanced": false,
134
+ "enterprise": false,
135
+ "custom": false
136
+ },
137
+ "maxDevices": 1,
138
+ "currentDevices": 1
139
+ }
140
+ }
141
+ ```
142
+
143
+ **Manuelle Ping:**
144
+ ```bash
145
+ curl -X POST http://localhost:1337/magic-link/license/ping
146
+ ```
147
+
148
+ **Online-Statistiken:**
149
+ ```bash
150
+ curl http://localhost:1337/magic-link/license/stats
151
+ ```
152
+
153
+ ## 🔧 Gesammelte Daten
154
+
155
+ Der License Guard sammelt automatisch:
156
+
157
+ ### Device Information
158
+ - **DeviceID**: SHA256-Hash von MAC-Adressen + Hostname
159
+ - **DeviceName**: System-Hostname (z.B. "MacBook-Pro.local")
160
+ - **IP Address**: Server-IP (erste nicht-interne IPv4)
161
+ - **User Agent**: "Strapi/{version} Node/{version} {platform}/{release}"
162
+
163
+ ### Beispiel gesammelte Daten:
164
+ ```javascript
165
+ {
166
+ deviceId: "a3f8e92c1d4b5e6f7a8b9c0d1e2f3a4b",
167
+ deviceName: "MacBook-Pro.local",
168
+ ipAddress: "192.168.1.100",
169
+ userAgent: "Strapi/5.11.2 Node/v20.11.0 darwin/23.0.0"
170
+ }
171
+ ```
172
+
173
+ ## 📊 Console Output
174
+
175
+ Beim Plugin-Start siehst du eine dieser Meldungen:
176
+
177
+ ### ✅ Lizenz aktiv:
178
+ ```
179
+ ╔════════════════════════════════════════════════════════════════╗
180
+ ║ ✅ MAGIC LINK PLUGIN LICENSE ACTIVE ║
181
+ ║ ║
182
+ ║ License: A1B2-C3D4-E5F6-G7H8 ║
183
+ ║ User: Max Mustermann ║
184
+ ║ Email: max@example.com ║
185
+ ║ ║
186
+ ║ 🔄 Auto-pinging every 15 minutes ║
187
+ ╚════════════════════════════════════════════════════════════════╝
188
+ ```
189
+
190
+ ### ⚠️ Demo-Mode:
191
+ ```
192
+ ╔════════════════════════════════════════════════════════════════╗
193
+ ║ ⚠️ MAGIC LINK PLUGIN RUNNING IN DEMO MODE ║
194
+ ║ ║
195
+ ║ To activate, create a license: ║
196
+ ║ POST http://localhost:1337/api/licenses/create ║
197
+ ║ ║
198
+ ║ Or auto-create with: ║
199
+ ║ strapi.plugin("magic-link").service("license-guard") ║
200
+ ║ .autoCreateLicense("your@email.com", "First", "Last") ║
201
+ ╚════════════════════════════════════════════════════════════════╝
202
+ ```
203
+
204
+ ## 🔄 Lifecycle
205
+
206
+ ### Bootstrap (Plugin Start)
207
+ 1. License Guard Service wird geladen
208
+ 2. Nach 3 Sekunden: Initialize()
209
+ 3. Prüfe auf gespeicherten Lizenzschlüssel
210
+ 4. Verifiziere Lizenz
211
+ 5. Starte Auto-Ping (alle 15 Min)
212
+
213
+ ### Destroy (Plugin Stop)
214
+ 1. Stoppe Ping-Interval
215
+ 2. Cleanup-Log
216
+
217
+ ## 💻 Integration in dein Plugin
218
+
219
+ ### Lizenz-Status im Admin-Panel anzeigen
220
+
221
+ Erstelle eine Settings-Seite mit Lizenz-Info:
222
+
223
+ ```javascript
224
+ // In deiner Settings-Component
225
+ const { data: licenseStatus } = await get('/magic-link/license/status');
226
+
227
+ if (licenseStatus.valid) {
228
+ console.log('✅ License active:', licenseStatus.data.licenseKey);
229
+ console.log('Features:', licenseStatus.data.features);
230
+ } else {
231
+ console.log('⚠️ Demo mode or invalid license');
232
+ }
233
+ ```
234
+
235
+ ### Lizenz erstellen aus dem Admin-Panel
236
+
237
+ ```javascript
238
+ const createLicense = async () => {
239
+ const response = await post('/magic-link/license/create', {
240
+ email: 'user@example.com',
241
+ firstName: 'John',
242
+ lastName: 'Doe',
243
+ });
244
+
245
+ if (response.data.success) {
246
+ console.log('License created:', response.data.data.licenseKey);
247
+ }
248
+ };
249
+ ```
250
+
251
+ ## 🔐 Sicherheit
252
+
253
+ - ✅ **DeviceID ist persistent** - Basiert auf Hardware
254
+ - ✅ **Eindeutige Identifikation** - SHA256-Hash
255
+ - ✅ **Keine Speicherung sensibler Daten** - Nur Hashes
256
+ - ✅ **GDPR-konform** - User-Daten anonymisiert
257
+
258
+ ## 🛠 Troubleshooting
259
+
260
+ ### Plugin startet im Demo-Mode
261
+
262
+ **Ursache:** Keine Lizenz gefunden oder Lizenz ungültig
263
+
264
+ **Lösung:**
265
+ ```bash
266
+ # Option 1: Auto-Create
267
+ curl -X POST http://localhost:1337/magic-link/license/auto-create
268
+
269
+ # Option 2: Manuell über License API
270
+ curl -X POST http://localhost:1337/api/licenses/create \
271
+ -H "Content-Type: application/json" \
272
+ -d '{"email":"admin@localhost","firstName":"Admin","lastName":"User"}'
273
+
274
+ # Option 3: Im Strapi Terminal
275
+ await strapi.plugin('magic-link').service('license-guard')
276
+ .autoCreateLicense('admin@example.com', 'Admin', 'User');
277
+ ```
278
+
279
+ ### Pinging funktioniert nicht
280
+
281
+ **Prüfen:**
282
+ ```bash
283
+ # Manueller Ping
284
+ curl -X POST http://localhost:1337/magic-link/license/ping
285
+
286
+ # Status prüfen
287
+ curl http://localhost:1337/magic-link/license/status
288
+ ```
289
+
290
+ ### Lizenz als "offline" markiert
291
+
292
+ - Grace Period ist abgelaufen (>24h kein Ping)
293
+ - Pinging wurde gestoppt
294
+ - Netzwerk-Probleme
295
+
296
+ **Lösung:** Einmal pingen → `isOnline` wird wieder auf `true` gesetzt
297
+
298
+ ## 📚 Logs
299
+
300
+ Der License Guard loggt:
301
+
302
+ ```
303
+ [INFO] 🔐 Initializing License Guard...
304
+ [INFO] 📄 Found existing license key: A1B2-C3D4-E5F6-G7H8
305
+ [INFO] ✅ License is valid and active
306
+ [INFO] 📡 Started pinging license every 15 minutes
307
+ [DEBUG] 📡 License ping successful: A1B2-C3D4-E5F6-G7H8
308
+ [INFO] 🛑 License pinging stopped
309
+ ```
310
+
311
+ ## 🎉 Fertig!
312
+
313
+ Der License Guard läuft nun automatisch im Hintergrund:
314
+ - ✅ Verifiziert beim Start
315
+ - ✅ Pingt alle 15 Minuten
316
+ - ✅ Tracked Online-Status
317
+ - ✅ Bereit für Production
318
+
319
+ Für weitere Informationen siehe:
320
+ - `/src/api/license/README.md` - License API Dokumentation
321
+ - `/src/api/license/TRACKING.md` - Tracking-Details
322
+ - `/src/api/license/SUMMARY.md` - Zusammenfassung
323
+
package/README.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  A secure passwordless authentication solution for Strapi, allowing users to log in via email links without requiring passwords.
4
4
 
5
+ ---
6
+
7
+ ## ⚠️ LICENSE & USAGE NOTICE
8
+
9
+ **This is proprietary commercial software.**
10
+
11
+ - ❌ **NOT** open source or free to use
12
+ - ❌ **NOT** licensed under MIT, Apache, or similar permissive licenses
13
+ - ✅ Requires a **valid commercial license** for production use
14
+ - ✅ Source code is visible for transparency and evaluation only
15
+
16
+ **Using this software without a valid license is copyright infringement.**
17
+
18
+ 📄 See [LICENSE](./LICENSE) for full terms
19
+ 💼 Purchase a license: [Your Website]
20
+ 📧 Questions? Contact: [Your Email]
21
+
22
+ ---
23
+
5
24
  ![Magic Link Overview](pics/pic6.png)
6
25
 
7
26
  ## Core Features!
@@ -31,6 +50,29 @@ yarn add begservice/strapi-magic-link
31
50
 
32
51
  After installation, restart your Strapi server and the plugin will be available in the admin panel.
33
52
 
53
+ ## License Server
54
+
55
+ This plugin uses a **centralized license server** for validation and activation.
56
+
57
+ ### How It Works
58
+
59
+ - The plugin connects to a fixed license server URL for all license operations
60
+ - License keys are validated against this server
61
+ - The server URL is hardcoded for security (cannot be changed by end users)
62
+ - Supports **24-hour grace period** for offline operation
63
+
64
+ ### For Developers (Development Mode)
65
+
66
+ During development, you can override the license server URL:
67
+
68
+ ```bash
69
+ # .env file
70
+ LICENSE_SERVER_URL=http://localhost:1337
71
+ NODE_ENV=development
72
+ ```
73
+
74
+ **Note**: This override only works in development mode for testing purposes.
75
+
34
76
  ## How It Works
35
77
 
36
78
  ### Email User with Login Link
package/SECURITY.md ADDED
@@ -0,0 +1,79 @@
1
+ # Security & License Protection
2
+
3
+ ## License Enforcement
4
+
5
+ This software includes multiple layers of license protection:
6
+
7
+ ### 1. Backend License Check
8
+ - API endpoints are protected by `license-check` policy
9
+ - All requests are validated against active license
10
+ - Invalid/expired licenses are rejected with 401 status
11
+
12
+ ### 2. Frontend License Guard
13
+ - Admin UI displays activation modal without valid license
14
+ - Prevents unauthorized UI access
15
+ - Requires license activation before use
16
+
17
+ ### 3. License Verification
18
+ - License keys are validated against central license database
19
+ - Regular "ping" mechanism ensures license is active
20
+ - Offline grace period for temporary network issues
21
+
22
+ ## Anti-Piracy Measures
23
+
24
+ ### Current Protection:
25
+ 1. **License Key Validation**: Server-side verification
26
+ 2. **Device Binding**: License tied to specific server instances
27
+ 3. **Online Checks**: Regular validation against license server
28
+ 4. **IP Tracking**: Monitor and limit license usage by IP
29
+ 5. **Audit Logging**: All license operations are logged
30
+
31
+ ### Additional Recommendations:
32
+
33
+ #### Code Obfuscation (Optional)
34
+ Consider obfuscating critical parts of the code:
35
+ ```bash
36
+ npm install javascript-obfuscator --save-dev
37
+ ```
38
+
39
+ #### API Key Protection
40
+ Never commit license server API credentials to git:
41
+ ```bash
42
+ # Add to .env
43
+ LICENSE_SERVER_URL=https://your-license-server.com
44
+ LICENSE_API_KEY=your-secret-key
45
+ ```
46
+
47
+ #### Monitoring
48
+ Set up monitoring for:
49
+ - Unusual license activation patterns
50
+ - Multiple IPs using same license
51
+ - Attempts to bypass license checks
52
+
53
+ ## Reporting License Violations
54
+
55
+ If you discover unauthorized use of this software:
56
+
57
+ **Email:** [Your Email]
58
+ **Subject:** License Violation Report
59
+
60
+ Include:
61
+ - URL or location where unauthorized use was found
62
+ - Screenshots/evidence
63
+ - Any relevant information
64
+
65
+ We take license violations seriously and will pursue legal action when necessary.
66
+
67
+ ## Legal Notice
68
+
69
+ Unauthorized use, copying, or distribution of this software constitutes:
70
+ - Copyright infringement
71
+ - Breach of software license agreement
72
+ - Potential criminal violation under applicable laws
73
+
74
+ Violators will be prosecuted to the fullest extent of the law.
75
+
76
+ ---
77
+
78
+ **Last Updated:** 2025-01-13
79
+
@@ -1,6 +1,5 @@
1
1
  import { useEffect, useRef } from 'react';
2
-
3
- import { PLUGIN_ID } from '../pluginId';
2
+ import pluginId from '../pluginId';
4
3
 
5
4
  /**
6
5
  * @type {import('react').FC<{ setPlugin: (id: string) => void }>}
@@ -9,10 +8,11 @@ const Initializer = ({ setPlugin }) => {
9
8
  const ref = useRef(setPlugin);
10
9
 
11
10
  useEffect(() => {
12
- ref.current(PLUGIN_ID);
11
+ ref.current(pluginId);
13
12
  }, []);
14
13
 
15
14
  return null;
16
15
  };
17
16
 
18
17
  export { Initializer };
18
+ export default Initializer;
@@ -0,0 +1,54 @@
1
+ import React, { createContext, useContext, useState, useEffect } from 'react';
2
+ import { IntlProvider } from 'react-intl';
3
+ import enTranslations from '../translations/en.json';
4
+ import deTranslations from '../translations/de.json';
5
+
6
+ const LanguageContext = createContext();
7
+
8
+ export const usePluginLanguage = () => {
9
+ const context = useContext(LanguageContext);
10
+ if (!context) {
11
+ throw new Error('usePluginLanguage must be used within LanguageProvider');
12
+ }
13
+ return context;
14
+ };
15
+
16
+ const translations = {
17
+ en: enTranslations,
18
+ de: deTranslations,
19
+ };
20
+
21
+ export const LanguageProvider = ({ children }) => {
22
+ const [currentLanguage, setCurrentLanguage] = useState(() => {
23
+ return localStorage.getItem('magic-link-language') || 'en';
24
+ });
25
+
26
+ const changeLanguage = (newLang) => {
27
+ setCurrentLanguage(newLang);
28
+ localStorage.setItem('magic-link-language', newLang);
29
+ };
30
+
31
+ const value = {
32
+ language: currentLanguage,
33
+ changeLanguage,
34
+ t: (key) => {
35
+ const messages = translations[currentLanguage] || translations.en;
36
+ return messages[key] || key;
37
+ },
38
+ };
39
+
40
+ return (
41
+ <LanguageContext.Provider value={value}>
42
+ <IntlProvider
43
+ locale={currentLanguage}
44
+ messages={translations[currentLanguage]}
45
+ defaultLocale="en"
46
+ >
47
+ {children}
48
+ </IntlProvider>
49
+ </LanguageContext.Provider>
50
+ );
51
+ };
52
+
53
+ export default LanguageProvider;
54
+