strapi-plugin-magic-link-v5 5.5.5 → 5.5.7
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 +14 -0
- package/dist/_chunks/{index-C6WRQuex.mjs → index-34ICAF9_.mjs} +3 -3
- package/dist/_chunks/{index-DoSROJog.js → index-BFzW7Xex.js} +3 -3
- package/dist/_chunks/{index-Ki-zhMlp.mjs → index-BZFGxKmY.mjs} +1 -1
- package/dist/_chunks/{index-DJyAppvB.js → index-CddEy_As.js} +1 -1
- package/dist/_chunks/{index-CQ3Kd12m.js → index-CuXnqVl4.js} +12 -10
- package/dist/_chunks/{index-B9M8wkAj.mjs → index-CxCULraY.mjs} +1 -1
- package/dist/_chunks/{index-DC00x-wm.js → index-M5s7QN5m.js} +1 -1
- package/dist/_chunks/{index-CoZjdlQd.mjs → index-ivgYEX37.mjs} +12 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +309 -276
- package/dist/server/index.mjs +309 -276
- package/package.json +8 -2
package/dist/server/index.mjs
CHANGED
|
@@ -4628,6 +4628,50 @@ var magicLink$1 = ({ strapi: strapi2 }) => ({
|
|
|
4628
4628
|
strapi2.log.error("MagicMail send failed, falling back to default provider:", error);
|
|
4629
4629
|
}
|
|
4630
4630
|
}
|
|
4631
|
+
const wantsEmailDesigner = settings?.use_email_designer && settings?.email_designer_template_id;
|
|
4632
|
+
const hasEmailDesignerPlugin = Boolean(strapi2.plugin("email-designer-5"));
|
|
4633
|
+
if (wantsEmailDesigner && hasEmailDesignerPlugin) {
|
|
4634
|
+
const templateId = parseInt(settings.email_designer_template_id, 10);
|
|
4635
|
+
if (!Number.isNaN(templateId) && templateId > 0) {
|
|
4636
|
+
try {
|
|
4637
|
+
await strapi2.plugin("email-designer-5").service("email").sendTemplatedEmail(
|
|
4638
|
+
{
|
|
4639
|
+
to: token2.email,
|
|
4640
|
+
from: settings.from_email ? `${settings.from_name || "Magic Link"} <${settings.from_email}>` : void 0,
|
|
4641
|
+
replyTo: settings.response_email || void 0
|
|
4642
|
+
},
|
|
4643
|
+
{
|
|
4644
|
+
templateReferenceId: templateId,
|
|
4645
|
+
subject: settings.object || emailConfig.object
|
|
4646
|
+
},
|
|
4647
|
+
{
|
|
4648
|
+
...templatePayload,
|
|
4649
|
+
user: { email: token2.email },
|
|
4650
|
+
magicLink: loginUrl,
|
|
4651
|
+
expiresAt: token2.expires_at ? new Date(token2.expires_at).toISOString() : void 0,
|
|
4652
|
+
expiryText: expiryTextForTemplate
|
|
4653
|
+
}
|
|
4654
|
+
);
|
|
4655
|
+
strapi2.log.info(
|
|
4656
|
+
`Magic Link email sent via Email Designer 5 (template ${templateId}) to ${token2.email}`
|
|
4657
|
+
);
|
|
4658
|
+
return token2;
|
|
4659
|
+
} catch (emailDesignerError) {
|
|
4660
|
+
strapi2.log.error(
|
|
4661
|
+
"Email Designer 5 send failed, falling back to default provider:",
|
|
4662
|
+
emailDesignerError
|
|
4663
|
+
);
|
|
4664
|
+
}
|
|
4665
|
+
} else {
|
|
4666
|
+
strapi2.log.warn(
|
|
4667
|
+
`Invalid Email Designer template ID: '${settings.email_designer_template_id}', falling back to default email`
|
|
4668
|
+
);
|
|
4669
|
+
}
|
|
4670
|
+
} else if (wantsEmailDesigner && !hasEmailDesignerPlugin) {
|
|
4671
|
+
strapi2.log.debug(
|
|
4672
|
+
"Email Designer enabled but plugin not installed — falling back to default email"
|
|
4673
|
+
);
|
|
4674
|
+
}
|
|
4631
4675
|
await strapi2.plugin("email").service("email").send({
|
|
4632
4676
|
to: token2.email,
|
|
4633
4677
|
from: emailConfig.from,
|
|
@@ -4810,271 +4854,265 @@ var store$1 = ({ strapi: strapi2 }) => ({
|
|
|
4810
4854
|
return pluginStore.set({ key: "settings", value: settings });
|
|
4811
4855
|
}
|
|
4812
4856
|
});
|
|
4813
|
-
var features$1
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
//
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
//
|
|
4825
|
-
|
|
4826
|
-
//
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
//
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
//
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
/**
|
|
4994
|
-
* Check if a feature is available for given license tier
|
|
4995
|
-
*/
|
|
4996
|
-
hasFeature(licenseData, featureName) {
|
|
4997
|
-
if (!licenseData) {
|
|
4998
|
-
return this.free.features.includes(featureName);
|
|
4999
|
-
}
|
|
5000
|
-
let isEnterprise = false;
|
|
5001
|
-
let isAdvanced = false;
|
|
5002
|
-
let isPremium = false;
|
|
5003
|
-
if (licenseData.tier) {
|
|
5004
|
-
isEnterprise = licenseData.tier === "enterprise";
|
|
5005
|
-
isAdvanced = licenseData.tier === "advanced";
|
|
5006
|
-
isPremium = licenseData.tier === "premium";
|
|
5007
|
-
}
|
|
5008
|
-
if (licenseData.features) {
|
|
5009
|
-
isEnterprise = isEnterprise || licenseData.features.enterprise === true;
|
|
5010
|
-
isAdvanced = isAdvanced || licenseData.features.advanced === true;
|
|
5011
|
-
isPremium = isPremium || licenseData.features.premium === true;
|
|
5012
|
-
}
|
|
5013
|
-
if (licenseData.featureEnterprise === true) {
|
|
5014
|
-
isEnterprise = true;
|
|
5015
|
-
}
|
|
5016
|
-
if (licenseData.featureAdvanced === true) {
|
|
5017
|
-
isAdvanced = true;
|
|
5018
|
-
}
|
|
5019
|
-
if (licenseData.featurePremium === true) {
|
|
5020
|
-
isPremium = true;
|
|
5021
|
-
}
|
|
5022
|
-
if (isEnterprise && this.enterprise.features.includes(featureName)) {
|
|
5023
|
-
return true;
|
|
5024
|
-
}
|
|
5025
|
-
if (isAdvanced && this.advanced.features.includes(featureName)) {
|
|
5026
|
-
return true;
|
|
5027
|
-
}
|
|
5028
|
-
if (isPremium && this.premium.features.includes(featureName)) {
|
|
5029
|
-
return true;
|
|
5030
|
-
}
|
|
4857
|
+
var features$1 = {
|
|
4858
|
+
// FREE/DEMO Features
|
|
4859
|
+
free: {
|
|
4860
|
+
maxTokens: 100,
|
|
4861
|
+
// 100 aktive Tokens gleichzeitig
|
|
4862
|
+
maxSessions: 50,
|
|
4863
|
+
// 50 aktive JWT Sessions
|
|
4864
|
+
maxIPBans: 10,
|
|
4865
|
+
// 10 gebannte IPs
|
|
4866
|
+
features: [
|
|
4867
|
+
"basic-magic-link",
|
|
4868
|
+
// Basis Magic Link Auth
|
|
4869
|
+
"email-templates",
|
|
4870
|
+
// Basis Email Templates
|
|
4871
|
+
"jwt-sessions",
|
|
4872
|
+
// JWT Session Management
|
|
4873
|
+
"ip-tracking",
|
|
4874
|
+
// IP Tracking für Security
|
|
4875
|
+
"rate-limiting",
|
|
4876
|
+
// Basis Rate Limiting
|
|
4877
|
+
"auto-user-creation",
|
|
4878
|
+
// Auto User Creation
|
|
4879
|
+
"token-management",
|
|
4880
|
+
// Token Dashboard
|
|
4881
|
+
"ip-bans"
|
|
4882
|
+
// IP Ban Management
|
|
4883
|
+
]
|
|
4884
|
+
},
|
|
4885
|
+
// PREMIUM Features
|
|
4886
|
+
premium: {
|
|
4887
|
+
maxTokens: 1e3,
|
|
4888
|
+
// 1000 aktive Tokens
|
|
4889
|
+
maxSessions: 500,
|
|
4890
|
+
// 500 aktive Sessions
|
|
4891
|
+
maxIPBans: 100,
|
|
4892
|
+
// 100 gebannte IPs
|
|
4893
|
+
features: [
|
|
4894
|
+
"basic-magic-link",
|
|
4895
|
+
"email-templates",
|
|
4896
|
+
"jwt-sessions",
|
|
4897
|
+
"ip-tracking",
|
|
4898
|
+
"rate-limiting",
|
|
4899
|
+
"auto-user-creation",
|
|
4900
|
+
"token-management",
|
|
4901
|
+
"ip-bans",
|
|
4902
|
+
"otp-email",
|
|
4903
|
+
// Email OTP (6-digit code)
|
|
4904
|
+
"mfa-totp",
|
|
4905
|
+
// MFA: Magic Link + TOTP (Szenario 1)
|
|
4906
|
+
"custom-email-templates",
|
|
4907
|
+
// Custom HTML/Text Templates
|
|
4908
|
+
"email-designer-integration",
|
|
4909
|
+
// Email Designer 5 Support
|
|
4910
|
+
"magic-mail-integration",
|
|
4911
|
+
// MagicMail Integration
|
|
4912
|
+
"advanced-rate-limiting",
|
|
4913
|
+
// Custom Rate Limits
|
|
4914
|
+
"session-management",
|
|
4915
|
+
// Erweiterte Session Verwaltung
|
|
4916
|
+
"bulk-operations",
|
|
4917
|
+
// Bulk Token/Session Operations
|
|
4918
|
+
"extended-logging",
|
|
4919
|
+
// Erweiterte Login-Info Logs
|
|
4920
|
+
"custom-redirect-urls"
|
|
4921
|
+
// Custom Redirect URLs per Token
|
|
4922
|
+
]
|
|
4923
|
+
},
|
|
4924
|
+
// ADVANCED Features
|
|
4925
|
+
advanced: {
|
|
4926
|
+
maxTokens: -1,
|
|
4927
|
+
// Unlimited
|
|
4928
|
+
maxSessions: -1,
|
|
4929
|
+
// Unlimited
|
|
4930
|
+
maxIPBans: -1,
|
|
4931
|
+
// Unlimited
|
|
4932
|
+
features: [
|
|
4933
|
+
"basic-magic-link",
|
|
4934
|
+
"email-templates",
|
|
4935
|
+
"jwt-sessions",
|
|
4936
|
+
"ip-tracking",
|
|
4937
|
+
"rate-limiting",
|
|
4938
|
+
"auto-user-creation",
|
|
4939
|
+
"token-management",
|
|
4940
|
+
"ip-bans",
|
|
4941
|
+
"otp-email",
|
|
4942
|
+
"mfa-totp",
|
|
4943
|
+
// MFA: Magic Link + TOTP (Szenario 1)
|
|
4944
|
+
"otp-sms",
|
|
4945
|
+
// SMS OTP via Twilio/Vonage
|
|
4946
|
+
"otp-totp",
|
|
4947
|
+
// TOTP (Authenticator Apps)
|
|
4948
|
+
"totp-primary-login",
|
|
4949
|
+
// Login with Email + TOTP only (Szenario 2)
|
|
4950
|
+
"custom-email-templates",
|
|
4951
|
+
"email-designer-integration",
|
|
4952
|
+
"magic-mail-integration",
|
|
4953
|
+
"advanced-rate-limiting",
|
|
4954
|
+
"session-management",
|
|
4955
|
+
"bulk-operations",
|
|
4956
|
+
"extended-logging",
|
|
4957
|
+
"custom-redirect-urls",
|
|
4958
|
+
"webhook-notifications",
|
|
4959
|
+
// Webhooks für Events
|
|
4960
|
+
"api-access-tokens",
|
|
4961
|
+
// API Tokens für Programmatic Access
|
|
4962
|
+
"advanced-analytics",
|
|
4963
|
+
// Analytics Dashboard
|
|
4964
|
+
"custom-token-context",
|
|
4965
|
+
// Custom Context Data in Tokens
|
|
4966
|
+
"geolocation-tracking",
|
|
4967
|
+
// GeoIP Tracking
|
|
4968
|
+
"device-fingerprinting",
|
|
4969
|
+
// Device Fingerprinting
|
|
4970
|
+
"suspicious-login-alerts"
|
|
4971
|
+
// Alerts für verdächtige Logins
|
|
4972
|
+
]
|
|
4973
|
+
},
|
|
4974
|
+
// ENTERPRISE Features
|
|
4975
|
+
enterprise: {
|
|
4976
|
+
maxTokens: -1,
|
|
4977
|
+
maxSessions: -1,
|
|
4978
|
+
maxIPBans: -1,
|
|
4979
|
+
features: [
|
|
4980
|
+
"basic-magic-link",
|
|
4981
|
+
"email-templates",
|
|
4982
|
+
"jwt-sessions",
|
|
4983
|
+
"ip-tracking",
|
|
4984
|
+
"rate-limiting",
|
|
4985
|
+
"auto-user-creation",
|
|
4986
|
+
"token-management",
|
|
4987
|
+
"ip-bans",
|
|
4988
|
+
"otp-email",
|
|
4989
|
+
"mfa-totp",
|
|
4990
|
+
// MFA: Magic Link + TOTP (Szenario 1)
|
|
4991
|
+
"otp-sms",
|
|
4992
|
+
"otp-totp",
|
|
4993
|
+
"totp-primary-login",
|
|
4994
|
+
// Login with Email + TOTP only (Szenario 2)
|
|
4995
|
+
"otp-backup-codes",
|
|
4996
|
+
// Backup Recovery Codes
|
|
4997
|
+
"biometric-support",
|
|
4998
|
+
// WebAuthn/FIDO2
|
|
4999
|
+
"custom-email-templates",
|
|
5000
|
+
"email-designer-integration",
|
|
5001
|
+
"magic-mail-integration",
|
|
5002
|
+
"advanced-rate-limiting",
|
|
5003
|
+
"session-management",
|
|
5004
|
+
"bulk-operations",
|
|
5005
|
+
"extended-logging",
|
|
5006
|
+
"custom-redirect-urls",
|
|
5007
|
+
"webhook-notifications",
|
|
5008
|
+
"api-access-tokens",
|
|
5009
|
+
"advanced-analytics",
|
|
5010
|
+
"custom-token-context",
|
|
5011
|
+
"geolocation-tracking",
|
|
5012
|
+
"device-fingerprinting",
|
|
5013
|
+
"suspicious-login-alerts",
|
|
5014
|
+
"sso-integration",
|
|
5015
|
+
// SSO/SAML Integration
|
|
5016
|
+
"ldap-sync",
|
|
5017
|
+
// LDAP/AD Sync
|
|
5018
|
+
"audit-logs",
|
|
5019
|
+
// Vollständige Audit Logs
|
|
5020
|
+
"compliance-reports",
|
|
5021
|
+
// GDPR/SOC2 Reports
|
|
5022
|
+
"priority-support",
|
|
5023
|
+
// 24/7 Priority Support
|
|
5024
|
+
"custom-security-rules",
|
|
5025
|
+
// Custom Security Rules
|
|
5026
|
+
"multi-tenant",
|
|
5027
|
+
// Multi-Tenant Support
|
|
5028
|
+
"white-label"
|
|
5029
|
+
// White-Label Branding
|
|
5030
|
+
]
|
|
5031
|
+
},
|
|
5032
|
+
/**
|
|
5033
|
+
* Check if a feature is available for given license tier
|
|
5034
|
+
*/
|
|
5035
|
+
hasFeature(licenseData, featureName) {
|
|
5036
|
+
if (!licenseData) {
|
|
5031
5037
|
return this.free.features.includes(featureName);
|
|
5032
|
-
},
|
|
5033
|
-
/**
|
|
5034
|
-
* Get max allowed tokens for license tier
|
|
5035
|
-
*/
|
|
5036
|
-
getMaxTokens(licenseData) {
|
|
5037
|
-
if (!licenseData) return this.free.maxTokens;
|
|
5038
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxTokens;
|
|
5039
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxTokens;
|
|
5040
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxTokens;
|
|
5041
|
-
return this.free.maxTokens;
|
|
5042
|
-
},
|
|
5043
|
-
/**
|
|
5044
|
-
* Get max allowed sessions for license tier
|
|
5045
|
-
*/
|
|
5046
|
-
getMaxSessions(licenseData) {
|
|
5047
|
-
if (!licenseData) return this.free.maxSessions;
|
|
5048
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxSessions;
|
|
5049
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxSessions;
|
|
5050
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxSessions;
|
|
5051
|
-
return this.free.maxSessions;
|
|
5052
|
-
},
|
|
5053
|
-
/**
|
|
5054
|
-
* Get max allowed IP bans for license tier
|
|
5055
|
-
*/
|
|
5056
|
-
getMaxIPBans(licenseData) {
|
|
5057
|
-
if (!licenseData) return this.free.maxIPBans;
|
|
5058
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxIPBans;
|
|
5059
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxIPBans;
|
|
5060
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxIPBans;
|
|
5061
|
-
return this.free.maxIPBans;
|
|
5062
|
-
},
|
|
5063
|
-
/**
|
|
5064
|
-
* Get tier name from license data
|
|
5065
|
-
*/
|
|
5066
|
-
getTierName(licenseData) {
|
|
5067
|
-
if (!licenseData) return "free";
|
|
5068
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return "enterprise";
|
|
5069
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return "advanced";
|
|
5070
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return "premium";
|
|
5071
|
-
return "free";
|
|
5072
5038
|
}
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5039
|
+
let isEnterprise = false;
|
|
5040
|
+
let isAdvanced = false;
|
|
5041
|
+
let isPremium = false;
|
|
5042
|
+
if (licenseData.tier) {
|
|
5043
|
+
isEnterprise = licenseData.tier === "enterprise";
|
|
5044
|
+
isAdvanced = licenseData.tier === "advanced";
|
|
5045
|
+
isPremium = licenseData.tier === "premium";
|
|
5046
|
+
}
|
|
5047
|
+
if (licenseData.features) {
|
|
5048
|
+
isEnterprise = isEnterprise || licenseData.features.enterprise === true;
|
|
5049
|
+
isAdvanced = isAdvanced || licenseData.features.advanced === true;
|
|
5050
|
+
isPremium = isPremium || licenseData.features.premium === true;
|
|
5051
|
+
}
|
|
5052
|
+
if (licenseData.featureEnterprise === true) {
|
|
5053
|
+
isEnterprise = true;
|
|
5054
|
+
}
|
|
5055
|
+
if (licenseData.featureAdvanced === true) {
|
|
5056
|
+
isAdvanced = true;
|
|
5057
|
+
}
|
|
5058
|
+
if (licenseData.featurePremium === true) {
|
|
5059
|
+
isPremium = true;
|
|
5060
|
+
}
|
|
5061
|
+
if (isEnterprise && this.enterprise.features.includes(featureName)) {
|
|
5062
|
+
return true;
|
|
5063
|
+
}
|
|
5064
|
+
if (isAdvanced && this.advanced.features.includes(featureName)) {
|
|
5065
|
+
return true;
|
|
5066
|
+
}
|
|
5067
|
+
if (isPremium && this.premium.features.includes(featureName)) {
|
|
5068
|
+
return true;
|
|
5069
|
+
}
|
|
5070
|
+
return this.free.features.includes(featureName);
|
|
5071
|
+
},
|
|
5072
|
+
/**
|
|
5073
|
+
* Get max allowed tokens for license tier
|
|
5074
|
+
*/
|
|
5075
|
+
getMaxTokens(licenseData) {
|
|
5076
|
+
if (!licenseData) return this.free.maxTokens;
|
|
5077
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxTokens;
|
|
5078
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxTokens;
|
|
5079
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxTokens;
|
|
5080
|
+
return this.free.maxTokens;
|
|
5081
|
+
},
|
|
5082
|
+
/**
|
|
5083
|
+
* Get max allowed sessions for license tier
|
|
5084
|
+
*/
|
|
5085
|
+
getMaxSessions(licenseData) {
|
|
5086
|
+
if (!licenseData) return this.free.maxSessions;
|
|
5087
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxSessions;
|
|
5088
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxSessions;
|
|
5089
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxSessions;
|
|
5090
|
+
return this.free.maxSessions;
|
|
5091
|
+
},
|
|
5092
|
+
/**
|
|
5093
|
+
* Get max allowed IP bans for license tier
|
|
5094
|
+
*/
|
|
5095
|
+
getMaxIPBans(licenseData) {
|
|
5096
|
+
if (!licenseData) return this.free.maxIPBans;
|
|
5097
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxIPBans;
|
|
5098
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxIPBans;
|
|
5099
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxIPBans;
|
|
5100
|
+
return this.free.maxIPBans;
|
|
5101
|
+
},
|
|
5102
|
+
/**
|
|
5103
|
+
* Get tier name from license data
|
|
5104
|
+
*/
|
|
5105
|
+
getTierName(licenseData) {
|
|
5106
|
+
if (!licenseData) return "free";
|
|
5107
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return "enterprise";
|
|
5108
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return "advanced";
|
|
5109
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return "premium";
|
|
5110
|
+
return "free";
|
|
5111
|
+
}
|
|
5112
|
+
};
|
|
5076
5113
|
const crypto$1 = require$$0$3;
|
|
5077
5114
|
const os = require$$1$3;
|
|
5115
|
+
const features = features$1;
|
|
5078
5116
|
const LICENSE_SERVER_URL = "https://magicapi.fitlex.me";
|
|
5079
5117
|
const envTimeout = Number(process.env.MAGIC_LICENSE_TIMEOUT_MS);
|
|
5080
5118
|
const DEFAULT_FETCH_TIMEOUT_MS = Number.isFinite(envTimeout) && envTimeout > 0 ? envTimeout : 12e3;
|
|
@@ -5456,14 +5494,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5456
5494
|
*/
|
|
5457
5495
|
async hasFeature(featureName) {
|
|
5458
5496
|
try {
|
|
5459
|
-
const features2 = requireFeatures();
|
|
5460
5497
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5461
5498
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5462
5499
|
if (!licenseKey) {
|
|
5463
|
-
return
|
|
5500
|
+
return features.hasFeature(null, featureName);
|
|
5464
5501
|
}
|
|
5465
5502
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5466
|
-
return
|
|
5503
|
+
return features.hasFeature(licenseData, featureName);
|
|
5467
5504
|
} catch (error) {
|
|
5468
5505
|
strapi2.log.error("Error checking feature:", error);
|
|
5469
5506
|
return false;
|
|
@@ -5475,14 +5512,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5475
5512
|
*/
|
|
5476
5513
|
async getMaxTokens() {
|
|
5477
5514
|
try {
|
|
5478
|
-
const features2 = requireFeatures();
|
|
5479
5515
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5480
5516
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5481
5517
|
if (!licenseKey) {
|
|
5482
|
-
return
|
|
5518
|
+
return features.getMaxTokens(null);
|
|
5483
5519
|
}
|
|
5484
5520
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5485
|
-
return
|
|
5521
|
+
return features.getMaxTokens(licenseData);
|
|
5486
5522
|
} catch (error) {
|
|
5487
5523
|
strapi2.log.error("Error getting max tokens:", error);
|
|
5488
5524
|
return features.free.maxTokens;
|
|
@@ -5494,14 +5530,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5494
5530
|
*/
|
|
5495
5531
|
async getMaxSessions() {
|
|
5496
5532
|
try {
|
|
5497
|
-
const features2 = requireFeatures();
|
|
5498
5533
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5499
5534
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5500
5535
|
if (!licenseKey) {
|
|
5501
|
-
return
|
|
5536
|
+
return features.getMaxSessions(null);
|
|
5502
5537
|
}
|
|
5503
5538
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5504
|
-
return
|
|
5539
|
+
return features.getMaxSessions(licenseData);
|
|
5505
5540
|
} catch (error) {
|
|
5506
5541
|
strapi2.log.error("Error getting max sessions:", error);
|
|
5507
5542
|
return features.free.maxSessions;
|
|
@@ -5513,14 +5548,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5513
5548
|
*/
|
|
5514
5549
|
async getMaxIPBans() {
|
|
5515
5550
|
try {
|
|
5516
|
-
const features2 = requireFeatures();
|
|
5517
5551
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5518
5552
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5519
5553
|
if (!licenseKey) {
|
|
5520
|
-
return
|
|
5554
|
+
return features.getMaxIPBans(null);
|
|
5521
5555
|
}
|
|
5522
5556
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5523
|
-
return
|
|
5557
|
+
return features.getMaxIPBans(licenseData);
|
|
5524
5558
|
} catch (error) {
|
|
5525
5559
|
strapi2.log.error("Error getting max IP bans:", error);
|
|
5526
5560
|
return features.free.maxIPBans;
|
|
@@ -5532,14 +5566,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5532
5566
|
*/
|
|
5533
5567
|
async getAvailableOTPTypes() {
|
|
5534
5568
|
try {
|
|
5535
|
-
const features2 = requireFeatures();
|
|
5536
5569
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5537
5570
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5538
5571
|
if (!licenseKey) {
|
|
5539
|
-
return
|
|
5572
|
+
return features.getAvailableOTPTypes(null);
|
|
5540
5573
|
}
|
|
5541
5574
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5542
|
-
return
|
|
5575
|
+
return features.getAvailableOTPTypes(licenseData);
|
|
5543
5576
|
} catch (error) {
|
|
5544
5577
|
strapi2.log.error("Error getting available OTP types:", error);
|
|
5545
5578
|
return [];
|