@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
package/README.md CHANGED
@@ -1,45 +1,45 @@
1
- <div align='center'>
2
-
3
- <br />
4
-
5
- <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
-
7
- <h2>ECLIPSE THEIA - MINI-BROWSER EXTENSION</h2>
8
-
9
- <hr />
10
-
11
- </div>
12
-
13
- ## Description
14
-
15
- The `@theia/mini-browser` extension provides a browser widget with the corresponding backend endpoints.
16
-
17
- ## Environment Variables
18
-
19
- - `THEIA_MINI_BROWSER_HOST_PATTERN`
20
-
21
- A string pattern possibly containing `{{uuid}}` and `{{hostname}}` which will be replaced. This is the host for which the `mini-browser` will serve.
22
- It is a good practice to host the `mini-browser` handlers on a sub-domain as it is more secure.
23
- Defaults to `{{uuid}}.mini-browser.{{hostname}}`.
24
-
25
- ## Security Warnings
26
-
27
- - Potentially Insecure Host Pattern
28
-
29
- When you change the host pattern via the `THEIA_MINI_BROWSER_HOST_PATTERN` environment variable warnings will be emitted both from the frontend and from the backend.
30
- You can disable those warnings by setting `warnOnPotentiallyInsecureHostPattern: false` in the appropriate application configurations in your application's `package.json`.
31
-
32
- ## Additional Information
33
-
34
- - [API documentation for `@theia/mini-browser`](https://eclipse-theia.github.io/theia/docs/next/modules/mini_browser.html)
35
- - [Theia - GitHub](https://github.com/eclipse-theia/theia)
36
- - [Theia - Website](https://theia-ide.org/)
37
-
38
- ## License
39
-
40
- - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
41
- - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
42
-
43
- ## Trademark
44
- "Theia" is a trademark of the Eclipse Foundation
45
- https://www.eclipse.org/theia
1
+ <div align='center'>
2
+
3
+ <br />
4
+
5
+ <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
+
7
+ <h2>ECLIPSE THEIA - MINI-BROWSER EXTENSION</h2>
8
+
9
+ <hr />
10
+
11
+ </div>
12
+
13
+ ## Description
14
+
15
+ The `@theia/mini-browser` extension provides a browser widget with the corresponding backend endpoints.
16
+
17
+ ## Environment Variables
18
+
19
+ - `THEIA_MINI_BROWSER_HOST_PATTERN`
20
+
21
+ A string pattern possibly containing `{{uuid}}` and `{{hostname}}` which will be replaced. This is the host for which the `mini-browser` will serve.
22
+ It is a good practice to host the `mini-browser` handlers on a sub-domain as it is more secure.
23
+ Defaults to `{{uuid}}.mini-browser.{{hostname}}`.
24
+
25
+ ## Security Warnings
26
+
27
+ - Potentially Insecure Host Pattern
28
+
29
+ When you change the host pattern via the `THEIA_MINI_BROWSER_HOST_PATTERN` environment variable warnings will be emitted both from the frontend and from the backend.
30
+ You can disable those warnings by setting `warnOnPotentiallyInsecureHostPattern: false` in the appropriate application configurations in your application's `package.json`.
31
+
32
+ ## Additional Information
33
+
34
+ - [API documentation for `@theia/mini-browser`](https://eclipse-theia.github.io/theia/docs/next/modules/mini_browser.html)
35
+ - [Theia - GitHub](https://github.com/eclipse-theia/theia)
36
+ - [Theia - Website](https://theia-ide.org/)
37
+
38
+ ## License
39
+
40
+ - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
41
+ - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
42
+
43
+ ## Trademark
44
+ "Theia" is a trademark of the Eclipse Foundation
45
+ https://www.eclipse.org/theia
@@ -36,8 +36,8 @@ let MiniBrowserFrontendSecurityWarnings = class MiniBrowserFrontendSecurityWarni
36
36
  const hostPattern = await this.miniBrowserEnvironment.hostPatternPromise;
37
37
  if (hostPattern !== mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_DEFAULT) {
38
38
  const goToReadme = nls_1.nls.localize('theia/webview/goToReadme', 'Go To README');
39
- const message = nls_1.nls.localize('theia/webview/messageWarning', '\
40
- The {0} endpoint\'s host pattern has been changed to `{1}`; changing the pattern can lead to security vulnerabilities. \
39
+ const message = nls_1.nls.localize('theia/webview/messageWarning', '\
40
+ The {0} endpoint\'s host pattern has been changed to `{1}`; changing the pattern can lead to security vulnerabilities. \
41
41
  See `{2}` for more information.', 'mini-browser', hostPattern, '@theia/mini-browser/README.md');
42
42
  this.messageService.warn(message, browser_1.Dialog.OK, goToReadme).then(action => {
43
43
  if (action === goToReadme) {
@@ -30,12 +30,12 @@ let MiniBrowserBackendSecurityWarnings = class MiniBrowserBackendSecurityWarning
30
30
  }
31
31
  const envHostPattern = process.env[mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_ENV];
32
32
  if (envHostPattern && envHostPattern !== mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_DEFAULT) {
33
- console.warn(`\
34
- MINI BROWSER SECURITY WARNING
35
-
36
- Changing the @theia/mini-browser host pattern can lead to security vulnerabilities.
37
- Current pattern: "${envHostPattern}"
38
- Please read @theia/mini-browser/README.md for more information.
33
+ console.warn(`\
34
+ MINI BROWSER SECURITY WARNING
35
+
36
+ Changing the @theia/mini-browser host pattern can lead to security vulnerabilities.
37
+ Current pattern: "${envHostPattern}"
38
+ Please read @theia/mini-browser/README.md for more information.
39
39
  `);
40
40
  }
41
41
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@theia/mini-browser",
3
- "version": "1.53.0-next.55+d1a989a68c",
3
+ "version": "1.53.0-next.64+23b351d26",
4
4
  "description": "Theia - Mini-Browser Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.53.0-next.55+d1a989a68c",
7
- "@theia/filesystem": "1.53.0-next.55+d1a989a68c",
6
+ "@theia/core": "1.53.0-next.64+23b351d26",
7
+ "@theia/filesystem": "1.53.0-next.64+23b351d26",
8
8
  "@types/mime-types": "^2.1.0",
9
9
  "mime-types": "^2.1.18",
10
10
  "pdfobject": "^2.0.201604172",
@@ -54,5 +54,5 @@
54
54
  "nyc": {
55
55
  "extends": "../../configs/nyc.json"
56
56
  },
57
- "gitHead": "d1a989a68c1b5ec1f9098e9126653c6346844769"
57
+ "gitHead": "23b351d26346a2b5d6aca3ee81fba59c056132f7"
58
58
  }
@@ -1,24 +1,24 @@
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 { FrontendApplicationContribution } from '@theia/core/lib/browser';
18
- import { ContainerModule } from '@theia/core/shared/inversify';
19
- import { MiniBrowserEnvironment } from './mini-browser-environment';
20
-
21
- export default new ContainerModule(bind => {
22
- bind(MiniBrowserEnvironment).toSelf().inSingletonScope();
23
- bind(FrontendApplicationContribution).toService(MiniBrowserEnvironment);
24
- });
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 { FrontendApplicationContribution } from '@theia/core/lib/browser';
18
+ import { ContainerModule } from '@theia/core/shared/inversify';
19
+ import { MiniBrowserEnvironment } from './mini-browser-environment';
20
+
21
+ export default new ContainerModule(bind => {
22
+ bind(MiniBrowserEnvironment).toSelf().inSingletonScope();
23
+ bind(FrontendApplicationContribution).toService(MiniBrowserEnvironment);
24
+ });
@@ -1,87 +1,87 @@
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 { Endpoint, FrontendApplicationContribution } from '@theia/core/lib/browser';
18
- import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
19
- import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
20
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
21
- import { generateUuid } from '@theia/core/lib/common/uuid';
22
- import { MiniBrowserEndpoint } from '../../common/mini-browser-endpoint';
23
-
24
- /**
25
- * Fetch values from the backend's environment and caches them locally.
26
- * Helps with deploying various mini-browser endpoints.
27
- */
28
- @injectable()
29
- export class MiniBrowserEnvironment implements FrontendApplicationContribution {
30
-
31
- protected _hostPatternPromise: Promise<string>;
32
- protected _hostPattern?: string;
33
-
34
- @inject(EnvVariablesServer)
35
- protected environment: EnvVariablesServer;
36
-
37
- @postConstruct()
38
- protected init(): void {
39
- this._hostPatternPromise = this.getHostPattern()
40
- .then(pattern => this._hostPattern = pattern);
41
- }
42
-
43
- get hostPatternPromise(): Promise<string> {
44
- return this._hostPatternPromise;
45
- }
46
-
47
- get hostPattern(): string | undefined {
48
- return this._hostPattern;
49
- }
50
-
51
- async onStart(): Promise<void> {
52
- await this._hostPatternPromise;
53
- }
54
-
55
- /**
56
- * Throws if `hostPatternPromise` is not yet resolved.
57
- */
58
- getEndpoint(uuid: string, hostname?: string): Endpoint {
59
- if (this._hostPattern === undefined) {
60
- throw new Error('MiniBrowserEnvironment is not finished initializing');
61
- }
62
- return new Endpoint({
63
- path: MiniBrowserEndpoint.PATH,
64
- host: this._hostPattern
65
- .replace('{{uuid}}', uuid)
66
- .replace('{{hostname}}', hostname || this.getDefaultHostname()),
67
- });
68
- }
69
-
70
- /**
71
- * Throws if `hostPatternPromise` is not yet resolved.
72
- */
73
- getRandomEndpoint(): Endpoint {
74
- return this.getEndpoint(generateUuid());
75
- }
76
-
77
- protected async getHostPattern(): Promise<string> {
78
- return environment.electron.is()
79
- ? MiniBrowserEndpoint.HOST_PATTERN_DEFAULT
80
- : this.environment.getValue(MiniBrowserEndpoint.HOST_PATTERN_ENV)
81
- .then(envVar => envVar?.value || MiniBrowserEndpoint.HOST_PATTERN_DEFAULT);
82
- }
83
-
84
- protected getDefaultHostname(): string {
85
- return self.location.host;
86
- }
87
- }
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 { Endpoint, FrontendApplicationContribution } from '@theia/core/lib/browser';
18
+ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
19
+ import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
20
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
21
+ import { generateUuid } from '@theia/core/lib/common/uuid';
22
+ import { MiniBrowserEndpoint } from '../../common/mini-browser-endpoint';
23
+
24
+ /**
25
+ * Fetch values from the backend's environment and caches them locally.
26
+ * Helps with deploying various mini-browser endpoints.
27
+ */
28
+ @injectable()
29
+ export class MiniBrowserEnvironment implements FrontendApplicationContribution {
30
+
31
+ protected _hostPatternPromise: Promise<string>;
32
+ protected _hostPattern?: string;
33
+
34
+ @inject(EnvVariablesServer)
35
+ protected environment: EnvVariablesServer;
36
+
37
+ @postConstruct()
38
+ protected init(): void {
39
+ this._hostPatternPromise = this.getHostPattern()
40
+ .then(pattern => this._hostPattern = pattern);
41
+ }
42
+
43
+ get hostPatternPromise(): Promise<string> {
44
+ return this._hostPatternPromise;
45
+ }
46
+
47
+ get hostPattern(): string | undefined {
48
+ return this._hostPattern;
49
+ }
50
+
51
+ async onStart(): Promise<void> {
52
+ await this._hostPatternPromise;
53
+ }
54
+
55
+ /**
56
+ * Throws if `hostPatternPromise` is not yet resolved.
57
+ */
58
+ getEndpoint(uuid: string, hostname?: string): Endpoint {
59
+ if (this._hostPattern === undefined) {
60
+ throw new Error('MiniBrowserEnvironment is not finished initializing');
61
+ }
62
+ return new Endpoint({
63
+ path: MiniBrowserEndpoint.PATH,
64
+ host: this._hostPattern
65
+ .replace('{{uuid}}', uuid)
66
+ .replace('{{hostname}}', hostname || this.getDefaultHostname()),
67
+ });
68
+ }
69
+
70
+ /**
71
+ * Throws if `hostPatternPromise` is not yet resolved.
72
+ */
73
+ getRandomEndpoint(): Endpoint {
74
+ return this.getEndpoint(generateUuid());
75
+ }
76
+
77
+ protected async getHostPattern(): Promise<string> {
78
+ return environment.electron.is()
79
+ ? MiniBrowserEndpoint.HOST_PATTERN_DEFAULT
80
+ : this.environment.getValue(MiniBrowserEndpoint.HOST_PATTERN_ENV)
81
+ .then(envVar => envVar?.value || MiniBrowserEndpoint.HOST_PATTERN_DEFAULT);
82
+ }
83
+
84
+ protected getDefaultHostname(): string {
85
+ return self.location.host;
86
+ }
87
+ }