Compare commits

..

9 Commits

Author SHA1 Message Date
Asher
cf63bbd003 Fix "no authentication" message with custom password
Fixes #757.
2019-06-11 12:08:02 -05:00
Anmol Sethi
02f62882b8 Propagate full env to browser (#756)
* Propogate full env to browser

* Add support for setting $ITEM_URL

* Add serviceURL getter
2019-06-11 11:54:49 -05:00
Asher
362715bbeb Fix dialog items getting cut off
Fixes #336.
2019-06-07 14:30:45 -05:00
Dean Sheather
ec70ea6994 Change documentation to use port 8443 (#740) 2019-06-07 14:22:33 -05:00
Asher
04adf14146 Move OSX package task into build script
This is to match how the other binaries are built. Also made some
changes to make the Docker containers clean up for when you are running
this locally.
2019-06-06 13:43:37 -05:00
Liudas Sodonis aka lfx aka lso
406ec0ba71 Updated google_cloud to have proper link to ssl.md (#745) 2019-06-05 15:28:10 -05:00
Asher
a2ad3d4ff4 Show hidden files by default
Since there is no other way to enable hidden files, it seems better to
enable it by default otherwise there are some folders/files you simply
can never open from the dialog.
2019-05-20 16:08:54 -05:00
Asher
4a29cd1664 Fix human readable byte size when zero 2019-05-20 15:53:06 -05:00
Anmol Sethi
0462a93f11 Expose actions registry (#701) 2019-05-20 14:35:58 -05:00
25 changed files with 187 additions and 99 deletions

View File

@@ -27,7 +27,6 @@ before_deploy:
- git config --local user.name "$USER_NAME" - git config --local user.name "$USER_NAME"
- git config --local user.email "$USER_EMAIL" - git config --local user.email "$USER_EMAIL"
- git tag "$VERSION" "$TRAVIS_COMMIT" - git tag "$VERSION" "$TRAVIS_COMMIT"
- if [[ “$TRAVIS_OS_NAME” == “osx” ]]; then yarn task package $VERSION; fi
deploy: deploy:
provider: releases provider: releases
file_glob: true file_glob: true

View File

@@ -21,6 +21,8 @@ const buildServerBinary = register("build:server:binary", async (runner) => {
logger.info("Building with environment", field("env", { logger.info("Building with environment", field("env", {
NODE_ENV: process.env.NODE_ENV, NODE_ENV: process.env.NODE_ENV,
VERSION: process.env.VERSION, VERSION: process.env.VERSION,
OSTYPE: process.env.OSTYPE,
TARGET: process.env.TARGET,
})); }));
await ensureInstalled(); await ensureInstalled();

View File

@@ -11,9 +11,9 @@ If you're just starting out, we recommend [installing code-server locally](../..
### Use the AWS wizard ### Use the AWS wizard
- Click **Launch Instance** from your [EC2 dashboard](https://console.aws.amazon.com/ec2/v2/home). - Click **Launch Instance** from your [EC2 dashboard](https://console.aws.amazon.com/ec2/v2/home).
- Select the Ubuntu Server 16.04 LTS (HVM), SSD Volume Type (`ami-0f9cf087c1f27d9b1)` at this time of writing) - Select the Ubuntu Server 18.04 LTS (HVM), SSD Volume Type
- Select an appropriate instance size (we recommend t2.medium/large, depending on team size and number of repositories/languages enabled), then **Next: Configure Instance Details** - Select an appropriate instance size (we recommend t2.medium/large, depending on team size and number of repositories/languages enabled), then **Next: Configure Instance Details**
- Select **Next: ...** until you get to the **Configure Security Group** page, then add the default **HTTP** rule (port range "80", source "0.0.0.0/0, ::/0") - Select **Next: ...** until you get to the **Configure Security Group** page, then add a **Custom TCP Rule** rule with port range set to `8443` and source set to "Anywhere"
> Rules with source of 0.0.0.0/0 allow all IP addresses to access your instance. We recommend setting [security group rules](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html?icmpid=docs_ec2_console) to allow access from known IP addresses only. > Rules with source of 0.0.0.0/0 allow all IP addresses to access your instance. We recommend setting [security group rules](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html?icmpid=docs_ec2_console) to allow access from known IP addresses only.
- Click **Launch** - Click **Launch**
- You will be prompted to create a key pair - You will be prompted to create a key pair
@@ -56,14 +56,11 @@ If you're just starting out, we recommend [installing code-server locally](../..
> To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md) > To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md)
- Finally, run - Finally, run
``` ```
sudo ./code-server -p 80 ./code-server
``` ```
- When you visit the public IP for your AWS 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"> - Open your browser and visit `https://$public_ip:8443/` (where `$public_ip` is your AWS instance's public IP address). You will be greeted with a page similar to the following screenshot. Code-server is using a self-signed SSL certificate for easy setup. In Chrome/Chromium, click **"Advanced"** then click **"proceed anyway"**. In Firefox, click **Advanced**, then **Add Exception**, then finally **Confirm Security Exception**.<img src ="../../assets/chrome_warning.png">
- Then click **"proceed anyway"**<img src="../../assets/chrome_confirm.png">
> 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 > 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
> 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.
--- ---
> NOTE: If you get stuck or need help, [file an issue](https://github.com/cdr/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). > NOTE: If you get stuck or need help, [file an issue](https://github.com/cdr/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).

View File

@@ -39,11 +39,10 @@ If you're just starting out, we recommend [installing code-server locally](../..
> To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md) > To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md)
- Finally start the code-server - Finally start the code-server
``` ```
sudo ./code-server -p 80 ./code-server
``` ```
> 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 > 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
- 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"> - Open your browser and visit `https://$public_ip:8443/` (where `$public_ip` is your Digital Ocean instance's public IP address). You will be greeted with a page similar to the following screenshot. Code-server is using a self-signed SSL certificate for easy setup. In Chrome/Chromium, click **"Advanced"** then click **"proceed anyway"**. In Firefox, click **Advanced**, then **Add Exception**, then finally **Confirm Security Exception**.<img src ="../../assets/chrome_warning.png">
- Then click **"proceed anyway"**<img src="../../assets/chrome_confirm.png">
--- ---
> NOTE: If you get stuck or need help, [file an issue](https://github.com/cdr/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). > NOTE: If you get stuck or need help, [file an issue](https://github.com/cdr/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).

View File

@@ -12,8 +12,9 @@ If you're just starting out, we recommend [installing code-server locally](../..
- [Open your Google Cloud console](https://console.cloud.google.com/compute/instances) to create a new VM instance and click **Create Instance** - [Open your Google Cloud console](https://console.cloud.google.com/compute/instances) to create a new VM instance and click **Create Instance**
- Choose an appropriate machine type (we recommend 2 vCPU and 7.5 GB RAM, more depending on team size and number of repositories/languages enabled) - Choose an appropriate machine type (we recommend 2 vCPU and 7.5 GB RAM, more depending on team size and number of repositories/languages enabled)
- Choose Ubuntu 16.04 LTS as your boot disk - Choose Ubuntu 16.04 LTS as your boot disk
- Check the boxes for **Allow HTTP traffic** and **Allow HTTPS traffic** in the **Firewall** section - Expand the "Management, security, disks, networking, sole tenancy" section, go to the "Networking" tab, then under network tags add "code-server"
- Create your VM, and **take note** of its public IP address. - Create your VM, and **take note** of its public IP address.
- Visit "VPC network" in the console and go to "Firewall rules". Create a new firewall rule called "http-8443". Under "Target tags" add "code-server", and under "Protocols and ports" tick "Specified protocols and ports" and "tcp". Beside "tcp", add "8443", then create the rule.
- Copy the link to download the latest Linux binary from our [releases page](https://github.com/cdr/code-server/releases) - Copy the link to download the latest Linux binary from our [releases page](https://github.com/cdr/code-server/releases)
--- ---
@@ -50,22 +51,16 @@ cd code-server-{version}-linux-x64
chmod +x code-server chmod +x code-server
``` ```
> To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../security/ssl.md) > To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md)
- Start the code-server - Start the code-server
``` ```
sudo ./code-server -p 80 ./code-server
``` ```
- Open your browser and visit `https://$public_ip:8443/` (where `$public_ip` is your Compute Engine instance's public IP address). You will be greeted with a page similar to the following screenshot. Code-server is using a self-signed SSL certificate for easy setup. In Chrome/Chromium, click **"Advanced"** then click **"proceed anyway"**. In Firefox, click **Advanced**, then **Add Exception**, then finally **Confirm Security Exception**.<img src ="../../assets/chrome_warning.png">
> 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 > 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
- Access code-server from the public IP of your Google Cloud instance we noted earlier in your browser.
> example: 32.32.32.234
- 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">
- Then click **"proceed anyway"**<img src="../../assets/chrome_confirm.png">
--- ---
> NOTE: If you get stuck or need help, [file an issue](https://github.com/cdr/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). > NOTE: If you get stuck or need help, [file an issue](https://github.com/cdr/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).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -25,8 +25,7 @@ It takes just a few minutes to get your own self-hosted server running. If you'v
> NOTE: Be careful with your password as sharing it will grant those users access to your server's file system > NOTE: Be careful with your password as sharing it will grant those users access to your server's file system
### Things To Know ### Things To Know
- When you visit the IP for your code-server, 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"> - When you visit the IP for your code-server instance, you will be greeted with a page similar to the following screenshot. Code-server is using a self-signed SSL certificate for easy setup. In Chrome/Chromium, click **"Advanced"** then click **"proceed anyway"**. In Firefox, click **Advanced**, then **Add Exception**, then finally **Confirm Security Exception**.<img src ="../../assets/chrome_warning.png">
- Then click **"proceed anyway"**<img src="../assets/chrome_confirm.png">
## Usage ## Usage
<pre class="pre-wrap"><code>code-server<span class="virtual-br"></span> --help</code></pre> <pre class="pre-wrap"><code>code-server<span class="virtual-br"></span> --help</code></pre>
@@ -94,7 +93,7 @@ Options:
} }
} }
``` ```
### Apache Reverse Proxy ### Apache Reverse Proxy
Example of https virtualhost configuration for Apache as a reverse proxy. Please also pass --allow-http on code-server startup to allow the proxy to connect. Example of https virtualhost configuration for Apache as a reverse proxy. Please also pass --allow-http on code-server startup to allow the proxy to connect.
``` ```
@@ -106,7 +105,7 @@ Options:
RewriteRule /(.*) ws://localhost:8443/$1 [P,L] RewriteRule /(.*) ws://localhost:8443/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC] RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:8443/$1 [P,L] RewriteRule /(.*) http://localhost:8443/$1 [P,L]
ProxyRequests off ProxyRequests off
RequestHeader set X-Forwarded-Proto https RequestHeader set X-Forwarded-Proto https
@@ -118,6 +117,6 @@ Options:
</VirtualHost> </VirtualHost>
``` ```
*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 *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
### Help ### Help
Use `code-server --help` to view the usage for the CLI. This is also shown at the beginning of this section. Use `code-server --help` to view the usage for the CLI. This is also shown at the beginning of this section.

View File

@@ -1,6 +1,9 @@
// tslint:disable no-any // tslint:disable no-any
import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal"; import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal";
import { IWorkbenchActionRegistry } from 'vs/workbench/common/actions';
import { Action } from 'vs/base/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
export interface EvalHelper { } export interface EvalHelper { }
interface ActiveEvalEmitter { interface ActiveEvalEmitter {
@@ -146,7 +149,10 @@ declare namespace ide {
export const client: {}; export const client: {};
export const workbench: { export const workbench: {
readonly action: Action,
readonly syncActionDescriptor: SyncActionDescriptor,
readonly statusbarService: IStatusbarService; readonly statusbarService: IStatusbarService;
readonly actionsRegistry: IWorkbenchActionRegistry;
readonly notificationService: INotificationService; readonly notificationService: INotificationService;
readonly storageService: IStorageService; readonly storageService: IStorageService;
readonly menuRegistry: IMenuRegistry; readonly menuRegistry: IMenuRegistry;

View File

@@ -35,6 +35,10 @@ class OS {
default: this._platform = "linux"; break; default: this._platform = "linux"; break;
} }
process.platform = this._platform; process.platform = this._platform;
process.env = {};
data.env.forEach((v, k) => {
process.env[k] = v;
});
} }
public release(): string { public release(): string {

View File

@@ -14,5 +14,8 @@
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"text-encoding": "^0.7.0", "text-encoding": "^0.7.0",
"ts-protoc-gen": "^0.8.0" "ts-protoc-gen": "^0.8.0"
},
"scripts": {
"gen": "./scripts/generate_proto.sh"
} }
} }

View File

@@ -1,3 +1,5 @@
#!/bin/bash #!/bin/bash
protoc --plugin="protoc-gen-ts=./node_modules/.bin/protoc-gen-ts" --js_out="import_style=commonjs,binary:./src/proto" --ts_out="./src/proto" ./src/proto/*.proto --proto_path="./src/proto" cd "$(dirname "$0")/.."
protoc --plugin="protoc-gen-ts=./node_modules/.bin/protoc-gen-ts" --js_out="import_style=commonjs,binary:./src/proto" --ts_out="./src/proto" ./src/proto/*.proto --proto_path="./src/proto"

View File

@@ -280,6 +280,7 @@ export class Client {
builtInExtensionsDirectory: init.getBuiltinExtensionsDir(), builtInExtensionsDirectory: init.getBuiltinExtensionsDir(),
extraExtensionDirectories: init.getExtraExtensionDirectoriesList(), extraExtensionDirectories: init.getExtraExtensionDirectoriesList(),
extraBuiltinExtensionDirectories: init.getExtraBuiltinExtensionDirectoriesList(), extraBuiltinExtensionDirectories: init.getExtraBuiltinExtensionDirectoriesList(),
env: init.getEnvMap(),
}; };
this.initDataEmitter.emit(this._initData); this.initDataEmitter.emit(this._initData);
break; break;

View File

@@ -1,3 +1,5 @@
import * as jspb from "google-protobuf";
export interface SendableConnection { export interface SendableConnection {
send(data: Buffer | Uint8Array): void; send(data: Buffer | Uint8Array): void;
} }
@@ -27,6 +29,7 @@ export interface InitData {
readonly builtInExtensionsDirectory: string; readonly builtInExtensionsDirectory: string;
readonly extraExtensionDirectories: string[]; readonly extraExtensionDirectories: string[];
readonly extraBuiltinExtensionDirectories: string[]; readonly extraBuiltinExtensionDirectories: string[];
readonly env: jspb.Map<string, string>;
} }
export interface SharedProcessData { export interface SharedProcessData {

View File

@@ -103,6 +103,11 @@ export class Server {
initMsg.setShell(os.userInfo().shell || global.process.env.SHELL || ""); initMsg.setShell(os.userInfo().shell || global.process.env.SHELL || "");
initMsg.setExtraExtensionDirectoriesList(this.options.extraExtensionDirectories || []); initMsg.setExtraExtensionDirectoriesList(this.options.extraExtensionDirectories || []);
initMsg.setExtraBuiltinExtensionDirectoriesList(this.options.extraBuiltinExtensionDirectories || []); initMsg.setExtraBuiltinExtensionDirectoriesList(this.options.extraBuiltinExtensionDirectories || []);
for (let key in process.env) {
initMsg.getEnvMap().set(key, process.env[key] as string);
}
const srvMsg = new ServerMessage(); const srvMsg = new ServerMessage();
srvMsg.setInit(initMsg); srvMsg.setInit(initMsg);
connection.send(srvMsg.serializeBinary()); connection.send(srvMsg.serializeBinary());

View File

@@ -44,4 +44,6 @@ message WorkingInit {
string extensions_directory = 8; string extensions_directory = 8;
repeated string extra_extension_directories = 9; repeated string extra_extension_directories = 9;
repeated string extra_builtin_extension_directories = 10; repeated string extra_builtin_extension_directories = 10;
map<string, string> env = 11;
} }

View File

@@ -145,6 +145,8 @@ export class WorkingInit extends jspb.Message {
setExtraBuiltinExtensionDirectoriesList(value: Array<string>): void; setExtraBuiltinExtensionDirectoriesList(value: Array<string>): void;
addExtraBuiltinExtensionDirectories(value: string, index?: number): string; addExtraBuiltinExtensionDirectories(value: string, index?: number): string;
getEnvMap(): jspb.Map<string, string>;
clearEnvMap(): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): WorkingInit.AsObject; toObject(includeInstance?: boolean): WorkingInit.AsObject;
static toObject(includeInstance: boolean, msg: WorkingInit): WorkingInit.AsObject; static toObject(includeInstance: boolean, msg: WorkingInit): WorkingInit.AsObject;
@@ -167,6 +169,7 @@ export namespace WorkingInit {
extensionsDirectory: string, extensionsDirectory: string,
extraExtensionDirectoriesList: Array<string>, extraExtensionDirectoriesList: Array<string>,
extraBuiltinExtensionDirectoriesList: Array<string>, extraBuiltinExtensionDirectoriesList: Array<string>,
envMap: Array<[string, string]>,
} }
export enum OperatingSystem { export enum OperatingSystem {

View File

@@ -137,7 +137,7 @@ proto.ClientMessage.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.ClientMessage.toObject = function(includeInstance, msg) { proto.ClientMessage.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
method: (f = msg.getMethod()) && node_pb.Method.toObject(includeInstance, f), method: (f = msg.getMethod()) && node_pb.Method.toObject(includeInstance, f),
ping: (f = msg.getPing()) && node_pb.Ping.toObject(includeInstance, f) ping: (f = msg.getPing()) && node_pb.Ping.toObject(includeInstance, f)
}; };
@@ -360,7 +360,7 @@ proto.ServerMessage.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.ServerMessage.toObject = function(includeInstance, msg) { proto.ServerMessage.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
fail: (f = msg.getFail()) && node_pb.Method.Fail.toObject(includeInstance, f), fail: (f = msg.getFail()) && node_pb.Method.Fail.toObject(includeInstance, f),
success: (f = msg.getSuccess()) && node_pb.Method.Success.toObject(includeInstance, f), success: (f = msg.getSuccess()) && node_pb.Method.Success.toObject(includeInstance, f),
event: (f = msg.getEvent()) && node_pb.Event.toObject(includeInstance, f), event: (f = msg.getEvent()) && node_pb.Event.toObject(includeInstance, f),
@@ -794,7 +794,7 @@ proto.WorkingInit.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.WorkingInit.toObject = function(includeInstance, msg) { proto.WorkingInit.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
homeDirectory: jspb.Message.getFieldWithDefault(msg, 1, ""), homeDirectory: jspb.Message.getFieldWithDefault(msg, 1, ""),
tmpDirectory: jspb.Message.getFieldWithDefault(msg, 2, ""), tmpDirectory: jspb.Message.getFieldWithDefault(msg, 2, ""),
dataDirectory: jspb.Message.getFieldWithDefault(msg, 3, ""), dataDirectory: jspb.Message.getFieldWithDefault(msg, 3, ""),
@@ -804,7 +804,8 @@ proto.WorkingInit.toObject = function(includeInstance, msg) {
builtinExtensionsDir: jspb.Message.getFieldWithDefault(msg, 7, ""), builtinExtensionsDir: jspb.Message.getFieldWithDefault(msg, 7, ""),
extensionsDirectory: jspb.Message.getFieldWithDefault(msg, 8, ""), extensionsDirectory: jspb.Message.getFieldWithDefault(msg, 8, ""),
extraExtensionDirectoriesList: jspb.Message.getRepeatedField(msg, 9), extraExtensionDirectoriesList: jspb.Message.getRepeatedField(msg, 9),
extraBuiltinExtensionDirectoriesList: jspb.Message.getRepeatedField(msg, 10) extraBuiltinExtensionDirectoriesList: jspb.Message.getRepeatedField(msg, 10),
envMap: (f = msg.getEnvMap()) ? f.toObject(includeInstance, undefined) : []
}; };
if (includeInstance) { if (includeInstance) {
@@ -881,6 +882,12 @@ proto.WorkingInit.deserializeBinaryFromReader = function(msg, reader) {
var value = /** @type {string} */ (reader.readString()); var value = /** @type {string} */ (reader.readString());
msg.addExtraBuiltinExtensionDirectories(value); msg.addExtraBuiltinExtensionDirectories(value);
break; break;
case 11:
var value = msg.getEnvMap();
reader.readMessage(value, function(message, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "");
});
break;
default: default:
reader.skipField(); reader.skipField();
break; break;
@@ -980,6 +987,10 @@ proto.WorkingInit.serializeBinaryToWriter = function(message, writer) {
f f
); );
} }
f = message.getEnvMap(true);
if (f && f.getLength() > 0) {
f.serializeBinary(11, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
}
}; };
@@ -1176,4 +1187,25 @@ proto.WorkingInit.prototype.clearExtraBuiltinExtensionDirectoriesList = function
}; };
/**
* map<string, string> env = 11;
* @param {boolean=} opt_noLazyCreate Do not create the map if
* empty, instead returning `undefined`
* @return {!jspb.Map<string,string>}
*/
proto.WorkingInit.prototype.getEnvMap = function(opt_noLazyCreate) {
return /** @type {!jspb.Map<string,string>} */ (
jspb.Message.getMapField(this, 11, opt_noLazyCreate,
null));
};
/**
* Clears values from the map. The map will be non-null.
*/
proto.WorkingInit.prototype.clearEnvMap = function() {
this.getEnvMap().clear();
};
goog.object.extend(exports, proto); goog.object.extend(exports, proto);

View File

@@ -583,7 +583,7 @@ proto.Argument.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.toObject = function(includeInstance, msg) { proto.Argument.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
error: (f = msg.getError()) && proto.Argument.ErrorValue.toObject(includeInstance, f), error: (f = msg.getError()) && proto.Argument.ErrorValue.toObject(includeInstance, f),
buffer: (f = msg.getBuffer()) && proto.Argument.BufferValue.toObject(includeInstance, f), buffer: (f = msg.getBuffer()) && proto.Argument.BufferValue.toObject(includeInstance, f),
object: (f = msg.getObject()) && proto.Argument.ObjectValue.toObject(includeInstance, f), object: (f = msg.getObject()) && proto.Argument.ObjectValue.toObject(includeInstance, f),
@@ -843,7 +843,7 @@ proto.Argument.ErrorValue.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.ErrorValue.toObject = function(includeInstance, msg) { proto.Argument.ErrorValue.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
message: jspb.Message.getFieldWithDefault(msg, 1, ""), message: jspb.Message.getFieldWithDefault(msg, 1, ""),
stack: jspb.Message.getFieldWithDefault(msg, 2, ""), stack: jspb.Message.getFieldWithDefault(msg, 2, ""),
code: jspb.Message.getFieldWithDefault(msg, 3, "") code: jspb.Message.getFieldWithDefault(msg, 3, "")
@@ -1022,7 +1022,7 @@ proto.Argument.BufferValue.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.BufferValue.toObject = function(includeInstance, msg) { proto.Argument.BufferValue.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
data: msg.getData_asB64() data: msg.getData_asB64()
}; };
@@ -1171,7 +1171,7 @@ proto.Argument.ObjectValue.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.ObjectValue.toObject = function(includeInstance, msg) { proto.Argument.ObjectValue.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
dataMap: (f = msg.getDataMap()) ? f.toObject(includeInstance, proto.Argument.toObject) : [] dataMap: (f = msg.getDataMap()) ? f.toObject(includeInstance, proto.Argument.toObject) : []
}; };
@@ -1308,7 +1308,7 @@ proto.Argument.ArrayValue.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.ArrayValue.toObject = function(includeInstance, msg) { proto.Argument.ArrayValue.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
dataList: jspb.Message.toObjectList(msg.getDataList(), dataList: jspb.Message.toObjectList(msg.getDataList(),
proto.Argument.toObject, includeInstance) proto.Argument.toObject, includeInstance)
}; };
@@ -1455,7 +1455,7 @@ proto.Argument.ProxyValue.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.ProxyValue.toObject = function(includeInstance, msg) { proto.Argument.ProxyValue.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0) id: jspb.Message.getFieldWithDefault(msg, 1, 0)
}; };
@@ -1580,7 +1580,7 @@ proto.Argument.FunctionValue.prototype.toObject = function(opt_includeInstance)
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.FunctionValue.toObject = function(includeInstance, msg) { proto.Argument.FunctionValue.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0) id: jspb.Message.getFieldWithDefault(msg, 1, 0)
}; };
@@ -1705,7 +1705,7 @@ proto.Argument.NullValue.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.NullValue.toObject = function(includeInstance, msg) { proto.Argument.NullValue.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
}; };
@@ -1804,7 +1804,7 @@ proto.Argument.UndefinedValue.prototype.toObject = function(opt_includeInstance)
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.UndefinedValue.toObject = function(includeInstance, msg) { proto.Argument.UndefinedValue.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
}; };
@@ -1903,7 +1903,7 @@ proto.Argument.DateValue.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Argument.DateValue.toObject = function(includeInstance, msg) { proto.Argument.DateValue.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
date: jspb.Message.getFieldWithDefault(msg, 1, "") date: jspb.Message.getFieldWithDefault(msg, 1, "")
}; };
@@ -2449,7 +2449,7 @@ proto.Method.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Method.toObject = function(includeInstance, msg) { proto.Method.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
namedProxy: (f = msg.getNamedProxy()) && proto.Method.Named.toObject(includeInstance, f), namedProxy: (f = msg.getNamedProxy()) && proto.Method.Named.toObject(includeInstance, f),
numberedProxy: (f = msg.getNumberedProxy()) && proto.Method.Numbered.toObject(includeInstance, f) numberedProxy: (f = msg.getNumberedProxy()) && proto.Method.Numbered.toObject(includeInstance, f)
}; };
@@ -2582,7 +2582,7 @@ proto.Method.Named.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Method.Named.toObject = function(includeInstance, msg) { proto.Method.Named.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0), id: jspb.Message.getFieldWithDefault(msg, 1, 0),
module: jspb.Message.getFieldWithDefault(msg, 2, 0), module: jspb.Message.getFieldWithDefault(msg, 2, 0),
method: jspb.Message.getFieldWithDefault(msg, 3, ""), method: jspb.Message.getFieldWithDefault(msg, 3, ""),
@@ -2817,7 +2817,7 @@ proto.Method.Numbered.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Method.Numbered.toObject = function(includeInstance, msg) { proto.Method.Numbered.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0), id: jspb.Message.getFieldWithDefault(msg, 1, 0),
proxyId: jspb.Message.getFieldWithDefault(msg, 2, 0), proxyId: jspb.Message.getFieldWithDefault(msg, 2, 0),
method: jspb.Message.getFieldWithDefault(msg, 3, ""), method: jspb.Message.getFieldWithDefault(msg, 3, ""),
@@ -3045,7 +3045,7 @@ proto.Method.Fail.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Method.Fail.toObject = function(includeInstance, msg) { proto.Method.Fail.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0), id: jspb.Message.getFieldWithDefault(msg, 1, 0),
response: (f = msg.getResponse()) && proto.Argument.toObject(includeInstance, f) response: (f = msg.getResponse()) && proto.Argument.toObject(includeInstance, f)
}; };
@@ -3217,7 +3217,7 @@ proto.Method.Success.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Method.Success.toObject = function(includeInstance, msg) { proto.Method.Success.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, 0), id: jspb.Message.getFieldWithDefault(msg, 1, 0),
response: (f = msg.getResponse()) && proto.Argument.toObject(includeInstance, f) response: (f = msg.getResponse()) && proto.Argument.toObject(includeInstance, f)
}; };
@@ -3481,7 +3481,7 @@ proto.Callback.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Callback.toObject = function(includeInstance, msg) { proto.Callback.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
namedCallback: (f = msg.getNamedCallback()) && proto.Callback.Named.toObject(includeInstance, f), namedCallback: (f = msg.getNamedCallback()) && proto.Callback.Named.toObject(includeInstance, f),
numberedCallback: (f = msg.getNumberedCallback()) && proto.Callback.Numbered.toObject(includeInstance, f) numberedCallback: (f = msg.getNumberedCallback()) && proto.Callback.Numbered.toObject(includeInstance, f)
}; };
@@ -3614,7 +3614,7 @@ proto.Callback.Named.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Callback.Named.toObject = function(includeInstance, msg) { proto.Callback.Named.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
module: jspb.Message.getFieldWithDefault(msg, 1, 0), module: jspb.Message.getFieldWithDefault(msg, 1, 0),
callbackId: jspb.Message.getFieldWithDefault(msg, 2, 0), callbackId: jspb.Message.getFieldWithDefault(msg, 2, 0),
argsList: jspb.Message.toObjectList(msg.getArgsList(), argsList: jspb.Message.toObjectList(msg.getArgsList(),
@@ -3822,7 +3822,7 @@ proto.Callback.Numbered.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Callback.Numbered.toObject = function(includeInstance, msg) { proto.Callback.Numbered.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
proxyId: jspb.Message.getFieldWithDefault(msg, 1, 0), proxyId: jspb.Message.getFieldWithDefault(msg, 1, 0),
callbackId: jspb.Message.getFieldWithDefault(msg, 2, 0), callbackId: jspb.Message.getFieldWithDefault(msg, 2, 0),
argsList: jspb.Message.toObjectList(msg.getArgsList(), argsList: jspb.Message.toObjectList(msg.getArgsList(),
@@ -4115,7 +4115,7 @@ proto.Event.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Event.toObject = function(includeInstance, msg) { proto.Event.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
namedEvent: (f = msg.getNamedEvent()) && proto.Event.Named.toObject(includeInstance, f), namedEvent: (f = msg.getNamedEvent()) && proto.Event.Named.toObject(includeInstance, f),
numberedEvent: (f = msg.getNumberedEvent()) && proto.Event.Numbered.toObject(includeInstance, f) numberedEvent: (f = msg.getNumberedEvent()) && proto.Event.Numbered.toObject(includeInstance, f)
}; };
@@ -4248,7 +4248,7 @@ proto.Event.Named.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Event.Named.toObject = function(includeInstance, msg) { proto.Event.Named.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
module: jspb.Message.getFieldWithDefault(msg, 1, 0), module: jspb.Message.getFieldWithDefault(msg, 1, 0),
event: jspb.Message.getFieldWithDefault(msg, 2, ""), event: jspb.Message.getFieldWithDefault(msg, 2, ""),
argsList: jspb.Message.toObjectList(msg.getArgsList(), argsList: jspb.Message.toObjectList(msg.getArgsList(),
@@ -4456,7 +4456,7 @@ proto.Event.Numbered.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Event.Numbered.toObject = function(includeInstance, msg) { proto.Event.Numbered.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
proxyId: jspb.Message.getFieldWithDefault(msg, 1, 0), proxyId: jspb.Message.getFieldWithDefault(msg, 1, 0),
event: jspb.Message.getFieldWithDefault(msg, 2, ""), event: jspb.Message.getFieldWithDefault(msg, 2, ""),
argsList: jspb.Message.toObjectList(msg.getArgsList(), argsList: jspb.Message.toObjectList(msg.getArgsList(),
@@ -4723,7 +4723,7 @@ proto.Ping.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Ping.toObject = function(includeInstance, msg) { proto.Ping.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
}; };
@@ -4822,7 +4822,7 @@ proto.Pong.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.Pong.toObject = function(includeInstance, msg) { proto.Pong.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
}; };

View File

@@ -62,7 +62,7 @@ proto.SharedProcessActive.prototype.toObject = function(opt_includeInstance) {
* @suppress {unusedLocalVariables} f is only used for nested messages * @suppress {unusedLocalVariables} f is only used for nested messages
*/ */
proto.SharedProcessActive.toObject = function(includeInstance, msg) { proto.SharedProcessActive.toObject = function(includeInstance, msg) {
var obj = { var f, obj = {
socketPath: jspb.Message.getFieldWithDefault(msg, 1, ""), socketPath: jspb.Message.getFieldWithDefault(msg, 1, ""),
logPath: jspb.Message.getFieldWithDefault(msg, 2, "") logPath: jspb.Message.getFieldWithDefault(msg, 2, "")
}; };

View File

@@ -315,10 +315,11 @@ const bold = (text: string | number): string | number => {
logger.warn("Documentation on securing your setup: https://github.com/cdr/code-server/blob/master/doc/security/ssl.md"); logger.warn("Documentation on securing your setup: https://github.com/cdr/code-server/blob/master/doc/security/ssl.md");
} }
if (!options.noAuth && !usingCustomPassword) { if (!options.noAuth) {
logger.info(" "); logger.info(" ");
logger.info(`Password:\u001B[1m ${password}`); logger.info(usingCustomPassword ? "Using custom password." : `Password:\u001B[1m ${password}`);
} else { } else {
logger.warn(" ");
logger.warn("Launched without authentication."); logger.warn("Launched without authentication.");
} }
if (options.disableTelemetry) { if (options.disableTelemetry) {

View File

@@ -6,13 +6,17 @@ import { IStatusbarService, StatusbarAlignment } from "vs/platform/statusbar/com
import * as paths from "./fill/paths"; import * as paths from "./fill/paths";
import product from "./fill/product"; import product from "./fill/product";
import "./vscode.scss"; import "./vscode.scss";
import { MenuId, MenuRegistry } from "vs/platform/actions/common/actions"; import { Action } from 'vs/base/common/actions';
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { CommandsRegistry } from "vs/platform/commands/common/commands"; import { CommandsRegistry } from "vs/platform/commands/common/commands";
import { IFileService, FileOperation } from "vs/platform/files/common/files"; import { IFileService, FileOperation } from "vs/platform/files/common/files";
import { ITextFileService } from "vs/workbench/services/textfile/common/textfiles"; import { ITextFileService } from "vs/workbench/services/textfile/common/textfiles";
import { IModelService } from "vs/editor/common/services/modelService"; import { IModelService } from "vs/editor/common/services/modelService";
import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal"; import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal";
import { IStorageService } from "vs/platform/storage/common/storage"; import { IStorageService } from "vs/platform/storage/common/storage";
// NOTE: shouldn't import anything from VS Code here or anything that will // NOTE: shouldn't import anything from VS Code here or anything that will
// depend on a synchronous fill like `os`. // depend on a synchronous fill like `os`.
@@ -33,11 +37,12 @@ class VSClient extends IdeClient {
window.ide = { window.ide = {
client: ideClientInstance, client: ideClientInstance,
workbench: { workbench: {
action: Action,
syncActionDescriptor: SyncActionDescriptor,
commandRegistry: CommandsRegistry, commandRegistry: CommandsRegistry,
// tslint:disable-next-line:no-any actionsRegistry: Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions),
menuRegistry: MenuRegistry as any, menuRegistry: MenuRegistry,
// tslint:disable-next-line:no-any statusbarService: getService<IStatusbarService>(IStatusbarService),
statusbarService: getService<IStatusbarService>(IStatusbarService) as any,
notificationService: getService<INotificationService>(INotificationService), notificationService: getService<INotificationService>(INotificationService),
terminalService: getService<ITerminalService>(ITerminalService), terminalService: getService<ITerminalService>(ITerminalService),
storageService: { storageService: {

View File

@@ -52,7 +52,15 @@ export type DialogOptions = OpenDialogOptions | SaveDialogOptions;
export const showOpenDialog = (options: OpenDialogOptions): Promise<string> => { export const showOpenDialog = (options: OpenDialogOptions): Promise<string> => {
return new Promise<string>((resolve, reject): void => { return new Promise<string>((resolve, reject): void => {
const dialog = new Dialog(DialogType.Open, options); // Make the default to show hidden files and directories since there is no
// other way to make them visible in the dialogs currently.
const dialog = new Dialog(DialogType.Open, typeof options.properties.showHiddenFiles === "undefined" ? {
...options,
properties: {
...options.properties,
showHiddenFiles: true,
},
} : options);
dialog.onSelect((e) => { dialog.onSelect((e) => {
dialog.dispose(); dialog.dispose();
resolve(e); resolve(e);
@@ -307,7 +315,6 @@ class Dialog {
} }
buttonsNode.appendChild(confirmBtn); buttonsNode.appendChild(confirmBtn);
this.root.appendChild(buttonsNode); this.root.appendChild(buttonsNode);
this.entryList.layout();
this.path = options.defaultPath || "/"; this.path = options.defaultPath || "/";
} }
@@ -383,6 +390,8 @@ class Dialog {
return true; return true;
}); });
this.entryList.layout();
this.entryList.setChildren(null, items.map((i: DialogEntry): ITreeElement<DialogEntry> => ({ element: i }))); this.entryList.setChildren(null, items.map((i: DialogEntry): ITreeElement<DialogEntry> => ({ element: i })));
this.entryList.domFocus(); this.entryList.domFocus();
this.entryList.setFocus([null]); this.entryList.setFocus([null]);
@@ -505,9 +514,8 @@ class DialogEntryRenderer implements ITreeRenderer<DialogEntry, string, DialogEn
*/ */
private humanReadableSize(bytes: number): string { private humanReadableSize(bytes: number): string {
const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; 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); const i = Math.min(Math.floor(bytes && Math.log(bytes) / Math.log(1000)), units.length - 1);
return (bytes / Math.pow(1000, i)).toFixed(2) return (bytes / Math.pow(1000, i)).toFixed(2) + " " + units[i];
+ " " + units[i];
} }
} }

View File

@@ -28,12 +28,17 @@ class Product implements IProductConfiguration {
return this._dataFolderName; return this._dataFolderName;
} }
public extensionsGallery = { // tslint:disable-next-line:no-any
serviceUrl: global && global.process && global.process.env.SERVICE_URL public extensionsGallery: any = {
|| process.env.SERVICE_URL get serviceUrl(): string {
|| "https://v1.extapi.coder.com", return process.env.SERVICE_URL || "https://v1.extapi.coder.com";
// tslint:disable-next-line:no-any },
} as any;
get itemUrl(): string {
return process.env.ITEM_URL || "";
},
};
public extensionExecutionEnvironments = { public extensionExecutionEnvironments = {
"wayou.vscode-todo-highlight": "worker", "wayou.vscode-todo-highlight": "worker",

View File

@@ -1,32 +1,51 @@
#!/bin/bash #!/bin/bash
set -euxo pipefail set -euxo pipefail
# Variables to be set: # Build using a Docker container using the specified image and version.
# $IMAGE
function docker_build() { function docker_build() {
containerID=$(docker create -it -v $(pwd)/.cache:/src/.cache $IMAGE) local image="${1}" ; shift
docker start $containerID local version="${1}" ; shift
docker exec $containerID mkdir -p /src
function exec() { local containerId
docker exec $containerID bash -c "$@" containerId=$(docker create --network=host --rm -it -v "$(pwd)"/.cache:/src/.cache "${image}")
docker start "${containerId}"
docker exec "${containerId}" mkdir -p /src
function docker_exec() {
docker exec "${containerId}" bash -c "$@"
} }
docker cp ./. $containerID:/src docker cp ./. "${containerId}":/src
exec "cd /src && yarn" docker_exec "cd /src && yarn"
exec "cd /src && npm rebuild" docker_exec "cd /src && npm rebuild"
exec "cd /src && NODE_ENV=production VERSION=$VERSION yarn task build:server:binary" docker_exec "cd /src && NODE_ENV=production VERSION=${version} yarn task build:server:binary"
exec "cd /src && yarn task package $VERSION" docker_exec "cd /src && yarn task package ${version}"
docker cp $containerID:/src/release/. ./release/ docker cp "${containerId}":/src/release/. ./release/
docker stop "${containerId}"
} }
if [[ "$OSTYPE" == "darwin"* ]]; then function main() {
NODE_ENV=production yarn task build:server:binary local version=${VERSION:-}
else local ostype=${OSTYPE:-}
if [[ "$TARGET" == "alpine" ]]; then
IMAGE="codercom/nbin-alpine" if [[ -z "${version}" ]] ; then
else >&2 echo "Must set VERSION environment variable"
IMAGE="codercom/nbin-centos" exit 1
fi fi
docker_build
fi if [[ "${ostype}" == "darwin"* ]]; then
NODE_ENV=production VERSION="${version}" yarn task build:server:binary
yarn task package "${version}"
else
local image
if [[ "$TARGET" == "alpine" ]]; then
image="codercom/nbin-alpine"
else
image="codercom/nbin-centos"
fi
docker_build "${image}" "${version}"
fi
}
main "$@"

View File

@@ -90,8 +90,6 @@ module.exports = (options = {}) => ({
}), }),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
"process.env.NODE_ENV": `"${environment}"`, "process.env.NODE_ENV": `"${environment}"`,
"process.env.LOG_LEVEL": `"${process.env.LOG_LEVEL || ""}"`,
"process.env.SERVICE_URL": `"${process.env.SERVICE_URL || ""}"`,
"process.env.VERSION": `"${process.env.VERSION || ""}"`, "process.env.VERSION": `"${process.env.VERSION || ""}"`,
}), }),
], ],