@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,5 +1,5 @@
|
|
|
1
|
-
import '../../src/browser/style/index.css';
|
|
2
|
-
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
3
|
-
declare const _default: ContainerModule;
|
|
4
|
-
export default _default;
|
|
1
|
+
import '../../src/browser/style/index.css';
|
|
2
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
3
|
+
declare const _default: ContainerModule;
|
|
4
|
+
export default _default;
|
|
5
5
|
//# sourceMappingURL=mini-browser-frontend-module.d.ts.map
|
|
@@ -1,71 +1,71 @@
|
|
|
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
|
-
require("../../src/browser/style/index.css");
|
|
19
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
20
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
21
|
-
const opener_service_1 = require("@theia/core/lib/browser/opener-service");
|
|
22
|
-
const widget_manager_1 = require("@theia/core/lib/browser/widget-manager");
|
|
23
|
-
const contribution_provider_1 = require("@theia/core/lib/common/contribution-provider");
|
|
24
|
-
const ws_connection_provider_1 = require("@theia/core/lib/browser/messaging/ws-connection-provider");
|
|
25
|
-
const frontend_application_contribution_1 = require("@theia/core/lib/browser/frontend-application-contribution");
|
|
26
|
-
const tab_bar_toolbar_1 = require("@theia/core/lib/browser/shell/tab-bar-toolbar");
|
|
27
|
-
const command_1 = require("@theia/core/lib/common/command");
|
|
28
|
-
const menu_1 = require("@theia/core/lib/common/menu");
|
|
29
|
-
const mini_browser_open_handler_1 = require("./mini-browser-open-handler");
|
|
30
|
-
const mini_browser_service_1 = require("../common/mini-browser-service");
|
|
31
|
-
const mini_browser_1 = require("./mini-browser");
|
|
32
|
-
const mini_browser_content_1 = require("./mini-browser-content");
|
|
33
|
-
const location_mapper_service_1 = require("./location-mapper-service");
|
|
34
|
-
const mini_browser_frontend_security_warnings_1 = require("./mini-browser-frontend-security-warnings");
|
|
35
|
-
exports.default = new inversify_1.ContainerModule(bind => {
|
|
36
|
-
bind(mini_browser_content_1.MiniBrowserContent).toSelf();
|
|
37
|
-
bind(mini_browser_content_1.MiniBrowserContentFactory).toFactory(context => (props) => {
|
|
38
|
-
const { container } = context;
|
|
39
|
-
const child = container.createChild();
|
|
40
|
-
child.bind(mini_browser_content_1.MiniBrowserProps).toConstantValue(props);
|
|
41
|
-
return child.get(mini_browser_content_1.MiniBrowserContent);
|
|
42
|
-
});
|
|
43
|
-
bind(mini_browser_1.MiniBrowser).toSelf();
|
|
44
|
-
bind(widget_manager_1.WidgetFactory).toDynamicValue(context => ({
|
|
45
|
-
id: mini_browser_1.MiniBrowser.ID,
|
|
46
|
-
async createWidget(options) {
|
|
47
|
-
const { container } = context;
|
|
48
|
-
const child = container.createChild();
|
|
49
|
-
const uri = new uri_1.default(options.uri);
|
|
50
|
-
child.bind(mini_browser_1.MiniBrowserOptions).toConstantValue({ uri });
|
|
51
|
-
return child.get(mini_browser_1.MiniBrowser);
|
|
52
|
-
}
|
|
53
|
-
})).inSingletonScope();
|
|
54
|
-
bind(mini_browser_open_handler_1.MiniBrowserOpenHandler).toSelf().inSingletonScope();
|
|
55
|
-
bind(opener_service_1.OpenHandler).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
56
|
-
bind(frontend_application_contribution_1.FrontendApplicationContribution).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
57
|
-
bind(command_1.CommandContribution).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
58
|
-
bind(menu_1.MenuContribution).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
59
|
-
bind(tab_bar_toolbar_1.TabBarToolbarContribution).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
60
|
-
(0, contribution_provider_1.bindContributionProvider)(bind, location_mapper_service_1.LocationMapper);
|
|
61
|
-
bind(location_mapper_service_1.LocationMapper).to(location_mapper_service_1.FileLocationMapper).inSingletonScope();
|
|
62
|
-
bind(location_mapper_service_1.LocationMapper).to(location_mapper_service_1.HttpLocationMapper).inSingletonScope();
|
|
63
|
-
bind(location_mapper_service_1.LocationMapper).to(location_mapper_service_1.HttpsLocationMapper).inSingletonScope();
|
|
64
|
-
bind(location_mapper_service_1.LocationWithoutSchemeMapper).toSelf().inSingletonScope();
|
|
65
|
-
bind(location_mapper_service_1.LocationMapper).toService(location_mapper_service_1.LocationWithoutSchemeMapper);
|
|
66
|
-
bind(location_mapper_service_1.LocationMapperService).toSelf().inSingletonScope();
|
|
67
|
-
bind(mini_browser_service_1.MiniBrowserService).toDynamicValue(ctx => ws_connection_provider_1.WebSocketConnectionProvider.createProxy(ctx.container, mini_browser_service_1.MiniBrowserServicePath)).inSingletonScope();
|
|
68
|
-
bind(mini_browser_frontend_security_warnings_1.MiniBrowserFrontendSecurityWarnings).toSelf().inSingletonScope();
|
|
69
|
-
bind(frontend_application_contribution_1.FrontendApplicationContribution).toService(mini_browser_frontend_security_warnings_1.MiniBrowserFrontendSecurityWarnings);
|
|
70
|
-
});
|
|
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
|
+
require("../../src/browser/style/index.css");
|
|
19
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
20
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
21
|
+
const opener_service_1 = require("@theia/core/lib/browser/opener-service");
|
|
22
|
+
const widget_manager_1 = require("@theia/core/lib/browser/widget-manager");
|
|
23
|
+
const contribution_provider_1 = require("@theia/core/lib/common/contribution-provider");
|
|
24
|
+
const ws_connection_provider_1 = require("@theia/core/lib/browser/messaging/ws-connection-provider");
|
|
25
|
+
const frontend_application_contribution_1 = require("@theia/core/lib/browser/frontend-application-contribution");
|
|
26
|
+
const tab_bar_toolbar_1 = require("@theia/core/lib/browser/shell/tab-bar-toolbar");
|
|
27
|
+
const command_1 = require("@theia/core/lib/common/command");
|
|
28
|
+
const menu_1 = require("@theia/core/lib/common/menu");
|
|
29
|
+
const mini_browser_open_handler_1 = require("./mini-browser-open-handler");
|
|
30
|
+
const mini_browser_service_1 = require("../common/mini-browser-service");
|
|
31
|
+
const mini_browser_1 = require("./mini-browser");
|
|
32
|
+
const mini_browser_content_1 = require("./mini-browser-content");
|
|
33
|
+
const location_mapper_service_1 = require("./location-mapper-service");
|
|
34
|
+
const mini_browser_frontend_security_warnings_1 = require("./mini-browser-frontend-security-warnings");
|
|
35
|
+
exports.default = new inversify_1.ContainerModule(bind => {
|
|
36
|
+
bind(mini_browser_content_1.MiniBrowserContent).toSelf();
|
|
37
|
+
bind(mini_browser_content_1.MiniBrowserContentFactory).toFactory(context => (props) => {
|
|
38
|
+
const { container } = context;
|
|
39
|
+
const child = container.createChild();
|
|
40
|
+
child.bind(mini_browser_content_1.MiniBrowserProps).toConstantValue(props);
|
|
41
|
+
return child.get(mini_browser_content_1.MiniBrowserContent);
|
|
42
|
+
});
|
|
43
|
+
bind(mini_browser_1.MiniBrowser).toSelf();
|
|
44
|
+
bind(widget_manager_1.WidgetFactory).toDynamicValue(context => ({
|
|
45
|
+
id: mini_browser_1.MiniBrowser.ID,
|
|
46
|
+
async createWidget(options) {
|
|
47
|
+
const { container } = context;
|
|
48
|
+
const child = container.createChild();
|
|
49
|
+
const uri = new uri_1.default(options.uri);
|
|
50
|
+
child.bind(mini_browser_1.MiniBrowserOptions).toConstantValue({ uri });
|
|
51
|
+
return child.get(mini_browser_1.MiniBrowser);
|
|
52
|
+
}
|
|
53
|
+
})).inSingletonScope();
|
|
54
|
+
bind(mini_browser_open_handler_1.MiniBrowserOpenHandler).toSelf().inSingletonScope();
|
|
55
|
+
bind(opener_service_1.OpenHandler).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
56
|
+
bind(frontend_application_contribution_1.FrontendApplicationContribution).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
57
|
+
bind(command_1.CommandContribution).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
58
|
+
bind(menu_1.MenuContribution).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
59
|
+
bind(tab_bar_toolbar_1.TabBarToolbarContribution).toService(mini_browser_open_handler_1.MiniBrowserOpenHandler);
|
|
60
|
+
(0, contribution_provider_1.bindContributionProvider)(bind, location_mapper_service_1.LocationMapper);
|
|
61
|
+
bind(location_mapper_service_1.LocationMapper).to(location_mapper_service_1.FileLocationMapper).inSingletonScope();
|
|
62
|
+
bind(location_mapper_service_1.LocationMapper).to(location_mapper_service_1.HttpLocationMapper).inSingletonScope();
|
|
63
|
+
bind(location_mapper_service_1.LocationMapper).to(location_mapper_service_1.HttpsLocationMapper).inSingletonScope();
|
|
64
|
+
bind(location_mapper_service_1.LocationWithoutSchemeMapper).toSelf().inSingletonScope();
|
|
65
|
+
bind(location_mapper_service_1.LocationMapper).toService(location_mapper_service_1.LocationWithoutSchemeMapper);
|
|
66
|
+
bind(location_mapper_service_1.LocationMapperService).toSelf().inSingletonScope();
|
|
67
|
+
bind(mini_browser_service_1.MiniBrowserService).toDynamicValue(ctx => ws_connection_provider_1.WebSocketConnectionProvider.createProxy(ctx.container, mini_browser_service_1.MiniBrowserServicePath)).inSingletonScope();
|
|
68
|
+
bind(mini_browser_frontend_security_warnings_1.MiniBrowserFrontendSecurityWarnings).toSelf().inSingletonScope();
|
|
69
|
+
bind(frontend_application_contribution_1.FrontendApplicationContribution).toService(mini_browser_frontend_security_warnings_1.MiniBrowserFrontendSecurityWarnings);
|
|
70
|
+
});
|
|
71
71
|
//# sourceMappingURL=mini-browser-frontend-module.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { MessageService } from '@theia/core';
|
|
2
|
-
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
3
|
-
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
4
|
-
import { MiniBrowserEnvironment } from './environment/mini-browser-environment';
|
|
5
|
-
export declare class MiniBrowserFrontendSecurityWarnings implements FrontendApplicationContribution {
|
|
6
|
-
protected windowService: WindowService;
|
|
7
|
-
protected messageService: MessageService;
|
|
8
|
-
protected miniBrowserEnvironment: MiniBrowserEnvironment;
|
|
9
|
-
initialize(): void;
|
|
10
|
-
protected checkHostPattern(): Promise<void>;
|
|
11
|
-
}
|
|
1
|
+
import { MessageService } from '@theia/core';
|
|
2
|
+
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
3
|
+
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
4
|
+
import { MiniBrowserEnvironment } from './environment/mini-browser-environment';
|
|
5
|
+
export declare class MiniBrowserFrontendSecurityWarnings implements FrontendApplicationContribution {
|
|
6
|
+
protected windowService: WindowService;
|
|
7
|
+
protected messageService: MessageService;
|
|
8
|
+
protected miniBrowserEnvironment: MiniBrowserEnvironment;
|
|
9
|
+
initialize(): void;
|
|
10
|
+
protected checkHostPattern(): Promise<void>;
|
|
11
|
+
}
|
|
12
12
|
//# sourceMappingURL=mini-browser-frontend-security-warnings.d.ts.map
|
|
@@ -1,74 +1,74 @@
|
|
|
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
|
-
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.MiniBrowserFrontendSecurityWarnings = void 0;
|
|
28
|
-
const core_1 = require("@theia/core");
|
|
29
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
30
|
-
const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
|
|
31
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
32
|
-
const window_service_1 = require("@theia/core/lib/browser/window/window-service");
|
|
33
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
34
|
-
const mini_browser_endpoint_1 = require("../common/mini-browser-endpoint");
|
|
35
|
-
const mini_browser_environment_1 = require("./environment/mini-browser-environment");
|
|
36
|
-
let MiniBrowserFrontendSecurityWarnings = class MiniBrowserFrontendSecurityWarnings {
|
|
37
|
-
initialize() {
|
|
38
|
-
this.checkHostPattern();
|
|
39
|
-
}
|
|
40
|
-
async checkHostPattern() {
|
|
41
|
-
if (frontend_application_config_provider_1.FrontendApplicationConfigProvider.get()['warnOnPotentiallyInsecureHostPattern'] === false) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const hostPattern = await this.miniBrowserEnvironment.hostPatternPromise;
|
|
45
|
-
if (hostPattern !== mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_DEFAULT) {
|
|
46
|
-
const goToReadme = nls_1.nls.localize('theia/webview/goToReadme', 'Go To README');
|
|
47
|
-
const message = nls_1.nls.localize('theia/webview/messageWarning', '\
|
|
48
|
-
The {0} endpoint\'s host pattern has been changed to `{1}`; changing the pattern can lead to security vulnerabilities. \
|
|
49
|
-
See `{2}` for more information.', 'mini-browser', hostPattern, '@theia/mini-browser/README.md');
|
|
50
|
-
this.messageService.warn(message, browser_1.Dialog.OK, goToReadme).then(action => {
|
|
51
|
-
if (action === goToReadme) {
|
|
52
|
-
this.windowService.openNewWindow('https://www.npmjs.com/package/@theia/mini-browser', { external: true });
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, inversify_1.inject)(window_service_1.WindowService),
|
|
60
|
-
__metadata("design:type", Object)
|
|
61
|
-
], MiniBrowserFrontendSecurityWarnings.prototype, "windowService", void 0);
|
|
62
|
-
__decorate([
|
|
63
|
-
(0, inversify_1.inject)(core_1.MessageService),
|
|
64
|
-
__metadata("design:type", core_1.MessageService)
|
|
65
|
-
], MiniBrowserFrontendSecurityWarnings.prototype, "messageService", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
(0, inversify_1.inject)(mini_browser_environment_1.MiniBrowserEnvironment),
|
|
68
|
-
__metadata("design:type", mini_browser_environment_1.MiniBrowserEnvironment)
|
|
69
|
-
], MiniBrowserFrontendSecurityWarnings.prototype, "miniBrowserEnvironment", void 0);
|
|
70
|
-
MiniBrowserFrontendSecurityWarnings = __decorate([
|
|
71
|
-
(0, inversify_1.injectable)()
|
|
72
|
-
], MiniBrowserFrontendSecurityWarnings);
|
|
73
|
-
exports.MiniBrowserFrontendSecurityWarnings = MiniBrowserFrontendSecurityWarnings;
|
|
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
|
+
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.MiniBrowserFrontendSecurityWarnings = void 0;
|
|
28
|
+
const core_1 = require("@theia/core");
|
|
29
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
30
|
+
const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
|
|
31
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
32
|
+
const window_service_1 = require("@theia/core/lib/browser/window/window-service");
|
|
33
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
34
|
+
const mini_browser_endpoint_1 = require("../common/mini-browser-endpoint");
|
|
35
|
+
const mini_browser_environment_1 = require("./environment/mini-browser-environment");
|
|
36
|
+
let MiniBrowserFrontendSecurityWarnings = class MiniBrowserFrontendSecurityWarnings {
|
|
37
|
+
initialize() {
|
|
38
|
+
this.checkHostPattern();
|
|
39
|
+
}
|
|
40
|
+
async checkHostPattern() {
|
|
41
|
+
if (frontend_application_config_provider_1.FrontendApplicationConfigProvider.get()['warnOnPotentiallyInsecureHostPattern'] === false) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const hostPattern = await this.miniBrowserEnvironment.hostPatternPromise;
|
|
45
|
+
if (hostPattern !== mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_DEFAULT) {
|
|
46
|
+
const goToReadme = nls_1.nls.localize('theia/webview/goToReadme', 'Go To README');
|
|
47
|
+
const message = nls_1.nls.localize('theia/webview/messageWarning', '\
|
|
48
|
+
The {0} endpoint\'s host pattern has been changed to `{1}`; changing the pattern can lead to security vulnerabilities. \
|
|
49
|
+
See `{2}` for more information.', 'mini-browser', hostPattern, '@theia/mini-browser/README.md');
|
|
50
|
+
this.messageService.warn(message, browser_1.Dialog.OK, goToReadme).then(action => {
|
|
51
|
+
if (action === goToReadme) {
|
|
52
|
+
this.windowService.openNewWindow('https://www.npmjs.com/package/@theia/mini-browser', { external: true });
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, inversify_1.inject)(window_service_1.WindowService),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], MiniBrowserFrontendSecurityWarnings.prototype, "windowService", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, inversify_1.inject)(core_1.MessageService),
|
|
64
|
+
__metadata("design:type", core_1.MessageService)
|
|
65
|
+
], MiniBrowserFrontendSecurityWarnings.prototype, "messageService", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, inversify_1.inject)(mini_browser_environment_1.MiniBrowserEnvironment),
|
|
68
|
+
__metadata("design:type", mini_browser_environment_1.MiniBrowserEnvironment)
|
|
69
|
+
], MiniBrowserFrontendSecurityWarnings.prototype, "miniBrowserEnvironment", void 0);
|
|
70
|
+
MiniBrowserFrontendSecurityWarnings = __decorate([
|
|
71
|
+
(0, inversify_1.injectable)()
|
|
72
|
+
], MiniBrowserFrontendSecurityWarnings);
|
|
73
|
+
exports.MiniBrowserFrontendSecurityWarnings = MiniBrowserFrontendSecurityWarnings;
|
|
74
74
|
//# sourceMappingURL=mini-browser-frontend-security-warnings.js.map
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { Widget } from '@theia/core/shared/@phosphor/widgets';
|
|
2
|
-
import URI from '@theia/core/lib/common/uri';
|
|
3
|
-
import { MaybePromise } from '@theia/core/lib/common/types';
|
|
4
|
-
import { QuickInputService } from '@theia/core/lib/browser';
|
|
5
|
-
import { ApplicationShell } from '@theia/core/lib/browser/shell';
|
|
6
|
-
import { Command, CommandContribution, CommandRegistry } from '@theia/core/lib/common/command';
|
|
7
|
-
import { MenuContribution, MenuModelRegistry } from '@theia/core/lib/common/menu';
|
|
8
|
-
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
9
|
-
import { NavigatableWidget, NavigatableWidgetOpenHandler } from '@theia/core/lib/browser/navigatable';
|
|
10
|
-
import { OpenerService } from '@theia/core/lib/browser/opener-service';
|
|
11
|
-
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
|
|
12
|
-
import { FrontendApplicationContribution } from '@theia/core/lib/browser/frontend-application-contribution';
|
|
13
|
-
import { WidgetOpenerOptions } from '@theia/core/lib/browser/widget-open-handler';
|
|
14
|
-
import { MiniBrowserService } from '../common/mini-browser-service';
|
|
15
|
-
import { MiniBrowser, MiniBrowserProps } from './mini-browser';
|
|
16
|
-
import { LocationMapperService } from './location-mapper-service';
|
|
17
|
-
export declare namespace MiniBrowserCommands {
|
|
18
|
-
const PREVIEW_CATEGORY = "Preview";
|
|
19
|
-
const PREVIEW_CATEGORY_KEY: string;
|
|
20
|
-
const PREVIEW: Command;
|
|
21
|
-
const OPEN_SOURCE: Command;
|
|
22
|
-
const OPEN_URL: Command;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Further options for opening a new `Mini Browser` widget.
|
|
26
|
-
*/
|
|
27
|
-
export interface MiniBrowserOpenerOptions extends WidgetOpenerOptions, MiniBrowserProps {
|
|
28
|
-
/**
|
|
29
|
-
* Controls how the mini-browser widget should be opened.
|
|
30
|
-
* - `source`: editable source.
|
|
31
|
-
* - `preview`: rendered content of the source.
|
|
32
|
-
*/
|
|
33
|
-
openFor?: 'source' | 'preview';
|
|
34
|
-
}
|
|
35
|
-
export declare class MiniBrowserOpenHandler extends NavigatableWidgetOpenHandler<MiniBrowser> implements FrontendApplicationContribution, CommandContribution, MenuContribution, TabBarToolbarContribution {
|
|
36
|
-
static PREVIEW_URI: URI;
|
|
37
|
-
/**
|
|
38
|
-
* Instead of going to the backend with each file URI to ask whether it can handle the current file or not,
|
|
39
|
-
* we have this map of extension and priority pairs that we populate at application startup.
|
|
40
|
-
* The real advantage of this approach is the following: [Phosphor cannot run async code when invoking `isEnabled`/`isVisible`
|
|
41
|
-
* for the command handlers](https://github.com/eclipse-theia/theia/issues/1958#issuecomment-392829371)
|
|
42
|
-
* so the menu item would be always visible for the user even if the file type cannot be handled eventually.
|
|
43
|
-
* Hopefully, we could get rid of this hack once we have migrated the existing Phosphor code to [React](https://github.com/eclipse-theia/theia/issues/1915).
|
|
44
|
-
*/
|
|
45
|
-
protected readonly supportedExtensions: Map<string, number>;
|
|
46
|
-
readonly id: string;
|
|
47
|
-
readonly label: string;
|
|
48
|
-
protected readonly openerService: OpenerService;
|
|
49
|
-
protected readonly labelProvider: LabelProvider;
|
|
50
|
-
protected readonly quickInputService: QuickInputService;
|
|
51
|
-
protected readonly miniBrowserService: MiniBrowserService;
|
|
52
|
-
protected readonly locationMapperService: LocationMapperService;
|
|
53
|
-
onStart(): void;
|
|
54
|
-
canHandle(uri: URI, options?: MiniBrowserOpenerOptions): number;
|
|
55
|
-
open(uri: URI, options?: MiniBrowserOpenerOptions): Promise<MiniBrowser>;
|
|
56
|
-
protected getOrCreateWidget(uri: URI, options?: MiniBrowserOpenerOptions): Promise<MiniBrowser>;
|
|
57
|
-
protected options(uri?: URI, options?: MiniBrowserOpenerOptions): Promise<MiniBrowserOpenerOptions & {
|
|
58
|
-
widgetOptions: ApplicationShell.WidgetOptions;
|
|
59
|
-
}>;
|
|
60
|
-
protected resetBackground(uri: URI): MaybePromise<boolean>;
|
|
61
|
-
protected defaultOptions(): Promise<MiniBrowserOpenerOptions & {
|
|
62
|
-
widgetOptions: ApplicationShell.WidgetOptions;
|
|
63
|
-
}>;
|
|
64
|
-
registerCommands(commands: CommandRegistry): void;
|
|
65
|
-
registerMenus(menus: MenuModelRegistry): void;
|
|
66
|
-
registerToolbarItems(toolbar: TabBarToolbarRegistry): void;
|
|
67
|
-
protected canPreviewWidget(widget?: Widget): boolean;
|
|
68
|
-
protected getUriToPreview(widget?: Widget): URI | undefined;
|
|
69
|
-
protected getWidgetToPreview(widget?: Widget): NavigatableWidget | undefined;
|
|
70
|
-
protected preview(widget?: Widget): Promise<void>;
|
|
71
|
-
protected openSource(ref?: Widget): Promise<void>;
|
|
72
|
-
protected getSourceUri(ref?: Widget): URI | undefined;
|
|
73
|
-
protected openUrl(arg?: string): Promise<void>;
|
|
74
|
-
openPreview(startPage: string): Promise<MiniBrowser>;
|
|
75
|
-
protected getOpenPreviewProps(startPage: string): Promise<MiniBrowserOpenerOptions>;
|
|
76
|
-
}
|
|
1
|
+
import { Widget } from '@theia/core/shared/@phosphor/widgets';
|
|
2
|
+
import URI from '@theia/core/lib/common/uri';
|
|
3
|
+
import { MaybePromise } from '@theia/core/lib/common/types';
|
|
4
|
+
import { QuickInputService } from '@theia/core/lib/browser';
|
|
5
|
+
import { ApplicationShell } from '@theia/core/lib/browser/shell';
|
|
6
|
+
import { Command, CommandContribution, CommandRegistry } from '@theia/core/lib/common/command';
|
|
7
|
+
import { MenuContribution, MenuModelRegistry } from '@theia/core/lib/common/menu';
|
|
8
|
+
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
9
|
+
import { NavigatableWidget, NavigatableWidgetOpenHandler } from '@theia/core/lib/browser/navigatable';
|
|
10
|
+
import { OpenerService } from '@theia/core/lib/browser/opener-service';
|
|
11
|
+
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
|
|
12
|
+
import { FrontendApplicationContribution } from '@theia/core/lib/browser/frontend-application-contribution';
|
|
13
|
+
import { WidgetOpenerOptions } from '@theia/core/lib/browser/widget-open-handler';
|
|
14
|
+
import { MiniBrowserService } from '../common/mini-browser-service';
|
|
15
|
+
import { MiniBrowser, MiniBrowserProps } from './mini-browser';
|
|
16
|
+
import { LocationMapperService } from './location-mapper-service';
|
|
17
|
+
export declare namespace MiniBrowserCommands {
|
|
18
|
+
const PREVIEW_CATEGORY = "Preview";
|
|
19
|
+
const PREVIEW_CATEGORY_KEY: string;
|
|
20
|
+
const PREVIEW: Command;
|
|
21
|
+
const OPEN_SOURCE: Command;
|
|
22
|
+
const OPEN_URL: Command;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Further options for opening a new `Mini Browser` widget.
|
|
26
|
+
*/
|
|
27
|
+
export interface MiniBrowserOpenerOptions extends WidgetOpenerOptions, MiniBrowserProps {
|
|
28
|
+
/**
|
|
29
|
+
* Controls how the mini-browser widget should be opened.
|
|
30
|
+
* - `source`: editable source.
|
|
31
|
+
* - `preview`: rendered content of the source.
|
|
32
|
+
*/
|
|
33
|
+
openFor?: 'source' | 'preview';
|
|
34
|
+
}
|
|
35
|
+
export declare class MiniBrowserOpenHandler extends NavigatableWidgetOpenHandler<MiniBrowser> implements FrontendApplicationContribution, CommandContribution, MenuContribution, TabBarToolbarContribution {
|
|
36
|
+
static PREVIEW_URI: URI;
|
|
37
|
+
/**
|
|
38
|
+
* Instead of going to the backend with each file URI to ask whether it can handle the current file or not,
|
|
39
|
+
* we have this map of extension and priority pairs that we populate at application startup.
|
|
40
|
+
* The real advantage of this approach is the following: [Phosphor cannot run async code when invoking `isEnabled`/`isVisible`
|
|
41
|
+
* for the command handlers](https://github.com/eclipse-theia/theia/issues/1958#issuecomment-392829371)
|
|
42
|
+
* so the menu item would be always visible for the user even if the file type cannot be handled eventually.
|
|
43
|
+
* Hopefully, we could get rid of this hack once we have migrated the existing Phosphor code to [React](https://github.com/eclipse-theia/theia/issues/1915).
|
|
44
|
+
*/
|
|
45
|
+
protected readonly supportedExtensions: Map<string, number>;
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly label: string;
|
|
48
|
+
protected readonly openerService: OpenerService;
|
|
49
|
+
protected readonly labelProvider: LabelProvider;
|
|
50
|
+
protected readonly quickInputService: QuickInputService;
|
|
51
|
+
protected readonly miniBrowserService: MiniBrowserService;
|
|
52
|
+
protected readonly locationMapperService: LocationMapperService;
|
|
53
|
+
onStart(): void;
|
|
54
|
+
canHandle(uri: URI, options?: MiniBrowserOpenerOptions): number;
|
|
55
|
+
open(uri: URI, options?: MiniBrowserOpenerOptions): Promise<MiniBrowser>;
|
|
56
|
+
protected getOrCreateWidget(uri: URI, options?: MiniBrowserOpenerOptions): Promise<MiniBrowser>;
|
|
57
|
+
protected options(uri?: URI, options?: MiniBrowserOpenerOptions): Promise<MiniBrowserOpenerOptions & {
|
|
58
|
+
widgetOptions: ApplicationShell.WidgetOptions;
|
|
59
|
+
}>;
|
|
60
|
+
protected resetBackground(uri: URI): MaybePromise<boolean>;
|
|
61
|
+
protected defaultOptions(): Promise<MiniBrowserOpenerOptions & {
|
|
62
|
+
widgetOptions: ApplicationShell.WidgetOptions;
|
|
63
|
+
}>;
|
|
64
|
+
registerCommands(commands: CommandRegistry): void;
|
|
65
|
+
registerMenus(menus: MenuModelRegistry): void;
|
|
66
|
+
registerToolbarItems(toolbar: TabBarToolbarRegistry): void;
|
|
67
|
+
protected canPreviewWidget(widget?: Widget): boolean;
|
|
68
|
+
protected getUriToPreview(widget?: Widget): URI | undefined;
|
|
69
|
+
protected getWidgetToPreview(widget?: Widget): NavigatableWidget | undefined;
|
|
70
|
+
protected preview(widget?: Widget): Promise<void>;
|
|
71
|
+
protected openSource(ref?: Widget): Promise<void>;
|
|
72
|
+
protected getSourceUri(ref?: Widget): URI | undefined;
|
|
73
|
+
protected openUrl(arg?: string): Promise<void>;
|
|
74
|
+
openPreview(startPage: string): Promise<MiniBrowser>;
|
|
75
|
+
protected getOpenPreviewProps(startPage: string): Promise<MiniBrowserOpenerOptions>;
|
|
76
|
+
}
|
|
77
77
|
//# sourceMappingURL=mini-browser-open-handler.d.ts.map
|