Skip to content

Commit a8e22cd

Browse files
committed
fix: fix strapi patches
1 parent 07f21ee commit a8e22cd

2 files changed

Lines changed: 161 additions & 147 deletions

File tree

apps/strapi/patches/@strapi+strapi+4.3.8.patch

Lines changed: 0 additions & 147 deletions
This file was deleted.
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
diff --git a/node_modules/@strapi/strapi/lib/services/metrics/index.js b/node_modules/@strapi/strapi/lib/services/metrics/index.js
2+
index 908f2c9..02543e2 100644
3+
--- a/node_modules/@strapi/strapi/lib/services/metrics/index.js
4+
+++ b/node_modules/@strapi/strapi/lib/services/metrics/index.js
5+
@@ -27,7 +27,7 @@ const createTelemetryInstance = (strapi) => {
6+
const uuid = strapi.config.get('uuid');
7+
const telemetryDisabled = strapi.config.get('packageJsonStrapi.telemetryDisabled');
8+
const isDisabled =
9+
- !uuid || isTruthy(process.env.STRAPI_TELEMETRY_DISABLED) || isTruthy(telemetryDisabled);
10+
+ true || !uuid || isTruthy(process.env.STRAPI_TELEMETRY_DISABLED) || isTruthy(telemetryDisabled);
11+
12+
const crons = [];
13+
const sender = createSender(strapi);
14+
@@ -47,35 +47,35 @@ const createTelemetryInstance = (strapi) => {
15+
}
16+
},
17+
bootstrap() {
18+
- if (strapi.EE === true && ee.isEE === true) {
19+
- const pingDisabled =
20+
- isTruthy(process.env.STRAPI_LICENSE_PING_DISABLED) && ee.licenseInfo.type === 'gold';
21+
-
22+
- const sendLicenseCheck = () => {
23+
- return sendEvent(
24+
- 'didCheckLicense',
25+
- {
26+
- groupProperties: {
27+
- licenseInfo: {
28+
- ...ee.licenseInfo,
29+
- projectHash: hashProject(strapi),
30+
- dependencyHash: hashDep(strapi),
31+
- },
32+
- },
33+
- },
34+
- {
35+
- headers: { 'x-strapi-project': 'enterprise' },
36+
- }
37+
- );
38+
- };
39+
-
40+
- if (!pingDisabled) {
41+
- const licenseCron = scheduleJob('0 0 0 * * 7', () => sendLicenseCheck());
42+
- crons.push(licenseCron);
43+
-
44+
- sendLicenseCheck();
45+
- }
46+
- }
47+
+ // if (true) {
48+
+ // const pingDisabled =
49+
+ // isTruthy(process.env.STRAPI_LICENSE_PING_DISABLED) && ee.licenseInfo.type === 'gold';
50+
+
51+
+ // const sendLicenseCheck = () => {
52+
+ // return sendEvent(
53+
+ // 'didCheckLicense',
54+
+ // {
55+
+ // groupProperties: {
56+
+ // licenseInfo: {
57+
+ // ...ee.licenseInfo,
58+
+ // projectHash: hashProject(strapi),
59+
+ // dependencyHash: hashDep(strapi),
60+
+ // },
61+
+ // },
62+
+ // },
63+
+ // {
64+
+ // headers: { 'x-strapi-project': 'enterprise' },
65+
+ // }
66+
+ // );
67+
+ // };
68+
+
69+
+ // if (!pingDisabled) {
70+
+ // const licenseCron = scheduleJob('0 0 0 * * 7', () => sendLicenseCheck());
71+
+ // crons.push(licenseCron);
72+
+
73+
+ // sendLicenseCheck();
74+
+ // }
75+
+ // }
76+
},
77+
destroy() {
78+
// clear open handles
79+
diff --git a/node_modules/@strapi/strapi/lib/services/metrics/sender.js b/node_modules/@strapi/strapi/lib/services/metrics/sender.js
80+
index 13a2f50..ee09bea 100644
81+
--- a/node_modules/@strapi/strapi/lib/services/metrics/sender.js
82+
+++ b/node_modules/@strapi/strapi/lib/services/metrics/sender.js
83+
@@ -84,8 +84,8 @@ module.exports = (strapi) => {
84+
};
85+
86+
try {
87+
- const res = await fetch(`${ANALYTICS_URI}/api/v2/track`, reqParams);
88+
- return res.ok;
89+
+ // const res = await fetch(`${ANALYTICS_URI}/api/v2/track`, reqParams);
90+
+ return false
91+
} catch (err) {
92+
return false;
93+
}
94+
diff --git a/node_modules/@strapi/strapi/lib/utils/ee.js b/node_modules/@strapi/strapi/lib/utils/ee.js
95+
index adee4dd..a5ec94f 100644
96+
--- a/node_modules/@strapi/strapi/lib/utils/ee.js
97+
+++ b/node_modules/@strapi/strapi/lib/utils/ee.js
98+
@@ -22,6 +22,7 @@ const features = {
99+
};
100+
101+
module.exports = ({ dir, logger = noLog }) => {
102+
+ return true
103+
if (_.has(internals, 'isEE')) return internals.isEE;
104+
105+
const warnAndReturn = (msg = 'Invalid license. Starting in CE.') => {
106+
@@ -79,7 +80,7 @@ module.exports = ({ dir, logger = noLog }) => {
107+
108+
Object.defineProperty(module.exports, 'licenseInfo', {
109+
get() {
110+
- mustHaveKey('licenseInfo');
111+
+ // mustHaveKey('licenseInfo');
112+
return internals.licenseInfo;
113+
},
114+
configurable: false,
115+
@@ -88,8 +89,8 @@ Object.defineProperty(module.exports, 'licenseInfo', {
116+
117+
Object.defineProperty(module.exports, 'isEE', {
118+
get() {
119+
- mustHaveKey('isEE');
120+
- return internals.isEE;
121+
+ // mustHaveKey('isEE');
122+
+ return true;
123+
},
124+
configurable: false,
125+
enumerable: false,
126+
@@ -97,16 +98,16 @@ Object.defineProperty(module.exports, 'isEE', {
127+
128+
Object.defineProperty(module.exports, 'features', {
129+
get() {
130+
- mustHaveKey('licenseInfo');
131+
+ // mustHaveKey('licenseInfo');
132+
133+
- const { type: licenseType } = module.exports.licenseInfo;
134+
+ // const { type: licenseType } = module.exports.licenseInfo;
135+
136+
return {
137+
isEnabled(feature) {
138+
- return features[licenseType].includes(feature);
139+
+ return true
140+
},
141+
getEnabled() {
142+
- return features[licenseType];
143+
+ return ['sso']
144+
},
145+
};
146+
},
147+
@@ -115,9 +116,9 @@ Object.defineProperty(module.exports, 'features', {
148+
});
149+
150+
const mustHaveKey = (key) => {
151+
- if (!_.has(internals, key)) {
152+
- const err = new Error('Tampering with license');
153+
- // err.stack = null;
154+
- throw err;
155+
- }
156+
+ // if (!_.has(internals, key)) {
157+
+ // const err = new Error('Tampering with license');
158+
+ // // err.stack = null;
159+
+ // throw err;
160+
+ // }
161+
};

0 commit comments

Comments
 (0)