@strapi/admin 4.1.10-beta.0 → 4.1.10
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/admin/src/assets/images/homepage-logo.png +0 -0
- package/admin/src/components/AutoReloadOverlayBlockerProvider/Blocker.js +2 -6
- package/admin/src/components/GuidedTour/Homepage/index.js +1 -2
- package/admin/src/components/GuidedTour/Modal/components/Stepper.js +1 -2
- package/admin/src/components/LeftMenu/index.js +9 -9
- package/admin/src/components/Notifications/Notification/index.js +2 -2
- package/admin/src/components/Providers/index.js +4 -8
- package/admin/src/components/UnauthenticatedLogo/index.js +2 -4
- package/admin/src/components/UpgradePlanModal/index.js +6 -2
- package/admin/src/content-manager/components/SelectMany/ListItem.js +1 -2
- package/admin/src/content-manager/components/SelectWrapper/index.js +8 -7
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +2 -2
- package/admin/src/content-manager/components/Wysiwyg/Editor.js +2 -0
- package/admin/src/content-manager/pages/App/LeftMenu/index.js +8 -7
- package/admin/src/content-manager/pages/EditSettingsView/components/ComponentFieldList.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/LinkToCTB.js +1 -2
- package/admin/src/content-manager/pages/EditSettingsView/index.js +1 -2
- package/admin/src/content-manager/pages/EditView/Header/index.js +3 -3
- package/admin/src/content-manager/pages/EditView/index.js +1 -4
- package/admin/src/content-manager/pages/ListSettingsView/index.js +1 -2
- package/admin/src/content-manager/pages/ListView/index.js +1 -1
- package/admin/src/content-manager/pages/NoContentType/index.js +1 -2
- package/admin/src/pages/App/index.js +2 -7
- package/admin/src/pages/AuthPage/components/ForgotPassword/index.js +1 -2
- package/admin/src/pages/AuthPage/components/ForgotPasswordSuccess/index.js +1 -1
- package/admin/src/pages/AuthPage/components/Login/BaseLogin.js +1 -2
- package/admin/src/pages/AuthPage/components/Oops/index.js +1 -2
- package/admin/src/pages/AuthPage/components/Register/index.js +12 -12
- package/admin/src/pages/AuthPage/components/ResetPassword/index.js +3 -4
- package/admin/src/pages/HomePage/HomeHeader.js +2 -2
- package/admin/src/pages/HomePage/SocialLinks.js +4 -3
- package/admin/src/pages/InternalErrorPage/index.js +1 -2
- package/admin/src/pages/MarketplacePage/components/PageHeader/index.js +2 -1
- package/admin/src/pages/MarketplacePage/components/PluginCard/index.js +4 -3
- package/admin/src/pages/NotFoundPage/index.js +1 -2
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +5 -4
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/UpdateButton/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +94 -150
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +1 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +1 -1
- package/admin/src/translations/ca.json +699 -0
- package/admin/src/translations/en.json +0 -25
- package/admin/src/translations/languageNativeNames.js +1 -0
- package/admin/src/translations/ru.json +34 -0
- package/build/2077.51485bfb.chunk.js +194 -0
- package/build/6706.7f57cb76.chunk.js +113 -0
- package/build/7589.95466f9a.chunk.js +194 -0
- package/build/{5289.0341db2d.chunk.js → 7757.6d20cfe0.chunk.js} +89 -87
- package/build/8681.96961454.chunk.js +163 -0
- package/build/9066.118ecccd.chunk.js +101 -0
- package/build/9115.abdf4e3b.chunk.js +1 -0
- package/build/9158.60fcd720.chunk.js +503 -0
- package/build/{9298.f97fcef0.chunk.js → 9298.5b5c6ea1.chunk.js} +2 -2
- package/build/9420.cb0b75e8.chunk.js +508 -0
- package/build/Admin-authenticatedApp.ec0f0834.chunk.js +80 -0
- package/build/Admin_homePage.e6d4d977.chunk.js +71 -0
- package/build/Admin_marketplace.25133b64.chunk.js +11 -0
- package/build/Admin_settingsPage.e1dfbb1d.chunk.js +172 -0
- package/build/admin-edit-roles-page.e77a2acc.chunk.js +1 -0
- package/build/admin-edit-users.4c49fe98.chunk.js +11 -0
- package/build/api-tokens-create-page.618b3e40.chunk.js +1 -0
- package/build/api-tokens-edit-page.8d19dfe1.chunk.js +1 -0
- package/build/api-tokens-list-page.274e1c80.chunk.js +15 -0
- package/build/ca-json.0097e443.chunk.js +1 -0
- package/build/content-manager.d6449678.chunk.js +1204 -0
- package/build/{content-type-builder.0d8729ad.chunk.js → content-type-builder.a9554707.chunk.js} +8 -8
- package/build/en-json.3e1a222e.chunk.js +1 -0
- package/build/fb376b132d18bf4522ca.png +0 -0
- package/build/index.html +1 -1
- package/build/main.6dad6108.js +8404 -0
- package/build/ru-json.28147733.chunk.js +1 -0
- package/build/runtime~main.26528011.js +2 -0
- package/build/users-roles-settings-page.28bf6bdc.chunk.js +30 -0
- package/build/{webhook-edit-page.2e6727ab.chunk.js → webhook-edit-page.ca670f8d.chunk.js} +3 -3
- package/build/webhook-list-page.ce1fa92f.chunk.js +133 -0
- package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
- package/package.json +5 -5
- package/server/config/admin-actions.js +0 -14
- package/server/controllers/admin.js +1 -33
- package/server/routes/admin.js +0 -28
- package/server/services/index.js +0 -1
- package/server/services/permission/permissions-manager/sanitize.js +22 -0
- package/server/services/user.js +1 -1
- package/server/utils/index.d.ts +0 -2
- package/admin/src/components/ConfigurationsProvider/index.js +0 -51
- package/admin/src/components/ConfigurationsProvider/reducer.js +0 -28
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +0 -85
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/init.js +0 -13
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/reducer.js +0 -43
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +0 -116
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/reducer.js +0 -28
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js +0 -25
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/AddLogoDialog.js +0 -67
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromComputerForm.js +0 -176
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +0 -82
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/ImageCardAsset.js +0 -51
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/PendingLogoDialog.js +0 -97
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/index.js +0 -85
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/reducer.js +0 -28
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +0 -16
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/constants.js +0 -3
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/getFormData.js +0 -17
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/parseFileMetadatas.js +0 -76
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +0 -17
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +0 -21
- package/build/2481.7ba28142.chunk.js +0 -184
- package/build/2a9e9ef5c4c775bb7c7b.png +0 -0
- package/build/372.3720845e.chunk.js +0 -899
- package/build/497.fbd75558.chunk.js +0 -284
- package/build/6404.80bf5858.chunk.js +0 -506
- package/build/7197.959bbe97.chunk.js +0 -113
- package/build/7589.f3b26345.chunk.js +0 -194
- package/build/9115.318a6841.chunk.js +0 -1
- package/build/9853.d96fbc67.chunk.js +0 -356
- package/build/Admin-authenticatedApp.d8767873.chunk.js +0 -80
- package/build/Admin_homePage.50b6c129.chunk.js +0 -71
- package/build/Admin_marketplace.514ace37.chunk.js +0 -11
- package/build/Admin_settingsPage.0d94a598.chunk.js +0 -180
- package/build/admin-edit-roles-page.06f3d288.chunk.js +0 -1
- package/build/admin-edit-users.6a325cca.chunk.js +0 -11
- package/build/api-tokens-create-page.635e20c8.chunk.js +0 -1
- package/build/api-tokens-edit-page.db07253e.chunk.js +0 -1
- package/build/api-tokens-list-page.346c2149.chunk.js +0 -15
- package/build/content-manager.78e3f35c.chunk.js +0 -1204
- package/build/en-json.ca572384.chunk.js +0 -1
- package/build/main.06f66609.js +0 -7909
- package/build/ru-json.4560906c.chunk.js +0 -1
- package/build/runtime~main.dc1c7ef6.js +0 -2
- package/build/users-roles-settings-page.97d7092d.chunk.js +0 -30
- package/build/webhook-list-page.927257b5.chunk.js +0 -133
- package/server/services/project-settings.js +0 -173
- package/server/validation/project-settings.js +0 -39
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const { pick } = require('lodash');
|
|
5
|
-
|
|
6
|
-
const PROJECT_SETTINGS_FILE_INPUTS = ['menuLogo'];
|
|
7
|
-
const DEFAULT_PROJECT_SETTINGS = {
|
|
8
|
-
menuLogo: null,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const parseFilesData = async files => {
|
|
12
|
-
const formatedFilesData = {};
|
|
13
|
-
|
|
14
|
-
await Promise.all(
|
|
15
|
-
PROJECT_SETTINGS_FILE_INPUTS.map(async inputName => {
|
|
16
|
-
const file = files[inputName];
|
|
17
|
-
|
|
18
|
-
// Skip empty file inputs
|
|
19
|
-
if (!file) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const getStream = () => fs.createReadStream(file.path);
|
|
24
|
-
|
|
25
|
-
// Add formated data for the upload provider
|
|
26
|
-
formatedFilesData[inputName] = strapi
|
|
27
|
-
.plugin('upload')
|
|
28
|
-
.service('upload')
|
|
29
|
-
.formatFileInfo({
|
|
30
|
-
filename: file.name,
|
|
31
|
-
type: file.type,
|
|
32
|
-
size: file.size,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Add image dimensions
|
|
36
|
-
Object.assign(
|
|
37
|
-
formatedFilesData[inputName],
|
|
38
|
-
await strapi
|
|
39
|
-
.plugin('upload')
|
|
40
|
-
.service('image-manipulation')
|
|
41
|
-
.getDimensions({ getStream })
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
// Add file path, and stream
|
|
45
|
-
Object.assign(formatedFilesData[inputName], {
|
|
46
|
-
stream: getStream(),
|
|
47
|
-
tmpPath: file.path,
|
|
48
|
-
provider: strapi.config.get('plugin.upload').provider,
|
|
49
|
-
});
|
|
50
|
-
})
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
return formatedFilesData;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const getProjectSettings = async () => {
|
|
57
|
-
const store = strapi.store({ type: 'core', name: 'admin' });
|
|
58
|
-
const projectSettings = {
|
|
59
|
-
...DEFAULT_PROJECT_SETTINGS,
|
|
60
|
-
...(await store.get({ key: 'project-settings' })),
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// Filter file input fields
|
|
64
|
-
PROJECT_SETTINGS_FILE_INPUTS.forEach(inputName => {
|
|
65
|
-
if (!projectSettings[inputName]) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
projectSettings[inputName] = pick(projectSettings[inputName], [
|
|
70
|
-
'name',
|
|
71
|
-
'url',
|
|
72
|
-
'width',
|
|
73
|
-
'height',
|
|
74
|
-
'ext',
|
|
75
|
-
'size',
|
|
76
|
-
]);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return projectSettings;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const uploadFiles = async (files = {}) => {
|
|
83
|
-
// Call the provider upload function for each file
|
|
84
|
-
return Promise.all(
|
|
85
|
-
Object.values(files)
|
|
86
|
-
.filter(file => file.stream instanceof fs.ReadStream)
|
|
87
|
-
.map(file => strapi.plugin('upload').provider.uploadStream(file))
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const deleteOldFiles = async ({ previousSettings, newSettings }) => {
|
|
92
|
-
return Promise.all(
|
|
93
|
-
PROJECT_SETTINGS_FILE_INPUTS.map(async inputName => {
|
|
94
|
-
// Skip if the store doesn't contain project settings
|
|
95
|
-
if (!previousSettings) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Skip if there was no previous file
|
|
100
|
-
if (!previousSettings[inputName]) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Skip if the file was not changed
|
|
105
|
-
if (
|
|
106
|
-
newSettings[inputName] &&
|
|
107
|
-
previousSettings[inputName].hash === newSettings[inputName].hash
|
|
108
|
-
) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Skip if the file was not uploaded with the current provider
|
|
113
|
-
if (strapi.config.get('plugin.upload').provider !== previousSettings[inputName].provider) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// There was a previous file and an new file was uploaded
|
|
118
|
-
// Remove the previous file
|
|
119
|
-
strapi.plugin('upload').provider.delete(previousSettings[inputName]);
|
|
120
|
-
})
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const updateProjectSettings = async newSettings => {
|
|
125
|
-
const store = strapi.store({ type: 'core', name: 'admin' });
|
|
126
|
-
const previousSettings = await store.get({ key: 'project-settings' });
|
|
127
|
-
const files = pick(newSettings, PROJECT_SETTINGS_FILE_INPUTS);
|
|
128
|
-
|
|
129
|
-
await uploadFiles(files);
|
|
130
|
-
|
|
131
|
-
PROJECT_SETTINGS_FILE_INPUTS.forEach(inputName => {
|
|
132
|
-
// If the user input exists but is not a formdata "file" remove it
|
|
133
|
-
if (newSettings[inputName] !== undefined && !(typeof newSettings[inputName] === 'object')) {
|
|
134
|
-
newSettings[inputName] = null;
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// If the user input is undefined reuse previous setting (do not update field)
|
|
139
|
-
if (!newSettings[inputName]) {
|
|
140
|
-
newSettings[inputName] = previousSettings[inputName];
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Update the file
|
|
145
|
-
newSettings[inputName] = pick(newSettings[inputName], [
|
|
146
|
-
'name',
|
|
147
|
-
'hash',
|
|
148
|
-
'url',
|
|
149
|
-
'width',
|
|
150
|
-
'height',
|
|
151
|
-
'ext',
|
|
152
|
-
'size',
|
|
153
|
-
'provider',
|
|
154
|
-
]);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// No await to proceed asynchronously
|
|
158
|
-
deleteOldFiles({ previousSettings, newSettings });
|
|
159
|
-
|
|
160
|
-
await store.set({
|
|
161
|
-
key: 'project-settings',
|
|
162
|
-
value: { ...previousSettings, ...newSettings },
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
return getProjectSettings();
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
module.exports = {
|
|
169
|
-
deleteOldFiles,
|
|
170
|
-
parseFilesData,
|
|
171
|
-
getProjectSettings,
|
|
172
|
-
updateProjectSettings,
|
|
173
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { yup, validateYupSchemaSync } = require('@strapi/utils');
|
|
4
|
-
|
|
5
|
-
const MAX_IMAGE_WIDTH = 750;
|
|
6
|
-
const MAX_IMAGE_HEIGHT = MAX_IMAGE_WIDTH;
|
|
7
|
-
const MAX_IMAGE_FILE_SIZE = 1024 * 1024; // 1Mo
|
|
8
|
-
const ALLOWED_IMAGE_FILE_TYPES = ['image/jpeg', 'image/png', 'image/svg+xml'];
|
|
9
|
-
|
|
10
|
-
const updateProjectSettings = yup
|
|
11
|
-
.object({
|
|
12
|
-
menuLogo: yup.string(),
|
|
13
|
-
})
|
|
14
|
-
.noUnknown();
|
|
15
|
-
|
|
16
|
-
const updateProjectSettingsFiles = yup
|
|
17
|
-
.object({
|
|
18
|
-
menuLogo: yup.object({
|
|
19
|
-
name: yup.string(),
|
|
20
|
-
type: yup.string().oneOf(ALLOWED_IMAGE_FILE_TYPES),
|
|
21
|
-
size: yup.number().max(MAX_IMAGE_FILE_SIZE),
|
|
22
|
-
}),
|
|
23
|
-
})
|
|
24
|
-
.noUnknown();
|
|
25
|
-
|
|
26
|
-
const updateProjectSettingsImagesDimensions = yup.object({
|
|
27
|
-
menuLogo: yup.object({
|
|
28
|
-
width: yup.number().max(MAX_IMAGE_WIDTH),
|
|
29
|
-
height: yup.number().max(MAX_IMAGE_HEIGHT),
|
|
30
|
-
}),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
module.exports = {
|
|
34
|
-
validateUpdateProjectSettings: validateYupSchemaSync(updateProjectSettings),
|
|
35
|
-
validateUpdateProjectSettingsFiles: validateYupSchemaSync(updateProjectSettingsFiles),
|
|
36
|
-
validateUpdateProjectSettingsImagesDimensions: validateYupSchemaSync(
|
|
37
|
-
updateProjectSettingsImagesDimensions
|
|
38
|
-
),
|
|
39
|
-
};
|