@strapi/strapi 4.1.6-alpha.1 → 4.1.8
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/bin/strapi.js
CHANGED
|
@@ -227,4 +227,10 @@ program
|
|
|
227
227
|
.description('List all the application controllers')
|
|
228
228
|
.action(getLocalScript('controllers/list'));
|
|
229
229
|
|
|
230
|
+
// `$ strapi opt-out-telemetry`
|
|
231
|
+
program
|
|
232
|
+
.command('telemetry:disable')
|
|
233
|
+
.description('Stop Strapi from sending anonymous telemetry and metadata')
|
|
234
|
+
.action(getLocalScript('opt-out-telemetry'));
|
|
235
|
+
|
|
230
236
|
program.parseAsync(process.argv);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { resolve } = require('path');
|
|
4
|
+
const fse = require('fs-extra');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
const fetch = require('node-fetch');
|
|
7
|
+
const machineID = require('../utils/machine-id');
|
|
8
|
+
|
|
9
|
+
const readPackageJSON = async path => {
|
|
10
|
+
try {
|
|
11
|
+
const packageObj = await fse.readJson(path);
|
|
12
|
+
const uuid = packageObj.strapi ? packageObj.strapi.uuid : null;
|
|
13
|
+
|
|
14
|
+
return { uuid, packageObj };
|
|
15
|
+
} catch (err) {
|
|
16
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const writePackageJSON = async (path, file, spacing) => {
|
|
21
|
+
try {
|
|
22
|
+
await fse.writeJson(path, file, { spaces: spacing });
|
|
23
|
+
return true;
|
|
24
|
+
} catch (err) {
|
|
25
|
+
console.error(`${chalk.red('Error')}: ${err.message}`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const sendEvent = async uuid => {
|
|
30
|
+
try {
|
|
31
|
+
await fetch('https://analytics.strapi.io/track', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: JSON.stringify({
|
|
34
|
+
event: 'didOptOutTelemetry',
|
|
35
|
+
uuid,
|
|
36
|
+
deviceId: machineID(),
|
|
37
|
+
}),
|
|
38
|
+
headers: { 'Content-Type': 'application/json' },
|
|
39
|
+
});
|
|
40
|
+
} catch (e) {
|
|
41
|
+
//...
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = async function optOutTelemetry() {
|
|
46
|
+
const packageJSONPath = resolve(process.cwd(), 'package.json');
|
|
47
|
+
const exists = await fse.pathExists(packageJSONPath);
|
|
48
|
+
|
|
49
|
+
if (!exists) {
|
|
50
|
+
console.log(`${chalk.yellow('Warning')}: could not find package.json`);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { uuid, packageObj } = await readPackageJSON(packageJSONPath);
|
|
55
|
+
|
|
56
|
+
if ((packageObj.strapi && packageObj.strapi.telemetryDisabled) || !uuid) {
|
|
57
|
+
console.log(`${chalk.yellow('Warning:')} telemetry is already disabled`);
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const updatedPackageJSON = {
|
|
62
|
+
...packageObj,
|
|
63
|
+
strapi: {
|
|
64
|
+
...packageObj.strapi,
|
|
65
|
+
telemetryDisabled: true,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const write = await writePackageJSON(packageJSONPath, updatedPackageJSON, 2);
|
|
70
|
+
|
|
71
|
+
if (!write) {
|
|
72
|
+
console.log(
|
|
73
|
+
`${chalk.yellow(
|
|
74
|
+
'Warning'
|
|
75
|
+
)}: There has been an error, please set "telemetryDisabled": true in the "strapi" object of your package.json manually.`
|
|
76
|
+
);
|
|
77
|
+
process.exit(0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
await sendEvent(uuid);
|
|
81
|
+
console.log(`${chalk.green('Successfully opted out of Strapi telemetry')}`);
|
|
82
|
+
process.exit(0);
|
|
83
|
+
};
|
|
@@ -19,7 +19,9 @@ const defaultConfig = {
|
|
|
19
19
|
module.exports = (userConfig, { strapi }) => {
|
|
20
20
|
const keys = strapi.server.app.keys;
|
|
21
21
|
if (!isArray(keys) || isEmpty(keys) || keys.some(isEmpty)) {
|
|
22
|
-
throw new Error(
|
|
22
|
+
throw new Error(
|
|
23
|
+
`App keys are required. Please set app.keys in config/server.js (ex: keys: ['myKeyA', 'myKeyB'])`
|
|
24
|
+
);
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
const config = defaultsDeep(defaultConfig, userConfig);
|
|
@@ -24,7 +24,9 @@ const LIMITED_EVENTS = [
|
|
|
24
24
|
|
|
25
25
|
const createTelemetryInstance = strapi => {
|
|
26
26
|
const uuid = strapi.config.get('uuid');
|
|
27
|
-
const
|
|
27
|
+
const telemetryDisabled = strapi.config.get('packageJsonStrapi.telemetryDisabled');
|
|
28
|
+
const isDisabled =
|
|
29
|
+
!uuid || isTruthy(process.env.STRAPI_TELEMETRY_DISABLED) || isTruthy(telemetryDisabled);
|
|
28
30
|
|
|
29
31
|
const crons = [];
|
|
30
32
|
const sender = createSender(strapi);
|
|
@@ -30,7 +30,7 @@ const healthCheck = async ctx => {
|
|
|
30
30
|
const createServer = strapi => {
|
|
31
31
|
const app = createKoaApp({
|
|
32
32
|
proxy: strapi.config.get('server.proxy'),
|
|
33
|
-
keys:
|
|
33
|
+
keys: strapi.config.get('server.app.keys'),
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
const router = new Router();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.8",
|
|
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,16 +80,16 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@koa/cors": "3.1.0",
|
|
82
82
|
"@koa/router": "10.1.1",
|
|
83
|
-
"@strapi/admin": "4.1.
|
|
84
|
-
"@strapi/database": "4.1.
|
|
85
|
-
"@strapi/generate-new": "4.1.
|
|
86
|
-
"@strapi/generators": "4.1.
|
|
87
|
-
"@strapi/logger": "4.1.
|
|
88
|
-
"@strapi/plugin-content-manager": "4.1.
|
|
89
|
-
"@strapi/plugin-content-type-builder": "4.1.
|
|
90
|
-
"@strapi/plugin-email": "4.1.
|
|
91
|
-
"@strapi/plugin-upload": "4.1.
|
|
92
|
-
"@strapi/utils": "4.1.
|
|
83
|
+
"@strapi/admin": "4.1.8",
|
|
84
|
+
"@strapi/database": "4.1.8",
|
|
85
|
+
"@strapi/generate-new": "4.1.8",
|
|
86
|
+
"@strapi/generators": "4.1.8",
|
|
87
|
+
"@strapi/logger": "4.1.8",
|
|
88
|
+
"@strapi/plugin-content-manager": "4.1.8",
|
|
89
|
+
"@strapi/plugin-content-type-builder": "4.1.8",
|
|
90
|
+
"@strapi/plugin-email": "4.1.8",
|
|
91
|
+
"@strapi/plugin-upload": "4.1.8",
|
|
92
|
+
"@strapi/utils": "4.1.8",
|
|
93
93
|
"bcryptjs": "2.4.3",
|
|
94
94
|
"boxen": "5.1.2",
|
|
95
95
|
"chalk": "4.1.2",
|
|
@@ -136,5 +136,5 @@
|
|
|
136
136
|
"node": ">=12.22.0 <=16.x.x",
|
|
137
137
|
"npm": ">=6.0.0"
|
|
138
138
|
},
|
|
139
|
-
"gitHead": "
|
|
139
|
+
"gitHead": "3f204a0a48d4e1f6dca21683eb6c63041b2f6626"
|
|
140
140
|
}
|