@theia/mini-browser 1.53.0-next.55 → 1.53.0-next.64

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 (26) hide show
  1. package/README.md +45 -45
  2. package/lib/browser/mini-browser-frontend-security-warnings.js +2 -2
  3. package/lib/node/mini-browser-backend-security-warnings.js +6 -6
  4. package/package.json +4 -4
  5. package/src/browser/environment/mini-browser-environment-module.ts +24 -24
  6. package/src/browser/environment/mini-browser-environment.ts +87 -87
  7. package/src/browser/location-mapper-service.ts +150 -150
  8. package/src/browser/mini-browser-content-style.ts +32 -32
  9. package/src/browser/mini-browser-content.ts +630 -630
  10. package/src/browser/mini-browser-frontend-module.ts +86 -86
  11. package/src/browser/mini-browser-frontend-security-warnings.ts +59 -59
  12. package/src/browser/mini-browser-open-handler.ts +312 -312
  13. package/src/browser/mini-browser.ts +110 -110
  14. package/src/browser/pdfobject.d.ts +99 -99
  15. package/src/browser/style/index.css +157 -157
  16. package/src/browser/style/mini-browser.svg +17 -17
  17. package/src/common/mini-browser-endpoint.ts +28 -28
  18. package/src/common/mini-browser-service.ts +29 -29
  19. package/src/electron-browser/environment/electron-mini-browser-environment-module.ts +25 -25
  20. package/src/electron-browser/environment/electron-mini-browser-environment.ts +53 -53
  21. package/src/electron-main/mini-browser-electron-main-contribution.ts +42 -42
  22. package/src/node/mini-browser-backend-module.ts +41 -41
  23. package/src/node/mini-browser-backend-security-warnings.ts +45 -45
  24. package/src/node/mini-browser-endpoint.ts +315 -315
  25. package/src/node/mini-browser-ws-validator.ts +56 -56
  26. package/src/package.spec.ts +21 -21
@@ -1,42 +1,42 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { ElectronMainApplication, ElectronMainApplicationContribution } from '@theia/core/lib/electron-main/electron-main-application';
18
- import { ElectronSecurityTokenService } from '@theia/core/lib/electron-main/electron-security-token-service';
19
- import { inject, injectable } from '@theia/core/shared/inversify';
20
- import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint';
21
-
22
- /**
23
- * Since the mini-browser might serve content from a new origin,
24
- * we need to attach the ElectronSecurityToken for the Electron
25
- * backend to accept HTTP requests.
26
- */
27
- @injectable()
28
- export class MiniBrowserElectronMainContribution implements ElectronMainApplicationContribution {
29
-
30
- @inject(ElectronSecurityTokenService)
31
- protected readonly electronSecurityTokenService: ElectronSecurityTokenService;
32
-
33
- async onStart(app: ElectronMainApplication): Promise<void> {
34
- const url = this.getMiniBrowserEndpoint(await app.backendPort);
35
- await this.electronSecurityTokenService.setElectronSecurityTokenCookie(url);
36
- }
37
-
38
- protected getMiniBrowserEndpoint(port: number): string {
39
- const pattern = process.env[MiniBrowserEndpoint.HOST_PATTERN_ENV] ?? MiniBrowserEndpoint.HOST_PATTERN_DEFAULT;
40
- return 'http://' + pattern.replace('{{hostname}}', `localhost:${port}`);
41
- }
42
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ElectronMainApplication, ElectronMainApplicationContribution } from '@theia/core/lib/electron-main/electron-main-application';
18
+ import { ElectronSecurityTokenService } from '@theia/core/lib/electron-main/electron-security-token-service';
19
+ import { inject, injectable } from '@theia/core/shared/inversify';
20
+ import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint';
21
+
22
+ /**
23
+ * Since the mini-browser might serve content from a new origin,
24
+ * we need to attach the ElectronSecurityToken for the Electron
25
+ * backend to accept HTTP requests.
26
+ */
27
+ @injectable()
28
+ export class MiniBrowserElectronMainContribution implements ElectronMainApplicationContribution {
29
+
30
+ @inject(ElectronSecurityTokenService)
31
+ protected readonly electronSecurityTokenService: ElectronSecurityTokenService;
32
+
33
+ async onStart(app: ElectronMainApplication): Promise<void> {
34
+ const url = this.getMiniBrowserEndpoint(await app.backendPort);
35
+ await this.electronSecurityTokenService.setElectronSecurityTokenCookie(url);
36
+ }
37
+
38
+ protected getMiniBrowserEndpoint(port: number): string {
39
+ const pattern = process.env[MiniBrowserEndpoint.HOST_PATTERN_ENV] ?? MiniBrowserEndpoint.HOST_PATTERN_DEFAULT;
40
+ return 'http://' + pattern.replace('{{hostname}}', `localhost:${port}`);
41
+ }
42
+ }
@@ -1,41 +1,41 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { ContainerModule } from '@theia/core/shared/inversify';
18
- import { bindContributionProvider } from '@theia/core/lib/common/contribution-provider';
19
- import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
20
- import { ConnectionHandler, RpcConnectionHandler } from '@theia/core/lib/common';
21
- import { MiniBrowserService, MiniBrowserServicePath } from '../common/mini-browser-service';
22
- import { MiniBrowserEndpoint, MiniBrowserEndpointHandler, HtmlHandler, ImageHandler, PdfHandler, SvgHandler } from './mini-browser-endpoint';
23
- import { WsRequestValidatorContribution } from '@theia/core/lib/node/ws-request-validators';
24
- import { MiniBrowserWsRequestValidator } from './mini-browser-ws-validator';
25
- import { MiniBrowserBackendSecurityWarnings } from './mini-browser-backend-security-warnings';
26
-
27
- export default new ContainerModule(bind => {
28
- bind(MiniBrowserEndpoint).toSelf().inSingletonScope();
29
- bind(BackendApplicationContribution).toService(MiniBrowserEndpoint);
30
- bind(MiniBrowserWsRequestValidator).toSelf().inSingletonScope();
31
- bind(WsRequestValidatorContribution).toService(MiniBrowserWsRequestValidator);
32
- bind(MiniBrowserService).toService(MiniBrowserEndpoint);
33
- bind(ConnectionHandler).toDynamicValue(context => new RpcConnectionHandler(MiniBrowserServicePath, () => context.container.get(MiniBrowserService))).inSingletonScope();
34
- bindContributionProvider(bind, MiniBrowserEndpointHandler);
35
- bind(MiniBrowserEndpointHandler).to(HtmlHandler).inSingletonScope();
36
- bind(MiniBrowserEndpointHandler).to(ImageHandler).inSingletonScope();
37
- bind(MiniBrowserEndpointHandler).to(PdfHandler).inSingletonScope();
38
- bind(MiniBrowserEndpointHandler).to(SvgHandler).inSingletonScope();
39
- bind(MiniBrowserBackendSecurityWarnings).toSelf().inSingletonScope();
40
- bind(BackendApplicationContribution).toService(MiniBrowserBackendSecurityWarnings);
41
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ContainerModule } from '@theia/core/shared/inversify';
18
+ import { bindContributionProvider } from '@theia/core/lib/common/contribution-provider';
19
+ import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
20
+ import { ConnectionHandler, RpcConnectionHandler } from '@theia/core/lib/common';
21
+ import { MiniBrowserService, MiniBrowserServicePath } from '../common/mini-browser-service';
22
+ import { MiniBrowserEndpoint, MiniBrowserEndpointHandler, HtmlHandler, ImageHandler, PdfHandler, SvgHandler } from './mini-browser-endpoint';
23
+ import { WsRequestValidatorContribution } from '@theia/core/lib/node/ws-request-validators';
24
+ import { MiniBrowserWsRequestValidator } from './mini-browser-ws-validator';
25
+ import { MiniBrowserBackendSecurityWarnings } from './mini-browser-backend-security-warnings';
26
+
27
+ export default new ContainerModule(bind => {
28
+ bind(MiniBrowserEndpoint).toSelf().inSingletonScope();
29
+ bind(BackendApplicationContribution).toService(MiniBrowserEndpoint);
30
+ bind(MiniBrowserWsRequestValidator).toSelf().inSingletonScope();
31
+ bind(WsRequestValidatorContribution).toService(MiniBrowserWsRequestValidator);
32
+ bind(MiniBrowserService).toService(MiniBrowserEndpoint);
33
+ bind(ConnectionHandler).toDynamicValue(context => new RpcConnectionHandler(MiniBrowserServicePath, () => context.container.get(MiniBrowserService))).inSingletonScope();
34
+ bindContributionProvider(bind, MiniBrowserEndpointHandler);
35
+ bind(MiniBrowserEndpointHandler).to(HtmlHandler).inSingletonScope();
36
+ bind(MiniBrowserEndpointHandler).to(ImageHandler).inSingletonScope();
37
+ bind(MiniBrowserEndpointHandler).to(PdfHandler).inSingletonScope();
38
+ bind(MiniBrowserEndpointHandler).to(SvgHandler).inSingletonScope();
39
+ bind(MiniBrowserBackendSecurityWarnings).toSelf().inSingletonScope();
40
+ bind(BackendApplicationContribution).toService(MiniBrowserBackendSecurityWarnings);
41
+ });
@@ -1,45 +1,45 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2021 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { BackendApplicationContribution } from '@theia/core/lib/node';
18
- import { BackendApplicationConfigProvider } from '@theia/core/lib/node/backend-application-config-provider';
19
- import { injectable } from '@theia/core/shared/inversify';
20
- import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint';
21
-
22
- @injectable()
23
- export class MiniBrowserBackendSecurityWarnings implements BackendApplicationContribution {
24
-
25
- initialize(): void {
26
- this.checkHostPattern();
27
- }
28
-
29
- protected async checkHostPattern(): Promise<void> {
30
- if (BackendApplicationConfigProvider.get()['warnOnPotentiallyInsecureHostPattern'] === false) {
31
- return;
32
- }
33
- const envHostPattern = process.env[MiniBrowserEndpoint.HOST_PATTERN_ENV];
34
- if (envHostPattern && envHostPattern !== MiniBrowserEndpoint.HOST_PATTERN_DEFAULT) {
35
- console.warn(`\
36
- MINI BROWSER SECURITY WARNING
37
-
38
- Changing the @theia/mini-browser host pattern can lead to security vulnerabilities.
39
- Current pattern: "${envHostPattern}"
40
- Please read @theia/mini-browser/README.md for more information.
41
- `
42
- );
43
- }
44
- }
45
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { BackendApplicationContribution } from '@theia/core/lib/node';
18
+ import { BackendApplicationConfigProvider } from '@theia/core/lib/node/backend-application-config-provider';
19
+ import { injectable } from '@theia/core/shared/inversify';
20
+ import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint';
21
+
22
+ @injectable()
23
+ export class MiniBrowserBackendSecurityWarnings implements BackendApplicationContribution {
24
+
25
+ initialize(): void {
26
+ this.checkHostPattern();
27
+ }
28
+
29
+ protected async checkHostPattern(): Promise<void> {
30
+ if (BackendApplicationConfigProvider.get()['warnOnPotentiallyInsecureHostPattern'] === false) {
31
+ return;
32
+ }
33
+ const envHostPattern = process.env[MiniBrowserEndpoint.HOST_PATTERN_ENV];
34
+ if (envHostPattern && envHostPattern !== MiniBrowserEndpoint.HOST_PATTERN_DEFAULT) {
35
+ console.warn(`\
36
+ MINI BROWSER SECURITY WARNING
37
+
38
+ Changing the @theia/mini-browser host pattern can lead to security vulnerabilities.
39
+ Current pattern: "${envHostPattern}"
40
+ Please read @theia/mini-browser/README.md for more information.
41
+ `
42
+ );
43
+ }
44
+ }
45
+ }