Compare commits
11 Commits
2.1472-vsc
...
2.1485-vsc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef069d9b0e | ||
|
|
6a864f9f47 | ||
|
|
5c16399810 | ||
|
|
0141ded35d | ||
|
|
bb46e80d44 | ||
|
|
1bd5eca73d | ||
|
|
48a97abe1d | ||
|
|
0ff8a11c7f | ||
|
|
8b1cdaa4a1 | ||
|
|
0bbaa9763b | ||
|
|
dbe5f23e21 |
@@ -9,3 +9,4 @@ doc
|
|||||||
LICENSE
|
LICENSE
|
||||||
README.md
|
README.md
|
||||||
node_modules
|
node_modules
|
||||||
|
release
|
||||||
@@ -16,7 +16,9 @@ COPY . .
|
|||||||
RUN yarn \
|
RUN yarn \
|
||||||
&& MINIFY=true yarn build "${vscodeVersion}" "${codeServerVersion}" \
|
&& MINIFY=true yarn build "${vscodeVersion}" "${codeServerVersion}" \
|
||||||
&& yarn binary "${vscodeVersion}" "${codeServerVersion}" \
|
&& yarn binary "${vscodeVersion}" "${codeServerVersion}" \
|
||||||
&& mv "/src/build/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64-built/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64" /src/build/code-server
|
&& mv "/src/build/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64-built/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64" /src/build/code-server \
|
||||||
|
&& rm -r /src/build/vscode-* \
|
||||||
|
&& rm -r /src/build/code-server*-linux-*
|
||||||
|
|
||||||
# We deploy with ubuntu so that devs have a familiar environment.
|
# We deploy with ubuntu so that devs have a familiar environment.
|
||||||
FROM ubuntu:18.04
|
FROM ubuntu:18.04
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ you need to add `--security-opt seccomp=unconfined` to your `docker run`
|
|||||||
arguments when launching code-server with Docker. See
|
arguments when launching code-server with Docker. See
|
||||||
[#725](https://github.com/cdr/code-server/issues/725) for details.
|
[#725](https://github.com/cdr/code-server/issues/725) for details.
|
||||||
|
|
||||||
|
### Digital Ocean
|
||||||
|
[](https://marketplace.digitalocean.com/apps/code-server?action=deploy)
|
||||||
|
|
||||||
### Binaries
|
### Binaries
|
||||||
1. [Download a binary](https://github.com/cdr/code-server/releases). (Linux and
|
1. [Download a binary](https://github.com/cdr/code-server/releases). (Linux and
|
||||||
OS X supported. Windows coming soon)
|
OS X supported. Windows coming soon)
|
||||||
@@ -43,7 +46,6 @@ arguments when launching code-server with Docker. See
|
|||||||
- If you also plan on developing, set the `OUT` environment variable. Otherwise
|
- If you also plan on developing, set the `OUT` environment variable. Otherwise
|
||||||
it will build in this directory which will cause issues because `yarn watch`
|
it will build in this directory which will cause issues because `yarn watch`
|
||||||
will try to compile the build directory as well.
|
will try to compile the build directory as well.
|
||||||
- For now `@coder/nbin` is a global dependency.
|
|
||||||
- Run `yarn build ${vscodeVersion} ${codeServerVersion}` in this directory (for
|
- Run `yarn build ${vscodeVersion} ${codeServerVersion}` in this directory (for
|
||||||
example: `yarn build 1.36.0 development`).
|
example: `yarn build 1.36.0 development`).
|
||||||
- If you target the same VS Code version our Travis builds do everything will
|
- If you target the same VS Code version our Travis builds do everything will
|
||||||
@@ -54,7 +56,6 @@ arguments when launching code-server with Docker. See
|
|||||||
code into a single binary.
|
code into a single binary.
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
- Uploading .vsix files doesn't work.
|
|
||||||
- Creating custom VS Code extensions and debugging them doesn't work.
|
- Creating custom VS Code extensions and debugging them doesn't work.
|
||||||
- Extension profiling and tips are currently disabled.
|
- Extension profiling and tips are currently disabled.
|
||||||
|
|
||||||
|
|||||||
24
doc/assets/droplet.svg
Normal file
24
doc/assets/droplet.svg
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="200px" height="40px" viewBox="0 0 200 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<!-- Generator: Sketch 52.5 (67469) - http://www.bohemiancoding.com/sketch -->
|
||||||
|
<title>do-btn-blue-ghost</title>
|
||||||
|
<desc>Created with Sketch.</desc>
|
||||||
|
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<g id="Partner-welcome-kit-Copy-3" transform="translate(-651.000000, -828.000000)">
|
||||||
|
<g id="do-btn-blue-ghost" transform="translate(651.000000, 828.000000)">
|
||||||
|
<rect id="Rectangle-Copy-4" stroke="#0069FF" x="0.5" y="0.5" width="199" height="39" rx="6"></rect>
|
||||||
|
<path d="M6,0 L47,0 L47,40 L6,40 C2.6862915,40 4.05812251e-16,37.3137085 0,34 L-8.8817842e-16,6 C-1.29399067e-15,2.6862915 2.6862915,6.08718376e-16 6,0 Z" id="Rectangle-Copy-5" fill="#0069FF"></path>
|
||||||
|
<g id="DO_Logo_horizontal_blue-Copy-3" transform="translate(13.000000, 10.000000)" fill="#FFFFFF">
|
||||||
|
<path d="M10.0098493,20 L10.0098493,16.1262429 C14.12457,16.1262429 17.2897398,12.0548452 15.7269372,7.74627862 C15.1334679,6.14538921 13.8674,4.86072487 12.2650328,4.28756693 C7.952489,2.72620566 3.87733294,5.88845634 3.87733294,9.99938223 C3.87733294,9.99938223 3.87733294,9.99938223 3.87733294,9.99938223 L0,9.99938223 C0,3.45747613 6.3303395,-1.64165309 13.1948014,0.492866119 C16.2017127,1.42177726 18.57559,3.81322933 19.5053586,6.79760341 C21.6418482,13.6754986 16.5577943,20 10.0098493,20 Z" id="XMLID_49_"></path>
|
||||||
|
<polygon id="XMLID_47_" points="9.52380952 16.1904762 5.71428571 16.1904762 5.71428571 12.3809524 5.71428571 12.3809524 9.52380952 12.3809524 9.52380952 12.3809524"></polygon>
|
||||||
|
<polygon id="XMLID_46_" points="6.66666667 19.047619 3.80952381 19.047619 3.80952381 19.047619 3.80952381 16.1904762 6.66666667 16.1904762"></polygon>
|
||||||
|
<polygon id="XMLID_45_" points="3.80952381 16.1904762 0.952380952 16.1904762 0.952380952 16.1904762 0.952380952 13.3333333 0.952380952 13.3333333 3.80952381 13.3333333 3.80952381 13.3333333"></polygon>
|
||||||
|
</g>
|
||||||
|
<!-- Modified to add GitHub font-family after DigitalOcean's font-family, otherwise it looks bad on GitHub -->
|
||||||
|
<text id="Create-a-Droplet-Copy-3" font-family="Sailec-Medium, Sailec, -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" font-size="16" font-weight="400" fill="#0069FF">
|
||||||
|
<tspan x="58" y="26">Create a Droplet</tspan>
|
||||||
|
</text>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.7 KiB |
@@ -46,12 +46,66 @@ server {
|
|||||||
RewriteRule /(.*) http://localhost:8080/$1 [P,L]
|
RewriteRule /(.*) http://localhost:8080/$1 [P,L]
|
||||||
|
|
||||||
ProxyRequests off
|
ProxyRequests off
|
||||||
|
ProxyPass / http://localhost:8080/ nocanon
|
||||||
RequestHeader set X-Forwarded-Proto https
|
|
||||||
RequestHeader set X-Forwarded-Port 443
|
|
||||||
|
|
||||||
ProxyPass / http://localhost:8080/ nocanon
|
|
||||||
ProxyPassReverse / http://localhost:8080/
|
ProxyPassReverse / http://localhost:8080/
|
||||||
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Run automatically at startup
|
||||||
|
|
||||||
|
In some cases you might need to run code-server automatically once the host starts. You may use your local init service to do so.
|
||||||
|
|
||||||
|
#### Systemd
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[Unit]
|
||||||
|
|
||||||
|
Description=VSCode in a browser
|
||||||
|
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
|
||||||
|
Type=simple
|
||||||
|
|
||||||
|
ExecStart=/usr/bin/code-server $(pwd)
|
||||||
|
|
||||||
|
WorkingDirectory=$HOME/projects
|
||||||
|
|
||||||
|
ExecStop=/sbin/start-stop-daemon --stop -x /usr/bin/code-server
|
||||||
|
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
User=1000
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
#### OpenRC
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
after net-online
|
||||||
|
need net
|
||||||
|
}
|
||||||
|
|
||||||
|
supervisor=supervise-daemon
|
||||||
|
name="code-server"
|
||||||
|
command="/opt/cdr/code-server"
|
||||||
|
command_args=""
|
||||||
|
|
||||||
|
pidfile="/var/run/cdr.pid"
|
||||||
|
respawn_delay=5
|
||||||
|
|
||||||
|
set -o allexport
|
||||||
|
if [ -f /etc/environment ]; then source /etc/environment; fi
|
||||||
|
set +o allexport
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Kubernetes/Docker
|
||||||
|
|
||||||
|
Make sure you set your restart policy to always - this will ensure your container starts as the daemon starts.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"patch:apply": "yarn ensure-in-vscode && cd ../../../ && git apply ./src/vs/server/scripts/vscode.patch"
|
"patch:apply": "yarn ensure-in-vscode && cd ../../../ && git apply ./src/vs/server/scripts/vscode.patch"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@coder/nbin": "^1.2.0",
|
"@coder/nbin": "^1.2.2",
|
||||||
"@types/pem": "^1.9.5",
|
"@types/pem": "^1.9.5",
|
||||||
"@types/safe-compare": "^1.1.0",
|
"@types/safe-compare": "^1.1.0",
|
||||||
"@types/tar-fs": "^1.16.1",
|
"@types/tar-fs": "^1.16.1",
|
||||||
|
|||||||
@@ -57,27 +57,27 @@ index 6bb695db68..ecbabe5dc8 100644
|
|||||||
}
|
}
|
||||||
-
|
-
|
||||||
diff --git a/src/vs/base/browser/mouseEvent.ts b/src/vs/base/browser/mouseEvent.ts
|
diff --git a/src/vs/base/browser/mouseEvent.ts b/src/vs/base/browser/mouseEvent.ts
|
||||||
index 4c7295e3b9..fc9694a18b 100644
|
index 4c7295e3b9..b0af2cdd62 100644
|
||||||
--- a/src/vs/base/browser/mouseEvent.ts
|
--- a/src/vs/base/browser/mouseEvent.ts
|
||||||
+++ b/src/vs/base/browser/mouseEvent.ts
|
+++ b/src/vs/base/browser/mouseEvent.ts
|
||||||
@@ -158,7 +158,7 @@ export class StandardWheelEvent {
|
@@ -160,6 +160,8 @@ export class StandardWheelEvent {
|
||||||
// vertical delta scroll
|
|
||||||
if (typeof e1.wheelDeltaY !== 'undefined') {
|
|
||||||
this.deltaY = e1.wheelDeltaY / 120;
|
this.deltaY = e1.wheelDeltaY / 120;
|
||||||
- } else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {
|
} else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {
|
||||||
+ } else if (browser.isFirefox || (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS)) {
|
|
||||||
this.deltaY = -e2.detail / 3;
|
this.deltaY = -e2.detail / 3;
|
||||||
|
+ } else if (browser.isFirefox) {
|
||||||
|
+ this.deltaY = -e.deltaY / 3;
|
||||||
} else {
|
} else {
|
||||||
this.deltaY = -e.deltaY / 40;
|
this.deltaY = -e.deltaY / 40;
|
||||||
@@ -171,7 +171,7 @@ export class StandardWheelEvent {
|
}
|
||||||
} else {
|
@@ -173,6 +175,8 @@ export class StandardWheelEvent {
|
||||||
this.deltaX = e1.wheelDeltaX / 120;
|
|
||||||
}
|
}
|
||||||
- } else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {
|
} else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {
|
||||||
+ } else if (browser.isFirefox || (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS)) {
|
|
||||||
this.deltaX = -e.detail / 3;
|
this.deltaX = -e.detail / 3;
|
||||||
|
+ } else if (browser.isFirefox) {
|
||||||
|
+ this.deltaX = -e.deltaX / 3;
|
||||||
} else {
|
} else {
|
||||||
this.deltaX = -e.deltaX / 40;
|
this.deltaX = -e.deltaX / 40;
|
||||||
|
}
|
||||||
diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts
|
diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts
|
||||||
index 4f93e06df0..ae63e64a7f 100644
|
index 4f93e06df0..ae63e64a7f 100644
|
||||||
--- a/src/vs/base/common/network.ts
|
--- a/src/vs/base/common/network.ts
|
||||||
@@ -1032,37 +1032,33 @@ index 7c3b6ae53e..18dec6effa 100644
|
|||||||
|
|
||||||
get webviewResourceRoot(): string {
|
get webviewResourceRoot(): string {
|
||||||
diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
|
diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
|
||||||
index 6d31b177ac..a586ac7466 100644
|
index 6d31b177ac..67c955a59d 100644
|
||||||
--- a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
|
--- a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
|
||||||
+++ b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
|
+++ b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
|
||||||
@@ -116,7 +116,7 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
|
@@ -41,12 +41,12 @@ const args = minimist(process.argv.slice(2), {
|
||||||
protocol.onClose(() => onTerminate());
|
const Module = require.__$__nodeRequire('module') as any;
|
||||||
resolve(protocol);
|
const originalLoad = Module._load;
|
||||||
|
|
||||||
- if (msg.skipWebSocketFrames) {
|
- Module._load = function (request: string) {
|
||||||
+ // if (msg.skipWebSocketFrames) {
|
+ Module._load = function (request: string, parent: object, isMain: boolean) {
|
||||||
// Wait for rich client to reconnect
|
if (request === 'natives') {
|
||||||
|
throw new Error('Either the extension or a NPM dependency is using the "natives" node module which is unsupported as it can cause a crash of the extension host. Click [here](https://go.microsoft.com/fwlink/?linkid=871887) to find out more');
|
||||||
|
}
|
||||||
|
|
||||||
|
- return originalLoad.apply(this, arguments);
|
||||||
|
+ return originalLoad.apply(this, [request.replace(/node_modules\.asar(\.unpacked)?/, 'node_modules'), parent, isMain]);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
@@ -128,7 +128,7 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
|
||||||
|
} else {
|
||||||
|
// Do not wait for web companion to reconnect
|
||||||
protocol.onSocketClose(() => {
|
protocol.onSocketClose(() => {
|
||||||
// The socket has closed, let's give the renderer a certain amount of time to reconnect
|
|
||||||
@@ -125,12 +125,12 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
|
|
||||||
onTerminate();
|
|
||||||
}, ProtocolConstants.ReconnectionGraceTime);
|
|
||||||
});
|
|
||||||
- } else {
|
|
||||||
- // Do not wait for web companion to reconnect
|
|
||||||
- protocol.onSocketClose(() => {
|
|
||||||
- onTerminate();
|
- onTerminate();
|
||||||
- });
|
+ process.send!({ type: 'VSCODE_EXTHOST_DISCONNECTED' });
|
||||||
- }
|
});
|
||||||
+ // } else {
|
}
|
||||||
+ // // Do not wait for web companion to reconnect
|
|
||||||
+ // protocol.onSocketClose(() => {
|
|
||||||
+ // onTerminate();
|
|
||||||
+ // });
|
|
||||||
+ // }
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts
|
diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts
|
||||||
index 681fc606b6..e34ef5d4bc 100644
|
index 681fc606b6..e34ef5d4bc 100644
|
||||||
--- a/src/vs/workbench/workbench.web.main.ts
|
--- a/src/vs/workbench/workbench.web.main.ts
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ export class FileProviderChannel implements IServerChannel, IDisposable {
|
|||||||
|
|
||||||
private transform(resource: UriComponents): URI {
|
private transform(resource: UriComponents): URI {
|
||||||
// Used for walkthrough content.
|
// Used for walkthrough content.
|
||||||
if (resource.path.indexOf("/static") === 0) {
|
if (/^\/static[^/]*\//.test(resource.path)) {
|
||||||
return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static/, ""));
|
return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static[^/]*\//, "/"));
|
||||||
// Used by the webview service worker to load resources.
|
// Used by the webview service worker to load resources.
|
||||||
} else if (resource.path === "/vscode-resource" && resource.query) {
|
} else if (resource.path === "/vscode-resource" && resource.query) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ export abstract class Connection {
|
|||||||
private disposed = false;
|
private disposed = false;
|
||||||
private _offline: number | undefined;
|
private _offline: number | undefined;
|
||||||
|
|
||||||
public constructor(protected protocol: Protocol) {
|
public constructor(protected protocol: Protocol, public readonly token: string) {}
|
||||||
protocol.onClose(() => this.dispose()); // Explicit close.
|
|
||||||
protocol.onSocketClose(() => this._offline = Date.now()); // Might reconnect.
|
|
||||||
}
|
|
||||||
|
|
||||||
public get offline(): number | undefined {
|
public get offline(): number | undefined {
|
||||||
return this._offline;
|
return this._offline;
|
||||||
@@ -39,6 +36,12 @@ export abstract class Connection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected setOffline(): void {
|
||||||
|
if (!this._offline) {
|
||||||
|
this._offline = Date.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the connection on a new socket.
|
* Set up the connection on a new socket.
|
||||||
*/
|
*/
|
||||||
@@ -50,6 +53,12 @@ export abstract class Connection {
|
|||||||
* Used for all the IPC channels.
|
* Used for all the IPC channels.
|
||||||
*/
|
*/
|
||||||
export class ManagementConnection extends Connection {
|
export class ManagementConnection extends Connection {
|
||||||
|
public constructor(protected protocol: Protocol, token: string) {
|
||||||
|
super(protocol, token);
|
||||||
|
protocol.onClose(() => this.dispose()); // Explicit close.
|
||||||
|
protocol.onSocketClose(() => this.setOffline()); // Might reconnect.
|
||||||
|
}
|
||||||
|
|
||||||
protected doDispose(): void {
|
protected doDispose(): void {
|
||||||
this.protocol.sendDisconnect();
|
this.protocol.sendDisconnect();
|
||||||
this.protocol.dispose();
|
this.protocol.dispose();
|
||||||
@@ -66,11 +75,11 @@ export class ExtensionHostConnection extends Connection {
|
|||||||
private process?: cp.ChildProcess;
|
private process?: cp.ChildProcess;
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
locale:string, protocol: Protocol, buffer: VSBuffer,
|
locale:string, protocol: Protocol, buffer: VSBuffer, token: string,
|
||||||
private readonly log: ILogService,
|
private readonly log: ILogService,
|
||||||
private readonly environment: IEnvironmentService,
|
private readonly environment: IEnvironmentService,
|
||||||
) {
|
) {
|
||||||
super(protocol);
|
super(protocol, token);
|
||||||
this.protocol.dispose();
|
this.protocol.dispose();
|
||||||
this.spawn(locale, buffer).then((p) => this.process = p);
|
this.spawn(locale, buffer).then((p) => this.process = p);
|
||||||
this.protocol.getUnderlyingSocket().pause();
|
this.protocol.getUnderlyingSocket().pause();
|
||||||
@@ -129,6 +138,9 @@ export class ExtensionHostConnection extends Connection {
|
|||||||
const severity = (<any>this.log)[event.severity] ? event.severity : "info";
|
const severity = (<any>this.log)[event.severity] ? event.severity : "info";
|
||||||
(<any>this.log)[severity]("Extension host", event.arguments);
|
(<any>this.log)[severity]("Extension host", event.arguments);
|
||||||
}
|
}
|
||||||
|
if (event && event.type === "VSCODE_EXTHOST_DISCONNECTED") {
|
||||||
|
this.setOffline();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const listen = (message: IExtHostReadyMessage) => {
|
const listen = (message: IExtHostReadyMessage) => {
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ export abstract class Server {
|
|||||||
// without adding query parameters which have their own issues.
|
// without adding query parameters which have their own issues.
|
||||||
// REVIEW: Discuss whether this is the best option; this is sort of a quick
|
// REVIEW: Discuss whether this is the best option; this is sort of a quick
|
||||||
// hack almost to get caching in the meantime but it does work pretty well.
|
// hack almost to get caching in the meantime but it does work pretty well.
|
||||||
if (/static-.+/.test(base)) {
|
if (/^\/static-.+/.test(base)) {
|
||||||
base = "/static";
|
base = "/static";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ export abstract class Server {
|
|||||||
this.ensureGet(request);
|
this.ensureGet(request);
|
||||||
if (!this.authenticate(request)) {
|
if (!this.authenticate(request)) {
|
||||||
throw new HttpError("Unauthorized", HttpCode.Unauthorized);
|
throw new HttpError("Unauthorized", HttpCode.Unauthorized);
|
||||||
} else if (request.headers.upgrade !== "websocket") {
|
} else if (!request.headers.upgrade || request.headers.upgrade.toLowerCase() !== "websocket") {
|
||||||
throw new Error("HTTP/1.1 400 Bad Request");
|
throw new Error("HTTP/1.1 400 Bad Request");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ export class MainServer extends Server {
|
|||||||
public readonly onDidClientConnect = this._onDidClientConnect.event;
|
public readonly onDidClientConnect = this._onDidClientConnect.event;
|
||||||
private readonly ipc = new IPCServer(this.onDidClientConnect);
|
private readonly ipc = new IPCServer(this.onDidClientConnect);
|
||||||
|
|
||||||
private readonly maxOfflineConnections = 5;
|
private readonly maxExtraOfflineConnections = 0;
|
||||||
private readonly connections = new Map<ConnectionType, Map<string, Connection>>();
|
private readonly connections = new Map<ConnectionType, Map<string, Connection>>();
|
||||||
|
|
||||||
private readonly services = new ServiceCollection();
|
private readonly services = new ServiceCollection();
|
||||||
@@ -601,7 +601,7 @@ export class MainServer extends Server {
|
|||||||
|
|
||||||
let connection: Connection;
|
let connection: Connection;
|
||||||
if (message.desiredConnectionType === ConnectionType.Management) {
|
if (message.desiredConnectionType === ConnectionType.Management) {
|
||||||
connection = new ManagementConnection(protocol);
|
connection = new ManagementConnection(protocol, token);
|
||||||
this._onDidClientConnect.fire({
|
this._onDidClientConnect.fire({
|
||||||
protocol, onDidClientDisconnect: connection.onClose,
|
protocol, onDidClientDisconnect: connection.onClose,
|
||||||
});
|
});
|
||||||
@@ -609,28 +609,26 @@ export class MainServer extends Server {
|
|||||||
const buffer = protocol.readEntireBuffer();
|
const buffer = protocol.readEntireBuffer();
|
||||||
connection = new ExtensionHostConnection(
|
connection = new ExtensionHostConnection(
|
||||||
message.args ? message.args.language : "en",
|
message.args ? message.args.language : "en",
|
||||||
protocol, buffer,
|
protocol, buffer, token,
|
||||||
this.services.get(ILogService) as ILogService,
|
this.services.get(ILogService) as ILogService,
|
||||||
this.services.get(IEnvironmentService) as IEnvironmentService,
|
this.services.get(IEnvironmentService) as IEnvironmentService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
connections.set(token, connection);
|
connections.set(token, connection);
|
||||||
this.disposeOldOfflineConnections();
|
|
||||||
connection.onClose(() => connections.delete(token));
|
connection.onClose(() => connections.delete(token));
|
||||||
|
this.disposeOldOfflineConnections(connections);
|
||||||
break;
|
break;
|
||||||
case ConnectionType.Tunnel: return protocol.tunnel();
|
case ConnectionType.Tunnel: return protocol.tunnel();
|
||||||
default: throw new Error("Unrecognized connection type");
|
default: throw new Error("Unrecognized connection type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private disposeOldOfflineConnections(): void {
|
private disposeOldOfflineConnections(connections: Map<string, Connection>): void {
|
||||||
this.connections.forEach((connections) => {
|
const offline = Array.from(connections.values())
|
||||||
const offline = Array.from(connections.values())
|
.filter((connection) => typeof connection.offline !== "undefined");
|
||||||
.filter((connection) => typeof connection.offline !== "undefined");
|
for (let i = 0, max = offline.length - this.maxExtraOfflineConnections; i < max; ++i) {
|
||||||
for (let i = 0, max = offline.length - this.maxOfflineConnections; i < max; ++i) {
|
offline[i].dispose();
|
||||||
offline[i].dispose();
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async initializeServices(args: ParsedArgs): Promise<void> {
|
private async initializeServices(args: ParsedArgs): Promise<void> {
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.8.tgz#416a7221d84161ee35eca9cfa93ba9377639b4ee"
|
resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.8.tgz#416a7221d84161ee35eca9cfa93ba9377639b4ee"
|
||||||
integrity sha512-NJDC4rZTx0deVYqAxZtJWACq3IrVR59BjFeZebO3i7OfTZZMkkbLsGsCFMnJd5KnX6KjnvvFq4XXtwJ9yf8/YQ==
|
integrity sha512-NJDC4rZTx0deVYqAxZtJWACq3IrVR59BjFeZebO3i7OfTZZMkkbLsGsCFMnJd5KnX6KjnvvFq4XXtwJ9yf8/YQ==
|
||||||
|
|
||||||
"@coder/nbin@^1.2.0":
|
"@coder/nbin@^1.2.2":
|
||||||
version "1.2.0"
|
version "1.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/@coder/nbin/-/nbin-1.2.0.tgz#b1cc5ed51193ded98ccfe39825ceee500b90f849"
|
resolved "https://registry.yarnpkg.com/@coder/nbin/-/nbin-1.2.2.tgz#c5f9aaa2a0e84c2a13a4cce895547efbd66730b7"
|
||||||
integrity sha512-fHnOqx1yAuK65gr1D9Du7W4AXiITEcFPKIZ3JifvXMeSSwzdVzq3nvVSCPD45KTwK1nS6pDKkXC/CqrYinUf7Q==
|
integrity sha512-1Z6aYBRZRY1AQ2xp0jmoz+TXR8M4WaHa9FfVkOPej0KPJjYtEp18I+/6CmffDtBLxSnIai0rc+AA0VhbjCN/rg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@coder/logger" "^1.1.8"
|
"@coder/logger" "^1.1.8"
|
||||||
fs-extra "^7.0.1"
|
fs-extra "^7.0.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user