@crowdin/app-project-module 0.12.1 → 0.12.2
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/README.md +1 -0
- package/out/handlers/manifest.js +5 -5
- package/out/index.js +4 -0
- package/out/models/index.d.ts +12 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -591,6 +591,7 @@ const configuration = {
|
|
|
591
591
|
dbFolder: __dirname,
|
|
592
592
|
imagePath: __dirname + '/' + 'logo.png',
|
|
593
593
|
reports: { //can be editorPanels, projectMenu, tools
|
|
594
|
+
imagePath: __dirname + '/' + 'reports.png',
|
|
594
595
|
fileName: 'reports.html', //optional, only needed if file is not index.html
|
|
595
596
|
uiPath: __dirname + '/' + 'public' // folder where UI of the module is located (js, html, css files)
|
|
596
597
|
},
|
package/out/handlers/manifest.js
CHANGED
|
@@ -8,7 +8,7 @@ function handle(config) {
|
|
|
8
8
|
key: config.identifier + '-int',
|
|
9
9
|
name: config.name,
|
|
10
10
|
description: config.description,
|
|
11
|
-
logo: '/logo.png',
|
|
11
|
+
logo: '/logo/integration/logo.png',
|
|
12
12
|
url: '/',
|
|
13
13
|
},
|
|
14
14
|
];
|
|
@@ -38,7 +38,7 @@ function handle(config) {
|
|
|
38
38
|
key: config.identifier + '-resources',
|
|
39
39
|
name: config.name,
|
|
40
40
|
url: '/resources/' + (config.resources.fileName || 'index.html'),
|
|
41
|
-
icon: '/logo.png',
|
|
41
|
+
icon: '/logo/resources/logo.png',
|
|
42
42
|
},
|
|
43
43
|
];
|
|
44
44
|
modules['resources'] = [
|
|
@@ -46,7 +46,7 @@ function handle(config) {
|
|
|
46
46
|
key: config.identifier + '-resources',
|
|
47
47
|
name: config.name,
|
|
48
48
|
url: '/resources/' + (config.resources.fileName || 'index.html'),
|
|
49
|
-
icon: '/logo.png',
|
|
49
|
+
icon: '/logo/resources/logo.png',
|
|
50
50
|
},
|
|
51
51
|
];
|
|
52
52
|
}
|
|
@@ -76,8 +76,7 @@ function handle(config) {
|
|
|
76
76
|
key: config.identifier + '-tools',
|
|
77
77
|
name: config.name,
|
|
78
78
|
description: config.description,
|
|
79
|
-
logo: '/logo.png',
|
|
80
|
-
icon: '/logo.png',
|
|
79
|
+
logo: '/logo/tools/logo.png',
|
|
81
80
|
url: '/tools/' + (config.tools.fileName || 'index.html'),
|
|
82
81
|
},
|
|
83
82
|
];
|
|
@@ -88,6 +87,7 @@ function handle(config) {
|
|
|
88
87
|
key: config.identifier + '-reports',
|
|
89
88
|
name: config.name,
|
|
90
89
|
description: config.description,
|
|
90
|
+
logo: '/logo/reports/logo.png',
|
|
91
91
|
url: '/reports/' + (config.reports.fileName || 'index.html'),
|
|
92
92
|
},
|
|
93
93
|
];
|
package/out/index.js
CHANGED
|
@@ -91,6 +91,7 @@ function addCrowdinEndpoints(app, config) {
|
|
|
91
91
|
const integrationLogic = config.integration;
|
|
92
92
|
if (integrationLogic) {
|
|
93
93
|
(0, util_1.applyDefaults)(config, integrationLogic);
|
|
94
|
+
app.get('/logo/integration/logo.png', (req, res) => res.sendFile(integrationLogic.imagePath || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')));
|
|
94
95
|
app.get('/', (0, crowdin_client_1.default)(config, true), (0, integration_credentials_1.default)(config, integrationLogic, true), (0, main_1.default)(config, integrationLogic));
|
|
95
96
|
app.post('/api/settings', (0, crowdin_client_1.default)(config), (0, integration_credentials_1.default)(config, integrationLogic), (0, settings_save_1.default)(config));
|
|
96
97
|
app.post('/api/login', (0, crowdin_client_1.default)(config), (0, integration_login_1.default)(config, integrationLogic));
|
|
@@ -127,6 +128,7 @@ function addCrowdinEndpoints(app, config) {
|
|
|
127
128
|
app.post('/translate', (0, crowdin_client_1.default)(config), (0, translate_1.default)(config, config.customMT));
|
|
128
129
|
}
|
|
129
130
|
if (config.resources) {
|
|
131
|
+
app.get('/logo/resources/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.resources) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
130
132
|
app.use('/resources', express_1.default.static(config.resources.uiPath));
|
|
131
133
|
}
|
|
132
134
|
if (config.editorPanels) {
|
|
@@ -136,9 +138,11 @@ function addCrowdinEndpoints(app, config) {
|
|
|
136
138
|
app.use('/project-menu', express_1.default.static(config.projectMenu.uiPath));
|
|
137
139
|
}
|
|
138
140
|
if (config.tools) {
|
|
141
|
+
app.get('/logo/tools/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.tools) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
139
142
|
app.use('/tools', express_1.default.static(config.tools.uiPath));
|
|
140
143
|
}
|
|
141
144
|
if (config.reports) {
|
|
145
|
+
app.get('/logo/reports/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.tools) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
142
146
|
app.use('/reports', express_1.default.static(config.reports.uiPath));
|
|
143
147
|
}
|
|
144
148
|
return {
|
package/out/models/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Crowdin, { LanguagesModel, SourceFilesModel, SourceStringsModel } from '@crowdin/crowdin-api-client';
|
|
2
2
|
import { JwtPayload } from '@crowdin/crowdin-apps-functions';
|
|
3
3
|
import { Request } from 'express';
|
|
4
|
-
export interface Config {
|
|
4
|
+
export interface Config extends ImagePath {
|
|
5
5
|
/**
|
|
6
6
|
* client id that we received when registering the app
|
|
7
7
|
*/
|
|
@@ -34,14 +34,10 @@ export interface Config {
|
|
|
34
34
|
* folder where module will create sqlite db file to persist credentials (e.g. {@example __dirname})
|
|
35
35
|
*/
|
|
36
36
|
dbFolder: string;
|
|
37
|
-
/**
|
|
38
|
-
* path to app logo (e.g. {@example join(__dirname, 'logo.png')})
|
|
39
|
-
*/
|
|
40
|
-
imagePath?: string;
|
|
41
37
|
/**
|
|
42
38
|
* integration module logic
|
|
43
39
|
*/
|
|
44
|
-
integration?: IntegrationLogic;
|
|
40
|
+
integration?: IntegrationLogic & ImagePath;
|
|
45
41
|
/**
|
|
46
42
|
* custom file format module logic
|
|
47
43
|
*/
|
|
@@ -53,7 +49,7 @@ export interface Config {
|
|
|
53
49
|
/**
|
|
54
50
|
* resources module
|
|
55
51
|
*/
|
|
56
|
-
resources?: UiModule;
|
|
52
|
+
resources?: UiModule & ImagePath;
|
|
57
53
|
/**
|
|
58
54
|
* editor-panels module
|
|
59
55
|
*/
|
|
@@ -65,11 +61,11 @@ export interface Config {
|
|
|
65
61
|
/**
|
|
66
62
|
* tools module
|
|
67
63
|
*/
|
|
68
|
-
tools?: UiModule;
|
|
64
|
+
tools?: UiModule & ImagePath;
|
|
69
65
|
/**
|
|
70
66
|
* reports module
|
|
71
67
|
*/
|
|
72
|
-
reports?: UiModule;
|
|
68
|
+
reports?: UiModule & ImagePath;
|
|
73
69
|
/**
|
|
74
70
|
* Uninstall hook for cleanup logic
|
|
75
71
|
*/
|
|
@@ -439,3 +435,10 @@ export interface IntegrationSyncSettings {
|
|
|
439
435
|
crowdinId: string;
|
|
440
436
|
provider: string;
|
|
441
437
|
}
|
|
438
|
+
interface ImagePath {
|
|
439
|
+
/**
|
|
440
|
+
* path to app logo (e.g. {@example join(__dirname, 'logo.png')})
|
|
441
|
+
*/
|
|
442
|
+
imagePath?: string;
|
|
443
|
+
}
|
|
444
|
+
export {};
|
package/package.json
CHANGED