Skip to content

Commit 908d293

Browse files
committed
Merge branch 'master' into satlus-nonrootuser
2 parents 09c5556 + bcdbd90 commit 908d293

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+3823
-1475
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ doc/
77
.travis.yml
88
LICENSE
99
README.md
10+
node_modules

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ dist
44
out
55
.DS_Store
66
release
7-
.cache
7+
.vscode
8+
.cache

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.15.0
1+
10.15.1

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: node_js
22
node_js:
3-
- 8.15.0
3+
- 10.15.1
44
env:
5-
- VSCODE_VERSION="1.32.0" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
5+
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
66
matrix:
77
include:
88
- os: linux

Dockerfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:8.15.0
1+
FROM node:10.15.1
22

33
# Install VS Code's deps. These are the only two it seems we need.
44
RUN apt-get update && apt-get install -y \
@@ -24,23 +24,32 @@ RUN apt-get update && apt-get install -y \
2424
git \
2525
locales \
2626
sudo \
27-
dumb-init
27+
dumb-init \
28+
vim \
29+
curl \
30+
wget
2831

2932
RUN locale-gen en_US.UTF-8
3033
# We unfortunately cannot use update-locale because docker will not use the env variables
3134
# configured in /etc/default/locale so we need to set it manually.
3235
ENV LC_ALL=en_US.UTF-8
3336

34-
RUN adduser --gecos '' --disabled-password coder
35-
RUN echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
37+
RUN adduser --gecos '' --disabled-password coder && \
38+
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
3639

3740
USER coder
3841
COPY entrypoint.sh /home/coder/project/
3942

4043
# We create first instead of just using WORKDIR as when WORKDIR creates, the user is root.
41-
RUN mkdir -p /home/coder/project
44+
RUN mkdir -p /home/coder/project && \
45+
chmod g+rw /home/coder/project;
46+
4247
WORKDIR /home/coder/project
4348

49+
# This assures we have a volume mounted even if the user forgot to do bind mount.
50+
# XXX: Workaround for GH-459 and for OpenShift compatibility.
51+
VOLUME [ "/home/coder/project" ]
52+
4453
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
4554
EXPOSE 8443
4655

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
Try it out:
1111
```bash
12-
docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/code-server:1.621 --allow-http --no-auth
12+
docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/code-server --allow-http --no-auth
1313
```
1414

1515
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
@@ -23,9 +23,9 @@ docker run -it -p 127.0.0.1:8443:8443 -v "${PWD}:/home/coder/project" codercom/c
2323

2424
## Getting Started
2525

26-
### Hosted
26+
### Run over SSH
2727

28-
[Try `code-server` now](https://coder.com/signup) for free at coder.com.
28+
Use [sshcode](https://github.com/codercom/sshcode) for a simple setup.
2929

3030
### Docker
3131

@@ -67,6 +67,12 @@ How to [secure your setup](/doc/security/ssl.md).
6767
6868
At the moment we can't use the official VSCode Marketplace. We've created a custom extension marketplace focused around open-sourced extensions. However, if you have access to the `.vsix` file, you can manually install the extension.
6969
70+
## Telemetry
71+
72+
Use the `--disable-telemetry` flag or set `DISABLE_TELEMETRY=true` to disable tracking ENTIRELY.
73+
74+
We use data collected to improve code-server.
75+
7076
## Contributing
7177
7278
Development guides are coming soon.

build/tasks.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const libPath = path.join(__dirname, "../lib");
1212
const vscodePath = path.join(libPath, "vscode");
1313
const defaultExtensionsPath = path.join(libPath, "extensions");
1414
const pkgsPath = path.join(__dirname, "../packages");
15-
const vscodeVersion = process.env.VSCODE_VERSION || "1.32.0";
15+
const vscodeVersion = process.env.VSCODE_VERSION || "1.33.1";
1616
const vsSourceUrl = `https://codesrv-ci.cdr.sh/vstar-${vscodeVersion}.tar.gz`;
1717

1818
const buildServerBinary = register("build:server:binary", async (runner) => {
@@ -48,19 +48,11 @@ const buildServerBinaryCopy = register("build:server:binary:copy", async (runner
4848
const bootstrapForkPath = path.join(pkgsPath, "vscode", "out", "bootstrap-fork.js");
4949
const webOutputPath = path.join(pkgsPath, "web", "out");
5050
const browserAppOutputPath = path.join(pkgsPath, "app", "browser", "out");
51-
const nodePtyModule = path.join(pkgsPath, "protocol", "node_modules", "node-pty-prebuilt", "build", "Release", "pty.node");
52-
const spdlogModule = path.join(pkgsPath, "protocol", "node_modules", "spdlog", "build", "Release", "spdlog.node");
5351
let ripgrepPath = path.join(pkgsPath, "..", "lib", "vscode", "node_modules", "vscode-ripgrep", "bin", "rg");
5452
if (isWin) {
5553
ripgrepPath += ".exe";
5654
}
5755

58-
if (!fs.existsSync(nodePtyModule)) {
59-
throw new Error("Could not find pty.node. Ensure all packages have been installed");
60-
}
61-
if (!fs.existsSync(spdlogModule)) {
62-
throw new Error("Could not find spdlog.node. Ensure all packages have been installed");
63-
}
6456
if (!fs.existsSync(webOutputPath)) {
6557
throw new Error("Web bundle must be built");
6658
}
@@ -75,24 +67,22 @@ const buildServerBinaryCopy = register("build:server:binary:copy", async (runner
7567
}
7668
fse.copySync(defaultExtensionsPath, path.join(cliBuildPath, "extensions"));
7769
fs.writeFileSync(path.join(cliBuildPath, "bootstrap-fork.js.gz"), zlib.gzipSync(fs.readFileSync(bootstrapForkPath)));
78-
const cpDir = (dir: string, subdir: "auth" | "unauth", rootPath: string): void => {
70+
const cpDir = (dir: string, rootPath: string, subdir?: "login"): void => {
7971
const stat = fs.statSync(dir);
8072
if (stat.isDirectory()) {
8173
const paths = fs.readdirSync(dir);
82-
paths.forEach((p) => cpDir(path.join(dir, p), subdir, rootPath));
74+
paths.forEach((p) => cpDir(path.join(dir, p), rootPath, subdir));
8375
} else if (stat.isFile()) {
84-
const newPath = path.join(cliBuildPath, "web", subdir, path.relative(rootPath, dir));
76+
const newPath = path.join(cliBuildPath, "web", subdir || "", path.relative(rootPath, dir));
8577
fse.mkdirpSync(path.dirname(newPath));
8678
fs.writeFileSync(newPath + ".gz", zlib.gzipSync(fs.readFileSync(dir)));
8779
} else {
8880
// Nothing
8981
}
9082
};
91-
cpDir(webOutputPath, "auth", webOutputPath);
92-
cpDir(browserAppOutputPath, "unauth", browserAppOutputPath);
83+
cpDir(webOutputPath, webOutputPath);
84+
cpDir(browserAppOutputPath, browserAppOutputPath, "login");
9385
fse.mkdirpSync(path.join(cliBuildPath, "dependencies"));
94-
fse.copySync(nodePtyModule, path.join(cliBuildPath, "dependencies", "pty.node"));
95-
fse.copySync(spdlogModule, path.join(cliBuildPath, "dependencies", "spdlog.node"));
9686
fse.copySync(ripgrepPath, path.join(cliBuildPath, "dependencies", "rg"));
9787
});
9888

@@ -204,9 +194,9 @@ register("package", async (runner, releaseTag) => {
204194
});
205195

206196
runner.cwd = releasePath;
207-
await os.platform() === "linux"
197+
await (os.platform() === "linux"
208198
? runner.execute("tar", ["-cvzf", `${archiveName}.tar.gz`, `${archiveName}`])
209-
: runner.execute("zip", ["-r", `${archiveName}.zip`, `${archiveName}`]);
199+
: runner.execute("zip", ["-r", `${archiveName}.zip`, `${archiveName}`]));
210200
});
211201

212202
run();

doc/admin/install/digitalocean.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ If you're just starting out, we recommend [installing code-server locally](../..
3939
> To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md)
4040
- Finally start the code-server
4141
```
42-
sudo ./code-server-linux -p 80
42+
sudo ./code-server -p 80
4343
```
4444
> For instructions on how to keep the server running after you end your SSH session please checkout [how to use systemd](https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/) to start linux based services if they are killed
4545
- When you visit the public IP for your Digital Ocean instance, you will be greeted with this page. Code-server is using a self-signed SSL certificate for easy setup. To proceed to the IDE, click **"Advanced"**<img src ="../../assets/chrome_warning.png">

doc/self-hosted/index.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,40 +34,44 @@ It takes just a few minutes to get your own self-hosted server running. If you'v
3434
code-server can be ran with a number of arguments to customize your working directory, host, port, and SSL certificate.
3535

3636
```
37-
USAGE
38-
$ code-server [WORKDIR]
39-
40-
ARGUMENTS
41-
WORKDIR [default: (directory to binary)] Specify working dir
42-
43-
OPTIONS
44-
-d, --data-dir=data-dir
45-
-h, --host=host [default: 0.0.0.0]
46-
-o, --open Open in browser on startup
47-
-p, --port=port [default: 8443] Port to bind on
48-
-v, --version show CLI version
49-
--allow-http
50-
--cert=cert
51-
--cert-key=cert-key
52-
--help show CLI help
53-
--no-auth
54-
--password=password
37+
Usage: code-server [options]
38+
39+
Run VS Code on a remote server.
40+
41+
Options:
42+
-V, --version output the version number
43+
--cert <value>
44+
--cert-key <value>
45+
-e, --extensions-dir <dir> Set the root path for extensions.
46+
-d --user-data-dir <dir> Specifies the directory that user data is kept in, useful when running as root.
47+
--data-dir <value> DEPRECATED: Use '--user-data-dir' instead. Customize where user-data is stored.
48+
-h, --host <value> Customize the hostname. (default: "0.0.0.0")
49+
-o, --open Open in the browser on startup.
50+
-p, --port <number> Port to bind on. (default: 8443)
51+
-N, --no-auth Start without requiring authentication.
52+
-H, --allow-http Allow http connections.
53+
-P, --password <value> Specify a password for authentication.
54+
--disable-telemetry Disables ALL telemetry.
55+
--help output usage information
5556
```
5657

5758
### Data Directory
58-
Use `code-server -d (path/to/directory)` or `code-server --data-dir=(path/to/directory)`, excluding the parentheses to specify the root folder that VS Code will start in
59+
Use `code-server -d (path/to/directory)` or `code-server --data-dir=(path/to/directory)`, excluding the parentheses to specify the root folder that VS Code will start in.
5960

6061
### Host
6162
By default, code-server will use `0.0.0.0` as its address. This can be changed by using `code-server -h` or `code-server --host=` followed by the address you want to use.
6263
> Example: `code-server -h 127.0.0.1`
6364
6465
### Open
65-
You can have the server automatically open the VS Code in your browser on startup by using the `code server -o` or `code-server --open` flags
66+
You can have the server automatically open the VS Code in your browser on startup by using the `code-server -o` or `code-server --open` flags
6667

6768
### Port
6869
By default, code-server will use `8443` as its port. This can be changed by using `code-server -p` or `code-server --port=` followed by the port you want to use.
6970
> Example: `code-server -p 9000`
7071
72+
### Telemetry
73+
Disable all telemetry with `code-server --disable-telemetry`.
74+
7175
### Cert and Cert Key
7276
To encrypt the traffic between the browser and server use `code-server --cert=` followed by the path to your `.cer` file. Additionally, you can use certificate keys with `code-server --cert-key` followed by the path to your `.key` file.
7377
> Example (certificate and key): `code-server --cert /etc/letsencrypt/live/example.com/fullchain.cer --cert-key /etc/letsencrypt/live/example.com/fullchain.key`
@@ -116,4 +120,4 @@ OPTIONS
116120
*Important:* For more details about Apache reverse proxy configuration checkout the [documentation](https://httpd.apache.org/docs/current/mod/mod_proxy.html) - especially the [Securing your Server](https://httpd.apache.org/docs/current/mod/mod_proxy.html#access) section
117121

118122
### Help
119-
Use `code-server -h` or `code-server --help` to view the usage for the cli. This is also shown at the beginning of this section.
123+
Use `code-server --help` to view the usage for the CLI. This is also shown at the beginning of this section.

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,17 @@
5454
"webpack-dev-middleware": "^3.5.0",
5555
"webpack-dev-server": "^3.1.14",
5656
"webpack-hot-middleware": "^2.24.3",
57+
"webpack-pwa-manifest": "^4.0.0",
58+
"workbox-webpack-plugin": "^4.1.0",
5759
"write-file-webpack-plugin": "^4.5.0"
5860
},
61+
"resolutions": {
62+
"bindings": "1.3.0"
63+
},
5964
"dependencies": {
6065
"node-loader": "^0.6.0",
66+
"node-pty": "0.8.1",
67+
"spdlog": "0.8.1",
6168
"webpack-merge": "^4.2.1"
6269
}
6370
}

packages/app/browser/src/app.html

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,24 @@
77
</head>
88

99
<body>
10-
<div class="login">
11-
<div class="back"> <- Back </div>
12-
<h4 class="title">code-server</h4>
13-
<h2 class="subtitle">
14-
Enter server password
15-
</h2>
16-
<div class="mdc-text-field">
17-
<input type="password" id="password" class="mdc-text-field__input" required>
18-
<label class="mdc-floating-label" for="password">Password</label>
19-
<div class="mdc-line-ripple"></div>
20-
</div>
21-
<button id="submit" class="mdc-button mdc-button--unelevated">
22-
<span class="mdc-button__label">Enter IDE</span>
23-
</button>
24-
<div id="error-display"></div>
25-
</div>
10+
<form id="login-form">
11+
<div class="login">
12+
<div class="back">
13+
<- Back </div> <h4 class="title">code-server</h4>
14+
<h2 class="subtitle">
15+
Enter server password
16+
</h2>
17+
<div class="mdc-text-field">
18+
<input type="password" id="password" class="mdc-text-field__input" required>
19+
<label class="mdc-floating-label" for="password">Password</label>
20+
<div class="mdc-line-ripple"></div>
21+
</div>
22+
<button id="submit" class="mdc-button mdc-button--unelevated">
23+
<span class="mdc-button__label">Enter IDE</span>
24+
</button>
25+
<div id="error-display"></div>
26+
</div>
27+
</form>
2628
</body>
2729

2830
</html>

packages/app/browser/src/app.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@ window.addEventListener("message", (event) => {
2020
});
2121

2222
const password = document.getElementById("password") as HTMLInputElement;
23-
const submit = document.getElementById("submit") as HTMLButtonElement;
24-
if (!submit) {
25-
throw new Error("No submit button found");
23+
const form = document.getElementById("login-form") as HTMLFormElement;
24+
25+
if (!form) {
26+
throw new Error("No password form found");
2627
}
27-
submit.addEventListener("click", () => {
28-
document.cookie = `password=${password.value}`;
28+
29+
form.addEventListener("submit", (e) => {
30+
e.preventDefault();
31+
document.cookie = `password=${password.value}; `
32+
+ `path=${location.pathname.replace(/\/login\/?$/, "/")}; `
33+
+ `domain=${location.hostname}`;
2934
location.reload();
3035
});
3136

@@ -38,4 +43,4 @@ const errorDisplay = document.getElementById("error-display") as HTMLDivElement;
3843

3944
if (document.referrer === document.location.href && matches) {
4045
errorDisplay.innerText = "Password is incorrect!";
41-
}
46+
}

packages/app/browser/webpack.config.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ const root = path.resolve(__dirname, "../../..");
77

88
module.exports = merge(
99
require(path.join(root, "scripts/webpack.client.config.js"))({
10-
entry: path.join(root, "packages/app/browser/src/app.ts"),
11-
template: path.join(root, "packages/app/browser/src/app.html"),
10+
dirname: __dirname,
11+
entry: path.join(__dirname, "src/app.ts"),
12+
name: "login",
13+
template: path.join(__dirname, "src/app.html"),
1214
}), {
13-
output: {
14-
path: path.join(__dirname, "out"),
15-
},
1615
},
1716
);

packages/dns/webpack.config.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ const root = path.resolve(__dirname, "../..");
55

66
module.exports = merge(
77
require(path.join(root, "scripts/webpack.node.config.js"))({
8-
// Options.
8+
dirname: __dirname,
9+
name: "dns",
910
}), {
1011
externals: {
1112
"node-named": "commonjs node-named",
1213
},
13-
output: {
14-
path: path.join(__dirname, "out"),
15-
filename: "main.js",
16-
},
1714
entry: [
1815
"./packages/dns/src/dns.ts"
1916
],

packages/ide-api/api.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,17 @@ interface ICommandRegistry {
136136
registerCommand(command: ICommand): IDisposable;
137137
}
138138

139+
interface IStorageService {
140+
save(): Promise<void>;
141+
}
142+
139143
declare namespace ide {
140144
export const client: {};
141145

142146
export const workbench: {
143147
readonly statusbarService: IStatusbarService;
144148
readonly notificationService: INotificationService;
149+
readonly storageService: IStorageService;
145150
readonly menuRegistry: IMenuRegistry;
146151
readonly commandRegistry: ICommandRegistry;
147152

0 commit comments

Comments
 (0)