@crowdin/app-project-module 0.25.0 → 0.25.1
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 +2 -1
- package/out/index.js +7 -7
- package/out/middlewares/ui-module.d.ts +1 -1
- package/out/middlewares/ui-module.js +5 -1
- package/out/models/index.d.ts +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -816,7 +816,8 @@ const configuration = {
|
|
|
816
816
|
projectReports: { //can be editorRightPanel, projectMenu, projectTools, projectMenuCrowdsource
|
|
817
817
|
imagePath: __dirname + '/' + 'reports.png',
|
|
818
818
|
fileName: 'reports.html', //optional, only needed if file is not index.html
|
|
819
|
-
uiPath: __dirname + '/' + 'public' // folder where UI of the module is located (js, html, css files)
|
|
819
|
+
uiPath: __dirname + '/' + 'public', // folder where UI of the module is located (js, html, css files)
|
|
820
|
+
allowUnauthorized: true //make module publicly available without crowdin context
|
|
820
821
|
},
|
|
821
822
|
};
|
|
822
823
|
|
package/out/index.js
CHANGED
|
@@ -143,28 +143,28 @@ function addCrowdinEndpoints(app, config) {
|
|
|
143
143
|
}
|
|
144
144
|
if (config.profileResourcesMenu) {
|
|
145
145
|
app.get('/logo/resources/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.profileResourcesMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
146
|
-
app.use('/resources', (0, ui_module_1.default)(config), express_1.default.static(config.profileResourcesMenu.uiPath));
|
|
146
|
+
app.use('/resources', (0, ui_module_1.default)(config, config.profileResourcesMenu.allowUnauthorized), express_1.default.static(config.profileResourcesMenu.uiPath));
|
|
147
147
|
}
|
|
148
148
|
if (config.organizationMenu) {
|
|
149
149
|
app.get('/logo/resources/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.organizationMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
150
|
-
app.use('/resources', (0, ui_module_1.default)(config), express_1.default.static(config.organizationMenu.uiPath));
|
|
150
|
+
app.use('/resources', (0, ui_module_1.default)(config, config.organizationMenu.allowUnauthorized), express_1.default.static(config.organizationMenu.uiPath));
|
|
151
151
|
}
|
|
152
152
|
if (config.editorRightPanel) {
|
|
153
|
-
app.use('/editor-panels', (0, ui_module_1.default)(config), express_1.default.static(config.editorRightPanel.uiPath));
|
|
153
|
+
app.use('/editor-panels', (0, ui_module_1.default)(config, config.editorRightPanel.allowUnauthorized), express_1.default.static(config.editorRightPanel.uiPath));
|
|
154
154
|
}
|
|
155
155
|
if (config.projectMenu) {
|
|
156
|
-
app.use('/project-menu', (0, ui_module_1.default)(config), express_1.default.static(config.projectMenu.uiPath));
|
|
156
|
+
app.use('/project-menu', (0, ui_module_1.default)(config, config.projectMenu.allowUnauthorized), express_1.default.static(config.projectMenu.uiPath));
|
|
157
157
|
}
|
|
158
158
|
if (config.projectMenuCrowdsource) {
|
|
159
|
-
app.use('/project-menu-crowdsource', (0, ui_module_1.default)(config), express_1.default.static(config.projectMenuCrowdsource.uiPath));
|
|
159
|
+
app.use('/project-menu-crowdsource', (0, ui_module_1.default)(config, config.projectMenuCrowdsource.allowUnauthorized), express_1.default.static(config.projectMenuCrowdsource.uiPath));
|
|
160
160
|
}
|
|
161
161
|
if (config.projectTools) {
|
|
162
162
|
app.get('/logo/tools/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.projectTools) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
163
|
-
app.use('/tools', (0, ui_module_1.default)(config), express_1.default.static(config.projectTools.uiPath));
|
|
163
|
+
app.use('/tools', (0, ui_module_1.default)(config, config.projectTools.allowUnauthorized), express_1.default.static(config.projectTools.uiPath));
|
|
164
164
|
}
|
|
165
165
|
if (config.projectReports) {
|
|
166
166
|
app.get('/logo/reports/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.projectReports) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
167
|
-
app.use('/reports', (0, ui_module_1.default)(config), express_1.default.static(config.projectReports.uiPath));
|
|
167
|
+
app.use('/reports', (0, ui_module_1.default)(config, config.projectReports.allowUnauthorized), express_1.default.static(config.projectReports.uiPath));
|
|
168
168
|
}
|
|
169
169
|
return {
|
|
170
170
|
getMetadata: storage.getStorage().getMetadata.bind(storage.getStorage()),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { Config } from '../models';
|
|
4
|
-
export default function handle(config: Config): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
4
|
+
export default function handle(config: Config, allowUnauthorized?: boolean): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -13,8 +13,12 @@ const crowdin_apps_functions_1 = require("@crowdin/crowdin-apps-functions");
|
|
|
13
13
|
const storage_1 = require("../storage");
|
|
14
14
|
const util_1 = require("../util");
|
|
15
15
|
const connection_1 = require("../util/connection");
|
|
16
|
-
function handle(config) {
|
|
16
|
+
function handle(config, allowUnauthorized = false) {
|
|
17
17
|
return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
if (allowUnauthorized) {
|
|
19
|
+
next();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
18
22
|
const tokenJwt = req.query.tokenJwt;
|
|
19
23
|
if (!tokenJwt) {
|
|
20
24
|
return res.status(403).send({ error: 'Access denied' });
|
package/out/models/index.d.ts
CHANGED
|
@@ -566,6 +566,10 @@ export interface UiModule {
|
|
|
566
566
|
* page name (default index.html)
|
|
567
567
|
*/
|
|
568
568
|
fileName?: string;
|
|
569
|
+
/**
|
|
570
|
+
* make module publicly available without crowdin context
|
|
571
|
+
*/
|
|
572
|
+
allowUnauthorized?: boolean;
|
|
569
573
|
}
|
|
570
574
|
export interface EditorPanels extends UiModule {
|
|
571
575
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdin/app-project-module",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"test": "jest --config jestconfig.json"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@crowdin/crowdin-apps-functions": "0.3.
|
|
16
|
+
"@crowdin/crowdin-apps-functions": "0.3.1",
|
|
17
17
|
"@types/pg": "^8.6.5",
|
|
18
18
|
"crypto-js": "^4.0.0",
|
|
19
19
|
"express": "4.17.1",
|