Commit graph

41 commits

Author SHA1 Message Date
Connor Peet eb99b85bdf
chore: update CLI dependences, add env var options for login 2024-05-20 08:33:23 -07:00
Connor Peet 5bdc31357d
cli: update dev tunnel sdk (#207018) 2024-03-06 16:10:10 -08:00
Connor Peet 2ff1b39452
cli: update dev tunnels (#203997)
Fixes #201417
2024-02-01 10:07:46 -08:00
Connor Peet d7cfba7af7
cli: update dev tunnel sdk (#203763) 2024-01-30 03:01:21 +01:00
Connor Peet e0502b5442
cli: update dev tunnels (#195183) 2023-10-09 12:44:12 -07:00
Connor Peet db135a575a
cli: fix decompression loop stalling (#191512)
Fixes #191501

It turns out this was a difference in inflate/deflate implementations
between the extension/SDK and the CLI. The SDK uses Node's zlib bindings,
while by default Rust's flate2 library uses a rust port of [miniz][1].
The 'logic' in the CLI was good, but miniz does not appear to flush
decompressed data as nicely on SYNC'd boundaries as zlib does, which
caused data to 'stall'. Telling the flate2 crate to use the native
bindings fixed this.

This could also be the cause of the flakiness occasionally seen on idle
tunnel connections!

[1]: https://github.com/richgel999/miniz
2023-08-28 21:51:04 +02:00
Connor Peet ac0d0a89c8
cli: adopt latest devtunnels for ipv6 forwarding support (#191236) 2023-08-24 19:53:05 +02:00
Connor Peet 1fe8359ed0
cli: implement 'server of server' for a local web server (#191014)
Closes https://github.com/microsoft/vscode/issues/168492

This implements @aeschli's 'server server' concept in a new
`code serve-web` command.

Command line args are similar to the standalone web server. The first
time a user hits that page, the latest version of the VS Code web server
will be downloaded and run. Thanks to Martin's previous PRs, all
resources the page requests are prefixed with `/<quality-<commit>`.

The latest release version is cached, but when the page is loaded again
and there's a new release, a the new server version will be downloaded
and started up.

Behind the scenes the servers all listen on named pipes/sockets and the
CLI acts as a proxy server to those sockets. Servers without connections
for an hour will be shut down automatically.
2023-08-22 17:29:51 -07:00
Connor Peet 52840e3ca5
cli: cleanup build (#190213)
- Remove the `prepare` script entirely
- Variables are now populated from the product.json during build. Most
  variables are mapped automatically, with some special handling in a
	few cases. `build.rs` is now much more self-contained.
- Look for the `product.overrides.json` for vscode developers instead of
  looking for a peer `vscode-distro` folder

Fixes #178691
2023-08-10 20:14:30 -07:00
Connor Peet 0d22bb7efa
cli: update dependencies for s360 (#189562)
* cli: update dependencies for s360

* update rust
2023-08-03 18:05:46 +01:00
Connor Peet 75c2f321b2
cli: update dependencies (#184189)
Up all the dependencies! Notably:

- russh to the latest main now that tunnel changes are merged
- secret-service-rs to 3.x and dropping our custom fork
- which also fixes SDL pings

Fixes https://github.com/microsoft/vscode-internalbacklog/issues/4328
Fixes https://github.com/microsoft/vscode-internalbacklog/issues/4077
2023-06-02 10:27:47 -07:00
Connor Peet 679bb967c3
cli: add stdio control server
* signing: implement signing service on the web

* wip

* cli: implement stdio service

This is used to implement the exec server for WSL. Guarded behind a signed handshake.

* update distro

* rm debug

* address pr comments
2023-05-19 17:19:52 +02:00
Connor Peet f743297aa1
cli: add acquire_cli (#179837)
* cli: add acquire_cli

As given in my draft document, pipes a CLI of the given platform to the
specified process, for example:

```js
const cmd = await rpc.call('acquire_cli', {
	command: 'node',
	args: [
		'-e',
		'process.stdin.pipe(fs.createWriteStream("c:/users/conno/downloads/hello-cli"))',
	],
	platform: Platform.LinuxX64,
	quality: 'insider',
});
```

It genericizes caching so that the CLI is also cached on the host, just
like servers.

* fix bug
2023-04-13 19:18:48 +01:00
Connor Peet 2d8ff25c85
cli: add streams to rpc, generic 'spawn' command (#179732)
* cli: apply improvements from integrated wsl branch

* cli: add streams to rpc, generic 'spawn' command

For the "exec server" concept, fyi @aeschli.

* update clippy and apply fixes

* fix unused imports :(
2023-04-12 16:51:29 +01:00
Connor Peet 0e7d14d32d
cli: allow client process to control singleton process (#177141)
Other connected clients will now print:

```
Connected to an existing tunnel process running on this machine. You can press:

- Ctrl+C to detach
- "x" to stop the tunnel and exit
- "r" to restart the tunnel
```

These are then sent to the server to have that take effect. This is
mostly some refactors in the singleton_server to make the lifecycle work.
2023-03-14 17:55:28 -07:00
Connor Peet 1b5fd140fb
Run tunnels as singleton process (for a --cli-data-dir) (#177002)
* wip on singleton

* wip

* windows support

* wip

* wip

* fix clippy
2023-03-14 08:09:47 -07:00
Connor Peet 863b9261a3
cli: bump tempfile->remove_dir_all for cve (#176206) 2023-03-06 10:10:01 +01:00
Connor Peet 26fe31fc66
update openssl-prebuild for musl failures (#175731)
* update openssl-prebuild for musl failures

* reapply vendoring

* reapply macos pipeline fix
2023-03-01 08:57:45 +01:00
Connor Peet f8119e9beb
Revert "cli: fix static import of openssl (#175681)" (#175727)
This reverts commit 7014a17b1f.
2023-03-01 07:43:32 +01:00
Connor Peet 7014a17b1f
cli: fix static import of openssl (#175681)
* cli: fix static import of openssl

* update dev tunnels
2023-02-28 11:20:58 -08:00
Martin Aeschlimann beb9ed3758
update tokio (#173784) 2023-02-08 17:10:14 +07:00
Connor Peet b5aa3e0a3d
cli: use better approach to Windows services (#172679)
Fixes #167741

This eschews the offical Windows service system in favor of registering
into `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run`.
Unlike services, this can be done without administrative permissions,
does not require the current username/password, and is not blocked by
miscellaneous and mysterious system policies.

Since the process is basically unmanaged by the OS, this requires a
little legwork to start and stop the process when registering and
unregistering.
2023-01-27 15:04:56 -08:00
Connor Peet 4a9bf44941
Merge pull request #171894 from microsoft/connor4312/nosleep-windows
cli: implement --no-sleep for windows
2023-01-21 15:24:19 -08:00
Connor Peet bcc8232721
fix: build on windows (#171892)
🙈
2023-01-21 14:05:37 +09:00
Connor Peet 758bc69404
cli: implement --no-sleep for windows 2023-01-20 18:57:11 -08:00
Connor Peet 4cf496e905
cli: add --no-sleep flag, implementation for macos (#171885)
First part of https://github.com/microsoft/vscode-remote-release/issues/7127
2023-01-20 15:42:09 -08:00
Connor Peet 2c2ead679b
cli: initial wsl control server
Adds an stdin/out json rpc server for wsl.

Exposes a singular install_local command to install+boot the vscode server on a port from a local archive.

Also refines the common rpc layer some more. I'm decently happy with it now.
2023-01-18 08:23:04 -08:00
dependabot[bot] 2584c4b68b
Bump tokio from 1.21.2 to 1.23.1 in /cli (#170729)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.21.2 to 1.23.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.21.2...tokio-1.23.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 08:18:25 -08:00
Connor Peet adcffbdce9
cli: use connection token for CLI connections (#167426)
This uses a hash of the tunnel ID to create the connection token, which
should be sufficient to resolve the issues.

We also now publish the protocol version in the tunnel tags, since the
connection token must be supplied in the resolver, which is before we
start connecting to the tunnel.

See https://github.com/microsoft/vscode-internalbacklog/issues/3287
2022-11-28 18:03:15 +01:00
Connor Peet 94ee5f5861
cli: automatically use distro qualities if available (#166961)
A fully-functioning CLI with tunnel capabilities requires product-specific
configuration that is not included in the OSS. This change has the CLI's build
script automatically look for a peer `vscode-distro` folder and, in a debug
build, set its build variables based on that.

It also works to set correct variables if vscode-distro is not found, based on
the OSS product.json (though this is not sufficient to run a fully fledged
tunnel.)
2022-11-22 06:13:16 -08:00
Connor Peet 796ee2bf3c
chore: pull more strings from the product.json (#166769)
Fixes the bulk of https://github.com/microsoft/vscode-cli/issues/560
2022-11-18 18:52:52 -08:00
Connor Peet c47751948c
cli: add service integration for systemd (#166328)
systemd, like most 'modern' linux components, has a nice dbus API. This uses
that API to register the tunnel as a service of the calling user.

The dbus dependency is temporarily duplicated, until secret-service 3 is
released, where they update to the latest version (should be a week or two).

For https://github.com/microsoft/vscode-cli/issues/367. Next up, macOS,
then it's done :)
2022-11-14 21:39:05 -08:00
Connor Peet c536595a7f
cli: fallback to system installs in the standalone CLI
The standalone CLI should detect and fall back to using and
system-installed VS Code instance, rather than trying to download zips
and manage its own VS Code instances.

There are three approaches used for discovery:

- On Windows, we can easily and quickly read the register to find
  installed versions based on their app ID.
- On macOS, we initially look in `/Applications` and fall back to the
  slow `system_profiler` command to list app .app's if that fails.
- On Linux, we just look in the PATH. I believe all Linux installers
  (snap, dep, rpm) automatically add VS Code to the user's PATH.

Failing this, the user can also manually specify their installation dir,
using the command `code version use stable --install-dir /path/to/vscode`.

Fixes #164159
2022-10-20 10:54:13 -07:00
Connor Peet 75dfb8993e
Merge branch 'main' into connor4312/cli-self-update 2022-10-17 11:15:23 -07:00
Connor Peet cb1b7ec10b
temporarily disable secret-service pending update 2022-10-17 11:13:51 -07:00
Connor Peet 4772a823d4
cli: fix linux build
This contains the following changes:

https://github.com/hwchen/secret-service-rs/compare/v2.0.2...microsoft:vscode-secret-service-rs:2.0.2-openssl

Previously I had secret-service pulling in patches made against `main`
of secret-service-rs, but that is a newer, not-yet-published 3.x version
that was not compatible. I've now backported the necessary changes
(using openssl for SDL compliance) on the last 2.x release.
2022-10-17 09:43:48 -07:00
Connor Peet 84439a87f6
wip 2022-10-14 15:46:49 -07:00
Connor Peet a2dd71c0fe
cli: use openssl for all crypto-related activities
For compliance with SDL and MSFT crypto standards. Right now this uses
our forks of russh and secret-service. russh seems amenable to getting
this merged (https://github.com/warp-tech/russh/pull/52) but TBD about
the secret-service crate.

Fixes https://github.com/microsoft/vscode-internalbacklog/issues/3158
2022-10-14 11:09:31 -07:00
Connor Peet 9bcc88eafe
cli: get builds in order 2022-09-23 13:28:26 -07:00
Connor Peet 5b24e93b35
cli: update problematic dependencies 2022-09-20 08:57:55 -07:00
Connor Peet 3762635fe1
move cli to top level 2022-09-20 08:42:44 -07:00
Renamed from src/cli/Cargo.toml (Browse further)