Compare commits

...

8 Commits

Author SHA1 Message Date
Kyle Carberry
166efcb17e Hide titlebar controls and fix menubar toggle (#550) 2019-04-19 19:54:50 -05:00
Kyle Carberry
206e107a9a Merge branch 'master' of github.com:codercom/code-server 2019-04-19 20:03:54 -04:00
Kyle Carberry
12c8b5d337 Closes #466 2019-04-19 20:03:52 -04:00
Asher
4aa20fd864 Fix require.toUrl on the Node side
- Fixes #542
2019-04-19 13:32:10 -05:00
Illia Poplawski
0cd4e46055 Fix self hosted flags (#523)
* Remove -h flag for help information

* Add tab after removing -h option

* Remove spaces after --user-data-dir option to line up with other menu items
2019-04-18 13:02:29 -05:00
Asher
f51823b51f Fix open dialog
- Fixes #508
2019-04-18 12:08:44 -05:00
Asher
55bfeab208 Deprecate password flag in favor of an environment variable 2019-04-18 11:10:55 -05:00
Asher
309d15cefd Use file/folder open commands for all operating systems
Mac was using its own thing.

- Fixes #535
- Fixes #501
2019-04-18 10:50:23 -05:00
8 changed files with 80 additions and 30 deletions

View File

@@ -43,7 +43,7 @@ Options:
--cert <value>
--cert-key <value>
-e, --extensions-dir <dir> Set the root path for extensions.
-d --user-data-dir <dir> Specifies the directory that user data is kept in, useful when running as root.
-d --user-data-dir <dir> Specifies the directory that user data is kept in, useful when running as root.
--data-dir <value> DEPRECATED: Use '--user-data-dir' instead. Customize where user-data is stored.
-h, --host <value> Customize the hostname. (default: "0.0.0.0")
-o, --open Open in the browser on startup.
@@ -52,7 +52,7 @@ Options:
-H, --allow-http Allow http connections.
-P, --password <value> Specify a password for authentication.
--disable-telemetry Disables ALL telemetry.
-h, --help output usage information
--help output usage information
```
### Data Directory

View File

@@ -28,7 +28,7 @@ commander.version(process.env.VERSION || "development")
.option("-p, --port <number>", "Port to bind on.", parseInt(process.env.PORT!, 10) || 8443)
.option("-N, --no-auth", "Start without requiring authentication.", undefined)
.option("-H, --allow-http", "Allow http connections.", false)
.option("-P, --password <value>", "Specify a password for authentication.")
.option("-P, --password <value>", "DEPRECATED: Use the PASSWORD environment variable instead. Specify a password for authentication.")
.option("--disable-telemetry", "Disables ALL telemetry.", false)
.option("--install-extension <value>", "Install an extension by its ID.")
.option("--bootstrap-fork <name>", "Used for development. Never set.")
@@ -209,7 +209,11 @@ const bold = (text: string | number): string | number => {
}
});
let password = options.password;
if (options.password) {
logger.warn('"--password" is deprecated. Use the PASSWORD environment variable instead.');
}
let password = options.password || process.env.PASSWORD;
if (!password) {
// Generate a random password with a length of 24.
const buffer = Buffer.alloc(12);

View File

@@ -270,9 +270,12 @@ class Dialog {
return;
}
// If it's a directory, we want to navigate to it. If it's a file, then we
// only want to open it if opening files is supported.
if (element.isDirectory) {
this.path = element.fullPath;
} else if (!(this.options as OpenDialogOptions).properties.openDirectory) {
} else if ((this.options as OpenDialogOptions).properties.openFile) {
this.selectEmitter.emit(element.fullPath);
}
});
@@ -288,16 +291,18 @@ class Dialog {
});
buttonsNode.appendChild(cancelBtn);
const confirmBtn = document.createElement("button");
const openFile = (this.options as OpenDialogOptions).properties.openFile;
confirmBtn.innerText = openFile ? "Open" : "Confirm";
const openDirectory = (this.options as OpenDialogOptions).properties.openDirectory;
confirmBtn.innerText = this.options.buttonLabel || "Confirm";
confirmBtn.addEventListener("click", () => {
if (this._path && !openFile) {
if (this._path && openDirectory) {
this.selectEmitter.emit(this._path);
}
});
// Since a single click opens a file, the only time this button can be
// used is on a directory, which is invalid for opening files.
if (openFile) {
// Disable if we can't open directories, otherwise you can open a directory
// as a file which won't work. This is because our button currently just
// always opens whatever directory is opened and will not open selected
// files. (A single click on a file is used to open it instead.)
if (!openDirectory) {
confirmBtn.disabled = true;
}
buttonsNode.appendChild(confirmBtn);
@@ -407,8 +412,9 @@ class Dialog {
isDirectory: stat.isDirectory(),
lastModified: stat.mtime.toDateString(),
size: stat.size,
// If we are opening a directory, show files as disabled.
isDisabled: !stat.isDirectory() && (this.options as OpenDialogOptions).properties.openDirectory,
// If we can't open files, show them as disabled.
isDisabled: !stat.isDirectory()
&& !(this.options as OpenDialogOptions).properties.openFile,
}));
}
}

View File

@@ -142,8 +142,8 @@ export class WindowsService implements IWindowsService {
return [await showOpenDialog({
...(options || {}),
properties: {
openDirectory: true,
openFile: true,
openDirectory: options && options.properties && options.properties.includes("openDirectory") || false,
openFile: options && options.properties && options.properties.includes("openFile") || false,
},
})];
}

View File

@@ -53,3 +53,7 @@
width: 56px !important;
margin-right: 4px;
}
.window-controls-container {
display: none !important;
}

View File

@@ -398,19 +398,35 @@ index 7b6ad89..3190356 100644
- return;
+ return (require('vs/../../../../packages/vscode/src/workbench') as typeof import ('vs/../../../../packages/vscode/src/workbench')).workbench.handleDrop(event, resolveTargetGroup, afterDrop, targetIndex);
diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts
index c25c940..9f11d98 100644
index c25c940..f2004f8 100644
--- a/src/vs/workbench/browser/layout.ts
+++ b/src/vs/workbench/browser/layout.ts
@@ -12 +12 @@ import { Registry } from 'vs/platform/registry/common/platform';
-import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
+import { isWindows, isLinux, isMacintosh, isNative, isWeb } from 'vs/base/common/platform';
+import { isWindows, isLinux, isMacintosh, isNative } from 'vs/base/common/platform';
@@ -210 +210 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
- if ((isWindows || isLinux) && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') {
+ if ((isWeb || isWindows || isLinux) && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') {
@@ -535 +535 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
+ // if ((isWeb || isWindows || isLinux) && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') {
@@ -212 +212 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
- }
+ // }
@@ -219 +219 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
- if (this.state.fullscreen && (this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'default')) {
+ if ((this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'default')) {
@@ -531 +531,5 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
- if (getTitleBarStyle(this.configurationService, this.environmentService) === 'native') {
+ if (this.state.menuBar.visibility === 'hidden') {
+ return false;
+ } else if (this.state.menuBar.visibility === 'toggle') {
+ return this.state.menuBar.toggled;
+ } else if (getTitleBarStyle(this.configurationService, this.environmentService) === 'native') {
@@ -535 +539 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
- } else if (isMacintosh) {
+ } else if (isNative && isMacintosh) {
@@ -567 +567 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
@@ -539,2 +542,0 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
- } else if (this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'default') {
- return this.state.menuBar.toggled;
@@ -567 +569 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
- if (isMacintosh || this.state.menuBar.visibility === 'hidden') {
+ if ((isNative && isMacintosh) || this.state.menuBar.visibility === 'hidden') {
diff --git a/src/vs/workbench/browser/legacyLayout.ts b/src/vs/workbench/browser/legacyLayout.ts
@@ -522,7 +538,7 @@ index a822341..43b882a 100644
- if (!isMacintosh && this.currentTitlebarStyleSetting === 'custom') {
+ if (!(isNative && isMacintosh) && this.currentTitlebarStyleSetting === 'custom') {
diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
index 028f375..4bfe956 100644
index 028f375..f740471 100644
--- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
@@ -11 +11 @@ import { ITitleService, ITitleProperties } from 'vs/workbench/services/title/com
@@ -536,7 +552,10 @@ index 028f375..4bfe956 100644
+ if (!(isNative && isMacintosh)) {
@@ -343 +343 @@ export class TitlebarPart extends Part implements ITitleService {
- if (!isMacintosh) {
+ if (!(isNative && isMacintosh)) {
+ // if (!(isNative && isMacintosh)) {
@@ -346 +346 @@ export class TitlebarPart extends Part implements ITitleService {
- }
+ // }
@@ -549 +549 @@ export class TitlebarPart extends Part implements ITitleService {
- if (!isMacintosh &&
+ if (!(isNative && isMacintosh) &&
@@ -752,11 +771,14 @@ index 1f8088e..f5b0551 100644
- included: platform.isMacintosh
+ included: platform.isNative && platform.isMacintosh
diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts
index 24ba122..fca7faf 100644
index 24ba122..3ab8804 100644
--- a/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts
+++ b/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts
@@ -12,0 +13 @@ import * as nls from 'vs/nls';
+import * as browser from 'vs/base/browser/browser';
@@ -185 +186 @@ configurationRegistry.registerConfiguration({
- default: 'auto',
+ default: browser.isSafari ? 'dom' : 'auto',
@@ -196 +197 @@ configurationRegistry.registerConfiguration({
- default: platform.isMacintosh ? 'selectWord' : platform.isWindows ? 'copyPaste' : 'default',
+ default: browser.isMacintosh ? 'selectWord' : browser.isWindows ? 'copyPaste' : 'default',
@@ -885,13 +907,19 @@ index 48ef482..dc47f81 100644
- placeHolder: isMacintosh ? nls.localize('openRecentPlaceHolderMac', "Select to open (hold Cmd-key to open in new window)") : nls.localize('openRecentPlaceHolder', "Select to open (hold Ctrl-key to open in new window)"),
+ placeHolder: browser.isMacintosh ? nls.localize('openRecentPlaceHolderMac', "Select to open (hold Cmd-key to open in new window)") : nls.localize('openRecentPlaceHolder', "Select to open (hold Ctrl-key to open in new window)"),
diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts
index 71bc992..97cbb71 100644
index 71bc992..a76dad4 100644
--- a/src/vs/workbench/electron-browser/main.contribution.ts
+++ b/src/vs/workbench/electron-browser/main.contribution.ts
@@ -13 +13,2 @@ import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
-import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
+import { isNative, isWeb } from 'vs/base/common/platform';
+import { isMacintosh, isWindows, isLinux } from 'vs/base/browser/browser';
@@ -37 +38 @@ import { LogStorageAction } from 'vs/platform/storage/node/storageService';
- if (isMacintosh) {
+ if (isNative && isMacintosh) {
@@ -225 +226 @@ import { LogStorageAction } from 'vs/platform/storage/node/storageService';
- if (isMacintosh) {
+ if (isNative && isMacintosh) {
@@ -306 +307 @@ import { LogStorageAction } from 'vs/platform/storage/node/storageService';
- when: IsMacContext.toNegated()
+ // when: IsMacContext.toNegated()
@@ -907,8 +935,10 @@ index 71bc992..97cbb71 100644
@@ -633 +634 @@ import { LogStorageAction } from 'vs/platform/storage/node/storageService';
- 'included': isWindows || isLinux
+ 'included': isWeb || isWindows || isLinux
@@ -650 +651 @@ import { LogStorageAction } from 'vs/platform/storage/node/storageService';
@@ -649,2 +650,2 @@ import { LogStorageAction } from 'vs/platform/storage/node/storageService';
- 'enum': ['native', 'custom'],
- 'default': isLinux ? 'native' : 'custom',
+ 'enum': ['custom'],
+ 'default': isNative && isLinux ? 'native' : 'custom',
@@ -659 +660 @@ import { LogStorageAction } from 'vs/platform/storage/node/storageService';
- 'included': isMacintosh && parseFloat(os.release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)

View File

@@ -24,11 +24,14 @@ module.exports = (options = {}) => ({
test: /\.(j|t)s/,
options: {
multiple: [{
// These will be handled by file-loader. We need the location because
// they are parsed as URIs and will throw errors if not fully formed.
// The !! prefix causes it to ignore other loaders (doesn't work).
// These will be handled by file-loader. Must be a fully formed URI.
// The !! prefix causes it to ignore other loaders.
search: "require\\.toUrl\\(",
replace: "location.protocol + '//' + location.host + location.pathname.replace(/\\/$/,'') + '/' + require('!!file-loader?name=[path][name].[ext]!' + ",
replace: `${
options.node
? "'file://'"
: "location.protocol + '//' + location.host + location.pathname.replace(/\\/$/,'')"
} + '/' + require('!!file-loader?name=[path][name].[ext]!' + `,
flags: "g",
}, {
search: "require\\.__\\$__nodeRequire",

View File

@@ -1,7 +1,10 @@
const merge = require("webpack-merge");
module.exports = (options = {}) => merge(
require("./webpack.general.config")(options), {
require("./webpack.general.config")({
...options,
node: true,
}), {
devtool: "none",
mode: "production",
target: "node",