Skip to content

Commit 01a63a7

Browse files
committed
Merge branch 'master' of github.com:codercom/code-server
2 parents a2e0638 + 4e62f93 commit 01a63a7

File tree

6 files changed

+48
-10
lines changed

6 files changed

+48
-10
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ See docker oneliner mentioned above. Dockerfile is at [/Dockerfile](/Dockerfile)
4646
4747
For detailed instructions and troubleshooting, see the [self-hosted quick start guide](doc/self-hosted/index.md).
4848
49-
Quickstart guides for [Google Cloud](doc/admin/install/google_cloud.md), [AWS](doc/admin/install/aws.md), and [Digital Ocean](doc/admin/install/digitalocean.md).
49+
Quickstart guides for [Google Cloud](doc/admin/install/google_cloud.md), [AWS](doc/admin/install/aws.md), and [DigitalOcean](doc/admin/install/digitalocean.md).
5050
5151
How to [secure your setup](/doc/security/ssl.md).
5252

packages/ide/src/fill/electron.ts

+20-3
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,31 @@ class BrowserWindow extends EventEmitter {
378378

379379
public setFullScreen(fullscreen: boolean): void {
380380
if (fullscreen) {
381-
document.documentElement.requestFullscreen();
381+
document.documentElement.requestFullscreen().catch((error) => {
382+
logger.error(error.message);
383+
});
382384
} else {
383-
document.exitFullscreen();
385+
document.exitFullscreen().catch((error) => {
386+
logger.error(error.message);
387+
});
384388
}
385389
}
386390

387391
public isFullScreen(): boolean {
388-
return document.fullscreenEnabled;
392+
// TypeScript doesn't recognize this property.
393+
// tslint:disable no-any
394+
if (typeof (window as any)["fullScreen"] !== "undefined") {
395+
return (window as any)["fullScreen"];
396+
}
397+
// tslint:enable no-any
398+
399+
try {
400+
return window.matchMedia("(display-mode: fullscreen)").matches;
401+
} catch (error) {
402+
logger.error(error.message);
403+
404+
return false;
405+
}
389406
}
390407

391408
public isFocused(): boolean {

packages/server/src/cli.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ const bold = (text: string | number): string | number => {
216216
}
217217

218218
let password = options.password || process.env.PASSWORD;
219+
const usingCustomPassword = !!password;
219220
if (!password) {
220221
// Generate a random password with a length of 24.
221222
const buffer = Buffer.alloc(12);
@@ -304,7 +305,7 @@ const bold = (text: string | number): string | number => {
304305
logger.warn("Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md");
305306
}
306307

307-
if (!options.noAuth) {
308+
if (!options.noAuth && !usingCustomPassword) {
308309
logger.info(" ");
309310
logger.info(`Password:\u001B[1m ${password}`);
310311
} else {

packages/vscode/src/dialog.scss

+9-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@
7979
.dialog-entry {
8080
cursor: pointer;
8181
font-size: 1.02em;
82-
padding: 0px;
83-
padding-left: 8px;
84-
padding-right: 8px;
82+
padding: 0px 8px;
8583

8684
.dialog-entry-info {
8785
display: flex;
@@ -94,6 +92,14 @@
9492
margin-right: 5px;
9593
}
9694

95+
.dialog-entry-size {
96+
text-align: right;
97+
}
98+
99+
.dialog-entry-mtime {
100+
padding-left: 8px;
101+
}
102+
97103
&:hover {
98104
background-color: var(--list-hover-background);
99105
}

packages/vscode/src/dialog.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ class Dialog {
404404
*/
405405
private async list(directory: string): Promise<ReadonlyArray<DialogEntry>> {
406406
const paths = (await util.promisify(fs.readdir)(directory)).sort();
407-
const stats = await Promise.all(paths.map(p => util.promisify(fs.stat)(path.join(directory, p))));
407+
const stats = await Promise.all(paths.map(p => util.promisify(fs.lstat)(path.join(directory, p))));
408408

409409
return stats.map((stat, index): DialogEntry => ({
410410
fullPath: path.join(directory, paths[index]),
@@ -480,7 +480,7 @@ class DialogEntryRenderer implements ITreeRenderer<DialogEntry, string, DialogEn
480480
start: 0,
481481
end: node.filterData.length,
482482
}] : []);
483-
templateData.size.innerText = node.element.size.toString();
483+
templateData.size.innerText = !node.element.isDirectory ? this.humanReadableSize(node.element.size) : "";
484484
templateData.lastModified.innerText = node.element.lastModified;
485485

486486
// We know this exists because we created the template.
@@ -498,4 +498,16 @@ class DialogEntryRenderer implements ITreeRenderer<DialogEntry, string, DialogEn
498498
public disposeTemplate(_templateData: DialogEntryData): void {
499499
// throw new Error("Method not implemented.");
500500
}
501+
502+
/**
503+
* Given a positive size in bytes, return a string that is more readable for
504+
* humans.
505+
*/
506+
private humanReadableSize(bytes: number): string {
507+
const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
508+
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1000)), units.length - 1);
509+
510+
return (bytes / Math.pow(1000, i)).toFixed(2)
511+
+ " " + units[i];
512+
}
501513
}

packages/vscode/src/fill/menuRegistry.ts

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { OpenProcessExplorer } from "vs/workbench/contrib/issue/electron-browser
55
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions/developerActions";
66
import { OpenPrivacyStatementUrlAction, OpenRequestFeatureUrlAction, OpenTwitterUrlAction } from "vs/workbench/electron-browser/actions/helpActions";
77
import { CloseCurrentWindowAction, NewWindowAction, ShowAboutDialogAction } from "vs/workbench/electron-browser/actions/windowActions";
8+
import { REVEAL_IN_OS_COMMAND_ID } from "vs/workbench/contrib/files/browser/fileCommands";
89

910
const toSkip = [
1011
ToggleDevToolsAction.ID,
@@ -16,6 +17,7 @@ const toSkip = [
1617
NewWindowAction.ID,
1718
CloseCurrentWindowAction.ID,
1819
CloseWorkspaceAction.ID,
20+
REVEAL_IN_OS_COMMAND_ID,
1921

2022
// Unfortunately referenced as a string
2123
"update.showCurrentReleaseNotes",

0 commit comments

Comments
 (0)