@theia/mini-browser 1.53.0-next.4 → 1.53.0-next.55
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/mini-browser-frontend-security-warnings.js +2 -2
- package/lib/node/mini-browser-backend-security-warnings.js +6 -6
- package/package.json +5 -5
- 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,157 +1,157 @@
|
|
|
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
|
-
:root {
|
|
18
|
-
--theia-private-mini-browser-height: var(--theia-content-line-height);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.theia-mini-browser {
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
height: 100%;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.theia-mini-browser-toolbar {
|
|
28
|
-
margin-top: 8px;
|
|
29
|
-
display: flex;
|
|
30
|
-
align-items: center;
|
|
31
|
-
justify-content: space-evenly;
|
|
32
|
-
padding: 0 10px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.theia-mini-browser-toolbar-read-only {
|
|
36
|
-
margin-top: 8px;
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
justify-content: space-evenly;
|
|
40
|
-
padding: 0 10px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.theia-mini-browser-toolbar .theia-input {
|
|
44
|
-
width: 100%;
|
|
45
|
-
line-height: var(--theia-private-mini-browser-height);
|
|
46
|
-
margin-left: 4px;
|
|
47
|
-
margin-right: 4px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.theia-mini-browser-toolbar-read-only .theia-input {
|
|
51
|
-
width: 100%;
|
|
52
|
-
line-height: var(--theia-private-mini-browser-height);
|
|
53
|
-
margin-left: 4px;
|
|
54
|
-
margin-right: 4px;
|
|
55
|
-
cursor: pointer;
|
|
56
|
-
background: var(--theia-input-background);
|
|
57
|
-
border: none;
|
|
58
|
-
text-decoration: underline;
|
|
59
|
-
outline: none;
|
|
60
|
-
white-space: nowrap;
|
|
61
|
-
overflow: hidden;
|
|
62
|
-
text-overflow: ellipsis;
|
|
63
|
-
color: var(--theia-input-foreground);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.theia-mini-browser-toolbar-read-only .theia-input:hover {
|
|
67
|
-
color: var(--theia-button-hoverBackground);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.theia-mini-browser-button {
|
|
71
|
-
min-width: 1rem;
|
|
72
|
-
text-align: center;
|
|
73
|
-
flex-grow: 0;
|
|
74
|
-
font-family: FontAwesome;
|
|
75
|
-
font-size: calc(var(--theia-content-font-size) * 0.8);
|
|
76
|
-
color: var(--theia-icon-foreground);
|
|
77
|
-
margin: 0px 4px 0px 4px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.theia-mini-browser-button:not(.theia-mini-browser-button-disabled):hover {
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.theia-mini-browser-button-disabled {
|
|
85
|
-
opacity: var(--theia-mod-disabled-opacity);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.theia-mini-browser-previous::before {
|
|
89
|
-
content: "\f053";
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.theia-mini-browser-next::before {
|
|
93
|
-
content: "\f054";
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.theia-mini-browser-refresh::before {
|
|
97
|
-
content: "\f021";
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.theia-mini-browser-open::before {
|
|
101
|
-
content: "\f08e";
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.theia-mini-browser-content-area {
|
|
105
|
-
position: relative;
|
|
106
|
-
display: flex;
|
|
107
|
-
height: 100%;
|
|
108
|
-
width: 100%;
|
|
109
|
-
flex-direction: column;
|
|
110
|
-
overflow: hidden;
|
|
111
|
-
margin-top: 6px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.theia-mini-browser-pdf-container {
|
|
115
|
-
width: 100%;
|
|
116
|
-
height: 100%;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.theia-mini-browser-load-indicator {
|
|
120
|
-
position: absolute;
|
|
121
|
-
top: 0;
|
|
122
|
-
right: 0;
|
|
123
|
-
bottom: 0;
|
|
124
|
-
left: 0;
|
|
125
|
-
z-index: 10;
|
|
126
|
-
background: var(--theia-editor-background);
|
|
127
|
-
background-image: var(--theia-preloader);
|
|
128
|
-
background-size: 60px 60px;
|
|
129
|
-
background-repeat: no-repeat;
|
|
130
|
-
background-position: center;
|
|
131
|
-
transition: opacity 0.8s;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.theia-mini-browser-load-indicator.theia-fade-out {
|
|
135
|
-
opacity: 0;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.theia-mini-browser-error-bar {
|
|
139
|
-
height: 19px;
|
|
140
|
-
padding-left: var(--theia-ui-padding);
|
|
141
|
-
background-color: var(--theia-inputValidation-errorBorder);
|
|
142
|
-
color: var(--theia-editor-foreground);
|
|
143
|
-
font-size: var(--theia-statusBar-font-size);
|
|
144
|
-
z-index: 1000; /* Above the transparent overlay (`z-index: 999;`). */
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.theia-mini-browser-error-bar span {
|
|
148
|
-
margin-top: 3px;
|
|
149
|
-
margin-left: var(--theia-ui-padding);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.theia-mini-browser-content-area iframe {
|
|
153
|
-
flex-grow: 1;
|
|
154
|
-
border: none;
|
|
155
|
-
margin: 0;
|
|
156
|
-
padding: 0;
|
|
157
|
-
}
|
|
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
|
+
:root {
|
|
18
|
+
--theia-private-mini-browser-height: var(--theia-content-line-height);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.theia-mini-browser {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.theia-mini-browser-toolbar {
|
|
28
|
+
margin-top: 8px;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: space-evenly;
|
|
32
|
+
padding: 0 10px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.theia-mini-browser-toolbar-read-only {
|
|
36
|
+
margin-top: 8px;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: space-evenly;
|
|
40
|
+
padding: 0 10px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.theia-mini-browser-toolbar .theia-input {
|
|
44
|
+
width: 100%;
|
|
45
|
+
line-height: var(--theia-private-mini-browser-height);
|
|
46
|
+
margin-left: 4px;
|
|
47
|
+
margin-right: 4px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.theia-mini-browser-toolbar-read-only .theia-input {
|
|
51
|
+
width: 100%;
|
|
52
|
+
line-height: var(--theia-private-mini-browser-height);
|
|
53
|
+
margin-left: 4px;
|
|
54
|
+
margin-right: 4px;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
background: var(--theia-input-background);
|
|
57
|
+
border: none;
|
|
58
|
+
text-decoration: underline;
|
|
59
|
+
outline: none;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
text-overflow: ellipsis;
|
|
63
|
+
color: var(--theia-input-foreground);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.theia-mini-browser-toolbar-read-only .theia-input:hover {
|
|
67
|
+
color: var(--theia-button-hoverBackground);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.theia-mini-browser-button {
|
|
71
|
+
min-width: 1rem;
|
|
72
|
+
text-align: center;
|
|
73
|
+
flex-grow: 0;
|
|
74
|
+
font-family: FontAwesome;
|
|
75
|
+
font-size: calc(var(--theia-content-font-size) * 0.8);
|
|
76
|
+
color: var(--theia-icon-foreground);
|
|
77
|
+
margin: 0px 4px 0px 4px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.theia-mini-browser-button:not(.theia-mini-browser-button-disabled):hover {
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.theia-mini-browser-button-disabled {
|
|
85
|
+
opacity: var(--theia-mod-disabled-opacity);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.theia-mini-browser-previous::before {
|
|
89
|
+
content: "\f053";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.theia-mini-browser-next::before {
|
|
93
|
+
content: "\f054";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.theia-mini-browser-refresh::before {
|
|
97
|
+
content: "\f021";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.theia-mini-browser-open::before {
|
|
101
|
+
content: "\f08e";
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.theia-mini-browser-content-area {
|
|
105
|
+
position: relative;
|
|
106
|
+
display: flex;
|
|
107
|
+
height: 100%;
|
|
108
|
+
width: 100%;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
margin-top: 6px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.theia-mini-browser-pdf-container {
|
|
115
|
+
width: 100%;
|
|
116
|
+
height: 100%;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.theia-mini-browser-load-indicator {
|
|
120
|
+
position: absolute;
|
|
121
|
+
top: 0;
|
|
122
|
+
right: 0;
|
|
123
|
+
bottom: 0;
|
|
124
|
+
left: 0;
|
|
125
|
+
z-index: 10;
|
|
126
|
+
background: var(--theia-editor-background);
|
|
127
|
+
background-image: var(--theia-preloader);
|
|
128
|
+
background-size: 60px 60px;
|
|
129
|
+
background-repeat: no-repeat;
|
|
130
|
+
background-position: center;
|
|
131
|
+
transition: opacity 0.8s;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.theia-mini-browser-load-indicator.theia-fade-out {
|
|
135
|
+
opacity: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.theia-mini-browser-error-bar {
|
|
139
|
+
height: 19px;
|
|
140
|
+
padding-left: var(--theia-ui-padding);
|
|
141
|
+
background-color: var(--theia-inputValidation-errorBorder);
|
|
142
|
+
color: var(--theia-editor-foreground);
|
|
143
|
+
font-size: var(--theia-statusBar-font-size);
|
|
144
|
+
z-index: 1000; /* Above the transparent overlay (`z-index: 999;`). */
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.theia-mini-browser-error-bar span {
|
|
148
|
+
margin-top: 3px;
|
|
149
|
+
margin-left: var(--theia-ui-padding);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.theia-mini-browser-content-area iframe {
|
|
153
|
+
flex-grow: 1;
|
|
154
|
+
border: none;
|
|
155
|
+
margin: 0;
|
|
156
|
+
padding: 0;
|
|
157
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<!--Copyright (c) 2019 Kenneth Auchenberg. -->
|
|
2
|
-
<!--Copyright (C) 2019 TypeFox and others.-->
|
|
3
|
-
<!--Licensed under the MIT License.-->
|
|
4
|
-
<svg width="25px" height="25px" viewBox="0 0 25 25" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
5
|
-
<!-- Generator: Sketch 52.2 (67145) - http://www.bohemiancoding.com/sketch -->
|
|
6
|
-
<title>icon</title>
|
|
7
|
-
<desc>Created with Sketch.</desc>
|
|
8
|
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
9
|
-
<g id="icon" fill="#2879FF">
|
|
10
|
-
<polygon id="Path" points="13.8671875 15.625 13.8671875 14.0625 18.5546875 14.0625 18.5546875 15.625"></polygon>
|
|
11
|
-
<polygon id="Path" points="13.8671875 12.5 13.8671875 10.9375 21.6796875 10.9375 21.6796875 12.5"></polygon>
|
|
12
|
-
<polygon id="Path" points="13.8671875 9.375 13.8671875 7.8125 21.6796875 7.8125 21.6796875 9.375"></polygon>
|
|
13
|
-
<rect id="Rectangle" x="2.9296875" y="7.8125" width="7.8125" height="7.8125"></rect>
|
|
14
|
-
<path d="M0,0 L0,25 L24.9992188,25 L25,0 L0,0 Z M17.1875,1.5625 L17.1875,3.125 L7.8125,3.125 L7.8125,1.5625 L17.1875,1.5625 Z M6.25,1.5625 L6.25,3.125 L4.6875,3.125 L4.6875,1.5625 L6.25,1.5625 Z M1.5625,1.5625 L3.125,1.5625 L3.125,3.125 L1.5625,3.125 L1.5625,1.5625 Z M23.4367188,23.046875 L1.5625,23.046875 L1.5625,4.6875 L23.4367188,4.6875 L23.4367188,23.046875 Z M23.4375,3.125 L20.3125,3.125 L20.3125,1.5625 L23.4375,1.5625 L23.4375,3.125 Z" id="Shape" fill-rule="nonzero"></path>
|
|
15
|
-
</g>
|
|
16
|
-
</g>
|
|
17
|
-
</svg>
|
|
1
|
+
<!--Copyright (c) 2019 Kenneth Auchenberg. -->
|
|
2
|
+
<!--Copyright (C) 2019 TypeFox and others.-->
|
|
3
|
+
<!--Licensed under the MIT License.-->
|
|
4
|
+
<svg width="25px" height="25px" viewBox="0 0 25 25" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
5
|
+
<!-- Generator: Sketch 52.2 (67145) - http://www.bohemiancoding.com/sketch -->
|
|
6
|
+
<title>icon</title>
|
|
7
|
+
<desc>Created with Sketch.</desc>
|
|
8
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
9
|
+
<g id="icon" fill="#2879FF">
|
|
10
|
+
<polygon id="Path" points="13.8671875 15.625 13.8671875 14.0625 18.5546875 14.0625 18.5546875 15.625"></polygon>
|
|
11
|
+
<polygon id="Path" points="13.8671875 12.5 13.8671875 10.9375 21.6796875 10.9375 21.6796875 12.5"></polygon>
|
|
12
|
+
<polygon id="Path" points="13.8671875 9.375 13.8671875 7.8125 21.6796875 7.8125 21.6796875 9.375"></polygon>
|
|
13
|
+
<rect id="Rectangle" x="2.9296875" y="7.8125" width="7.8125" height="7.8125"></rect>
|
|
14
|
+
<path d="M0,0 L0,25 L24.9992188,25 L25,0 L0,0 Z M17.1875,1.5625 L17.1875,3.125 L7.8125,3.125 L7.8125,1.5625 L17.1875,1.5625 Z M6.25,1.5625 L6.25,3.125 L4.6875,3.125 L4.6875,1.5625 L6.25,1.5625 Z M1.5625,1.5625 L3.125,1.5625 L3.125,3.125 L1.5625,3.125 L1.5625,1.5625 Z M23.4367188,23.046875 L1.5625,23.046875 L1.5625,4.6875 L23.4367188,4.6875 L23.4367188,23.046875 Z M23.4375,3.125 L20.3125,3.125 L20.3125,1.5625 L23.4375,1.5625 L23.4375,3.125 Z" id="Shape" fill-rule="nonzero"></path>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</svg>
|
|
@@ -1,28 +1,28 @@
|
|
|
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
|
-
/**
|
|
18
|
-
* The mini-browser can now serve content on its own host/origin.
|
|
19
|
-
*
|
|
20
|
-
* The virtual host can be configured with this `THEIA_MINI_BROWSER_HOST_PATTERN`
|
|
21
|
-
* environment variable. `{{hostname}}` represents the current host, and `{{uuid}}`
|
|
22
|
-
* will be replace by a random uuid value.
|
|
23
|
-
*/
|
|
24
|
-
export namespace MiniBrowserEndpoint {
|
|
25
|
-
export const PATH = '/mini-browser';
|
|
26
|
-
export const HOST_PATTERN_ENV = 'THEIA_MINI_BROWSER_HOST_PATTERN';
|
|
27
|
-
export const HOST_PATTERN_DEFAULT = '{{uuid}}.mini-browser.{{hostname}}';
|
|
28
|
-
}
|
|
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
|
+
/**
|
|
18
|
+
* The mini-browser can now serve content on its own host/origin.
|
|
19
|
+
*
|
|
20
|
+
* The virtual host can be configured with this `THEIA_MINI_BROWSER_HOST_PATTERN`
|
|
21
|
+
* environment variable. `{{hostname}}` represents the current host, and `{{uuid}}`
|
|
22
|
+
* will be replace by a random uuid value.
|
|
23
|
+
*/
|
|
24
|
+
export namespace MiniBrowserEndpoint {
|
|
25
|
+
export const PATH = '/mini-browser';
|
|
26
|
+
export const HOST_PATTERN_ENV = 'THEIA_MINI_BROWSER_HOST_PATTERN';
|
|
27
|
+
export const HOST_PATTERN_DEFAULT = '{{uuid}}.mini-browser.{{hostname}}';
|
|
28
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
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
|
-
export const MiniBrowserServicePath = '/services/mini-browser-service';
|
|
18
|
-
export const MiniBrowserService = Symbol('MiniBrowserService');
|
|
19
|
-
export interface MiniBrowserService {
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Resolves to an array of file extensions - priority pairs supported by the `Mini Browser`.
|
|
23
|
-
*
|
|
24
|
-
* The file extensions start without the leading dot (`.`) and should be treated in a case-insensitive way. This means,
|
|
25
|
-
* if the `Mini Browser` supports `['jpg']`, then it can open the `MyPicture.JPG` file.
|
|
26
|
-
*/
|
|
27
|
-
supportedFileExtensions(): Promise<Readonly<{ extension: string, priority: number }>[]>;
|
|
28
|
-
|
|
29
|
-
}
|
|
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
|
+
export const MiniBrowserServicePath = '/services/mini-browser-service';
|
|
18
|
+
export const MiniBrowserService = Symbol('MiniBrowserService');
|
|
19
|
+
export interface MiniBrowserService {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Resolves to an array of file extensions - priority pairs supported by the `Mini Browser`.
|
|
23
|
+
*
|
|
24
|
+
* The file extensions start without the leading dot (`.`) and should be treated in a case-insensitive way. This means,
|
|
25
|
+
* if the `Mini Browser` supports `['jpg']`, then it can open the `MyPicture.JPG` file.
|
|
26
|
+
*/
|
|
27
|
+
supportedFileExtensions(): Promise<Readonly<{ extension: string, priority: number }>[]>;
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
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 '../../browser/environment/mini-browser-environment';
|
|
20
|
-
import { ElectronMiniBrowserEnvironment } from './electron-mini-browser-environment';
|
|
21
|
-
|
|
22
|
-
export default new ContainerModule(bind => {
|
|
23
|
-
bind(MiniBrowserEnvironment).to(ElectronMiniBrowserEnvironment).inSingletonScope();
|
|
24
|
-
bind(FrontendApplicationContribution).toService(MiniBrowserEnvironment);
|
|
25
|
-
});
|
|
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 '../../browser/environment/mini-browser-environment';
|
|
20
|
+
import { ElectronMiniBrowserEnvironment } from './electron-mini-browser-environment';
|
|
21
|
+
|
|
22
|
+
export default new ContainerModule(bind => {
|
|
23
|
+
bind(MiniBrowserEnvironment).to(ElectronMiniBrowserEnvironment).inSingletonScope();
|
|
24
|
+
bind(FrontendApplicationContribution).toService(MiniBrowserEnvironment);
|
|
25
|
+
});
|
|
@@ -1,53 +1,53 @@
|
|
|
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 } from '@theia/core/lib/browser';
|
|
18
|
-
|
|
19
|
-
import { ElectronSecurityToken } from '@theia/core/lib/electron-common/electron-token';
|
|
20
|
-
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
21
|
-
import { MiniBrowserEnvironment } from '../../browser/environment/mini-browser-environment';
|
|
22
|
-
|
|
23
|
-
import '@theia/core/lib/electron-common/electron-api';
|
|
24
|
-
|
|
25
|
-
@injectable()
|
|
26
|
-
export class ElectronMiniBrowserEnvironment extends MiniBrowserEnvironment {
|
|
27
|
-
|
|
28
|
-
@inject(ElectronSecurityToken)
|
|
29
|
-
protected readonly electronSecurityToken: ElectronSecurityToken;
|
|
30
|
-
|
|
31
|
-
override getEndpoint(uuid: string, hostname?: string): Endpoint {
|
|
32
|
-
const endpoint = super.getEndpoint(uuid, hostname);
|
|
33
|
-
|
|
34
|
-
window.electronTheiaCore.attachSecurityToken(endpoint.getRestUrl().toString(true));
|
|
35
|
-
return endpoint;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
protected override getDefaultHostname(): string {
|
|
39
|
-
const query = self.location.search
|
|
40
|
-
.substring(1) // remove leading `?`
|
|
41
|
-
.split('&')
|
|
42
|
-
.map(entry => entry
|
|
43
|
-
.split('=', 2)
|
|
44
|
-
.map(element => decodeURIComponent(element))
|
|
45
|
-
);
|
|
46
|
-
for (const [key, value] of query) {
|
|
47
|
-
if (key === 'port') {
|
|
48
|
-
return `localhost:${value}`;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
throw new Error('could not resolve Electron\'s backend port');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
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 } from '@theia/core/lib/browser';
|
|
18
|
+
|
|
19
|
+
import { ElectronSecurityToken } from '@theia/core/lib/electron-common/electron-token';
|
|
20
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
21
|
+
import { MiniBrowserEnvironment } from '../../browser/environment/mini-browser-environment';
|
|
22
|
+
|
|
23
|
+
import '@theia/core/lib/electron-common/electron-api';
|
|
24
|
+
|
|
25
|
+
@injectable()
|
|
26
|
+
export class ElectronMiniBrowserEnvironment extends MiniBrowserEnvironment {
|
|
27
|
+
|
|
28
|
+
@inject(ElectronSecurityToken)
|
|
29
|
+
protected readonly electronSecurityToken: ElectronSecurityToken;
|
|
30
|
+
|
|
31
|
+
override getEndpoint(uuid: string, hostname?: string): Endpoint {
|
|
32
|
+
const endpoint = super.getEndpoint(uuid, hostname);
|
|
33
|
+
|
|
34
|
+
window.electronTheiaCore.attachSecurityToken(endpoint.getRestUrl().toString(true));
|
|
35
|
+
return endpoint;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
protected override getDefaultHostname(): string {
|
|
39
|
+
const query = self.location.search
|
|
40
|
+
.substring(1) // remove leading `?`
|
|
41
|
+
.split('&')
|
|
42
|
+
.map(entry => entry
|
|
43
|
+
.split('=', 2)
|
|
44
|
+
.map(element => decodeURIComponent(element))
|
|
45
|
+
);
|
|
46
|
+
for (const [key, value] of query) {
|
|
47
|
+
if (key === 'port') {
|
|
48
|
+
return `localhost:${value}`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
throw new Error('could not resolve Electron\'s backend port');
|
|
52
|
+
}
|
|
53
|
+
}
|