Skip to content

Commit b405497

Browse files
author
Hikari Kibo
authored
Merge branch 'master' into docker-user
2 parents b5e0a66 + 0efae1f commit b405497

32 files changed

+664
-319
lines changed

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,4 @@ USER coder
4040
WORKDIR /home/coder
4141

4242
EXPOSE 8443
43-
ENTRYPOINT code-server
44-
CMD ["."]
43+
ENTRYPOINT ["code-server"]

build/tasks.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const libPath = path.join(__dirname, "../lib");
1010
const vscodePath = path.join(libPath, "vscode");
1111
const pkgsPath = path.join(__dirname, "../packages");
1212
const defaultExtensionsPath = path.join(libPath, "VSCode-linux-x64/resources/app/extensions");
13-
const vscodeVersion = "1.32";
13+
const vscodeVersion = "1.32.0";
1414

1515
const buildServerBinary = register("build:server:binary", async (runner) => {
1616
await ensureInstalled();
@@ -220,11 +220,17 @@ const ensureCloned = register("vscode:clone", async (runner) => {
220220
} else {
221221
fse.mkdirpSync(libPath);
222222
runner.cwd = libPath;
223-
const clone = await runner.execute("git", ["clone", "https://github.com/microsoft/vscode", "--branch", `release/${vscodeVersion}`, "--single-branch", "--depth=1"]);
223+
const clone = await runner.execute("git", ["clone", "https://github.com/microsoft/vscode", "--branch", vscodeVersion, "--single-branch", "--depth=1"]);
224224
if (clone.exitCode !== 0) {
225225
throw new Error(`Failed to clone: ${clone.exitCode}`);
226226
}
227227
}
228+
229+
runner.cwd = vscodePath;
230+
const checkout = await runner.execute("git", ["checkout", vscodeVersion]);
231+
if (checkout.exitCode !== 0) {
232+
throw new Error(`Failed to checkout: ${checkout.stderr}`);
233+
}
228234
});
229235

230236
const ensureClean = register("vscode:clean", async (runner) => {

doc/admin/install/aws.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If you're just starting out, we recommend [installing code-server locally](../..
2828
- In the description of your EC2 instance copy the public DNS (iPv4) address using the copy to clipboard button
2929
- Open a terminal on your computer and use the following command to SSH into your EC2 instance
3030
```
31-
ssh i "path/to/your/keypair.pem" ubuntu@(paste the public DNS here)
31+
ssh -i "path/to/your/keypair.pem" ubuntu@(paste the public DNS here)
3232
```
3333
>example: `ssh -i "/Users/John/Downloads/TestInstance.pem" ubuntu@ec2-3-45-678-910.compute-1.amazonaws.co`
3434
- You should see a prompt for your EC2 instance like so<img src="../../assets/aws_ubuntu.png">
@@ -54,4 +54,4 @@ If you're just starting out, we recommend [installing code-server locally](../..
5454
> The `-p 80` flag is necessary in order to make the IDE accessible from the public IP of your instance (also available from the description in the instances page.
5555
5656
---
57-
> NOTE: If you get stuck or need help, [file an issue](https://github.com/codercom/code-server/issues/new?&title=Improve+self-hosted+quickstart+guide), [tweet (@coderhq)](https://twitter.com/coderhq) or [email](mailto:support@coder.com?subject=Self-hosted%20quickstart%20guide).
57+
> NOTE: If you get stuck or need help, [file an issue](https://github.com/codercom/code-server/issues/new?&title=Improve+self-hosted+quickstart+guide), [tweet (@coderhq)](https://twitter.com/coderhq) or [email](mailto:support@coder.com?subject=Self-hosted%20quickstart%20guide).

doc/security/ssl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generate a self-signed certificate 🔒
22

3-
code-server has the ability to secure your connection between client and server using SSL/TSL certificates. By default, the server will start with an unencrypted connection. We recommend Self-signed TLS/SSL certificates for personal of code-server or within an organization.
3+
code-server has the ability to secure your connection between client and server using SSL/TSL certificates. By default, the server will start with an unencrypted connection. We recommend Self-signed TLS/SSL certificates for personal use of code-server or within an organization.
44

55
This guide will show you how to create a self-signed certificate and start code-server using your certificate/key.
66

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
},
5252
"dependencies": {
5353
"node-loader": "^0.6.0",
54-
"trash": "^4.3.0",
5554
"webpack-merge": "^4.2.1"
5655
}
5756
}

packages/app/browser/src/app.html

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,20 @@
88

99
<body>
1010
<div class="login">
11-
<div class="back">
12-
<- Back </div>
13-
<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>
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>
2520
</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>
2625
</div>
2726
</body>
2827

packages/app/browser/src/app.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,16 @@ body {
106106

107107
// transition: 500ms opacity ease;
108108
}
109+
110+
#error-display {
111+
box-sizing: border-box;
112+
color: #bb2d0f;
113+
font-size: 14px;
114+
font-weight: 400;
115+
letter-spacing: 0.3px;
116+
line-height: 12px;
117+
padding: 8px;
118+
padding-bottom: 0;
119+
padding-top: 20px;
120+
text-align: center;
121+
}

packages/app/browser/src/app.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,14 @@ submit.addEventListener("click", () => {
2828
document.cookie = `password=${password.value}`;
2929
location.reload();
3030
});
31+
32+
/**
33+
* Notify user on load of page if previous password was unsuccessful
34+
*/
35+
const reg = new RegExp(`password=(\\w+);?`);
36+
const matches = document.cookie.match(reg);
37+
const errorDisplay = document.getElementById("error-display") as HTMLDivElement;
38+
39+
if (document.referrer === document.location.href && matches) {
40+
errorDisplay.innerText = "Password is incorrect!";
41+
}

packages/ide-api/api.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,19 @@ declare namespace ide {
158158
readonly notificationService: INotificationService;
159159
readonly menuRegistry: IMenuRegistry;
160160
readonly commandRegistry: ICommandRegistry;
161+
162+
onFileCreate(cb: (path: string) => void): void;
163+
onFileMove(cb: (path: string, target: string) => void): void;
164+
onFileDelete(cb: (path: string) => void): void;
165+
onFileSaved(cb: (path: string) => void): void;
166+
onFileCopy(cb: (path: string, target: string) => void): void;
167+
168+
onModelAdded(cb: (path: string, languageId: string) => void): void;
169+
onModelRemoved(cb: (path: string, languageId: string) => void): void;
170+
onModelLanguageChange(cb: (path: string, languageId: string, oldLanguageId: string) => void): void;
171+
172+
onTerminalAdded(cb: () => void): void;
173+
onTerminalRemoved(cb: () => void): void;
161174
};
162175

163176
export enum Severity {

packages/ide-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coder/ide-api",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"typings": "api.d.ts",
55
"author": "Coder",
66
"license": "MIT",

packages/ide/src/fill/dialog.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
background: #141414;
2020
border: none;
2121
box-sizing: border-box;
22-
margin-bottom: 25px;
2322
padding: 10px;
2423
width: 100%;
2524
}
@@ -31,11 +30,11 @@
3130

3231
.msgbox > .detail {
3332
font-size: 14px;
34-
margin-top: 5px;
33+
margin: 5px 0;
3534
}
3635

3736
.msgbox > .errors {
38-
margin-bottom: 25px;
37+
margin-top: 20px;
3938
}
4039

4140
.msgbox > .errors {
@@ -46,6 +45,7 @@
4645
display: flex;
4746
flex-direction: row;
4847
justify-content: space-between;
48+
margin-top: 20px;
4949
}
5050

5151
.msgbox > .button-wrapper > button {

packages/ide/src/fill/dialog.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,31 @@ export class Dialog {
3131
private input: HTMLInputElement | undefined;
3232
private errors: HTMLElement;
3333
private buttons: HTMLElement[] | undefined;
34+
private readonly msgBox: HTMLElement;
3435

3536
private actionEmitter = new Emitter<IDialogAction>();
3637
public onAction = this.actionEmitter.event;
3738

3839
public constructor(private readonly options: IDialogOptions) {
39-
const msgBox = document.createElement("div");
40-
msgBox.classList.add("msgbox");
40+
this.msgBox = document.createElement("div");
41+
this.msgBox.classList.add("msgbox");
4142

4243
if (this.options.message) {
4344
const messageDiv = document.createElement("div");
4445
messageDiv.classList.add("msg");
4546
messageDiv.innerText = this.options.message;
46-
msgBox.appendChild(messageDiv);
47+
this.msgBox.appendChild(messageDiv);
4748
}
4849

4950
if (this.options.detail) {
5051
const detailDiv = document.createElement("div");
5152
detailDiv.classList.add("detail");
5253
detailDiv.innerText = this.options.detail;
53-
msgBox.appendChild(detailDiv);
54+
this.msgBox.appendChild(detailDiv);
5455
}
5556

5657
if (this.options.input) {
57-
msgBox.classList.add("input");
58+
this.msgBox.classList.add("input");
5859
this.input = document.createElement("input");
5960
this.input.classList.add("input");
6061
this.input.value = this.options.input.value;
@@ -67,12 +68,11 @@ export class Dialog {
6768
});
6869
}
6970
});
70-
msgBox.appendChild(this.input);
71+
this.msgBox.appendChild(this.input);
7172
}
7273

7374
this.errors = document.createElement("div");
7475
this.errors.classList.add("errors");
75-
msgBox.appendChild(this.errors);
7676

7777
if (this.options.buttons && this.options.buttons.length > 0) {
7878
this.buttons = this.options.buttons.map((buttonText, buttonIndex) => {
@@ -92,12 +92,12 @@ export class Dialog {
9292
const buttonWrapper = document.createElement("div");
9393
buttonWrapper.classList.add("button-wrapper");
9494
this.buttons.forEach((b) => buttonWrapper.appendChild(b));
95-
msgBox.appendChild(buttonWrapper);
95+
this.msgBox.appendChild(buttonWrapper);
9696
}
9797

9898
this.overlay = document.createElement("div");
9999
this.overlay.className = "msgbox-overlay";
100-
this.overlay.appendChild(msgBox);
100+
this.overlay.appendChild(this.msgBox);
101101

102102
setTimeout(() => {
103103
this.overlay.style.opacity = "1";
@@ -122,6 +122,7 @@ export class Dialog {
122122
const errorDiv = document.createElement("error");
123123
errorDiv.innerText = error;
124124
this.errors.appendChild(errorDiv);
125+
this.msgBox.appendChild(this.errors);
125126
}
126127
}
127128

@@ -131,7 +132,7 @@ export class Dialog {
131132
public show(): void {
132133
if (!this.cachedActiveElement) {
133134
this.cachedActiveElement = document.activeElement as HTMLElement;
134-
document.body.appendChild(this.overlay);
135+
(document.getElementById("workbench.main.container") || document.body).appendChild(this.overlay);
135136
document.addEventListener("keydown", this.onKeydown);
136137
if (this.input) {
137138
this.input.focus();

packages/ide/src/fill/electron.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ const newCreateElement = <K extends keyof HTMLElementTagNameMap>(tagName: K): HT
141141
// TODO
142142
args[0].contents = (args[0].contents as string).replace(/"(file:\/\/[^"]*)"/g, (m1) => `"/resource${m1}"`);
143143
args[0].contents = (args[0].contents as string).replace(/"vscode-resource:([^"]*)"/g, (m, m1) => `"/resource${m1}"`);
144+
args[0].contents = (args[0].contents as string).replace(/style-src vscode-core-resource:/g, "style-src 'self'");
144145
}
145146
if (view.contentWindow) {
146147
view.contentWindow.postMessage({
@@ -179,10 +180,8 @@ class Clipboard {
179180

180181
class Shell {
181182
public async moveItemToTrash(path: string): Promise<void> {
182-
await client.evaluate((_helper, path) => {
183-
const trash = __non_webpack_require__("trash") as typeof import("trash");
184-
185-
return trash(path);
183+
await client.evaluate((helper, path) => {
184+
return helper.modules.trash(path);
186185
}, path);
187186
}
188187
}

packages/protocol/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"google-protobuf": "^3.6.1",
77
"node-pty-prebuilt": "^0.7.6",
88
"spdlog": "^0.7.2",
9+
"trash": "^4.3.0",
910
"tslib": "^1.9.3",
1011
"ws": "^6.1.2"
1112
},

packages/protocol/src/common/helpers.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference path="../../../../lib/vscode/src/typings/spdlog.d.ts" />
2+
/// <reference path="../../node_modules/node-pty-prebuilt/typings/node-pty.d.ts" />
23
import { ChildProcess, SpawnOptions, ForkOptions } from "child_process";
34
import { EventEmitter } from "events";
45
import { Socket } from "net";
@@ -20,22 +21,25 @@ interface ActiveEvalEmitter {
2021
on(event: string, cb: (...args: any[]) => void): void;
2122
}
2223

24+
/**
25+
* For any non-external modules that are not built in, we need to require and
26+
* access them server-side. A require on the client-side won't work since that
27+
* code won't exist on the server (and bloat the client with an unused import),
28+
* and we can't manually import on the server-side and then call
29+
* `__webpack_require__` on the client-side because Webpack stores modules by
30+
* their paths which would require us to hard-code the path.
31+
*/
32+
export interface Modules {
33+
pty: typeof import("node-pty");
34+
spdlog: typeof import("spdlog");
35+
trash: typeof import("trash");
36+
}
37+
2338
/**
2439
* Helper class for server-side evaluations.
2540
*/
2641
export class EvalHelper {
27-
// For any non-external modules that are not built in, we need to require and
28-
// access them here. A require on the client-side won't work since that code
29-
// won't exist on the server (and bloat the client with an unused import), and
30-
// we can't manually import on the server-side and then call
31-
// `__webpack_require__` on the client-side because Webpack stores modules by
32-
// their paths which would require us to hard-code the path. These aren't
33-
// required immediately so we have a chance to unpack the .node files and set
34-
// their locations.
35-
public modules = {
36-
spdlog: require("spdlog") as typeof import("spdlog"),
37-
pty: require("node-pty-prebuilt") as typeof import("node-pty"),
38-
};
42+
public constructor(public modules: Modules) {}
3943

4044
/**
4145
* Some spawn code tries to preserve the env (the debug adapter for instance)
@@ -113,11 +117,11 @@ export class ActiveEvalHelper implements ActiveEvalEmitter {
113117
* Helper class for server-side active evaluations.
114118
*/
115119
export class ServerActiveEvalHelper extends ActiveEvalHelper implements EvalHelper {
116-
private readonly evalHelper = new EvalHelper();
117-
public modules = this.evalHelper.modules;
120+
private readonly evalHelper: EvalHelper;
118121

119-
public constructor(emitter: ActiveEvalEmitter, public readonly fork: ForkProvider) {
122+
public constructor(public modules: Modules, emitter: ActiveEvalEmitter, public readonly fork: ForkProvider) {
120123
super(emitter);
124+
this.evalHelper = new EvalHelper(modules);
121125
}
122126

123127
public preserveEnv(options: SpawnOptions | ForkOptions): void {
@@ -208,7 +212,7 @@ export class ServerActiveEvalHelper extends ActiveEvalHelper implements EvalHelp
208212
}
209213

210214
public createUnique(id: number | "stdout" | "stderr" | "stdin"): ServerActiveEvalHelper {
211-
return new ServerActiveEvalHelper(this.createUniqueEmitter(id), this.fork);
215+
return new ServerActiveEvalHelper(this.modules, this.createUniqueEmitter(id), this.fork);
212216
}
213217
}
214218

0 commit comments

Comments
 (0)