Compare commits

...

9 Commits
3.0.1 ... 3.0.2

Author SHA1 Message Date
Asher
e480f6527e Update VS Code to 1.43.2 2020-04-01 15:27:28 -05:00
Asher
26584f2060 Strip protocol from remote authority
In Google cloud shell the host header is 127.0.0.1:8080 instead of the
actual URL. This is what we write out to the HTML so VS Code can pick it
up. However cloud shell rewrites this string when found in the HTML
before serving it so it becomes https://8080-[...].appspot.com,
resulting in an extra unexpected https:// in the
URI (vscode-remote://https://8080[...]). The resulting malformed URI
causes the extension host to exit.

- Fixes #1471
- Fixes #1468
- Fixes #1440 (most likely).
2020-04-01 13:41:05 -05:00
Asher
a4c0fd1fdc Run ssh server listen after http
That way if they happen to conflict code-server doesn't crash.
2020-03-30 17:43:11 -05:00
Asher
6c104c016e Prevent exiting when an exception is uncaught 2020-03-30 17:43:10 -05:00
Asher
599670136d Output commit along with the version 2020-03-30 17:43:09 -05:00
Asher
ce637d318d Add descriptions to SSH flags 2020-03-30 17:43:08 -05:00
Anmol Sethi
d8654b5a19 Merge pull request #1460 from mjgallag/peg-yarn-version
Peg yarn version to ensure deterministic builds
2020-03-30 01:52:14 -04:00
Michael Gallagher
12c3ccd6c7 Peg yarn version to ensure deterministic builds
"Yarn is fully deterministic as long as all your teammates are using the same Yarn version." (https://classic.yarnpkg.com/blog/2017/05/31/determinism/)
2020-03-28 14:29:04 -07:00
Asher
7954656610 Set background color using VS Code theme 2020-03-27 16:58:50 -05:00
8 changed files with 83 additions and 41 deletions

View File

@@ -15,7 +15,7 @@ RUN yum update -y && yum install -y \
RUN mkdir /usr/share/node && cd /usr/share/node \
&& curl "https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-$(uname -m | sed 's/86_//; s/aarch/arm/').tar.xz" | tar xJ --strip-components=1 --
ENV PATH "$PATH:/usr/share/node/bin"
RUN npm install -g yarn
RUN npm install -g yarn@1.22.4
RUN curl -L "https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_$(uname -m | sed 's/x86_/amd/; s/aarch64/arm/')" > /usr/local/bin/shfmt \
&& chmod +x /usr/local/bin/shfmt

View File

@@ -157,7 +157,7 @@ index 2d8b725ff2..a8d93a17ca 100644
unique-stream@^2.0.2:
version "2.2.1"
diff --git a/package.json b/package.json
index 6e9b9dc0a0..49b14e536a 100644
index 29d3cb6677..d3788cb1ab 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,9 @@
@@ -248,7 +248,7 @@ index 2c64061da7..c0ef8faedd 100644
// Do nothing. If we can't read the file we have no
// language pack config.
diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts
index 45f6f17ce0..79fde0b92c 100644
index 45f6f17ce0..4d1a590a7c 100644
--- a/src/vs/code/browser/workbench/workbench.ts
+++ b/src/vs/code/browser/workbench/workbench.ts
@@ -246,12 +246,18 @@ class WorkspaceProvider implements IWorkspaceProvider {
@@ -272,7 +272,26 @@ index 45f6f17ce0..79fde0b92c 100644
}
// Append payload if any
@@ -302,35 +308,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
@@ -290,6 +296,18 @@ class WorkspaceProvider implements IWorkspaceProvider {
const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute);
+ // Strip the protocol from the authority if it exists.
+ const normalizeAuthority = (authority: string): string => authority.replace(/^https?:\/\//, "");
+ if (config.remoteAuthority) {
+ (config as any).remoteAuthority = normalizeAuthority(config.remoteAuthority);
+ }
+ if (config.workspaceUri) {
+ config.workspaceUri.authority = normalizeAuthority(config.workspaceUri.authority);
+ }
+ if (config.folderUri) {
+ config.folderUri.authority = normalizeAuthority(config.folderUri.authority);
+ }
+
// Revive static extension locations
if (Array.isArray(config.staticExtensions)) {
config.staticExtensions.forEach(extension => {
@@ -302,35 +320,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
let workspace: IWorkspace;
let payload = Object.create(null);
@@ -493,10 +512,10 @@ index eab8591492..26668701f7 100644
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts
new file mode 100644
index 0000000000..4042e32f74
index 0000000000..96fbd4b0bb
--- /dev/null
+++ b/src/vs/server/browser/client.ts
@@ -0,0 +1,263 @@
@@ -0,0 +1,270 @@
+import { Emitter } from 'vs/base/common/event';
+import { URI } from 'vs/base/common/uri';
+import { localize } from 'vs/nls';
@@ -515,6 +534,7 @@ index 0000000000..4042e32f74
+import { LocalizationsService } from 'vs/workbench/services/localizations/electron-browser/localizationsService';
+import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
+import { Options } from 'vs/server/ipc.d';
+import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
+
+class TelemetryService extends TelemetryChannelClient {
+ public constructor(
@@ -725,6 +745,12 @@ index 0000000000..4042e32f74
+ };
+
+ updateLoop();
+
+ // This will be used to set the background color while VS Code loads.
+ const theme = (services.get(IStorageService) as IStorageService).get("colorThemeData", StorageScope.GLOBAL);
+ if (theme) {
+ localStorage.setItem("colorThemeData", theme);
+ }
+};
+
+export interface Query {

View File

@@ -1,7 +1,7 @@
{
"name": "code-server",
"license": "MIT",
"version": "3.0.1",
"version": "3.0.2",
"scripts": {
"clean": "ci/clean.sh",
"vscode": "ci/vscode.sh",

View File

@@ -100,4 +100,11 @@
<script>
require(["vs/code/browser/workbench/workbench"], function() {})
</script>
<script>
try {
document.body.style.background = JSON.parse(localStorage.getItem("colorThemeData")).colorMap["editor.background"]
} catch (error) {
// Oh well.
}
</script>
</html>

View File

@@ -98,8 +98,8 @@ const options: Options<Required<Args>> = {
version: { type: "boolean", short: "v", description: "Display version information." },
_: { type: "string[]" },
"disable-ssh": { type: "boolean" },
"ssh-host-key": { type: "string", path: true },
"disable-ssh": { type: "boolean", description: "Disable the SSH server." },
"ssh-host-key": { type: "string", path: true, description: "SSH server host key." },
"user-data-dir": { type: "string", path: true, description: "Path to the user data directory." },
"extensions-dir": { type: "string", path: true, description: "Path to the extensions directory." },

View File

@@ -14,24 +14,34 @@ import { SshProvider } from "./ssh/server"
import { generateCertificate, generatePassword, generateSshHostKey, hash, open } from "./util"
import { ipcMain, wrap } from "./wrapper"
process.on("uncaughtException", (error) => {
logger.error(`Uncaught exception: ${error.message}`)
if (typeof error.stack !== "undefined") {
logger.error(error.stack)
}
})
let pkg: { version?: string; commit?: string } = {}
try {
pkg = require("../../package.json")
} catch (error) {
logger.warn(error.message)
}
const version = pkg.version || "development"
const commit = pkg.commit || "development"
const main = async (args: Args): Promise<void> => {
const auth = args.auth || AuthType.Password
const originalPassword = auth === AuthType.Password && (process.env.PASSWORD || (await generatePassword()))
let commit: string | undefined
try {
commit = require("../../package.json").commit
} catch (error) {
logger.warn(error.message)
}
// Spawn the main HTTP server.
const options = {
auth,
cert: args.cert ? args.cert.value : undefined,
certKey: args["cert-key"],
sshHostKey: args["ssh-host-key"],
commit: commit || "development",
commit,
host: args.host || (args.auth === AuthType.Password && typeof args.cert !== "undefined" ? "0.0.0.0" : "localhost"),
password: originalPassword ? hash(originalPassword) : undefined,
port: typeof args.port !== "undefined" ? args.port : process.env.PORT ? parseInt(process.env.PORT, 10) : 8080,
@@ -68,20 +78,9 @@ const main = async (args: Args): Promise<void> => {
ipcMain().onDispose(() => httpServer.dispose())
logger.info(`code-server ${require("../../package.json").version}`)
let sshPort = ""
if (!args["disable-ssh"] && options.sshHostKey) {
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
try {
sshPort = await sshProvider.listen()
} catch (error) {
logger.warn(`SSH server: ${error.message}`)
}
}
logger.info(`code-server ${version} ${commit}`)
const serverAddress = await httpServer.listen()
logger.info(`Server listening on ${serverAddress}`)
logger.info(`HTTP server listening on ${serverAddress}`)
if (auth === AuthType.Password && !process.env.PASSWORD) {
logger.info(` - Password is ${originalPassword}`)
@@ -105,19 +104,29 @@ const main = async (args: Args): Promise<void> => {
logger.info(" - Not serving HTTPS")
}
logger.info(` - Automatic updates are ${update.enabled ? "enabled" : "disabled"}`)
logger.info(`Automatic updates are ${update.enabled ? "enabled" : "disabled"}`)
if (sshPort) {
logger.info(` - SSH Server - Listening :${sshPort}`)
let sshPort: number | undefined
if (!args["disable-ssh"] && options.sshHostKey) {
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
try {
sshPort = await sshProvider.listen()
} catch (error) {
logger.warn(`SSH server: ${error.message}`)
}
}
if (typeof sshPort !== "undefined") {
logger.info(`SSH server listening on localhost:${sshPort}`)
} else {
logger.info(" - SSH Server - Disabled")
logger.info("SSH server disabled")
}
if (serverAddress && !options.socket && args.open) {
// The web socket doesn't seem to work if browsing with 0.0.0.0.
const openAddress = serverAddress.replace(/:\/\/0.0.0.0/, "://localhost")
await open(openAddress).catch(console.error)
logger.info(` - Opened ${openAddress}`)
logger.info(`Opened ${openAddress}`)
}
}
@@ -132,7 +141,7 @@ const tryParse = (): Args => {
const args = tryParse()
if (args.help) {
console.log("code-server", require("../../package.json").version)
console.log("code-server", version, commit)
console.log("")
console.log(`Usage: code-server [options] [path]`)
console.log("")
@@ -141,14 +150,14 @@ if (args.help) {
console.log("", description)
})
} else if (args.version) {
const version = require("../../package.json").version
if (args.json) {
console.log({
codeServer: version,
commit,
vscode: require("../../lib/vscode/package.json").version,
})
} else {
console.log(version)
console.log(version, commit)
}
process.exit(0)
} else if (args["list-extensions"] || args["install-extension"] || args["uninstall-extension"]) {

View File

@@ -24,11 +24,11 @@ export class SshProvider extends HttpProvider {
})
}
public async listen(): Promise<string> {
public async listen(): Promise<number> {
return new Promise((resolve, reject) => {
this.sshServer.once("error", reject)
this.sshServer.listen(() => {
resolve(this.sshServer.address().port.toString())
resolve(this.sshServer.address().port)
})
})
}