@theia/mini-browser 1.45.0 → 1.46.0-next.72

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.
Files changed (63) hide show
  1. package/README.md +45 -45
  2. package/lib/browser/environment/mini-browser-environment-module.d.ts +3 -3
  3. package/lib/browser/environment/mini-browser-environment-module.js +24 -24
  4. package/lib/browser/environment/mini-browser-environment.d.ts +25 -25
  5. package/lib/browser/environment/mini-browser-environment.js +95 -95
  6. package/lib/browser/environment/mini-browser-environment.js.map +1 -1
  7. package/lib/browser/location-mapper-service.d.ts +58 -58
  8. package/lib/browser/location-mapper-service.js +140 -140
  9. package/lib/browser/mini-browser-content-style.d.ts +17 -17
  10. package/lib/browser/mini-browser-content-style.js +36 -36
  11. package/lib/browser/mini-browser-content.d.ts +177 -177
  12. package/lib/browser/mini-browser-content.js +554 -554
  13. package/lib/browser/mini-browser-frontend-module.d.ts +4 -4
  14. package/lib/browser/mini-browser-frontend-module.js +70 -70
  15. package/lib/browser/mini-browser-frontend-security-warnings.d.ts +11 -11
  16. package/lib/browser/mini-browser-frontend-security-warnings.js +73 -73
  17. package/lib/browser/mini-browser-open-handler.d.ts +76 -76
  18. package/lib/browser/mini-browser-open-handler.js +292 -292
  19. package/lib/browser/mini-browser.d.ts +25 -25
  20. package/lib/browser/mini-browser.js +118 -118
  21. package/lib/common/mini-browser-endpoint.d.ts +12 -12
  22. package/lib/common/mini-browser-endpoint.js +31 -31
  23. package/lib/common/mini-browser-service.d.ts +14 -14
  24. package/lib/common/mini-browser-service.js +20 -20
  25. package/lib/electron-browser/environment/electron-mini-browser-environment-module.d.ts +3 -3
  26. package/lib/electron-browser/environment/electron-mini-browser-environment-module.js +25 -25
  27. package/lib/electron-browser/environment/electron-mini-browser-environment.d.ts +9 -9
  28. package/lib/electron-browser/environment/electron-mini-browser-environment.js +60 -60
  29. package/lib/electron-main/mini-browser-electron-main-contribution.d.ts +12 -12
  30. package/lib/electron-main/mini-browser-electron-main-contribution.js +54 -54
  31. package/lib/node/mini-browser-backend-module.d.ts +3 -3
  32. package/lib/node/mini-browser-backend-module.js +41 -41
  33. package/lib/node/mini-browser-backend-security-warnings.d.ts +5 -5
  34. package/lib/node/mini-browser-backend-security-warnings.js +51 -51
  35. package/lib/node/mini-browser-endpoint.d.ts +97 -97
  36. package/lib/node/mini-browser-endpoint.js +268 -268
  37. package/lib/node/mini-browser-endpoint.js.map +1 -1
  38. package/lib/node/mini-browser-ws-validator.d.ts +12 -12
  39. package/lib/node/mini-browser-ws-validator.js +69 -69
  40. package/lib/package.spec.js +18 -18
  41. package/package.json +5 -6
  42. package/src/browser/environment/mini-browser-environment-module.ts +24 -24
  43. package/src/browser/environment/mini-browser-environment.ts +87 -87
  44. package/src/browser/location-mapper-service.ts +150 -150
  45. package/src/browser/mini-browser-content-style.ts +32 -32
  46. package/src/browser/mini-browser-content.ts +630 -630
  47. package/src/browser/mini-browser-frontend-module.ts +86 -86
  48. package/src/browser/mini-browser-frontend-security-warnings.ts +59 -59
  49. package/src/browser/mini-browser-open-handler.ts +312 -312
  50. package/src/browser/mini-browser.ts +110 -110
  51. package/src/browser/pdfobject.d.ts +99 -99
  52. package/src/browser/style/index.css +157 -157
  53. package/src/browser/style/mini-browser.svg +17 -17
  54. package/src/common/mini-browser-endpoint.ts +28 -28
  55. package/src/common/mini-browser-service.ts +29 -29
  56. package/src/electron-browser/environment/electron-mini-browser-environment-module.ts +25 -25
  57. package/src/electron-browser/environment/electron-mini-browser-environment.ts +53 -53
  58. package/src/electron-main/mini-browser-electron-main-contribution.ts +42 -42
  59. package/src/node/mini-browser-backend-module.ts +41 -41
  60. package/src/node/mini-browser-backend-security-warnings.ts +45 -45
  61. package/src/node/mini-browser-endpoint.ts +315 -315
  62. package/src/node/mini-browser-ws-validator.ts +56 -56
  63. package/src/package.spec.ts +21 -21
@@ -1,55 +1,55 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2020 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.MiniBrowserElectronMainContribution = void 0;
28
- const electron_security_token_service_1 = require("@theia/core/lib/electron-main/electron-security-token-service");
29
- const inversify_1 = require("@theia/core/shared/inversify");
30
- const mini_browser_endpoint_1 = require("../common/mini-browser-endpoint");
31
- /**
32
- * Since the mini-browser might serve content from a new origin,
33
- * we need to attach the ElectronSecurityToken for the Electron
34
- * backend to accept HTTP requests.
35
- */
36
- let MiniBrowserElectronMainContribution = class MiniBrowserElectronMainContribution {
37
- async onStart(app) {
38
- const url = this.getMiniBrowserEndpoint(await app.backendPort);
39
- await this.electronSecurityTokenService.setElectronSecurityTokenCookie(url);
40
- }
41
- getMiniBrowserEndpoint(port) {
42
- var _a;
43
- const pattern = (_a = process.env[mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_ENV]) !== null && _a !== void 0 ? _a : mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_DEFAULT;
44
- return 'http://' + pattern.replace('{{hostname}}', `localhost:${port}`);
45
- }
46
- };
47
- __decorate([
48
- (0, inversify_1.inject)(electron_security_token_service_1.ElectronSecurityTokenService),
49
- __metadata("design:type", electron_security_token_service_1.ElectronSecurityTokenService)
50
- ], MiniBrowserElectronMainContribution.prototype, "electronSecurityTokenService", void 0);
51
- MiniBrowserElectronMainContribution = __decorate([
52
- (0, inversify_1.injectable)()
53
- ], MiniBrowserElectronMainContribution);
54
- exports.MiniBrowserElectronMainContribution = MiniBrowserElectronMainContribution;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2020 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.MiniBrowserElectronMainContribution = void 0;
28
+ const electron_security_token_service_1 = require("@theia/core/lib/electron-main/electron-security-token-service");
29
+ const inversify_1 = require("@theia/core/shared/inversify");
30
+ const mini_browser_endpoint_1 = require("../common/mini-browser-endpoint");
31
+ /**
32
+ * Since the mini-browser might serve content from a new origin,
33
+ * we need to attach the ElectronSecurityToken for the Electron
34
+ * backend to accept HTTP requests.
35
+ */
36
+ let MiniBrowserElectronMainContribution = class MiniBrowserElectronMainContribution {
37
+ async onStart(app) {
38
+ const url = this.getMiniBrowserEndpoint(await app.backendPort);
39
+ await this.electronSecurityTokenService.setElectronSecurityTokenCookie(url);
40
+ }
41
+ getMiniBrowserEndpoint(port) {
42
+ var _a;
43
+ const pattern = (_a = process.env[mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_ENV]) !== null && _a !== void 0 ? _a : mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_DEFAULT;
44
+ return 'http://' + pattern.replace('{{hostname}}', `localhost:${port}`);
45
+ }
46
+ };
47
+ __decorate([
48
+ (0, inversify_1.inject)(electron_security_token_service_1.ElectronSecurityTokenService),
49
+ __metadata("design:type", electron_security_token_service_1.ElectronSecurityTokenService)
50
+ ], MiniBrowserElectronMainContribution.prototype, "electronSecurityTokenService", void 0);
51
+ MiniBrowserElectronMainContribution = __decorate([
52
+ (0, inversify_1.injectable)()
53
+ ], MiniBrowserElectronMainContribution);
54
+ exports.MiniBrowserElectronMainContribution = MiniBrowserElectronMainContribution;
55
55
  //# sourceMappingURL=mini-browser-electron-main-contribution.js.map
@@ -1,4 +1,4 @@
1
- import { ContainerModule } from '@theia/core/shared/inversify';
2
- declare const _default: ContainerModule;
3
- export default _default;
1
+ import { ContainerModule } from '@theia/core/shared/inversify';
2
+ declare const _default: ContainerModule;
3
+ export default _default;
4
4
  //# sourceMappingURL=mini-browser-backend-module.d.ts.map
@@ -1,42 +1,42 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 TypeFox and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const inversify_1 = require("@theia/core/shared/inversify");
19
- const contribution_provider_1 = require("@theia/core/lib/common/contribution-provider");
20
- const backend_application_1 = require("@theia/core/lib/node/backend-application");
21
- const common_1 = require("@theia/core/lib/common");
22
- const mini_browser_service_1 = require("../common/mini-browser-service");
23
- const mini_browser_endpoint_1 = require("./mini-browser-endpoint");
24
- const ws_request_validators_1 = require("@theia/core/lib/node/ws-request-validators");
25
- const mini_browser_ws_validator_1 = require("./mini-browser-ws-validator");
26
- const mini_browser_backend_security_warnings_1 = require("./mini-browser-backend-security-warnings");
27
- exports.default = new inversify_1.ContainerModule(bind => {
28
- bind(mini_browser_endpoint_1.MiniBrowserEndpoint).toSelf().inSingletonScope();
29
- bind(backend_application_1.BackendApplicationContribution).toService(mini_browser_endpoint_1.MiniBrowserEndpoint);
30
- bind(mini_browser_ws_validator_1.MiniBrowserWsRequestValidator).toSelf().inSingletonScope();
31
- bind(ws_request_validators_1.WsRequestValidatorContribution).toService(mini_browser_ws_validator_1.MiniBrowserWsRequestValidator);
32
- bind(mini_browser_service_1.MiniBrowserService).toService(mini_browser_endpoint_1.MiniBrowserEndpoint);
33
- bind(common_1.ConnectionHandler).toDynamicValue(context => new common_1.RpcConnectionHandler(mini_browser_service_1.MiniBrowserServicePath, () => context.container.get(mini_browser_service_1.MiniBrowserService))).inSingletonScope();
34
- (0, contribution_provider_1.bindContributionProvider)(bind, mini_browser_endpoint_1.MiniBrowserEndpointHandler);
35
- bind(mini_browser_endpoint_1.MiniBrowserEndpointHandler).to(mini_browser_endpoint_1.HtmlHandler).inSingletonScope();
36
- bind(mini_browser_endpoint_1.MiniBrowserEndpointHandler).to(mini_browser_endpoint_1.ImageHandler).inSingletonScope();
37
- bind(mini_browser_endpoint_1.MiniBrowserEndpointHandler).to(mini_browser_endpoint_1.PdfHandler).inSingletonScope();
38
- bind(mini_browser_endpoint_1.MiniBrowserEndpointHandler).to(mini_browser_endpoint_1.SvgHandler).inSingletonScope();
39
- bind(mini_browser_backend_security_warnings_1.MiniBrowserBackendSecurityWarnings).toSelf().inSingletonScope();
40
- bind(backend_application_1.BackendApplicationContribution).toService(mini_browser_backend_security_warnings_1.MiniBrowserBackendSecurityWarnings);
41
- });
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const inversify_1 = require("@theia/core/shared/inversify");
19
+ const contribution_provider_1 = require("@theia/core/lib/common/contribution-provider");
20
+ const backend_application_1 = require("@theia/core/lib/node/backend-application");
21
+ const common_1 = require("@theia/core/lib/common");
22
+ const mini_browser_service_1 = require("../common/mini-browser-service");
23
+ const mini_browser_endpoint_1 = require("./mini-browser-endpoint");
24
+ const ws_request_validators_1 = require("@theia/core/lib/node/ws-request-validators");
25
+ const mini_browser_ws_validator_1 = require("./mini-browser-ws-validator");
26
+ const mini_browser_backend_security_warnings_1 = require("./mini-browser-backend-security-warnings");
27
+ exports.default = new inversify_1.ContainerModule(bind => {
28
+ bind(mini_browser_endpoint_1.MiniBrowserEndpoint).toSelf().inSingletonScope();
29
+ bind(backend_application_1.BackendApplicationContribution).toService(mini_browser_endpoint_1.MiniBrowserEndpoint);
30
+ bind(mini_browser_ws_validator_1.MiniBrowserWsRequestValidator).toSelf().inSingletonScope();
31
+ bind(ws_request_validators_1.WsRequestValidatorContribution).toService(mini_browser_ws_validator_1.MiniBrowserWsRequestValidator);
32
+ bind(mini_browser_service_1.MiniBrowserService).toService(mini_browser_endpoint_1.MiniBrowserEndpoint);
33
+ bind(common_1.ConnectionHandler).toDynamicValue(context => new common_1.RpcConnectionHandler(mini_browser_service_1.MiniBrowserServicePath, () => context.container.get(mini_browser_service_1.MiniBrowserService))).inSingletonScope();
34
+ (0, contribution_provider_1.bindContributionProvider)(bind, mini_browser_endpoint_1.MiniBrowserEndpointHandler);
35
+ bind(mini_browser_endpoint_1.MiniBrowserEndpointHandler).to(mini_browser_endpoint_1.HtmlHandler).inSingletonScope();
36
+ bind(mini_browser_endpoint_1.MiniBrowserEndpointHandler).to(mini_browser_endpoint_1.ImageHandler).inSingletonScope();
37
+ bind(mini_browser_endpoint_1.MiniBrowserEndpointHandler).to(mini_browser_endpoint_1.PdfHandler).inSingletonScope();
38
+ bind(mini_browser_endpoint_1.MiniBrowserEndpointHandler).to(mini_browser_endpoint_1.SvgHandler).inSingletonScope();
39
+ bind(mini_browser_backend_security_warnings_1.MiniBrowserBackendSecurityWarnings).toSelf().inSingletonScope();
40
+ bind(backend_application_1.BackendApplicationContribution).toService(mini_browser_backend_security_warnings_1.MiniBrowserBackendSecurityWarnings);
41
+ });
42
42
  //# sourceMappingURL=mini-browser-backend-module.js.map
@@ -1,6 +1,6 @@
1
- import { BackendApplicationContribution } from '@theia/core/lib/node';
2
- export declare class MiniBrowserBackendSecurityWarnings implements BackendApplicationContribution {
3
- initialize(): void;
4
- protected checkHostPattern(): Promise<void>;
5
- }
1
+ import { BackendApplicationContribution } from '@theia/core/lib/node';
2
+ export declare class MiniBrowserBackendSecurityWarnings implements BackendApplicationContribution {
3
+ initialize(): void;
4
+ protected checkHostPattern(): Promise<void>;
5
+ }
6
6
  //# sourceMappingURL=mini-browser-backend-security-warnings.d.ts.map
@@ -1,52 +1,52 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.MiniBrowserBackendSecurityWarnings = void 0;
25
- const backend_application_config_provider_1 = require("@theia/core/lib/node/backend-application-config-provider");
26
- const inversify_1 = require("@theia/core/shared/inversify");
27
- const mini_browser_endpoint_1 = require("../common/mini-browser-endpoint");
28
- let MiniBrowserBackendSecurityWarnings = class MiniBrowserBackendSecurityWarnings {
29
- initialize() {
30
- this.checkHostPattern();
31
- }
32
- async checkHostPattern() {
33
- if (backend_application_config_provider_1.BackendApplicationConfigProvider.get()['warnOnPotentiallyInsecureHostPattern'] === false) {
34
- return;
35
- }
36
- const envHostPattern = process.env[mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_ENV];
37
- if (envHostPattern && envHostPattern !== mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_DEFAULT) {
38
- console.warn(`\
39
- MINI BROWSER SECURITY WARNING
40
-
41
- Changing the @theia/mini-browser host pattern can lead to security vulnerabilities.
42
- Current pattern: "${envHostPattern}"
43
- Please read @theia/mini-browser/README.md for more information.
44
- `);
45
- }
46
- }
47
- };
48
- MiniBrowserBackendSecurityWarnings = __decorate([
49
- (0, inversify_1.injectable)()
50
- ], MiniBrowserBackendSecurityWarnings);
51
- exports.MiniBrowserBackendSecurityWarnings = MiniBrowserBackendSecurityWarnings;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2021 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.MiniBrowserBackendSecurityWarnings = void 0;
25
+ const backend_application_config_provider_1 = require("@theia/core/lib/node/backend-application-config-provider");
26
+ const inversify_1 = require("@theia/core/shared/inversify");
27
+ const mini_browser_endpoint_1 = require("../common/mini-browser-endpoint");
28
+ let MiniBrowserBackendSecurityWarnings = class MiniBrowserBackendSecurityWarnings {
29
+ initialize() {
30
+ this.checkHostPattern();
31
+ }
32
+ async checkHostPattern() {
33
+ if (backend_application_config_provider_1.BackendApplicationConfigProvider.get()['warnOnPotentiallyInsecureHostPattern'] === false) {
34
+ return;
35
+ }
36
+ const envHostPattern = process.env[mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_ENV];
37
+ if (envHostPattern && envHostPattern !== mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_DEFAULT) {
38
+ console.warn(`\
39
+ MINI BROWSER SECURITY WARNING
40
+
41
+ Changing the @theia/mini-browser host pattern can lead to security vulnerabilities.
42
+ Current pattern: "${envHostPattern}"
43
+ Please read @theia/mini-browser/README.md for more information.
44
+ `);
45
+ }
46
+ }
47
+ };
48
+ MiniBrowserBackendSecurityWarnings = __decorate([
49
+ (0, inversify_1.injectable)()
50
+ ], MiniBrowserBackendSecurityWarnings);
51
+ exports.MiniBrowserBackendSecurityWarnings = MiniBrowserBackendSecurityWarnings;
52
52
  //# sourceMappingURL=mini-browser-backend-security-warnings.js.map
@@ -1,98 +1,98 @@
1
- /// <reference types="node" />
2
- /// <reference types="express" />
3
- import * as fs from '@theia/core/shared/fs-extra';
4
- import { Application, Request, Response } from '@theia/core/shared/express';
5
- import { ILogger } from '@theia/core/lib/common/logger';
6
- import { MaybePromise } from '@theia/core/lib/common/types';
7
- import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
8
- import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
9
- import { MiniBrowserService } from '../common/mini-browser-service';
10
- /**
11
- * The return type of the `FileSystem#resolveContent` method.
12
- */
13
- export interface FileStatWithContent {
14
- /**
15
- * The file stat.
16
- */
17
- readonly stat: fs.Stats & {
18
- uri: string;
19
- };
20
- /**
21
- * The content of the file as a UTF-8 encoded string.
22
- */
23
- readonly content: string;
24
- }
25
- /**
26
- * Endpoint handler contribution for the `MiniBrowserEndpoint`.
27
- */
28
- export declare const MiniBrowserEndpointHandler: unique symbol;
29
- export interface MiniBrowserEndpointHandler {
30
- /**
31
- * Returns with or resolves to the file extensions supported by the current `mini-browser` endpoint handler.
32
- * The file extension must not start with the leading `.` (dot). For instance; `'html'` or `['jpg', 'jpeg']`.
33
- * The file extensions are case insensitive.
34
- */
35
- supportedExtensions(): MaybePromise<string | string[]>;
36
- /**
37
- * Returns a number representing the priority between all the available handlers for the same file extension.
38
- */
39
- priority(): number;
40
- /**
41
- * Responds back to the sender.
42
- */
43
- respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
44
- }
45
- export declare class MiniBrowserEndpoint implements BackendApplicationContribution, MiniBrowserService {
46
- private attachRequestHandlerPromise;
47
- protected readonly logger: ILogger;
48
- protected readonly contributions: ContributionProvider<MiniBrowserEndpointHandler>;
49
- protected readonly handlers: Map<string, MiniBrowserEndpointHandler>;
50
- configure(app: Application): void;
51
- onStart(): Promise<void>;
52
- supportedFileExtensions(): Promise<Readonly<{
53
- extension: string;
54
- priority: number;
55
- }>[]>;
56
- protected attachRequestHandler(app: Application): Promise<void>;
57
- protected response(uri: string, response: Response): Promise<Response>;
58
- protected getContributions(): MiniBrowserEndpointHandler[];
59
- protected getUri(request: Request): MaybePromise<string>;
60
- protected readContent(uri: string): Promise<FileStatWithContent>;
61
- protected errorHandler(): (error: any, uri: string, response: Response) => MaybePromise<Response>;
62
- protected missingResourceHandler(): (uri: string, response: Response) => MaybePromise<Response>;
63
- protected defaultHandler(): (statWithContent: FileStatWithContent, response: Response) => MaybePromise<Response>;
64
- protected getVirtualHostRegExp(): Promise<RegExp>;
65
- }
66
- /**
67
- * Endpoint handler contribution for HTML files.
68
- */
69
- export declare class HtmlHandler implements MiniBrowserEndpointHandler {
70
- supportedExtensions(): string[];
71
- priority(): number;
72
- respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
73
- }
74
- /**
75
- * Handler for JPG resources.
76
- */
77
- export declare class ImageHandler implements MiniBrowserEndpointHandler {
78
- supportedExtensions(): string[];
79
- priority(): number;
80
- respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
81
- }
82
- /**
83
- * PDF endpoint handler.
84
- */
85
- export declare class PdfHandler implements MiniBrowserEndpointHandler {
86
- supportedExtensions(): string;
87
- priority(): number;
88
- respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
89
- }
90
- /**
91
- * Endpoint contribution for SVG resources.
92
- */
93
- export declare class SvgHandler implements MiniBrowserEndpointHandler {
94
- supportedExtensions(): string;
95
- priority(): number;
96
- respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
97
- }
1
+ /// <reference types="node" />
2
+ /// <reference types="express" />
3
+ import * as fs from '@theia/core/shared/fs-extra';
4
+ import { Application, Request, Response } from '@theia/core/shared/express';
5
+ import { ILogger } from '@theia/core/lib/common/logger';
6
+ import { MaybePromise } from '@theia/core/lib/common/types';
7
+ import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
8
+ import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
9
+ import { MiniBrowserService } from '../common/mini-browser-service';
10
+ /**
11
+ * The return type of the `FileSystem#resolveContent` method.
12
+ */
13
+ export interface FileStatWithContent {
14
+ /**
15
+ * The file stat.
16
+ */
17
+ readonly stat: fs.Stats & {
18
+ uri: string;
19
+ };
20
+ /**
21
+ * The content of the file as a UTF-8 encoded string.
22
+ */
23
+ readonly content: string;
24
+ }
25
+ /**
26
+ * Endpoint handler contribution for the `MiniBrowserEndpoint`.
27
+ */
28
+ export declare const MiniBrowserEndpointHandler: unique symbol;
29
+ export interface MiniBrowserEndpointHandler {
30
+ /**
31
+ * Returns with or resolves to the file extensions supported by the current `mini-browser` endpoint handler.
32
+ * The file extension must not start with the leading `.` (dot). For instance; `'html'` or `['jpg', 'jpeg']`.
33
+ * The file extensions are case insensitive.
34
+ */
35
+ supportedExtensions(): MaybePromise<string | string[]>;
36
+ /**
37
+ * Returns a number representing the priority between all the available handlers for the same file extension.
38
+ */
39
+ priority(): number;
40
+ /**
41
+ * Responds back to the sender.
42
+ */
43
+ respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
44
+ }
45
+ export declare class MiniBrowserEndpoint implements BackendApplicationContribution, MiniBrowserService {
46
+ private attachRequestHandlerPromise;
47
+ protected readonly logger: ILogger;
48
+ protected readonly contributions: ContributionProvider<MiniBrowserEndpointHandler>;
49
+ protected readonly handlers: Map<string, MiniBrowserEndpointHandler>;
50
+ configure(app: Application): void;
51
+ onStart(): Promise<void>;
52
+ supportedFileExtensions(): Promise<Readonly<{
53
+ extension: string;
54
+ priority: number;
55
+ }>[]>;
56
+ protected attachRequestHandler(app: Application): Promise<void>;
57
+ protected response(uri: string, response: Response): Promise<Response>;
58
+ protected getContributions(): MiniBrowserEndpointHandler[];
59
+ protected getUri(request: Request): MaybePromise<string>;
60
+ protected readContent(uri: string): Promise<FileStatWithContent>;
61
+ protected errorHandler(): (error: any, uri: string, response: Response) => MaybePromise<Response>;
62
+ protected missingResourceHandler(): (uri: string, response: Response) => MaybePromise<Response>;
63
+ protected defaultHandler(): (statWithContent: FileStatWithContent, response: Response) => MaybePromise<Response>;
64
+ protected getVirtualHostRegExp(): Promise<RegExp>;
65
+ }
66
+ /**
67
+ * Endpoint handler contribution for HTML files.
68
+ */
69
+ export declare class HtmlHandler implements MiniBrowserEndpointHandler {
70
+ supportedExtensions(): string[];
71
+ priority(): number;
72
+ respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
73
+ }
74
+ /**
75
+ * Handler for JPG resources.
76
+ */
77
+ export declare class ImageHandler implements MiniBrowserEndpointHandler {
78
+ supportedExtensions(): string[];
79
+ priority(): number;
80
+ respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
81
+ }
82
+ /**
83
+ * PDF endpoint handler.
84
+ */
85
+ export declare class PdfHandler implements MiniBrowserEndpointHandler {
86
+ supportedExtensions(): string;
87
+ priority(): number;
88
+ respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
89
+ }
90
+ /**
91
+ * Endpoint contribution for SVG resources.
92
+ */
93
+ export declare class SvgHandler implements MiniBrowserEndpointHandler {
94
+ supportedExtensions(): string;
95
+ priority(): number;
96
+ respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response>;
97
+ }
98
98
  //# sourceMappingURL=mini-browser-endpoint.d.ts.map