@strapi/strapi 4.5.4 → 4.6.0-beta.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/lib/Strapi.js +4 -7
- package/lib/commands/opt-in-telemetry.js +2 -2
- package/lib/commands/opt-out-telemetry.js +2 -2
- package/lib/services/metrics/index.js +4 -6
- package/lib/services/metrics/middleware.js +1 -1
- package/lib/services/metrics/sender.js +9 -17
- package/lib/utils/success.js +1 -1
- package/package.json +14 -14
- package/lib/services/metrics/admin-user-hash.js +0 -15
package/lib/Strapi.js
CHANGED
|
@@ -242,14 +242,11 @@ class Strapi {
|
|
|
242
242
|
sendStartupTelemetry() {
|
|
243
243
|
// Emit started event.
|
|
244
244
|
// do not await to avoid slower startup
|
|
245
|
-
// This event is anonymous
|
|
246
245
|
this.telemetry.send('didStartServer', {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
// providers: this.config.installedProviders,
|
|
252
|
-
},
|
|
246
|
+
database: strapi.config.get('database.connection.client'),
|
|
247
|
+
plugins: Object.keys(strapi.plugins),
|
|
248
|
+
// TODO: to add back
|
|
249
|
+
// providers: this.config.installedProviders,
|
|
253
250
|
});
|
|
254
251
|
}
|
|
255
252
|
|
|
@@ -53,12 +53,12 @@ const generateNewPackageJSON = (packageObj) => {
|
|
|
53
53
|
|
|
54
54
|
const sendEvent = async (uuid) => {
|
|
55
55
|
try {
|
|
56
|
-
await fetch('https://analytics.strapi.io/
|
|
56
|
+
await fetch('https://analytics.strapi.io/track', {
|
|
57
57
|
method: 'POST',
|
|
58
58
|
body: JSON.stringify({
|
|
59
59
|
event: 'didOptInTelemetry',
|
|
60
|
+
uuid,
|
|
60
61
|
deviceId: machineID(),
|
|
61
|
-
groupProperties: { projectId: uuid },
|
|
62
62
|
}),
|
|
63
63
|
headers: { 'Content-Type': 'application/json' },
|
|
64
64
|
});
|
|
@@ -28,12 +28,12 @@ const writePackageJSON = async (path, file, spacing) => {
|
|
|
28
28
|
|
|
29
29
|
const sendEvent = async (uuid) => {
|
|
30
30
|
try {
|
|
31
|
-
await fetch('https://analytics.strapi.io/
|
|
31
|
+
await fetch('https://analytics.strapi.io/track', {
|
|
32
32
|
method: 'POST',
|
|
33
33
|
body: JSON.stringify({
|
|
34
34
|
event: 'didOptOutTelemetry',
|
|
35
|
+
uuid,
|
|
35
36
|
deviceId: machineID(),
|
|
36
|
-
groupProperties: { projectId: uuid },
|
|
37
37
|
}),
|
|
38
38
|
headers: { 'Content-Type': 'application/json' },
|
|
39
39
|
});
|
|
@@ -55,12 +55,10 @@ const createTelemetryInstance = (strapi) => {
|
|
|
55
55
|
return sendEvent(
|
|
56
56
|
'didCheckLicense',
|
|
57
57
|
{
|
|
58
|
-
|
|
59
|
-
licenseInfo
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
dependencyHash: hashDep(strapi),
|
|
63
|
-
},
|
|
58
|
+
licenseInfo: {
|
|
59
|
+
...ee.licenseInfo,
|
|
60
|
+
projectHash: hashProject(strapi),
|
|
61
|
+
dependencyHash: hashDep(strapi),
|
|
64
62
|
},
|
|
65
63
|
},
|
|
66
64
|
{
|
|
@@ -19,7 +19,7 @@ const createMiddleware = ({ sendEvent }) => {
|
|
|
19
19
|
|
|
20
20
|
// Send max. 1000 events per day.
|
|
21
21
|
if (_state.counter < 1000) {
|
|
22
|
-
sendEvent('didReceiveRequest', {
|
|
22
|
+
sendEvent('didReceiveRequest', { url: ctx.request.url });
|
|
23
23
|
|
|
24
24
|
// Increase counter.
|
|
25
25
|
_state.counter += 1;
|
|
@@ -10,7 +10,7 @@ const { isUsingTypeScriptSync } = require('@strapi/typescript-utils');
|
|
|
10
10
|
const { env } = require('@strapi/utils');
|
|
11
11
|
const ee = require('../../utils/ee');
|
|
12
12
|
const machineID = require('../../utils/machine-id');
|
|
13
|
-
const
|
|
13
|
+
const stringifyDeep = require('./stringify-deep');
|
|
14
14
|
|
|
15
15
|
const defaultQueryOpts = {
|
|
16
16
|
timeout: 1000,
|
|
@@ -42,49 +42,41 @@ module.exports = (strapi) => {
|
|
|
42
42
|
const serverRootPath = strapi.dirs.app.root;
|
|
43
43
|
const adminRootPath = path.join(strapi.dirs.app.root, 'src', 'admin');
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const anonymousMetadata = {
|
|
46
46
|
environment: strapi.config.environment,
|
|
47
47
|
os: os.type(),
|
|
48
48
|
osPlatform: os.platform(),
|
|
49
49
|
osArch: os.arch(),
|
|
50
50
|
osRelease: os.release(),
|
|
51
51
|
nodeVersion: process.versions.node,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const anonymousGroupProperties = {
|
|
55
52
|
docker: process.env.DOCKER || isDocker(),
|
|
56
53
|
isCI: ciEnv.isCI,
|
|
57
54
|
version: strapi.config.get('info.strapi'),
|
|
58
55
|
projectType: isEE ? 'Enterprise' : 'Community',
|
|
59
56
|
useTypescriptOnServer: isUsingTypeScriptSync(serverRootPath),
|
|
60
57
|
useTypescriptOnAdmin: isUsingTypeScriptSync(adminRootPath),
|
|
61
|
-
projectId: uuid,
|
|
62
58
|
isHostedOnStrapiCloud: env('STRAPI_HOSTING', null) === 'strapi.cloud',
|
|
63
59
|
};
|
|
64
60
|
|
|
65
|
-
addPackageJsonStrapiMetadata(
|
|
61
|
+
addPackageJsonStrapiMetadata(anonymousMetadata, strapi);
|
|
66
62
|
|
|
67
63
|
return async (event, payload = {}, opts = {}) => {
|
|
68
|
-
const userId = generateAdminUserHash();
|
|
69
|
-
|
|
70
64
|
const reqParams = {
|
|
71
65
|
method: 'POST',
|
|
72
66
|
body: JSON.stringify({
|
|
73
67
|
event,
|
|
74
|
-
|
|
68
|
+
uuid,
|
|
75
69
|
deviceId,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
...payload.groupProperties,
|
|
81
|
-
},
|
|
70
|
+
properties: stringifyDeep({
|
|
71
|
+
...payload,
|
|
72
|
+
...anonymousMetadata,
|
|
73
|
+
}),
|
|
82
74
|
}),
|
|
83
75
|
..._.merge({}, defaultQueryOpts, opts),
|
|
84
76
|
};
|
|
85
77
|
|
|
86
78
|
try {
|
|
87
|
-
const res = await fetch(`${ANALYTICS_URI}/
|
|
79
|
+
const res = await fetch(`${ANALYTICS_URI}/track`, reqParams);
|
|
88
80
|
return res.ok;
|
|
89
81
|
} catch (err) {
|
|
90
82
|
return false;
|
package/lib/utils/success.js
CHANGED
|
@@ -17,7 +17,7 @@ try {
|
|
|
17
17
|
process.env.npm_config_global === 'true' ||
|
|
18
18
|
JSON.parse(process.env.npm_config_argv).original.includes('global')
|
|
19
19
|
) {
|
|
20
|
-
fetch('https://analytics.strapi.io/
|
|
20
|
+
fetch('https://analytics.strapi.io/track', {
|
|
21
21
|
method: 'POST',
|
|
22
22
|
body: JSON.stringify({
|
|
23
23
|
event: 'didInstallStrapi',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0-beta.0",
|
|
4
4
|
"description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -80,18 +80,18 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@koa/cors": "3.4.3",
|
|
82
82
|
"@koa/router": "10.1.1",
|
|
83
|
-
"@strapi/admin": "4.
|
|
84
|
-
"@strapi/database": "4.
|
|
85
|
-
"@strapi/generate-new": "4.
|
|
86
|
-
"@strapi/generators": "4.
|
|
87
|
-
"@strapi/logger": "4.
|
|
88
|
-
"@strapi/permissions": "4.
|
|
89
|
-
"@strapi/plugin-content-manager": "4.
|
|
90
|
-
"@strapi/plugin-content-type-builder": "4.
|
|
91
|
-
"@strapi/plugin-email": "4.
|
|
92
|
-
"@strapi/plugin-upload": "4.
|
|
93
|
-
"@strapi/typescript-utils": "4.
|
|
94
|
-
"@strapi/utils": "4.
|
|
83
|
+
"@strapi/admin": "4.6.0-beta.0",
|
|
84
|
+
"@strapi/database": "4.6.0-beta.0",
|
|
85
|
+
"@strapi/generate-new": "4.6.0-beta.0",
|
|
86
|
+
"@strapi/generators": "4.6.0-beta.0",
|
|
87
|
+
"@strapi/logger": "4.6.0-beta.0",
|
|
88
|
+
"@strapi/permissions": "4.6.0-beta.0",
|
|
89
|
+
"@strapi/plugin-content-manager": "4.6.0-beta.0",
|
|
90
|
+
"@strapi/plugin-content-type-builder": "4.6.0-beta.0",
|
|
91
|
+
"@strapi/plugin-email": "4.6.0-beta.0",
|
|
92
|
+
"@strapi/plugin-upload": "4.6.0-beta.0",
|
|
93
|
+
"@strapi/typescript-utils": "4.6.0-beta.0",
|
|
94
|
+
"@strapi/utils": "4.6.0-beta.0",
|
|
95
95
|
"bcryptjs": "2.4.3",
|
|
96
96
|
"boxen": "5.1.2",
|
|
97
97
|
"chalk": "4.1.2",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
"node": ">=14.19.1 <=18.x.x",
|
|
141
141
|
"npm": ">=6.0.0"
|
|
142
142
|
},
|
|
143
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "c0c3365ad801d088a6ab6c4eb95a014078429747"
|
|
144
144
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const crypto = require('crypto');
|
|
4
|
-
|
|
5
|
-
const generateAdminUserHash = () => {
|
|
6
|
-
const ctx = strapi?.requestContext?.get();
|
|
7
|
-
if (!ctx?.state?.user) {
|
|
8
|
-
return '';
|
|
9
|
-
}
|
|
10
|
-
return crypto.createHash('sha256').update(ctx.state.user.email).digest('hex');
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
module.exports = {
|
|
14
|
-
generateAdminUserHash,
|
|
15
|
-
};
|