mirror of https://git.tuxpa.in/a/code-server.git
Merge branch 'master' of github.com:codercom/code-server
This commit is contained in:
commit
01a63a7241
|
@ -378,14 +378,31 @@ class BrowserWindow extends EventEmitter {
|
||||||
|
|
||||||
public setFullScreen(fullscreen: boolean): void {
|
public setFullScreen(fullscreen: boolean): void {
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
document.documentElement.requestFullscreen();
|
document.documentElement.requestFullscreen().catch((error) => {
|
||||||
|
logger.error(error.message);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
document.exitFullscreen();
|
document.exitFullscreen().catch((error) => {
|
||||||
|
logger.error(error.message);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public isFullScreen(): boolean {
|
public isFullScreen(): boolean {
|
||||||
return document.fullscreenEnabled;
|
// TypeScript doesn't recognize this property.
|
||||||
|
// tslint:disable no-any
|
||||||
|
if (typeof (window as any)["fullScreen"] !== "undefined") {
|
||||||
|
return (window as any)["fullScreen"];
|
||||||
|
}
|
||||||
|
// tslint:enable no-any
|
||||||
|
|
||||||
|
try {
|
||||||
|
return window.matchMedia("(display-mode: fullscreen)").matches;
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error.message);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public isFocused(): boolean {
|
public isFocused(): boolean {
|
||||||
|
|
|
@ -216,6 +216,7 @@ const bold = (text: string | number): string | number => {
|
||||||
}
|
}
|
||||||
|
|
||||||
let password = options.password || process.env.PASSWORD;
|
let password = options.password || process.env.PASSWORD;
|
||||||
|
const usingCustomPassword = !!password;
|
||||||
if (!password) {
|
if (!password) {
|
||||||
// Generate a random password with a length of 24.
|
// Generate a random password with a length of 24.
|
||||||
const buffer = Buffer.alloc(12);
|
const buffer = Buffer.alloc(12);
|
||||||
|
@ -304,7 +305,7 @@ const bold = (text: string | number): string | number => {
|
||||||
logger.warn("Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md");
|
logger.warn("Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options.noAuth) {
|
if (!options.noAuth && !usingCustomPassword) {
|
||||||
logger.info(" ");
|
logger.info(" ");
|
||||||
logger.info(`Password:\u001B[1m ${password}`);
|
logger.info(`Password:\u001B[1m ${password}`);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -79,9 +79,7 @@
|
||||||
.dialog-entry {
|
.dialog-entry {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 1.02em;
|
font-size: 1.02em;
|
||||||
padding: 0px;
|
padding: 0px 8px;
|
||||||
padding-left: 8px;
|
|
||||||
padding-right: 8px;
|
|
||||||
|
|
||||||
.dialog-entry-info {
|
.dialog-entry-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -94,6 +92,14 @@
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dialog-entry-size {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-entry-mtime {
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--list-hover-background);
|
background-color: var(--list-hover-background);
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,7 +404,7 @@ class Dialog {
|
||||||
*/
|
*/
|
||||||
private async list(directory: string): Promise<ReadonlyArray<DialogEntry>> {
|
private async list(directory: string): Promise<ReadonlyArray<DialogEntry>> {
|
||||||
const paths = (await util.promisify(fs.readdir)(directory)).sort();
|
const paths = (await util.promisify(fs.readdir)(directory)).sort();
|
||||||
const stats = await Promise.all(paths.map(p => util.promisify(fs.stat)(path.join(directory, p))));
|
const stats = await Promise.all(paths.map(p => util.promisify(fs.lstat)(path.join(directory, p))));
|
||||||
|
|
||||||
return stats.map((stat, index): DialogEntry => ({
|
return stats.map((stat, index): DialogEntry => ({
|
||||||
fullPath: path.join(directory, paths[index]),
|
fullPath: path.join(directory, paths[index]),
|
||||||
|
@ -480,7 +480,7 @@ class DialogEntryRenderer implements ITreeRenderer<DialogEntry, string, DialogEn
|
||||||
start: 0,
|
start: 0,
|
||||||
end: node.filterData.length,
|
end: node.filterData.length,
|
||||||
}] : []);
|
}] : []);
|
||||||
templateData.size.innerText = node.element.size.toString();
|
templateData.size.innerText = !node.element.isDirectory ? this.humanReadableSize(node.element.size) : "";
|
||||||
templateData.lastModified.innerText = node.element.lastModified;
|
templateData.lastModified.innerText = node.element.lastModified;
|
||||||
|
|
||||||
// We know this exists because we created the template.
|
// We know this exists because we created the template.
|
||||||
|
@ -498,4 +498,16 @@ class DialogEntryRenderer implements ITreeRenderer<DialogEntry, string, DialogEn
|
||||||
public disposeTemplate(_templateData: DialogEntryData): void {
|
public disposeTemplate(_templateData: DialogEntryData): void {
|
||||||
// throw new Error("Method not implemented.");
|
// throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a positive size in bytes, return a string that is more readable for
|
||||||
|
* humans.
|
||||||
|
*/
|
||||||
|
private humanReadableSize(bytes: number): string {
|
||||||
|
const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
||||||
|
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1000)), units.length - 1);
|
||||||
|
|
||||||
|
return (bytes / Math.pow(1000, i)).toFixed(2)
|
||||||
|
+ " " + units[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { OpenProcessExplorer } from "vs/workbench/contrib/issue/electron-browser
|
||||||
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions/developerActions";
|
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions/developerActions";
|
||||||
import { OpenPrivacyStatementUrlAction, OpenRequestFeatureUrlAction, OpenTwitterUrlAction } from "vs/workbench/electron-browser/actions/helpActions";
|
import { OpenPrivacyStatementUrlAction, OpenRequestFeatureUrlAction, OpenTwitterUrlAction } from "vs/workbench/electron-browser/actions/helpActions";
|
||||||
import { CloseCurrentWindowAction, NewWindowAction, ShowAboutDialogAction } from "vs/workbench/electron-browser/actions/windowActions";
|
import { CloseCurrentWindowAction, NewWindowAction, ShowAboutDialogAction } from "vs/workbench/electron-browser/actions/windowActions";
|
||||||
|
import { REVEAL_IN_OS_COMMAND_ID } from "vs/workbench/contrib/files/browser/fileCommands";
|
||||||
|
|
||||||
const toSkip = [
|
const toSkip = [
|
||||||
ToggleDevToolsAction.ID,
|
ToggleDevToolsAction.ID,
|
||||||
|
@ -16,6 +17,7 @@ const toSkip = [
|
||||||
NewWindowAction.ID,
|
NewWindowAction.ID,
|
||||||
CloseCurrentWindowAction.ID,
|
CloseCurrentWindowAction.ID,
|
||||||
CloseWorkspaceAction.ID,
|
CloseWorkspaceAction.ID,
|
||||||
|
REVEAL_IN_OS_COMMAND_ID,
|
||||||
|
|
||||||
// Unfortunately referenced as a string
|
// Unfortunately referenced as a string
|
||||||
"update.showCurrentReleaseNotes",
|
"update.showCurrentReleaseNotes",
|
||||||
|
|
Loading…
Reference in New Issue