@crowdin/app-project-module 0.96.3 → 0.98.0-cf-0
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/index.js +17 -6
- package/out/middlewares/integration-credentials.js +4 -1
- package/out/middlewares/render-ui-module.d.ts +3 -3
- package/out/middlewares/render-ui-module.js +9 -13
- package/out/middlewares/ui-module.js +4 -1
- package/out/modules/about.d.ts +1 -1
- package/out/modules/about.js +8 -2
- package/out/modules/ai-prompt-provider/index.js +4 -2
- package/out/modules/ai-provider/index.js +4 -2
- package/out/modules/ai-tools/index.js +1 -1
- package/out/modules/context-menu/index.js +2 -2
- package/out/modules/custom-mt/index.js +3 -1
- package/out/modules/custom-spell-check/index.js +4 -4
- package/out/modules/editor-right-panel/index.js +1 -1
- package/out/modules/external-qa-check/index.js +2 -2
- package/out/modules/integration/handlers/main.js +13 -1
- package/out/modules/integration/handlers/oauth-login.js +10 -2
- package/out/modules/integration/index.js +27 -21
- package/out/modules/integration/util/job.js +2 -4
- package/out/modules/integration/util/types.d.ts +2 -1
- package/out/modules/modal/index.js +2 -2
- package/out/modules/organization-menu/index.js +6 -4
- package/out/modules/organization-settings-menu/index.js +6 -4
- package/out/modules/profile-resources-menu/index.js +6 -4
- package/out/modules/profile-settings-menu/index.js +6 -4
- package/out/modules/project-menu/index.js +1 -1
- package/out/modules/project-menu-crowdsource/index.js +1 -1
- package/out/modules/project-reports/index.js +4 -2
- package/out/modules/project-tools/index.js +4 -2
- package/out/modules/workflow-step-type/index.js +3 -2
- package/out/storage/d1.d.ts +99 -0
- package/out/storage/d1.js +769 -0
- package/out/storage/index.d.ts +1 -0
- package/out/storage/index.js +8 -1
- package/out/storage/mysql.d.ts +1 -0
- package/out/storage/mysql.js +7 -1
- package/out/storage/postgre.d.ts +1 -0
- package/out/storage/postgre.js +2 -1
- package/out/storage/sqlite.d.ts +1 -0
- package/out/storage/sqlite.js +2 -1
- package/out/types.d.ts +10 -0
- package/out/util/index.d.ts +1 -0
- package/out/util/index.js +8 -2
- package/out/util/jsx-renderer.d.ts +6 -0
- package/out/util/jsx-renderer.js +13 -0
- package/out/util/static-files.d.ts +19 -0
- package/out/util/static-files.js +80 -0
- package/out/views/AboutPage.d.ts +9 -0
- package/out/views/AboutPage.js +79 -0
- package/out/views/ErrorPage.d.ts +18 -0
- package/out/views/ErrorPage.js +56 -0
- package/out/views/FormPage.d.ts +13 -0
- package/out/views/FormPage.js +27 -0
- package/out/views/InstallPage.d.ts +10 -0
- package/out/views/InstallPage.js +22 -0
- package/out/views/LoginPage.d.ts +33 -0
- package/out/views/LoginPage.js +199 -0
- package/out/views/MainPage.d.ts +79 -0
- package/out/views/MainPage.js +1613 -0
- package/out/views/OAuthPage.d.ts +7 -0
- package/out/views/OAuthPage.js +17 -0
- package/out/views/SubscriptionPage.d.ts +7 -0
- package/out/views/SubscriptionPage.js +26 -0
- package/out/views/index.d.ts +13 -0
- package/out/views/index.js +25 -0
- package/out/views/layout/Head.d.ts +9 -0
- package/out/views/layout/Head.js +54 -0
- package/package.json +12 -11
- package/out/util/handlebars.d.ts +0 -1
- package/out/util/handlebars.js +0 -46
- package/out/views/about.handlebars +0 -102
- package/out/views/error.handlebars +0 -54
- package/out/views/form.handlebars +0 -30
- package/out/views/install.handlebars +0 -16
- package/out/views/login.handlebars +0 -331
- package/out/views/main.handlebars +0 -1857
- package/out/views/oauth.handlebars +0 -11
- package/out/views/partials/head.handlebars +0 -53
- package/out/views/subscription.handlebars +0 -26
package/out/index.js
CHANGED
|
@@ -50,11 +50,11 @@ const subscription_paid_1 = __importDefault(require("./modules/subscription-paid
|
|
|
50
50
|
const uninstall_1 = __importDefault(require("./modules/uninstall"));
|
|
51
51
|
const status_1 = __importDefault(require("./modules/status"));
|
|
52
52
|
const storage = __importStar(require("./storage"));
|
|
53
|
+
const d1_1 = require("./storage/d1");
|
|
53
54
|
const types_1 = require("./types");
|
|
54
55
|
const util_1 = require("./util");
|
|
55
56
|
const form_schema_1 = require("./util/form-schema");
|
|
56
57
|
const connection_1 = require("./util/connection");
|
|
57
|
-
const handlebars_1 = require("./util/handlebars");
|
|
58
58
|
const logger = __importStar(require("./util/logger"));
|
|
59
59
|
const logger_1 = require("./util/logger");
|
|
60
60
|
const terminus_express_1 = __importDefault(require("./util/terminus-express"));
|
|
@@ -63,6 +63,7 @@ const credentials_masker_1 = require("./util/credentials-masker");
|
|
|
63
63
|
Object.defineProperty(exports, "getRequestCredentialsMasker", { enumerable: true, get: function () { return credentials_masker_1.getRequestCredentialsMasker; } });
|
|
64
64
|
Object.defineProperty(exports, "postRequestCredentialsMasker", { enumerable: true, get: function () { return credentials_masker_1.postRequestCredentialsMasker; } });
|
|
65
65
|
Object.defineProperty(exports, "maskKey", { enumerable: true, get: function () { return credentials_masker_1.maskKey; } });
|
|
66
|
+
const static_files_1 = require("./util/static-files");
|
|
66
67
|
//apps
|
|
67
68
|
const apiApp = __importStar(require("./modules/api"));
|
|
68
69
|
const contextMenuApp = __importStar(require("./modules/context-menu"));
|
|
@@ -138,6 +139,19 @@ function addCrowdinEndpoints(app, clientConfig) {
|
|
|
138
139
|
}
|
|
139
140
|
storage.initialize(config);
|
|
140
141
|
logger.initialize(config);
|
|
142
|
+
// Middleware to ensure D1 migration before handling requests
|
|
143
|
+
app.use((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
try {
|
|
145
|
+
const storageInstance = storage.getStorage();
|
|
146
|
+
if (storageInstance instanceof d1_1.D1Storage) {
|
|
147
|
+
yield storageInstance.ensureMigrated();
|
|
148
|
+
}
|
|
149
|
+
next();
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
next(error);
|
|
153
|
+
}
|
|
154
|
+
}));
|
|
141
155
|
app.use((req, res, next) => {
|
|
142
156
|
if (config.webhooks && req.path === '/webhooks') {
|
|
143
157
|
return terminus_express_1.default.raw({ type: '*/*', limit: '50mb' })(req, res, next);
|
|
@@ -151,11 +165,8 @@ function addCrowdinEndpoints(app, clientConfig) {
|
|
|
151
165
|
app.use(logsFormatter.contextResolverMiddleware());
|
|
152
166
|
app.use(logsFormatter.expressMiddleware());
|
|
153
167
|
}
|
|
154
|
-
app.use('/assets',
|
|
155
|
-
app.
|
|
156
|
-
app.engine('handlebars', handlebars_1.engine);
|
|
157
|
-
app.set('view engine', 'handlebars');
|
|
158
|
-
app.get((0, util_1.getLogoUrl)(), (req, res) => res.sendFile(config.imagePath));
|
|
168
|
+
app.use('/assets', (0, static_files_1.serveStatic)(config, 'static'));
|
|
169
|
+
app.get((0, util_1.getLogoUrl)(), (0, static_files_1.serveFile)(config, config.imagePath));
|
|
159
170
|
app.get('/manifest.json', json_response_1.default, (0, manifest_1.default)(config));
|
|
160
171
|
app.get('/', (0, about_1.default)(config));
|
|
161
172
|
if (((_a = config === null || config === void 0 ? void 0 : config.enableStatusPage) === null || _a === void 0 ? void 0 : _a.database) || ((_b = config === null || config === void 0 ? void 0 : config.enableStatusPage) === null || _b === void 0 ? void 0 : _b.filesystem)) {
|
|
@@ -37,6 +37,7 @@ const util_1 = require("../util");
|
|
|
37
37
|
const connection_1 = require("../util/connection");
|
|
38
38
|
const logger_1 = require("../util/logger");
|
|
39
39
|
const crowdinAppFunctions = __importStar(require("@crowdin/crowdin-apps-functions"));
|
|
40
|
+
const views_1 = require("../views");
|
|
40
41
|
function handle(config, integration, optional = false) {
|
|
41
42
|
return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
42
43
|
let clientId = req.crowdinContext.clientId;
|
|
@@ -89,7 +90,9 @@ function handle(config, integration, optional = false) {
|
|
|
89
90
|
else {
|
|
90
91
|
(0, logger_1.temporaryErrorDebug)('Access denied: integration-credentials', req);
|
|
91
92
|
}
|
|
92
|
-
|
|
93
|
+
const html = (0, util_1.renderJSX)(views_1.ErrorPage, errorOptions);
|
|
94
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
95
|
+
return res.send(html);
|
|
93
96
|
}
|
|
94
97
|
try {
|
|
95
98
|
req.integrationCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
|
-
import
|
|
3
|
-
import { UiModule } from '../types';
|
|
4
|
-
export default function handle(moduleConfig: UiModule): (req: import("../types").CrowdinClientRequest |
|
|
2
|
+
import { Request, Response } from 'express';
|
|
3
|
+
import { UiModule, Config, UnauthorizedConfig } from '../types';
|
|
4
|
+
export default function handle(moduleConfig: UiModule, config: Config | UnauthorizedConfig): (req: import("../types").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -8,28 +8,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const express_1 = __importDefault(require("express"));
|
|
16
12
|
const util_1 = require("../util");
|
|
17
|
-
|
|
13
|
+
const static_files_1 = require("../util/static-files");
|
|
14
|
+
const views_1 = require("../views");
|
|
15
|
+
function handle(moduleConfig, config) {
|
|
18
16
|
return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
19
17
|
if (moduleConfig.formSchema) {
|
|
20
|
-
|
|
21
|
-
formGetDataUrl: moduleConfig.formGetDataUrl
|
|
22
|
-
|
|
23
|
-
: `/api/${moduleConfig.key}/form-data`,
|
|
24
|
-
formPostDataUrl: moduleConfig.formPostDataUrl
|
|
25
|
-
? moduleConfig.formPostDataUrl
|
|
26
|
-
: `/api/${moduleConfig.key}/form-data`,
|
|
18
|
+
const html = (0, util_1.renderJSX)(views_1.FormPage, {
|
|
19
|
+
formGetDataUrl: moduleConfig.formGetDataUrl || `/api/${moduleConfig.key}/form-data`,
|
|
20
|
+
formPostDataUrl: moduleConfig.formPostDataUrl || `/api/${moduleConfig.key}/form-data`,
|
|
27
21
|
formSchema: JSON.stringify(moduleConfig.formSchema),
|
|
28
22
|
formUiSchema: moduleConfig.formUiSchema ? JSON.stringify(moduleConfig.formUiSchema) : '{}',
|
|
29
23
|
});
|
|
24
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
25
|
+
return res.send(html);
|
|
30
26
|
}
|
|
31
27
|
if (moduleConfig.uiPath) {
|
|
32
|
-
return
|
|
28
|
+
return (0, static_files_1.serveStatic)(config, moduleConfig.uiPath)(req, res, next);
|
|
33
29
|
}
|
|
34
30
|
throw new Error('uiPath or formSchema should be provided for module');
|
|
35
31
|
}));
|
|
@@ -15,6 +15,7 @@ const util_1 = require("../util");
|
|
|
15
15
|
const connection_1 = require("../util/connection");
|
|
16
16
|
const logger_1 = require("../util/logger");
|
|
17
17
|
const subscription_1 = require("../util/subscription");
|
|
18
|
+
const views_1 = require("../views");
|
|
18
19
|
function handle({ config, allowUnauthorized = false, moduleType, }) {
|
|
19
20
|
return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
20
21
|
if (allowUnauthorized) {
|
|
@@ -57,7 +58,9 @@ function handle({ config, allowUnauthorized = false, moduleType, }) {
|
|
|
57
58
|
accountType: credentials.type,
|
|
58
59
|
});
|
|
59
60
|
if (expired) {
|
|
60
|
-
|
|
61
|
+
const html = (0, util_1.renderJSX)(views_1.SubscriptionPage, { subscribeLink });
|
|
62
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
63
|
+
return res.send(html);
|
|
61
64
|
}
|
|
62
65
|
next();
|
|
63
66
|
}));
|
package/out/modules/about.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export declare function getAboutPageOptions(config: Config | UnauthorizedConfig)
|
|
|
6
6
|
manifest: string;
|
|
7
7
|
storeLink: string;
|
|
8
8
|
}>;
|
|
9
|
-
export default function handle(config: Config | UnauthorizedConfig): (req: Request, res: Response, next: NextFunction) => Promise<
|
|
9
|
+
export default function handle(config: Config | UnauthorizedConfig): (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
|
package/out/modules/about.js
CHANGED
|
@@ -16,6 +16,8 @@ exports.getAboutPageOptions = void 0;
|
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const util_1 = require("../util");
|
|
18
18
|
const crowdin_client_1 = require("../middlewares/crowdin-client");
|
|
19
|
+
const jsx_renderer_1 = require("../util/jsx-renderer");
|
|
20
|
+
const views_1 = require("../views");
|
|
19
21
|
function getAboutPageOptions(config) {
|
|
20
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
23
|
let detailPage = '';
|
|
@@ -43,7 +45,9 @@ function handle(config) {
|
|
|
43
45
|
const jwtToken = (0, crowdin_client_1.getToken)(req);
|
|
44
46
|
if (!jwtToken) {
|
|
45
47
|
const options = yield getAboutPageOptions(config);
|
|
46
|
-
|
|
48
|
+
const html = (0, jsx_renderer_1.renderJSX)(views_1.AboutPage, options);
|
|
49
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
50
|
+
return res.send(html);
|
|
47
51
|
}
|
|
48
52
|
else {
|
|
49
53
|
next();
|
|
@@ -51,7 +55,9 @@ function handle(config) {
|
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
const options = yield getAboutPageOptions(config);
|
|
54
|
-
|
|
58
|
+
const html = (0, jsx_renderer_1.renderJSX)(views_1.AboutPage, options);
|
|
59
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
60
|
+
return res.send(html);
|
|
55
61
|
});
|
|
56
62
|
}
|
|
57
63
|
exports.default = handle;
|
|
@@ -8,9 +8,11 @@ const json_response_1 = __importDefault(require("../../middlewares/json-response
|
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
10
10
|
const util_1 = require("../../util");
|
|
11
|
+
const static_files_1 = require("../../util/static-files");
|
|
11
12
|
const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
|
|
12
13
|
const compile_1 = __importDefault(require("./handlers/compile"));
|
|
13
14
|
function register({ config, app }) {
|
|
15
|
+
var _a;
|
|
14
16
|
if (!config.aiPromptProvider) {
|
|
15
17
|
return;
|
|
16
18
|
}
|
|
@@ -21,8 +23,8 @@ function register({ config, app }) {
|
|
|
21
23
|
moduleKey: config.aiPromptProvider.key,
|
|
22
24
|
}), (0, compile_1.default)(config.aiPromptProvider));
|
|
23
25
|
if (config.aiPromptProvider.formSchema || config.aiPromptProvider.uiPath) {
|
|
24
|
-
app.use('/prompt-provider/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiPromptProvider.key }), (0, render_ui_module_1.default)(config.aiPromptProvider));
|
|
26
|
+
app.use('/prompt-provider/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiPromptProvider.key }), (0, render_ui_module_1.default)(config.aiPromptProvider, config));
|
|
25
27
|
}
|
|
26
|
-
app.get((0, util_1.getLogoUrl)(config.aiPromptProvider, '/ai-prompt-provider'), (
|
|
28
|
+
app.get((0, util_1.getLogoUrl)(config.aiPromptProvider, '/ai-prompt-provider'), (0, static_files_1.serveFile)(config, ((_a = config.aiPromptProvider) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath));
|
|
27
29
|
}
|
|
28
30
|
exports.register = register;
|
|
@@ -10,15 +10,17 @@ const chat_completions_1 = __importDefault(require("./handlers/chat-completions"
|
|
|
10
10
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
11
11
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
12
12
|
const util_1 = require("../../util");
|
|
13
|
+
const static_files_1 = require("../../util/static-files");
|
|
13
14
|
const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
|
|
14
15
|
function register({ config, app }) {
|
|
16
|
+
var _a;
|
|
15
17
|
if (!config.aiProvider) {
|
|
16
18
|
return;
|
|
17
19
|
}
|
|
18
20
|
if (config.aiProvider.settingsUiModule) {
|
|
19
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiProvider.key }), (0, render_ui_module_1.default)(config.aiProvider.settingsUiModule));
|
|
21
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiProvider.key }), (0, render_ui_module_1.default)(config.aiProvider.settingsUiModule, config));
|
|
20
22
|
}
|
|
21
|
-
app.get((0, util_1.getLogoUrl)(config.aiProvider, '/aiprovider'), (
|
|
23
|
+
app.get((0, util_1.getLogoUrl)(config.aiProvider, '/aiprovider'), (0, static_files_1.serveFile)(config, ((_a = config.aiProvider) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath));
|
|
22
24
|
app.get('/ai-provider/models', json_response_1.default, (0, crowdin_client_1.default)({
|
|
23
25
|
config,
|
|
24
26
|
optional: false,
|
|
@@ -37,7 +37,7 @@ function registerAiToolWidgets({ config, app }) {
|
|
|
37
37
|
const tools = Array.isArray(config.aiToolsWidget) ? config.aiToolsWidget : [config.aiToolsWidget];
|
|
38
38
|
for (const tool of tools) {
|
|
39
39
|
if ((0, util_1.isUniqueFunctionName)(tool)) {
|
|
40
|
-
app.use((0, util_1.getAiToolWidgetUrl)(tool), (0, ui_module_1.default)({ config, moduleType: tool.key }), (0, render_ui_module_1.default)(tool));
|
|
40
|
+
app.use((0, util_1.getAiToolWidgetUrl)(tool), (0, ui_module_1.default)({ config, moduleType: tool.key }), (0, render_ui_module_1.default)(tool, config));
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
throw new Error(`The function name '${tool.function.name}' is not unique within aiTools and aiToolsWidget`);
|
|
@@ -16,14 +16,14 @@ function register({ config, app }) {
|
|
|
16
16
|
if (Array.isArray(config.contextMenu)) {
|
|
17
17
|
config.contextMenu.forEach((contextMenu) => {
|
|
18
18
|
if ((contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.uiPath) || (contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.formSchema)) {
|
|
19
|
-
app.use(`/context-${contextMenu.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: contextMenu.key }), (0, render_ui_module_1.default)(contextMenu));
|
|
19
|
+
app.use(`/context-${contextMenu.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: contextMenu.key }), (0, render_ui_module_1.default)(contextMenu, config));
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
24
|
// backward compatibility will be removed after migration
|
|
25
25
|
if (((_a = config.contextMenu) === null || _a === void 0 ? void 0 : _a.uiPath) || ((_b = config.contextMenu) === null || _b === void 0 ? void 0 : _b.formSchema)) {
|
|
26
|
-
app.use('/context', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.contextMenu.key }), (0, render_ui_module_1.default)(config.contextMenu));
|
|
26
|
+
app.use('/context', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.contextMenu.key }), (0, render_ui_module_1.default)(config.contextMenu, config));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.register = void 0;
|
|
7
7
|
const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
|
|
8
8
|
const util_1 = require("../../util");
|
|
9
|
+
const static_files_1 = require("../../util/static-files");
|
|
9
10
|
const translate_1 = __importDefault(require("./handlers/translate"));
|
|
10
11
|
function register({ config, app }) {
|
|
12
|
+
var _a;
|
|
11
13
|
if (!config.customMT) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
|
-
app.get((0, util_1.getLogoUrl)(config.customMT, '/mt'), (
|
|
16
|
+
app.get((0, util_1.getLogoUrl)(config.customMT, '/mt'), (0, static_files_1.serveFile)(config, ((_a = config.customMT) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath));
|
|
15
17
|
app.post('/mt/translate', (0, crowdin_client_1.default)({
|
|
16
18
|
config,
|
|
17
19
|
optional: false,
|
|
@@ -17,9 +17,9 @@ function register({ config, app }) {
|
|
|
17
17
|
}
|
|
18
18
|
if ((0, util_1.isAuthorizedConfig)(config)) {
|
|
19
19
|
if (config.customSpellchecker.settingsUiModule) {
|
|
20
|
-
app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule));
|
|
20
|
+
app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule, config));
|
|
21
21
|
// TEMPORARY CODE: it needs to support old path
|
|
22
|
-
app.use('/settings', (0, ui_module_1.default)({ config }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule));
|
|
22
|
+
app.use('/settings', (0, ui_module_1.default)({ config }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule, config));
|
|
23
23
|
// END TEMPORARY CODE
|
|
24
24
|
}
|
|
25
25
|
app.get('/spellchecker/languages', json_response_1.default, (0, crowdin_client_1.default)({
|
|
@@ -49,9 +49,9 @@ function register({ config, app }) {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
if (config.customSpellchecker.settingsUiModule) {
|
|
52
|
-
app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule));
|
|
52
|
+
app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule, config));
|
|
53
53
|
// TEMPORARY CODE: it needs to support old path
|
|
54
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule));
|
|
54
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule, config));
|
|
55
55
|
// END TEMPORARY CODE
|
|
56
56
|
}
|
|
57
57
|
app.get('/spellchecker/languages', json_response_1.default, (0, get_languages_list_1.default)(config.customSpellchecker));
|
|
@@ -12,6 +12,6 @@ function register({ config, app }) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
15
|
-
app.use('/editor-panels', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.editorRightPanel.key }), (0, render_ui_module_1.default)(config.editorRightPanel));
|
|
15
|
+
app.use('/editor-panels', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.editorRightPanel.key }), (0, render_ui_module_1.default)(config.editorRightPanel, config));
|
|
16
16
|
}
|
|
17
17
|
exports.register = register;
|
|
@@ -38,9 +38,9 @@ function register({ config, app }) {
|
|
|
38
38
|
}), (0, validate_1.default)(qaCheck));
|
|
39
39
|
// END TEMPORARY CODE
|
|
40
40
|
if (qaCheck.settingsUiModule) {
|
|
41
|
-
app.use('/qa-check/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: qaCheck.key }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule));
|
|
41
|
+
app.use('/qa-check/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: qaCheck.key }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule, config));
|
|
42
42
|
// TEMPORARY CODE: it needs to support old path
|
|
43
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule));
|
|
43
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule, config));
|
|
44
44
|
// END TEMPORARY CODE
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -14,6 +14,7 @@ const logger_1 = require("../../../util/logger");
|
|
|
14
14
|
const subscription_1 = require("../../../util/subscription");
|
|
15
15
|
const defaults_1 = require("../util/defaults");
|
|
16
16
|
const users_1 = require("./users");
|
|
17
|
+
const views_1 = require("../../../views");
|
|
17
18
|
function handle(config, integration) {
|
|
18
19
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
19
20
|
var _a, _b, _c, _d;
|
|
@@ -92,7 +93,18 @@ function handle(config, integration) {
|
|
|
92
93
|
checkInterval: ((_d = integration.asyncProgress) === null || _d === void 0 ? void 0 : _d.checkInterval) || 1000,
|
|
93
94
|
};
|
|
94
95
|
logger(`Routing user to ${view} view`);
|
|
95
|
-
|
|
96
|
+
let html;
|
|
97
|
+
if (view === 'install') {
|
|
98
|
+
html = (0, util_1.renderJSX)(views_1.InstallPage, options);
|
|
99
|
+
}
|
|
100
|
+
else if (view === 'login') {
|
|
101
|
+
html = (0, util_1.renderJSX)(views_1.LoginPage, options);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
html = (0, util_1.renderJSX)(views_1.MainPage, options);
|
|
105
|
+
}
|
|
106
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
107
|
+
return res.send(html);
|
|
96
108
|
}));
|
|
97
109
|
}
|
|
98
110
|
exports.default = handle;
|
|
@@ -18,6 +18,7 @@ const defaults_1 = require("../util/defaults");
|
|
|
18
18
|
const logger_1 = require("../../../util/logger");
|
|
19
19
|
const storage_1 = require("../../../storage");
|
|
20
20
|
const crowdin_apps_functions_1 = require("@crowdin/crowdin-apps-functions");
|
|
21
|
+
const views_1 = require("../../../views");
|
|
21
22
|
function handle(config, integration) {
|
|
22
23
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
23
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
@@ -65,12 +66,19 @@ function handle(config, integration) {
|
|
|
65
66
|
yield (0, storage_1.getStorage)().deleteMetadata((0, defaults_1.getOAuthPollingId)(clientId));
|
|
66
67
|
yield (0, storage_1.getStorage)().saveMetadata((0, defaults_1.getOAuthPollingId)(clientId), oauthCredentials, organization);
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
const html = (0, util_1.renderJSX)(views_1.OAuthPage, {
|
|
70
|
+
message: JSON.stringify(message),
|
|
71
|
+
oauthMode: (_p = integration.oauthLogin) === null || _p === void 0 ? void 0 : _p.mode,
|
|
72
|
+
});
|
|
73
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
74
|
+
return res.send(html);
|
|
69
75
|
}
|
|
70
76
|
catch (e) {
|
|
71
77
|
(0, logger_1.logError)(e);
|
|
72
78
|
message.data = { error: (0, logger_1.getErrorMessage)(e) };
|
|
73
|
-
|
|
79
|
+
const html = (0, util_1.renderJSX)(views_1.OAuthPage, { message: JSON.stringify(message) });
|
|
80
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
81
|
+
return res.send(html);
|
|
74
82
|
}
|
|
75
83
|
}));
|
|
76
84
|
}
|
|
@@ -36,11 +36,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.register = void 0;
|
|
39
|
-
const cron = __importStar(require("node-cron"));
|
|
40
39
|
const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
|
|
41
40
|
const integration_credentials_1 = __importDefault(require("../../middlewares/integration-credentials"));
|
|
42
41
|
const json_response_1 = __importDefault(require("../../middlewares/json-response"));
|
|
43
42
|
const util_1 = require("../../util");
|
|
43
|
+
const static_files_1 = require("../../util/static-files");
|
|
44
44
|
const defaults_1 = require("./util/defaults");
|
|
45
45
|
const webhooks_1 = require("./util/webhooks");
|
|
46
46
|
const crowdin_file_progress_1 = __importDefault(require("./handlers/crowdin-file-progress"));
|
|
@@ -75,7 +75,7 @@ function register({ config, app }) {
|
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
(0, defaults_1.applyIntegrationModuleDefaults)(config, integrationLogic);
|
|
78
|
-
app.get((0, util_1.getLogoUrl)(integrationLogic, '/integration'), (
|
|
78
|
+
app.get((0, util_1.getLogoUrl)(integrationLogic, '/integration'), (0, static_files_1.serveFile)(config, integrationLogic.imagePath || config.imagePath));
|
|
79
79
|
app.get('/', (0, crowdin_client_1.default)({
|
|
80
80
|
config,
|
|
81
81
|
optional: true,
|
|
@@ -183,25 +183,32 @@ function register({ config, app }) {
|
|
|
183
183
|
}), (0, oauth_polling_1.default)(integrationLogic));
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
cron.schedule('0 * * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '1' }).catch(console.error));
|
|
193
|
-
cron.schedule('0 */3 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '3' }).catch(console.error));
|
|
194
|
-
cron.schedule('0 */6 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '6' }).catch(console.error));
|
|
195
|
-
cron.schedule('0 */12 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '12' }).catch(console.error));
|
|
196
|
-
cron.schedule('0 0 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '24' }).catch(console.error));
|
|
197
|
-
}
|
|
198
|
-
// remove user errors
|
|
199
|
-
cron.schedule('0 0 * * *', () => __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
if (integrationLogic.userErrorLifetimeDays) {
|
|
201
|
-
const date = (0, util_1.getPreviousDate)(integrationLogic.userErrorLifetimeDays);
|
|
202
|
-
yield (0, storage_1.getStorage)().deleteAllUsersErrorsOlderThan(`${date.getTime()}`);
|
|
186
|
+
Promise.resolve().then(() => __importStar(require('node-cron'))).then((nodeCron) => {
|
|
187
|
+
const cron = nodeCron.default || nodeCron;
|
|
188
|
+
if (integrationLogic.cronJobs) {
|
|
189
|
+
integrationLogic.cronJobs.forEach((job) => {
|
|
190
|
+
cron.schedule(job.expression, () => (0, cron_1.runJob)({ config, integration: integrationLogic, job }).catch(console.error));
|
|
191
|
+
});
|
|
203
192
|
}
|
|
204
|
-
|
|
193
|
+
if (integrationLogic.withCronSync) {
|
|
194
|
+
cron.schedule('0 * * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '1' }).catch(console.error));
|
|
195
|
+
cron.schedule('0 */3 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '3' }).catch(console.error));
|
|
196
|
+
cron.schedule('0 */6 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '6' }).catch(console.error));
|
|
197
|
+
cron.schedule('0 */12 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '12' }).catch(console.error));
|
|
198
|
+
cron.schedule('0 0 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '24' }).catch(console.error));
|
|
199
|
+
}
|
|
200
|
+
// remove user errors
|
|
201
|
+
cron.schedule('0 0 * * *', () => __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
if (integrationLogic.userErrorLifetimeDays) {
|
|
203
|
+
const date = (0, util_1.getPreviousDate)(integrationLogic.userErrorLifetimeDays);
|
|
204
|
+
yield (0, storage_1.getStorage)().deleteAllUsersErrorsOlderThan(`${date.getTime()}`);
|
|
205
|
+
}
|
|
206
|
+
}));
|
|
207
|
+
cron.schedule('0 0 1 * *', () => (0, cron_1.removeFinishedJobs)());
|
|
208
|
+
})
|
|
209
|
+
.catch(() => {
|
|
210
|
+
// node-cron not available (e.g., Cloudflare Workers)
|
|
211
|
+
});
|
|
205
212
|
if (integrationLogic.webhooks) {
|
|
206
213
|
app.post(`${integrationLogic.webhooks.crowdinWebhookUrl
|
|
207
214
|
? integrationLogic.webhooks.crowdinWebhookUrl
|
|
@@ -238,6 +245,5 @@ function register({ config, app }) {
|
|
|
238
245
|
checkSubscriptionExpiration: true,
|
|
239
246
|
moduleKey: integrationLogic.key,
|
|
240
247
|
}), (0, integration_credentials_1.default)(config, integrationLogic), (0, invite_users_1.default)());
|
|
241
|
-
cron.schedule('0 0 1 * *', () => (0, cron_1.removeFinishedJobs)());
|
|
242
248
|
}
|
|
243
249
|
exports.register = register;
|
|
@@ -104,7 +104,7 @@ function runAsJob({ integrationId, crowdinId, type, title, payload, res, project
|
|
|
104
104
|
});
|
|
105
105
|
},
|
|
106
106
|
type: jobType,
|
|
107
|
-
fetchTranslation: ({ fileId, languageId }) => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
fetchTranslation: ({ fileId, languageId, params }) => __awaiter(this, void 0, void 0, function* () {
|
|
108
108
|
var _a, _b, _c;
|
|
109
109
|
const translationCache = isDbStore
|
|
110
110
|
? yield storage.getFileTranslationCacheByLanguage({
|
|
@@ -140,9 +140,7 @@ function runAsJob({ integrationId, crowdinId, type, title, payload, res, project
|
|
|
140
140
|
let translation = null;
|
|
141
141
|
try {
|
|
142
142
|
(0, logger_1.log)(`Receiving translation for file ${fileId} in language ${languageId}`);
|
|
143
|
-
translation = yield client.translationsApi.buildProjectFileTranslation(projectId, fileId, {
|
|
144
|
-
targetLanguageId: languageId,
|
|
145
|
-
}, (translationCache === null || translationCache === void 0 ? void 0 : translationCache.etag) && !forcePushTranslations ? translationCache === null || translationCache === void 0 ? void 0 : translationCache.etag : undefined);
|
|
143
|
+
translation = yield client.translationsApi.buildProjectFileTranslation(projectId, fileId, Object.assign({ targetLanguageId: languageId }, (params !== null && params !== void 0 ? params : {})), (translationCache === null || translationCache === void 0 ? void 0 : translationCache.etag) && !forcePushTranslations ? translationCache === null || translationCache === void 0 ? void 0 : translationCache.etag : undefined);
|
|
146
144
|
return translation;
|
|
147
145
|
}
|
|
148
146
|
catch (e) {
|
|
@@ -84,9 +84,10 @@ export type SaveUploadedFileTranslation = ({ fileId, translationParams, }: {
|
|
|
84
84
|
etag: string;
|
|
85
85
|
}[];
|
|
86
86
|
}) => Promise<void>;
|
|
87
|
-
export type FetchTranslation = ({ fileId, languageId, }: {
|
|
87
|
+
export type FetchTranslation = ({ fileId, languageId, params, }: {
|
|
88
88
|
fileId: number;
|
|
89
89
|
languageId: string;
|
|
90
|
+
params?: Omit<TranslationsModel.BuildProjectFileTranslationRequest, 'targetLanguageId'>;
|
|
90
91
|
}) => Promise<ResponseObject<TranslationsModel.BuildProjectFileTranslationResponse> | null>;
|
|
91
92
|
export interface TranslationCache {
|
|
92
93
|
integrationId: string;
|
|
@@ -16,14 +16,14 @@ function register({ config, app }) {
|
|
|
16
16
|
if (Array.isArray(config.modal)) {
|
|
17
17
|
config.modal.forEach((modal) => {
|
|
18
18
|
if ((modal === null || modal === void 0 ? void 0 : modal.uiPath) || (modal === null || modal === void 0 ? void 0 : modal.formSchema)) {
|
|
19
|
-
app.use(`/modal-${modal.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: modal.key }), (0, render_ui_module_1.default)(modal));
|
|
19
|
+
app.use(`/modal-${modal.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: modal.key }), (0, render_ui_module_1.default)(modal, config));
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
24
|
// backward compatibility will be removed after migration
|
|
25
25
|
if (((_a = config.modal) === null || _a === void 0 ? void 0 : _a.uiPath) || ((_b = config.modal) === null || _b === void 0 ? void 0 : _b.formSchema)) {
|
|
26
|
-
app.use('/modal', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.modal.key }), (0, render_ui_module_1.default)(config.modal));
|
|
26
|
+
app.use('/modal', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.modal.key }), (0, render_ui_module_1.default)(config.modal, config));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -7,16 +7,18 @@ exports.register = void 0;
|
|
|
7
7
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const util_1 = require("../../util");
|
|
10
|
+
const static_files_1 = require("../../util/static-files");
|
|
10
11
|
function register({ config, app }) {
|
|
12
|
+
var _a, _b;
|
|
11
13
|
if (!config.organizationMenu) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
16
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
15
|
-
app.get((0, util_1.getLogoUrl)(config.organizationMenu, '/organization-menu'), (
|
|
16
|
-
app.use('/organization-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationMenu.key }), (0, render_ui_module_1.default)(config.organizationMenu));
|
|
17
|
+
app.get((0, util_1.getLogoUrl)(config.organizationMenu, '/organization-menu'), (0, static_files_1.serveFile)(config, ((_a = config.organizationMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath));
|
|
18
|
+
app.use('/organization-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationMenu.key }), (0, render_ui_module_1.default)(config.organizationMenu, config));
|
|
17
19
|
// TEMPORARY CODE: it needs to support old path
|
|
18
|
-
app.get((0, util_1.getLogoUrl)(config.organizationMenu, '/resources'), (
|
|
19
|
-
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationMenu));
|
|
20
|
+
app.get((0, util_1.getLogoUrl)(config.organizationMenu, '/resources'), (0, static_files_1.serveFile)(config, ((_b = config.organizationMenu) === null || _b === void 0 ? void 0 : _b.imagePath) || config.imagePath));
|
|
21
|
+
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationMenu, config));
|
|
20
22
|
// END TEMPORARY CODE
|
|
21
23
|
}
|
|
22
24
|
exports.register = register;
|
|
@@ -7,16 +7,18 @@ exports.register = void 0;
|
|
|
7
7
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const util_1 = require("../../util");
|
|
10
|
+
const static_files_1 = require("../../util/static-files");
|
|
10
11
|
function register({ config, app }) {
|
|
12
|
+
var _a, _b;
|
|
11
13
|
if (!config.organizationSettingsMenu) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
16
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
15
|
-
app.get((0, util_1.getLogoUrl)(config.organizationSettingsMenu, '/organization-settings'), (
|
|
16
|
-
app.use('/organization-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationSettingsMenu.key }), (0, render_ui_module_1.default)(config.organizationSettingsMenu));
|
|
17
|
+
app.get((0, util_1.getLogoUrl)(config.organizationSettingsMenu, '/organization-settings'), (0, static_files_1.serveFile)(config, ((_a = config.organizationSettingsMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath));
|
|
18
|
+
app.use('/organization-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationSettingsMenu.key }), (0, render_ui_module_1.default)(config.organizationSettingsMenu, config));
|
|
17
19
|
// TEMPORARY CODE: it needs to support old path
|
|
18
|
-
app.get((0, util_1.getLogoUrl)(config.organizationSettingsMenu, '/settings'), (
|
|
19
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationSettingsMenu));
|
|
20
|
+
app.get((0, util_1.getLogoUrl)(config.organizationSettingsMenu, '/settings'), (0, static_files_1.serveFile)(config, ((_b = config.organizationSettingsMenu) === null || _b === void 0 ? void 0 : _b.imagePath) || config.imagePath));
|
|
21
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationSettingsMenu, config));
|
|
20
22
|
// END TEMPORARY CODE
|
|
21
23
|
}
|
|
22
24
|
exports.register = register;
|
|
@@ -7,16 +7,18 @@ exports.register = void 0;
|
|
|
7
7
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const util_1 = require("../../util");
|
|
10
|
+
const static_files_1 = require("../../util/static-files");
|
|
10
11
|
function register({ config, app }) {
|
|
12
|
+
var _a, _b;
|
|
11
13
|
if (!config.profileResourcesMenu) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
|
-
app.get((0, util_1.getLogoUrl)(config.profileResourcesMenu, '/profile-resources'), (
|
|
16
|
+
app.get((0, util_1.getLogoUrl)(config.profileResourcesMenu, '/profile-resources'), (0, static_files_1.serveFile)(config, ((_a = config.profileResourcesMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath));
|
|
15
17
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
16
|
-
app.use('/profile-resources', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileResourcesMenu.key }), (0, render_ui_module_1.default)(config.profileResourcesMenu));
|
|
18
|
+
app.use('/profile-resources', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileResourcesMenu.key }), (0, render_ui_module_1.default)(config.profileResourcesMenu, config));
|
|
17
19
|
// TEMPORARY CODE: it needs to support old path
|
|
18
|
-
app.get((0, util_1.getLogoUrl)(config.profileResourcesMenu, '/resources'), (
|
|
19
|
-
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileResourcesMenu));
|
|
20
|
+
app.get((0, util_1.getLogoUrl)(config.profileResourcesMenu, '/resources'), (0, static_files_1.serveFile)(config, ((_b = config.profileResourcesMenu) === null || _b === void 0 ? void 0 : _b.imagePath) || config.imagePath));
|
|
21
|
+
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileResourcesMenu, config));
|
|
20
22
|
// END TEMPORARY CODE
|
|
21
23
|
}
|
|
22
24
|
exports.register = register;
|