@crowdin/app-project-module 0.28.7 → 0.28.9
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/out/middlewares/crowdin-client.js +6 -6
- package/out/middlewares/ui-module.js +3 -3
- package/out/models/index.d.ts +4 -3
- package/out/static/js/form.js +17 -17
- package/out/static/js/main.js +56 -105
- package/out/views/login.handlebars +5 -1
- package/out/views/main.handlebars +5 -1
- package/package.json +10 -10
|
@@ -46,12 +46,12 @@ function prepareCrowdinRequest(jwtToken, config, optional = false, checkSubscrip
|
|
|
46
46
|
exports.prepareCrowdinRequest = prepareCrowdinRequest;
|
|
47
47
|
function handle(config, optional = false, checkSubscriptionExpiration = true) {
|
|
48
48
|
return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
49
|
+
const jwtToken = getToken(req);
|
|
50
|
+
if (!jwtToken) {
|
|
51
51
|
return res.status(403).send({ error: 'Access denied' });
|
|
52
52
|
}
|
|
53
53
|
try {
|
|
54
|
-
const data = yield prepareCrowdinRequest(
|
|
54
|
+
const data = yield prepareCrowdinRequest(jwtToken, config, optional, checkSubscriptionExpiration);
|
|
55
55
|
req.crowdinContext = data.context;
|
|
56
56
|
if (data.client) {
|
|
57
57
|
req.crowdinApiClient = data.client;
|
|
@@ -76,9 +76,9 @@ function handle(config, optional = false, checkSubscriptionExpiration = true) {
|
|
|
76
76
|
}
|
|
77
77
|
exports.default = handle;
|
|
78
78
|
function getToken(req) {
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
return
|
|
79
|
+
const jwtToken = req.query.jwtToken;
|
|
80
|
+
if (jwtToken) {
|
|
81
|
+
return jwtToken;
|
|
82
82
|
}
|
|
83
83
|
if (req.headers.authorization) {
|
|
84
84
|
if (req.headers.authorization.startsWith('Bearer ') || req.headers.authorization.startsWith('bearer ')) {
|
|
@@ -19,12 +19,12 @@ function handle(config, allowUnauthorized = false) {
|
|
|
19
19
|
next();
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
22
|
+
const jwtToken = req.query.jwtToken;
|
|
23
|
+
if (!jwtToken) {
|
|
24
24
|
return res.status(403).send({ error: 'Access denied' });
|
|
25
25
|
}
|
|
26
26
|
(0, util_1.log)('Validating jwt token from incoming request', config.logger);
|
|
27
|
-
const jwtPayload = yield (0, crowdin_apps_functions_1.validateJwtToken)(
|
|
27
|
+
const jwtPayload = yield (0, crowdin_apps_functions_1.validateJwtToken)(jwtToken, config.clientSecret, config.jwtValidationOptions);
|
|
28
28
|
const id = `${jwtPayload.domain || jwtPayload.context.organization_id}`;
|
|
29
29
|
(0, util_1.log)('Loading crowdin credentials', config.logger);
|
|
30
30
|
const credentials = yield (0, storage_1.getStorage)().getCrowdinCredentials(id);
|
package/out/models/index.d.ts
CHANGED
|
@@ -270,9 +270,10 @@ export interface IntegrationLogic {
|
|
|
270
270
|
*/
|
|
271
271
|
webhooks?: Webhooks;
|
|
272
272
|
}
|
|
273
|
-
export type FormEntity = FormField |
|
|
274
|
-
export interface
|
|
275
|
-
label
|
|
273
|
+
export type FormEntity = FormField | FormDelimiter;
|
|
274
|
+
export interface FormDelimiter {
|
|
275
|
+
label?: string;
|
|
276
|
+
labelHtml?: string;
|
|
276
277
|
}
|
|
277
278
|
export interface LoginForm {
|
|
278
279
|
fields: FormEntity[];
|