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.js
CHANGED
|
@@ -4641,6 +4641,50 @@ var magicLink$1 = ({ strapi: strapi2 }) => ({
|
|
|
4641
4641
|
strapi2.log.error("MagicMail send failed, falling back to default provider:", error);
|
|
4642
4642
|
}
|
|
4643
4643
|
}
|
|
4644
|
+
const wantsEmailDesigner = settings?.use_email_designer && settings?.email_designer_template_id;
|
|
4645
|
+
const hasEmailDesignerPlugin = Boolean(strapi2.plugin("email-designer-5"));
|
|
4646
|
+
if (wantsEmailDesigner && hasEmailDesignerPlugin) {
|
|
4647
|
+
const templateId = parseInt(settings.email_designer_template_id, 10);
|
|
4648
|
+
if (!Number.isNaN(templateId) && templateId > 0) {
|
|
4649
|
+
try {
|
|
4650
|
+
await strapi2.plugin("email-designer-5").service("email").sendTemplatedEmail(
|
|
4651
|
+
{
|
|
4652
|
+
to: token2.email,
|
|
4653
|
+
from: settings.from_email ? `${settings.from_name || "Magic Link"} <${settings.from_email}>` : void 0,
|
|
4654
|
+
replyTo: settings.response_email || void 0
|
|
4655
|
+
},
|
|
4656
|
+
{
|
|
4657
|
+
templateReferenceId: templateId,
|
|
4658
|
+
subject: settings.object || emailConfig.object
|
|
4659
|
+
},
|
|
4660
|
+
{
|
|
4661
|
+
...templatePayload,
|
|
4662
|
+
user: { email: token2.email },
|
|
4663
|
+
magicLink: loginUrl,
|
|
4664
|
+
expiresAt: token2.expires_at ? new Date(token2.expires_at).toISOString() : void 0,
|
|
4665
|
+
expiryText: expiryTextForTemplate
|
|
4666
|
+
}
|
|
4667
|
+
);
|
|
4668
|
+
strapi2.log.info(
|
|
4669
|
+
`Magic Link email sent via Email Designer 5 (template ${templateId}) to ${token2.email}`
|
|
4670
|
+
);
|
|
4671
|
+
return token2;
|
|
4672
|
+
} catch (emailDesignerError) {
|
|
4673
|
+
strapi2.log.error(
|
|
4674
|
+
"Email Designer 5 send failed, falling back to default provider:",
|
|
4675
|
+
emailDesignerError
|
|
4676
|
+
);
|
|
4677
|
+
}
|
|
4678
|
+
} else {
|
|
4679
|
+
strapi2.log.warn(
|
|
4680
|
+
`Invalid Email Designer template ID: '${settings.email_designer_template_id}', falling back to default email`
|
|
4681
|
+
);
|
|
4682
|
+
}
|
|
4683
|
+
} else if (wantsEmailDesigner && !hasEmailDesignerPlugin) {
|
|
4684
|
+
strapi2.log.debug(
|
|
4685
|
+
"Email Designer enabled but plugin not installed — falling back to default email"
|
|
4686
|
+
);
|
|
4687
|
+
}
|
|
4644
4688
|
await strapi2.plugin("email").service("email").send({
|
|
4645
4689
|
to: token2.email,
|
|
4646
4690
|
from: emailConfig.from,
|
|
@@ -4823,271 +4867,265 @@ var store$1 = ({ strapi: strapi2 }) => ({
|
|
|
4823
4867
|
return pluginStore.set({ key: "settings", value: settings });
|
|
4824
4868
|
}
|
|
4825
4869
|
});
|
|
4826
|
-
var features$1
|
|
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
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
/**
|
|
5007
|
-
* Check if a feature is available for given license tier
|
|
5008
|
-
*/
|
|
5009
|
-
hasFeature(licenseData, featureName) {
|
|
5010
|
-
if (!licenseData) {
|
|
5011
|
-
return this.free.features.includes(featureName);
|
|
5012
|
-
}
|
|
5013
|
-
let isEnterprise = false;
|
|
5014
|
-
let isAdvanced = false;
|
|
5015
|
-
let isPremium = false;
|
|
5016
|
-
if (licenseData.tier) {
|
|
5017
|
-
isEnterprise = licenseData.tier === "enterprise";
|
|
5018
|
-
isAdvanced = licenseData.tier === "advanced";
|
|
5019
|
-
isPremium = licenseData.tier === "premium";
|
|
5020
|
-
}
|
|
5021
|
-
if (licenseData.features) {
|
|
5022
|
-
isEnterprise = isEnterprise || licenseData.features.enterprise === true;
|
|
5023
|
-
isAdvanced = isAdvanced || licenseData.features.advanced === true;
|
|
5024
|
-
isPremium = isPremium || licenseData.features.premium === true;
|
|
5025
|
-
}
|
|
5026
|
-
if (licenseData.featureEnterprise === true) {
|
|
5027
|
-
isEnterprise = true;
|
|
5028
|
-
}
|
|
5029
|
-
if (licenseData.featureAdvanced === true) {
|
|
5030
|
-
isAdvanced = true;
|
|
5031
|
-
}
|
|
5032
|
-
if (licenseData.featurePremium === true) {
|
|
5033
|
-
isPremium = true;
|
|
5034
|
-
}
|
|
5035
|
-
if (isEnterprise && this.enterprise.features.includes(featureName)) {
|
|
5036
|
-
return true;
|
|
5037
|
-
}
|
|
5038
|
-
if (isAdvanced && this.advanced.features.includes(featureName)) {
|
|
5039
|
-
return true;
|
|
5040
|
-
}
|
|
5041
|
-
if (isPremium && this.premium.features.includes(featureName)) {
|
|
5042
|
-
return true;
|
|
5043
|
-
}
|
|
4870
|
+
var features$1 = {
|
|
4871
|
+
// FREE/DEMO Features
|
|
4872
|
+
free: {
|
|
4873
|
+
maxTokens: 100,
|
|
4874
|
+
// 100 aktive Tokens gleichzeitig
|
|
4875
|
+
maxSessions: 50,
|
|
4876
|
+
// 50 aktive JWT Sessions
|
|
4877
|
+
maxIPBans: 10,
|
|
4878
|
+
// 10 gebannte IPs
|
|
4879
|
+
features: [
|
|
4880
|
+
"basic-magic-link",
|
|
4881
|
+
// Basis Magic Link Auth
|
|
4882
|
+
"email-templates",
|
|
4883
|
+
// Basis Email Templates
|
|
4884
|
+
"jwt-sessions",
|
|
4885
|
+
// JWT Session Management
|
|
4886
|
+
"ip-tracking",
|
|
4887
|
+
// IP Tracking für Security
|
|
4888
|
+
"rate-limiting",
|
|
4889
|
+
// Basis Rate Limiting
|
|
4890
|
+
"auto-user-creation",
|
|
4891
|
+
// Auto User Creation
|
|
4892
|
+
"token-management",
|
|
4893
|
+
// Token Dashboard
|
|
4894
|
+
"ip-bans"
|
|
4895
|
+
// IP Ban Management
|
|
4896
|
+
]
|
|
4897
|
+
},
|
|
4898
|
+
// PREMIUM Features
|
|
4899
|
+
premium: {
|
|
4900
|
+
maxTokens: 1e3,
|
|
4901
|
+
// 1000 aktive Tokens
|
|
4902
|
+
maxSessions: 500,
|
|
4903
|
+
// 500 aktive Sessions
|
|
4904
|
+
maxIPBans: 100,
|
|
4905
|
+
// 100 gebannte IPs
|
|
4906
|
+
features: [
|
|
4907
|
+
"basic-magic-link",
|
|
4908
|
+
"email-templates",
|
|
4909
|
+
"jwt-sessions",
|
|
4910
|
+
"ip-tracking",
|
|
4911
|
+
"rate-limiting",
|
|
4912
|
+
"auto-user-creation",
|
|
4913
|
+
"token-management",
|
|
4914
|
+
"ip-bans",
|
|
4915
|
+
"otp-email",
|
|
4916
|
+
// Email OTP (6-digit code)
|
|
4917
|
+
"mfa-totp",
|
|
4918
|
+
// MFA: Magic Link + TOTP (Szenario 1)
|
|
4919
|
+
"custom-email-templates",
|
|
4920
|
+
// Custom HTML/Text Templates
|
|
4921
|
+
"email-designer-integration",
|
|
4922
|
+
// Email Designer 5 Support
|
|
4923
|
+
"magic-mail-integration",
|
|
4924
|
+
// MagicMail Integration
|
|
4925
|
+
"advanced-rate-limiting",
|
|
4926
|
+
// Custom Rate Limits
|
|
4927
|
+
"session-management",
|
|
4928
|
+
// Erweiterte Session Verwaltung
|
|
4929
|
+
"bulk-operations",
|
|
4930
|
+
// Bulk Token/Session Operations
|
|
4931
|
+
"extended-logging",
|
|
4932
|
+
// Erweiterte Login-Info Logs
|
|
4933
|
+
"custom-redirect-urls"
|
|
4934
|
+
// Custom Redirect URLs per Token
|
|
4935
|
+
]
|
|
4936
|
+
},
|
|
4937
|
+
// ADVANCED Features
|
|
4938
|
+
advanced: {
|
|
4939
|
+
maxTokens: -1,
|
|
4940
|
+
// Unlimited
|
|
4941
|
+
maxSessions: -1,
|
|
4942
|
+
// Unlimited
|
|
4943
|
+
maxIPBans: -1,
|
|
4944
|
+
// Unlimited
|
|
4945
|
+
features: [
|
|
4946
|
+
"basic-magic-link",
|
|
4947
|
+
"email-templates",
|
|
4948
|
+
"jwt-sessions",
|
|
4949
|
+
"ip-tracking",
|
|
4950
|
+
"rate-limiting",
|
|
4951
|
+
"auto-user-creation",
|
|
4952
|
+
"token-management",
|
|
4953
|
+
"ip-bans",
|
|
4954
|
+
"otp-email",
|
|
4955
|
+
"mfa-totp",
|
|
4956
|
+
// MFA: Magic Link + TOTP (Szenario 1)
|
|
4957
|
+
"otp-sms",
|
|
4958
|
+
// SMS OTP via Twilio/Vonage
|
|
4959
|
+
"otp-totp",
|
|
4960
|
+
// TOTP (Authenticator Apps)
|
|
4961
|
+
"totp-primary-login",
|
|
4962
|
+
// Login with Email + TOTP only (Szenario 2)
|
|
4963
|
+
"custom-email-templates",
|
|
4964
|
+
"email-designer-integration",
|
|
4965
|
+
"magic-mail-integration",
|
|
4966
|
+
"advanced-rate-limiting",
|
|
4967
|
+
"session-management",
|
|
4968
|
+
"bulk-operations",
|
|
4969
|
+
"extended-logging",
|
|
4970
|
+
"custom-redirect-urls",
|
|
4971
|
+
"webhook-notifications",
|
|
4972
|
+
// Webhooks für Events
|
|
4973
|
+
"api-access-tokens",
|
|
4974
|
+
// API Tokens für Programmatic Access
|
|
4975
|
+
"advanced-analytics",
|
|
4976
|
+
// Analytics Dashboard
|
|
4977
|
+
"custom-token-context",
|
|
4978
|
+
// Custom Context Data in Tokens
|
|
4979
|
+
"geolocation-tracking",
|
|
4980
|
+
// GeoIP Tracking
|
|
4981
|
+
"device-fingerprinting",
|
|
4982
|
+
// Device Fingerprinting
|
|
4983
|
+
"suspicious-login-alerts"
|
|
4984
|
+
// Alerts für verdächtige Logins
|
|
4985
|
+
]
|
|
4986
|
+
},
|
|
4987
|
+
// ENTERPRISE Features
|
|
4988
|
+
enterprise: {
|
|
4989
|
+
maxTokens: -1,
|
|
4990
|
+
maxSessions: -1,
|
|
4991
|
+
maxIPBans: -1,
|
|
4992
|
+
features: [
|
|
4993
|
+
"basic-magic-link",
|
|
4994
|
+
"email-templates",
|
|
4995
|
+
"jwt-sessions",
|
|
4996
|
+
"ip-tracking",
|
|
4997
|
+
"rate-limiting",
|
|
4998
|
+
"auto-user-creation",
|
|
4999
|
+
"token-management",
|
|
5000
|
+
"ip-bans",
|
|
5001
|
+
"otp-email",
|
|
5002
|
+
"mfa-totp",
|
|
5003
|
+
// MFA: Magic Link + TOTP (Szenario 1)
|
|
5004
|
+
"otp-sms",
|
|
5005
|
+
"otp-totp",
|
|
5006
|
+
"totp-primary-login",
|
|
5007
|
+
// Login with Email + TOTP only (Szenario 2)
|
|
5008
|
+
"otp-backup-codes",
|
|
5009
|
+
// Backup Recovery Codes
|
|
5010
|
+
"biometric-support",
|
|
5011
|
+
// WebAuthn/FIDO2
|
|
5012
|
+
"custom-email-templates",
|
|
5013
|
+
"email-designer-integration",
|
|
5014
|
+
"magic-mail-integration",
|
|
5015
|
+
"advanced-rate-limiting",
|
|
5016
|
+
"session-management",
|
|
5017
|
+
"bulk-operations",
|
|
5018
|
+
"extended-logging",
|
|
5019
|
+
"custom-redirect-urls",
|
|
5020
|
+
"webhook-notifications",
|
|
5021
|
+
"api-access-tokens",
|
|
5022
|
+
"advanced-analytics",
|
|
5023
|
+
"custom-token-context",
|
|
5024
|
+
"geolocation-tracking",
|
|
5025
|
+
"device-fingerprinting",
|
|
5026
|
+
"suspicious-login-alerts",
|
|
5027
|
+
"sso-integration",
|
|
5028
|
+
// SSO/SAML Integration
|
|
5029
|
+
"ldap-sync",
|
|
5030
|
+
// LDAP/AD Sync
|
|
5031
|
+
"audit-logs",
|
|
5032
|
+
// Vollständige Audit Logs
|
|
5033
|
+
"compliance-reports",
|
|
5034
|
+
// GDPR/SOC2 Reports
|
|
5035
|
+
"priority-support",
|
|
5036
|
+
// 24/7 Priority Support
|
|
5037
|
+
"custom-security-rules",
|
|
5038
|
+
// Custom Security Rules
|
|
5039
|
+
"multi-tenant",
|
|
5040
|
+
// Multi-Tenant Support
|
|
5041
|
+
"white-label"
|
|
5042
|
+
// White-Label Branding
|
|
5043
|
+
]
|
|
5044
|
+
},
|
|
5045
|
+
/**
|
|
5046
|
+
* Check if a feature is available for given license tier
|
|
5047
|
+
*/
|
|
5048
|
+
hasFeature(licenseData, featureName) {
|
|
5049
|
+
if (!licenseData) {
|
|
5044
5050
|
return this.free.features.includes(featureName);
|
|
5045
|
-
},
|
|
5046
|
-
/**
|
|
5047
|
-
* Get max allowed tokens for license tier
|
|
5048
|
-
*/
|
|
5049
|
-
getMaxTokens(licenseData) {
|
|
5050
|
-
if (!licenseData) return this.free.maxTokens;
|
|
5051
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxTokens;
|
|
5052
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxTokens;
|
|
5053
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxTokens;
|
|
5054
|
-
return this.free.maxTokens;
|
|
5055
|
-
},
|
|
5056
|
-
/**
|
|
5057
|
-
* Get max allowed sessions for license tier
|
|
5058
|
-
*/
|
|
5059
|
-
getMaxSessions(licenseData) {
|
|
5060
|
-
if (!licenseData) return this.free.maxSessions;
|
|
5061
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxSessions;
|
|
5062
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxSessions;
|
|
5063
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxSessions;
|
|
5064
|
-
return this.free.maxSessions;
|
|
5065
|
-
},
|
|
5066
|
-
/**
|
|
5067
|
-
* Get max allowed IP bans for license tier
|
|
5068
|
-
*/
|
|
5069
|
-
getMaxIPBans(licenseData) {
|
|
5070
|
-
if (!licenseData) return this.free.maxIPBans;
|
|
5071
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxIPBans;
|
|
5072
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxIPBans;
|
|
5073
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxIPBans;
|
|
5074
|
-
return this.free.maxIPBans;
|
|
5075
|
-
},
|
|
5076
|
-
/**
|
|
5077
|
-
* Get tier name from license data
|
|
5078
|
-
*/
|
|
5079
|
-
getTierName(licenseData) {
|
|
5080
|
-
if (!licenseData) return "free";
|
|
5081
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return "enterprise";
|
|
5082
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return "advanced";
|
|
5083
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return "premium";
|
|
5084
|
-
return "free";
|
|
5085
5051
|
}
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5052
|
+
let isEnterprise = false;
|
|
5053
|
+
let isAdvanced = false;
|
|
5054
|
+
let isPremium = false;
|
|
5055
|
+
if (licenseData.tier) {
|
|
5056
|
+
isEnterprise = licenseData.tier === "enterprise";
|
|
5057
|
+
isAdvanced = licenseData.tier === "advanced";
|
|
5058
|
+
isPremium = licenseData.tier === "premium";
|
|
5059
|
+
}
|
|
5060
|
+
if (licenseData.features) {
|
|
5061
|
+
isEnterprise = isEnterprise || licenseData.features.enterprise === true;
|
|
5062
|
+
isAdvanced = isAdvanced || licenseData.features.advanced === true;
|
|
5063
|
+
isPremium = isPremium || licenseData.features.premium === true;
|
|
5064
|
+
}
|
|
5065
|
+
if (licenseData.featureEnterprise === true) {
|
|
5066
|
+
isEnterprise = true;
|
|
5067
|
+
}
|
|
5068
|
+
if (licenseData.featureAdvanced === true) {
|
|
5069
|
+
isAdvanced = true;
|
|
5070
|
+
}
|
|
5071
|
+
if (licenseData.featurePremium === true) {
|
|
5072
|
+
isPremium = true;
|
|
5073
|
+
}
|
|
5074
|
+
if (isEnterprise && this.enterprise.features.includes(featureName)) {
|
|
5075
|
+
return true;
|
|
5076
|
+
}
|
|
5077
|
+
if (isAdvanced && this.advanced.features.includes(featureName)) {
|
|
5078
|
+
return true;
|
|
5079
|
+
}
|
|
5080
|
+
if (isPremium && this.premium.features.includes(featureName)) {
|
|
5081
|
+
return true;
|
|
5082
|
+
}
|
|
5083
|
+
return this.free.features.includes(featureName);
|
|
5084
|
+
},
|
|
5085
|
+
/**
|
|
5086
|
+
* Get max allowed tokens for license tier
|
|
5087
|
+
*/
|
|
5088
|
+
getMaxTokens(licenseData) {
|
|
5089
|
+
if (!licenseData) return this.free.maxTokens;
|
|
5090
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxTokens;
|
|
5091
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxTokens;
|
|
5092
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxTokens;
|
|
5093
|
+
return this.free.maxTokens;
|
|
5094
|
+
},
|
|
5095
|
+
/**
|
|
5096
|
+
* Get max allowed sessions for license tier
|
|
5097
|
+
*/
|
|
5098
|
+
getMaxSessions(licenseData) {
|
|
5099
|
+
if (!licenseData) return this.free.maxSessions;
|
|
5100
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxSessions;
|
|
5101
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxSessions;
|
|
5102
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxSessions;
|
|
5103
|
+
return this.free.maxSessions;
|
|
5104
|
+
},
|
|
5105
|
+
/**
|
|
5106
|
+
* Get max allowed IP bans for license tier
|
|
5107
|
+
*/
|
|
5108
|
+
getMaxIPBans(licenseData) {
|
|
5109
|
+
if (!licenseData) return this.free.maxIPBans;
|
|
5110
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxIPBans;
|
|
5111
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxIPBans;
|
|
5112
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxIPBans;
|
|
5113
|
+
return this.free.maxIPBans;
|
|
5114
|
+
},
|
|
5115
|
+
/**
|
|
5116
|
+
* Get tier name from license data
|
|
5117
|
+
*/
|
|
5118
|
+
getTierName(licenseData) {
|
|
5119
|
+
if (!licenseData) return "free";
|
|
5120
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return "enterprise";
|
|
5121
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return "advanced";
|
|
5122
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return "premium";
|
|
5123
|
+
return "free";
|
|
5124
|
+
}
|
|
5125
|
+
};
|
|
5089
5126
|
const crypto$1 = require$$0__default.default;
|
|
5090
5127
|
const os = require$$1__default$3.default;
|
|
5128
|
+
const features = features$1;
|
|
5091
5129
|
const LICENSE_SERVER_URL = "https://magicapi.fitlex.me";
|
|
5092
5130
|
const envTimeout = Number(process.env.MAGIC_LICENSE_TIMEOUT_MS);
|
|
5093
5131
|
const DEFAULT_FETCH_TIMEOUT_MS = Number.isFinite(envTimeout) && envTimeout > 0 ? envTimeout : 12e3;
|
|
@@ -5469,14 +5507,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5469
5507
|
*/
|
|
5470
5508
|
async hasFeature(featureName) {
|
|
5471
5509
|
try {
|
|
5472
|
-
const features2 = requireFeatures();
|
|
5473
5510
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5474
5511
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5475
5512
|
if (!licenseKey) {
|
|
5476
|
-
return
|
|
5513
|
+
return features.hasFeature(null, featureName);
|
|
5477
5514
|
}
|
|
5478
5515
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5479
|
-
return
|
|
5516
|
+
return features.hasFeature(licenseData, featureName);
|
|
5480
5517
|
} catch (error) {
|
|
5481
5518
|
strapi2.log.error("Error checking feature:", error);
|
|
5482
5519
|
return false;
|
|
@@ -5488,14 +5525,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5488
5525
|
*/
|
|
5489
5526
|
async getMaxTokens() {
|
|
5490
5527
|
try {
|
|
5491
|
-
const features2 = requireFeatures();
|
|
5492
5528
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5493
5529
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5494
5530
|
if (!licenseKey) {
|
|
5495
|
-
return
|
|
5531
|
+
return features.getMaxTokens(null);
|
|
5496
5532
|
}
|
|
5497
5533
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5498
|
-
return
|
|
5534
|
+
return features.getMaxTokens(licenseData);
|
|
5499
5535
|
} catch (error) {
|
|
5500
5536
|
strapi2.log.error("Error getting max tokens:", error);
|
|
5501
5537
|
return features.free.maxTokens;
|
|
@@ -5507,14 +5543,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5507
5543
|
*/
|
|
5508
5544
|
async getMaxSessions() {
|
|
5509
5545
|
try {
|
|
5510
|
-
const features2 = requireFeatures();
|
|
5511
5546
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5512
5547
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5513
5548
|
if (!licenseKey) {
|
|
5514
|
-
return
|
|
5549
|
+
return features.getMaxSessions(null);
|
|
5515
5550
|
}
|
|
5516
5551
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5517
|
-
return
|
|
5552
|
+
return features.getMaxSessions(licenseData);
|
|
5518
5553
|
} catch (error) {
|
|
5519
5554
|
strapi2.log.error("Error getting max sessions:", error);
|
|
5520
5555
|
return features.free.maxSessions;
|
|
@@ -5526,14 +5561,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5526
5561
|
*/
|
|
5527
5562
|
async getMaxIPBans() {
|
|
5528
5563
|
try {
|
|
5529
|
-
const features2 = requireFeatures();
|
|
5530
5564
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5531
5565
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5532
5566
|
if (!licenseKey) {
|
|
5533
|
-
return
|
|
5567
|
+
return features.getMaxIPBans(null);
|
|
5534
5568
|
}
|
|
5535
5569
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5536
|
-
return
|
|
5570
|
+
return features.getMaxIPBans(licenseData);
|
|
5537
5571
|
} catch (error) {
|
|
5538
5572
|
strapi2.log.error("Error getting max IP bans:", error);
|
|
5539
5573
|
return features.free.maxIPBans;
|
|
@@ -5545,14 +5579,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5545
5579
|
*/
|
|
5546
5580
|
async getAvailableOTPTypes() {
|
|
5547
5581
|
try {
|
|
5548
|
-
const features2 = requireFeatures();
|
|
5549
5582
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5550
5583
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5551
5584
|
if (!licenseKey) {
|
|
5552
|
-
return
|
|
5585
|
+
return features.getAvailableOTPTypes(null);
|
|
5553
5586
|
}
|
|
5554
5587
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5555
|
-
return
|
|
5588
|
+
return features.getAvailableOTPTypes(licenseData);
|
|
5556
5589
|
} catch (error) {
|
|
5557
5590
|
strapi2.log.error("Error getting available OTP types:", error);
|
|
5558
5591
|
return [];
|