@crowdin/app-project-module 0.12.0 → 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 +10 -0
- package/out/models/index.d.ts +12 -9
- package/out/views/main.handlebars +7 -1
- 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
|
@@ -75,6 +75,12 @@ function addCrowdinEndpoints(app, config) {
|
|
|
75
75
|
}
|
|
76
76
|
return options.inverse(this);
|
|
77
77
|
},
|
|
78
|
+
checkLength: function (a, b, options) {
|
|
79
|
+
if (a.length > b) {
|
|
80
|
+
return options.fn(this);
|
|
81
|
+
}
|
|
82
|
+
return options.inverse(this);
|
|
83
|
+
},
|
|
78
84
|
},
|
|
79
85
|
}));
|
|
80
86
|
app.set('view engine', 'handlebars');
|
|
@@ -85,6 +91,7 @@ function addCrowdinEndpoints(app, config) {
|
|
|
85
91
|
const integrationLogic = config.integration;
|
|
86
92
|
if (integrationLogic) {
|
|
87
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')));
|
|
88
95
|
app.get('/', (0, crowdin_client_1.default)(config, true), (0, integration_credentials_1.default)(config, integrationLogic, true), (0, main_1.default)(config, integrationLogic));
|
|
89
96
|
app.post('/api/settings', (0, crowdin_client_1.default)(config), (0, integration_credentials_1.default)(config, integrationLogic), (0, settings_save_1.default)(config));
|
|
90
97
|
app.post('/api/login', (0, crowdin_client_1.default)(config), (0, integration_login_1.default)(config, integrationLogic));
|
|
@@ -121,6 +128,7 @@ function addCrowdinEndpoints(app, config) {
|
|
|
121
128
|
app.post('/translate', (0, crowdin_client_1.default)(config), (0, translate_1.default)(config, config.customMT));
|
|
122
129
|
}
|
|
123
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')); });
|
|
124
132
|
app.use('/resources', express_1.default.static(config.resources.uiPath));
|
|
125
133
|
}
|
|
126
134
|
if (config.editorPanels) {
|
|
@@ -130,9 +138,11 @@ function addCrowdinEndpoints(app, config) {
|
|
|
130
138
|
app.use('/project-menu', express_1.default.static(config.projectMenu.uiPath));
|
|
131
139
|
}
|
|
132
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')); });
|
|
133
142
|
app.use('/tools', express_1.default.static(config.tools.uiPath));
|
|
134
143
|
}
|
|
135
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')); });
|
|
136
146
|
app.use('/reports', express_1.default.static(config.reports.uiPath));
|
|
137
147
|
}
|
|
138
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 {};
|
|
@@ -40,7 +40,13 @@
|
|
|
40
40
|
</crowdin-modal>
|
|
41
41
|
{{/if}}
|
|
42
42
|
{{#if configurationFields}}
|
|
43
|
-
<crowdin-modal
|
|
43
|
+
<crowdin-modal
|
|
44
|
+
id="settings-modal"
|
|
45
|
+
body-overflow-unset="{{#checkLength configurationFields 3}}false{{else}}true{{/checkLength}}"
|
|
46
|
+
modal-width="50"
|
|
47
|
+
modal-title="Settings"
|
|
48
|
+
close-button-title="Close"
|
|
49
|
+
>
|
|
44
50
|
<div id="modal-content">
|
|
45
51
|
{{#each configurationFields}}
|
|
46
52
|
{{#ifeq type "checkbox"}}
|
package/package.json
CHANGED