@cloudimage-strapi/content-plugin 1.0.2 → 1.0.5

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.
Files changed (40) hide show
  1. package/README.md +7 -7
  2. package/dist/_chunks/App-BmZyLUWk.mjs +138 -0
  3. package/dist/_chunks/App-CRbNvJDt.js +138 -0
  4. package/dist/_chunks/en-DUVjg0jJ.js +16 -0
  5. package/dist/_chunks/en-r7lu9xMg.mjs +16 -0
  6. package/dist/_chunks/fr-DTrzyr9o.js +16 -0
  7. package/dist/_chunks/fr-Ge-jvwxL.mjs +16 -0
  8. package/dist/_chunks/index-4zkw0zS1.mjs +72 -0
  9. package/dist/_chunks/index-DfCnchyr.js +71 -0
  10. package/dist/admin/index.js +3 -0
  11. package/dist/admin/index.mjs +4 -0
  12. package/dist/server/index.js +237 -0
  13. package/dist/server/index.mjs +238 -0
  14. package/package.json +69 -32
  15. package/LICENSE +0 -21
  16. package/admin/src/components/Initializer/index.js +0 -26
  17. package/admin/src/components/PluginIcon/index.js +0 -12
  18. package/admin/src/index.js +0 -63
  19. package/admin/src/pages/App/index.js +0 -25
  20. package/admin/src/pages/HomePage/index.js +0 -199
  21. package/admin/src/pluginId.js +0 -5
  22. package/admin/src/translations/en.json +0 -1
  23. package/admin/src/translations/fr.json +0 -1
  24. package/admin/src/utils/axiosInstance.js +0 -40
  25. package/admin/src/utils/getTrad.js +0 -5
  26. package/server/bootstrap.js +0 -25
  27. package/server/config/index.js +0 -6
  28. package/server/content-types/index.js +0 -3
  29. package/server/controllers/index.js +0 -7
  30. package/server/controllers/scaleflex-cloudimage.js +0 -40
  31. package/server/destroy.js +0 -5
  32. package/server/index.js +0 -25
  33. package/server/middlewares/index.js +0 -3
  34. package/server/policies/index.js +0 -3
  35. package/server/register.js +0 -65
  36. package/server/routes/index.js +0 -56
  37. package/server/services/index.js +0 -7
  38. package/server/services/scaleflex-cloudimage.js +0 -172
  39. package/strapi-admin.js +0 -3
  40. package/strapi-server.js +0 -3
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ const bootstrap = ({ strapi }) => {
3
+ };
4
+ const destroy = ({ strapi }) => {
5
+ };
6
+ const register = ({ strapi }) => {
7
+ };
8
+ const config = {
9
+ default: {},
10
+ validator() {
11
+ }
12
+ };
13
+ const contentTypes = {};
14
+ const controller = ({ strapi }) => ({
15
+ async index(ctx) {
16
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").getWelcomeMessage();
17
+ },
18
+ async getConfig(ctx) {
19
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").getConfig();
20
+ },
21
+ async updateConfig(ctx) {
22
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").updateConfig(ctx);
23
+ },
24
+ async checkV7(ctx) {
25
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").checkV7(ctx);
26
+ },
27
+ async countUpdate(ctx) {
28
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").countUpdate(ctx);
29
+ },
30
+ async updateMedia(ctx) {
31
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").updateMedia(ctx);
32
+ }
33
+ });
34
+ const controllers = {
35
+ controller
36
+ };
37
+ const middlewares = {};
38
+ const policies = {};
39
+ const routes = [
40
+ {
41
+ method: "GET",
42
+ path: "/",
43
+ handler: "controller.index",
44
+ config: {
45
+ policies: [],
46
+ auth: false
47
+ }
48
+ },
49
+ {
50
+ method: "GET",
51
+ path: "/config",
52
+ handler: "controller.getConfig",
53
+ config: {
54
+ policies: [],
55
+ auth: false
56
+ }
57
+ },
58
+ {
59
+ method: "PUT",
60
+ path: "/update-config",
61
+ handler: "controller.updateConfig",
62
+ config: {
63
+ policies: [],
64
+ auth: false
65
+ }
66
+ },
67
+ {
68
+ method: "GET",
69
+ path: "/is-v7",
70
+ handler: "controller.checkV7",
71
+ config: {
72
+ policies: [],
73
+ auth: false
74
+ }
75
+ },
76
+ {
77
+ method: "GET",
78
+ path: "/count-update",
79
+ handler: "controller.countUpdate",
80
+ config: {
81
+ policies: [],
82
+ auth: false
83
+ }
84
+ },
85
+ {
86
+ method: "PUT",
87
+ path: "/update-media",
88
+ handler: "controller.updateMedia",
89
+ config: {
90
+ policies: [],
91
+ auth: false
92
+ }
93
+ }
94
+ ];
95
+ const PLUGIN_ID = "cloudimage-by-scaleflex";
96
+ const service = ({ strapi }) => ({
97
+ getWelcomeMessage() {
98
+ return "Thank you for using Cloudimage by Scaleflex";
99
+ },
100
+ getPluginStore() {
101
+ return strapi.store({
102
+ environment: strapi.config.environment,
103
+ type: "plugin",
104
+ name: PLUGIN_ID
105
+ });
106
+ },
107
+ async getConfig() {
108
+ const pluginStore = this.getPluginStore();
109
+ let config2 = {
110
+ domain: "",
111
+ isV7: ""
112
+ };
113
+ const storedConfig = await pluginStore.get({ key: "options" });
114
+ if (storedConfig) {
115
+ config2 = storedConfig;
116
+ }
117
+ return config2;
118
+ },
119
+ async updateConfig(ctx) {
120
+ const pluginStore = this.getPluginStore();
121
+ await pluginStore.set({
122
+ key: "options",
123
+ value: ctx.request.body
124
+ });
125
+ const config2 = await pluginStore.get({ key: "options" });
126
+ return config2;
127
+ },
128
+ async checkV7(ctx) {
129
+ let domain = ctx.request.query.domain;
130
+ let response = {};
131
+ let responseV7 = {};
132
+ try {
133
+ response = await fetch(`https://${domain}/http://sample.li/blank.png`);
134
+ responseV7 = await fetch(`https://${domain}/v7/http://sample.li/blank.png`);
135
+ } catch (error) {
136
+ console.error(error);
137
+ return { domainExists: false };
138
+ }
139
+ let isValid = response.status === 200 && !response.headers.get("x-hexa-missingbehavior");
140
+ let isV7Valid = responseV7.status === 200 && !responseV7.headers.get("x-hexa-missingbehavior");
141
+ if (isValid && !isV7Valid) {
142
+ return { isSuccess: true, domainExists: true, isV7: false };
143
+ } else if (!isValid && isV7Valid) {
144
+ return { isSuccess: true, domainExists: true, isV7: true };
145
+ } else {
146
+ return { isSuccess: false, domainExists: true };
147
+ }
148
+ },
149
+ async countUpdate(ctx) {
150
+ let pluginStore = this.getPluginStore();
151
+ let pluginConfig = await pluginStore.get({ key: "options" });
152
+ let domain = pluginConfig.domain;
153
+ let media = await strapi.entityService.findMany("plugin::upload.file", {
154
+ filters: {
155
+ $and: [
156
+ {
157
+ url: { $notContains: domain }
158
+ },
159
+ {
160
+ mime: { $contains: "image" }
161
+ },
162
+ {
163
+ provider: { $notContains: "filerobot" }
164
+ }
165
+ ]
166
+ }
167
+ });
168
+ return media.length;
169
+ },
170
+ async updateMedia(ctx) {
171
+ let baseUrl = strapi.config.get("server.url");
172
+ let pluginStore = this.getPluginStore();
173
+ let pluginConfig = await pluginStore.get({ key: "options" });
174
+ let domain = pluginConfig.domain;
175
+ let media = await strapi.entityService.findMany("plugin::upload.file", {
176
+ filters: {
177
+ $and: [
178
+ {
179
+ url: { $notContains: domain }
180
+ },
181
+ {
182
+ mime: { $contains: "image" }
183
+ },
184
+ {
185
+ provider: { $notContains: "filerobot" }
186
+ }
187
+ ]
188
+ }
189
+ });
190
+ return Promise.all(media.map((item, index2) => {
191
+ let prepUrl = "";
192
+ if (/^https?:\/\//.test(item.url)) {
193
+ prepUrl = item.url.replace(/^https?:\/\//, "");
194
+ } else {
195
+ prepUrl = `${baseUrl}${item.url}`.replace(/^https?:\/\//, "");
196
+ }
197
+ let ciUrl = `https://${pluginConfig.domain}${pluginConfig.isV7 ? "/v7" : ""}/${prepUrl}`;
198
+ return strapi.entityService.update("plugin::upload.file", item.id, {
199
+ data: {
200
+ url: ciUrl,
201
+ formats: null
202
+ }
203
+ }).then(function(result) {
204
+ return { success: true, result };
205
+ }).catch(function(error) {
206
+ return { success: false, error: error.message };
207
+ });
208
+ })).then(function(results) {
209
+ let successCount = 0;
210
+ results.forEach((result, index2) => {
211
+ if (result.success) {
212
+ successCount++;
213
+ }
214
+ });
215
+ return { response: `${successCount} / ${results.length}` };
216
+ }).catch(function(error) {
217
+ console.dir(error.message);
218
+ return { response: false };
219
+ });
220
+ }
221
+ });
222
+ const services = {
223
+ service
224
+ };
225
+ const index = {
226
+ bootstrap,
227
+ destroy,
228
+ register,
229
+ config,
230
+ controllers,
231
+ contentTypes,
232
+ middlewares,
233
+ policies,
234
+ routes,
235
+ services
236
+ };
237
+ module.exports = index;
@@ -0,0 +1,238 @@
1
+ const bootstrap = ({ strapi }) => {
2
+ };
3
+ const destroy = ({ strapi }) => {
4
+ };
5
+ const register = ({ strapi }) => {
6
+ };
7
+ const config = {
8
+ default: {},
9
+ validator() {
10
+ }
11
+ };
12
+ const contentTypes = {};
13
+ const controller = ({ strapi }) => ({
14
+ async index(ctx) {
15
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").getWelcomeMessage();
16
+ },
17
+ async getConfig(ctx) {
18
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").getConfig();
19
+ },
20
+ async updateConfig(ctx) {
21
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").updateConfig(ctx);
22
+ },
23
+ async checkV7(ctx) {
24
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").checkV7(ctx);
25
+ },
26
+ async countUpdate(ctx) {
27
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").countUpdate(ctx);
28
+ },
29
+ async updateMedia(ctx) {
30
+ ctx.body = await strapi.plugin("cloudimage-by-scaleflex").service("service").updateMedia(ctx);
31
+ }
32
+ });
33
+ const controllers = {
34
+ controller
35
+ };
36
+ const middlewares = {};
37
+ const policies = {};
38
+ const routes = [
39
+ {
40
+ method: "GET",
41
+ path: "/",
42
+ handler: "controller.index",
43
+ config: {
44
+ policies: [],
45
+ auth: false
46
+ }
47
+ },
48
+ {
49
+ method: "GET",
50
+ path: "/config",
51
+ handler: "controller.getConfig",
52
+ config: {
53
+ policies: [],
54
+ auth: false
55
+ }
56
+ },
57
+ {
58
+ method: "PUT",
59
+ path: "/update-config",
60
+ handler: "controller.updateConfig",
61
+ config: {
62
+ policies: [],
63
+ auth: false
64
+ }
65
+ },
66
+ {
67
+ method: "GET",
68
+ path: "/is-v7",
69
+ handler: "controller.checkV7",
70
+ config: {
71
+ policies: [],
72
+ auth: false
73
+ }
74
+ },
75
+ {
76
+ method: "GET",
77
+ path: "/count-update",
78
+ handler: "controller.countUpdate",
79
+ config: {
80
+ policies: [],
81
+ auth: false
82
+ }
83
+ },
84
+ {
85
+ method: "PUT",
86
+ path: "/update-media",
87
+ handler: "controller.updateMedia",
88
+ config: {
89
+ policies: [],
90
+ auth: false
91
+ }
92
+ }
93
+ ];
94
+ const PLUGIN_ID = "cloudimage-by-scaleflex";
95
+ const service = ({ strapi }) => ({
96
+ getWelcomeMessage() {
97
+ return "Thank you for using Cloudimage by Scaleflex";
98
+ },
99
+ getPluginStore() {
100
+ return strapi.store({
101
+ environment: strapi.config.environment,
102
+ type: "plugin",
103
+ name: PLUGIN_ID
104
+ });
105
+ },
106
+ async getConfig() {
107
+ const pluginStore = this.getPluginStore();
108
+ let config2 = {
109
+ domain: "",
110
+ isV7: ""
111
+ };
112
+ const storedConfig = await pluginStore.get({ key: "options" });
113
+ if (storedConfig) {
114
+ config2 = storedConfig;
115
+ }
116
+ return config2;
117
+ },
118
+ async updateConfig(ctx) {
119
+ const pluginStore = this.getPluginStore();
120
+ await pluginStore.set({
121
+ key: "options",
122
+ value: ctx.request.body
123
+ });
124
+ const config2 = await pluginStore.get({ key: "options" });
125
+ return config2;
126
+ },
127
+ async checkV7(ctx) {
128
+ let domain = ctx.request.query.domain;
129
+ let response = {};
130
+ let responseV7 = {};
131
+ try {
132
+ response = await fetch(`https://${domain}/http://sample.li/blank.png`);
133
+ responseV7 = await fetch(`https://${domain}/v7/http://sample.li/blank.png`);
134
+ } catch (error) {
135
+ console.error(error);
136
+ return { domainExists: false };
137
+ }
138
+ let isValid = response.status === 200 && !response.headers.get("x-hexa-missingbehavior");
139
+ let isV7Valid = responseV7.status === 200 && !responseV7.headers.get("x-hexa-missingbehavior");
140
+ if (isValid && !isV7Valid) {
141
+ return { isSuccess: true, domainExists: true, isV7: false };
142
+ } else if (!isValid && isV7Valid) {
143
+ return { isSuccess: true, domainExists: true, isV7: true };
144
+ } else {
145
+ return { isSuccess: false, domainExists: true };
146
+ }
147
+ },
148
+ async countUpdate(ctx) {
149
+ let pluginStore = this.getPluginStore();
150
+ let pluginConfig = await pluginStore.get({ key: "options" });
151
+ let domain = pluginConfig.domain;
152
+ let media = await strapi.entityService.findMany("plugin::upload.file", {
153
+ filters: {
154
+ $and: [
155
+ {
156
+ url: { $notContains: domain }
157
+ },
158
+ {
159
+ mime: { $contains: "image" }
160
+ },
161
+ {
162
+ provider: { $notContains: "filerobot" }
163
+ }
164
+ ]
165
+ }
166
+ });
167
+ return media.length;
168
+ },
169
+ async updateMedia(ctx) {
170
+ let baseUrl = strapi.config.get("server.url");
171
+ let pluginStore = this.getPluginStore();
172
+ let pluginConfig = await pluginStore.get({ key: "options" });
173
+ let domain = pluginConfig.domain;
174
+ let media = await strapi.entityService.findMany("plugin::upload.file", {
175
+ filters: {
176
+ $and: [
177
+ {
178
+ url: { $notContains: domain }
179
+ },
180
+ {
181
+ mime: { $contains: "image" }
182
+ },
183
+ {
184
+ provider: { $notContains: "filerobot" }
185
+ }
186
+ ]
187
+ }
188
+ });
189
+ return Promise.all(media.map((item, index2) => {
190
+ let prepUrl = "";
191
+ if (/^https?:\/\//.test(item.url)) {
192
+ prepUrl = item.url.replace(/^https?:\/\//, "");
193
+ } else {
194
+ prepUrl = `${baseUrl}${item.url}`.replace(/^https?:\/\//, "");
195
+ }
196
+ let ciUrl = `https://${pluginConfig.domain}${pluginConfig.isV7 ? "/v7" : ""}/${prepUrl}`;
197
+ return strapi.entityService.update("plugin::upload.file", item.id, {
198
+ data: {
199
+ url: ciUrl,
200
+ formats: null
201
+ }
202
+ }).then(function(result) {
203
+ return { success: true, result };
204
+ }).catch(function(error) {
205
+ return { success: false, error: error.message };
206
+ });
207
+ })).then(function(results) {
208
+ let successCount = 0;
209
+ results.forEach((result, index2) => {
210
+ if (result.success) {
211
+ successCount++;
212
+ }
213
+ });
214
+ return { response: `${successCount} / ${results.length}` };
215
+ }).catch(function(error) {
216
+ console.dir(error.message);
217
+ return { response: false };
218
+ });
219
+ }
220
+ });
221
+ const services = {
222
+ service
223
+ };
224
+ const index = {
225
+ bootstrap,
226
+ destroy,
227
+ register,
228
+ config,
229
+ controllers,
230
+ contentTypes,
231
+ middlewares,
232
+ policies,
233
+ routes,
234
+ services
235
+ };
236
+ export {
237
+ index as default
238
+ };
package/package.json CHANGED
@@ -1,32 +1,69 @@
1
- {
2
- "name": "@cloudimage-strapi/content-plugin",
3
- "version": "1.0.2",
4
- "description": "Strapi v4 plugin for Filerobot by Scaleflex",
5
- "strapi": {
6
- "name": "scaleflex-cloudimage",
7
- "description": "Scaleflex Cloudimage",
8
- "kind": "plugin",
9
- "displayName": "Scaleflex Cloudimage"
10
- },
11
- "peerDependencies": {
12
- "@strapi/strapi": "^4.3.0"
13
- },
14
- "author": {
15
- "name": "Scaleflex"
16
- },
17
- "maintainers": [
18
- {
19
- "name": "Ruslan Aliyev"
20
- }
21
- ],
22
- "engines": {
23
- "node": ">=12.x. <=16.x.x",
24
- "npm": ">=6.0.0"
25
- },
26
- "license": "MIT",
27
- "keywords": [
28
- "scaleflex",
29
- "filerobot",
30
- "strapi"
31
- ]
32
- }
1
+ {
2
+ "version": "1.0.5",
3
+ "keywords": [
4
+ "scaleflex",
5
+ "cloudimage",
6
+ "strapi"
7
+ ],
8
+ "type": "commonjs",
9
+ "exports": {
10
+ "./package.json": "./package.json",
11
+ "./strapi-admin": {
12
+ "source": "./admin/src/index.js",
13
+ "import": "./dist/admin/index.mjs",
14
+ "require": "./dist/admin/index.js",
15
+ "default": "./dist/admin/index.js"
16
+ },
17
+ "./strapi-server": {
18
+ "source": "./server/src/index.js",
19
+ "import": "./dist/server/index.mjs",
20
+ "require": "./dist/server/index.js",
21
+ "default": "./dist/server/index.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "scripts": {
28
+ "build": "strapi-plugin build",
29
+ "watch": "strapi-plugin watch",
30
+ "watch:link": "strapi-plugin watch:link",
31
+ "verify": "strapi-plugin verify"
32
+ },
33
+ "dependencies": {
34
+ "@strapi/design-system": "^2.0.0-rc.30",
35
+ "@strapi/icons": "^2.0.0-rc.30",
36
+ "react-intl": "^7.1.14",
37
+ "react-konva": "^18.2.10"
38
+ },
39
+ "devDependencies": {
40
+ "@strapi/sdk-plugin": "^5.3.2",
41
+ "@strapi/strapi": "^5.33.0",
42
+ "prettier": "^3.7.4",
43
+ "react": "^18.3.1",
44
+ "react-dom": "^18.3.1",
45
+ "react-router-dom": "^6.30.2",
46
+ "styled-components": "^6.1.19"
47
+ },
48
+ "peerDependencies": {
49
+ "@strapi/sdk-plugin": "^5.3.2",
50
+ "@strapi/strapi": "^5.33.0",
51
+ "react": "^18.3.1",
52
+ "react-dom": "^18.3.1",
53
+ "react-router-dom": "^6.30.2",
54
+ "styled-components": "^6.1.19"
55
+ },
56
+ "strapi": {
57
+ "kind": "plugin",
58
+ "name": "cloudimage-by-scaleflex",
59
+ "displayName": "Cloudimage",
60
+ "description": "The easiest way to resize, compress, optimize and distribute your images lightning fast to your users on any device via CDN."
61
+ },
62
+ "name": "@cloudimage-strapi/content-plugin",
63
+ "description": "Cloudimage plugin from Scaleflex for Strapi",
64
+ "license": "MIT",
65
+ "author": "Scaleflex <register@scaleflex.com> (https://www.scaleflex.com)",
66
+ "maintainers": [
67
+ "Scaleflex <plugins@scaleflex.com>"
68
+ ]
69
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 scaleflex
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,26 +0,0 @@
1
- /**
2
- *
3
- * Initializer
4
- *
5
- */
6
-
7
- import { useEffect, useRef } from 'react';
8
- import PropTypes from 'prop-types';
9
- import pluginId from '../../pluginId';
10
-
11
- const Initializer = ({ setPlugin }) => {
12
- const ref = useRef();
13
- ref.current = setPlugin;
14
-
15
- useEffect(() => {
16
- ref.current(pluginId);
17
- }, []);
18
-
19
- return null;
20
- };
21
-
22
- Initializer.propTypes = {
23
- setPlugin: PropTypes.func.isRequired,
24
- };
25
-
26
- export default Initializer;
@@ -1,12 +0,0 @@
1
- /**
2
- *
3
- * PluginIcon
4
- *
5
- */
6
-
7
- import React from 'react';
8
- import Puzzle from '@strapi/icons/Puzzle';
9
-
10
- const PluginIcon = () => <img src="https://assets.scaleflex.com/Marketing/Logos/Cloudimage+Logos/Favicon/CLOUDIMAGE+favicon.ico" width="16" height="16" />;
11
-
12
- export default PluginIcon;
@@ -1,63 +0,0 @@
1
- import { prefixPluginTranslations } from '@strapi/helper-plugin';
2
- import pluginPkg from '../../package.json';
3
- import pluginId from './pluginId';
4
- import Initializer from './components/Initializer';
5
- import PluginIcon from './components/PluginIcon';
6
-
7
- const name = "scaleflex-cloudimage";
8
-
9
- export default {
10
- register(app) {
11
- app.addMenuLink({
12
- to: `/plugins/${pluginId}`,
13
- icon: PluginIcon,
14
- intlLabel: {
15
- id: `${pluginId}.plugin.name`,
16
- defaultMessage: 'Cloudimage by Scaleflex',
17
- },
18
- Component: async () => {
19
- const component = await import(/* webpackChunkName: "[request]" */ './pages/App');
20
-
21
- return component;
22
- },
23
- permissions: [
24
- // Uncomment to set the permissions of the plugin here
25
- // {
26
- // action: '', // the action name should be plugin::plugin-name.actionType
27
- // subject: null,
28
- // },
29
- ],
30
- });
31
- app.registerPlugin({
32
- id: pluginId,
33
- initializer: Initializer,
34
- isReady: false,
35
- name,
36
- });
37
- },
38
-
39
- bootstrap(app) {},
40
- async registerTrads({ locales }) {
41
- const importedTrads = await Promise.all(
42
- locales.map(locale => {
43
- return import(
44
- /* webpackChunkName: "translation-[request]" */ `./translations/${locale}.json`
45
- )
46
- .then(({ default: data }) => {
47
- return {
48
- data: prefixPluginTranslations(data, pluginId),
49
- locale,
50
- };
51
- })
52
- .catch(() => {
53
- return {
54
- data: {},
55
- locale,
56
- };
57
- });
58
- })
59
- );
60
-
61
- return Promise.resolve(importedTrads);
62
- },
63
- };