@theia/mini-browser 1.45.1 → 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.
- package/README.md +45 -45
- package/lib/browser/environment/mini-browser-environment-module.d.ts +3 -3
- package/lib/browser/environment/mini-browser-environment-module.js +24 -24
- package/lib/browser/environment/mini-browser-environment.d.ts +25 -25
- package/lib/browser/environment/mini-browser-environment.js +95 -95
- package/lib/browser/environment/mini-browser-environment.js.map +1 -1
- package/lib/browser/location-mapper-service.d.ts +58 -58
- package/lib/browser/location-mapper-service.js +140 -140
- package/lib/browser/mini-browser-content-style.d.ts +17 -17
- package/lib/browser/mini-browser-content-style.js +36 -36
- package/lib/browser/mini-browser-content.d.ts +177 -177
- package/lib/browser/mini-browser-content.js +554 -554
- package/lib/browser/mini-browser-frontend-module.d.ts +4 -4
- package/lib/browser/mini-browser-frontend-module.js +70 -70
- package/lib/browser/mini-browser-frontend-security-warnings.d.ts +11 -11
- package/lib/browser/mini-browser-frontend-security-warnings.js +73 -73
- package/lib/browser/mini-browser-open-handler.d.ts +76 -76
- package/lib/browser/mini-browser-open-handler.js +292 -292
- package/lib/browser/mini-browser.d.ts +25 -25
- package/lib/browser/mini-browser.js +118 -118
- package/lib/common/mini-browser-endpoint.d.ts +12 -12
- package/lib/common/mini-browser-endpoint.js +31 -31
- package/lib/common/mini-browser-service.d.ts +14 -14
- package/lib/common/mini-browser-service.js +20 -20
- package/lib/electron-browser/environment/electron-mini-browser-environment-module.d.ts +3 -3
- package/lib/electron-browser/environment/electron-mini-browser-environment-module.js +25 -25
- package/lib/electron-browser/environment/electron-mini-browser-environment.d.ts +9 -9
- package/lib/electron-browser/environment/electron-mini-browser-environment.js +60 -60
- package/lib/electron-main/mini-browser-electron-main-contribution.d.ts +12 -12
- package/lib/electron-main/mini-browser-electron-main-contribution.js +54 -54
- package/lib/node/mini-browser-backend-module.d.ts +3 -3
- package/lib/node/mini-browser-backend-module.js +41 -41
- package/lib/node/mini-browser-backend-security-warnings.d.ts +5 -5
- package/lib/node/mini-browser-backend-security-warnings.js +51 -51
- package/lib/node/mini-browser-endpoint.d.ts +97 -97
- package/lib/node/mini-browser-endpoint.js +268 -268
- package/lib/node/mini-browser-endpoint.js.map +1 -1
- package/lib/node/mini-browser-ws-validator.d.ts +12 -12
- package/lib/node/mini-browser-ws-validator.js +69 -69
- package/lib/package.spec.js +18 -18
- package/package.json +5 -6
- package/src/browser/environment/mini-browser-environment-module.ts +24 -24
- package/src/browser/environment/mini-browser-environment.ts +87 -87
- package/src/browser/location-mapper-service.ts +150 -150
- package/src/browser/mini-browser-content-style.ts +32 -32
- package/src/browser/mini-browser-content.ts +630 -630
- package/src/browser/mini-browser-frontend-module.ts +86 -86
- package/src/browser/mini-browser-frontend-security-warnings.ts +59 -59
- package/src/browser/mini-browser-open-handler.ts +312 -312
- package/src/browser/mini-browser.ts +110 -110
- package/src/browser/pdfobject.d.ts +99 -99
- package/src/browser/style/index.css +157 -157
- package/src/browser/style/mini-browser.svg +17 -17
- package/src/common/mini-browser-endpoint.ts +28 -28
- package/src/common/mini-browser-service.ts +29 -29
- package/src/electron-browser/environment/electron-mini-browser-environment-module.ts +25 -25
- package/src/electron-browser/environment/electron-mini-browser-environment.ts +53 -53
- package/src/electron-main/mini-browser-electron-main-contribution.ts +42 -42
- package/src/node/mini-browser-backend-module.ts +41 -41
- package/src/node/mini-browser-backend-security-warnings.ts +45 -45
- package/src/node/mini-browser-endpoint.ts +315 -315
- package/src/node/mini-browser-ws-validator.ts +56 -56
- 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
|
+
}
|