Archived
1
0
Commit Graph

114 Commits

Author SHA1 Message Date
946e4e8843 feat(cli): add test for readSocketPath (#4284)
* fix: update isNodeJSErrnoException

* refactor(cli): export and purify readSocketPath

* feat: add tests for readSocketPath

* fix(ci): temporarily disable install deps from cache
2021-10-29 16:03:57 -07:00
705e821741 fix(testing): revert change & fix playwright tests (#4310)
* fix(testing): revert change & fix playwright tests

* fix(constants): add type to import statement

* refactor(e2e): delete browser test

This test was originally added to ensure playwright was working.

At this point, we know it works so removing this test because it doesn't help
with anything specific to code-server and only adds unnecessary code to the
codebase plus increases the e2e test job duration.

* chore(e2e): use 1 worker for e2e test

I don't know if it's a resources issue, playwright, or code-server but it seems
like the e2e tests choke when multiple workers are used.

This change is okay because our CI runner only has 2 cores so it would only use
1 worker anyway, but by specifying it in our playwright config, we ensure more
stability in our e2e tests working correctly.

See these PRs:
- https://github.com/cdr/code-server/pull/3263
- https://github.com/cdr/code-server/pull/4310

* revert(vscode): add missing route with redirect

* chore(vscode): update to latest fork

* Touch up compilation step.

* Bump vendor.

* Fix VS Code minification step

* Move ClientConfiguration to common

Common code must not import Node code as it is imported by the browser.

* Ensure lib directory exists before curling

cURL errors now because VS Code was moved and the directory does not
exist.

* Update incorrect e2e test help output

Revert workers change as well; this can be overridden when desired.

* Add back extension compilation step

* Include missing resources in release

This includes a favicon, for example.  I opted to include the entire
directory to make sure we do not miss anything.  Some of the other
stuff looks potentially useful (like completions).

* Set quality property in product configuration

When httpWebWorkerExtensionHostIframe.html is fetched it uses the web
endpoint template (in which we do not include the commit) but if the
quality is not set it prepends the commit to the web endpoint instead.
The new static endpoint does not use/handle commits so this 404s.

Long-term we might want to make the new static endpoint use commits like
the old one but we will also need to update the various other static
URLs to include the commit.

For now I just fixed this by adding the quality since:
  1. Probably faster than trying to find and update all static uses.
  2. VS Code probably expects it anyway.
  3. Gives us better control over the endpoint.

* Update VS Code

This fixes several build issues.

* Bump vscode.

* Bump.

* Bump.

* Use CLI directly.

* Update tests to reflect new upstream behavior.

* Move unit tests to after the build

Our code has new dependencies on VS Code that are pulled in when the
unit tests run.  Because of this we need to build VS Code before running
the unit tests (as it only pulls built code).

* Upgrade proxy-agent dependencies

This resolves a security report with one of its dependencies (vm2).

* Symlink VS Code output directory before unit tests

This is necessary now that we import from the out directory.

* Fix issues surrounding persistent processes between tests.

* Update VS Code cache directories

These were renamed so the cached paths need to be updated.  I changed
the key as well to force a rebuild.

* Move test symlink to script

This way it works for local testing as well.

I had to use out-build instead of out-vscode-server-min because Jest
throws some obscure error about a handlebars haste map.

* Fix listening on a socket

* Update VS Code

It contains fixes for missing files in the build.

* Standardize disposals

* Dispose HTTP server

Shares code with the test HTTP server.  For now it is a function but
maybe we should make it a class that is extended by tests.

* Dispose app on exit

* Fix logging link errors

Unfortunately the logger currently chokes when provided with error
objects.

Also for some reason the bracketed text was not displaying...

* Update regex used by e2e to extract address

The address was recently changed to use URL which seems to add a
trailing slash when using toString, causing the regex match to fail.

* Log browser console in e2e tests

* Add base back to login page

This is used to set cookies when using a base path.

* Remove login page test

The file this was testing no longer exists.

* Use path.posix for static base

Since this is a web path and not platform-dependent.

* Add test for invalid password

Co-authored-by: Teffen Ellis <teffen@nirri.us>
Co-authored-by: Asher <ash@coder.com>
2021-10-28 15:27:17 -05:00
d8c344beda Refactor vscode endpoints to use fork directly. 2021-09-30 19:14:17 -04:00
6c95f72d2b refactor: make password param to defaultConfigFile 2021-09-28 16:13:13 -07:00
fb2625dbe8 chore(cli): export defaultConfigFile + add JSDoc 2021-09-28 15:38:59 -07:00
f84757507b feat: add tests for bindAddrFromArgs 2021-09-21 11:48:20 -07:00
a673cf2833 refactor: shouldRunVsCodeCli 2021-09-20 15:14:46 -07:00
1e55a648a5 feat: check for empty str in isHashMatch 2021-06-08 15:10:59 -07:00
8c2bb61af9 refactor: parse options with multiple = in cli
There was a case with the hashed-password which had multiple equal signs in the
value and it wasn't being parsed correctly. This uses a new function and adds a
few tests.
2021-06-08 14:33:17 -07:00
531b7c0c25 feat: add splitOnFirstEquals function 2021-06-08 14:33:16 -07:00
ffa5c16e51 feat: update cli and test for hashed-password 2021-06-08 14:33:15 -07:00
083400b50a Add flag to enable permessage-deflate 2021-05-05 12:24:34 -05:00
101c2a01f1 Fix tsc watch restarting when it shouldn't
It seems reaching into lib/vscode for the types caused tsc to establish
watches that caused it to restart over and over while vscode was
building.

The strategy used here is to symlink it instead which is the same thing
we do for the proxy agent.
2021-04-01 10:58:56 -05:00
b04104cafe Merge branch 'main' into jsjoeio/upgrade-vscode-1.54 2021-03-22 10:43:39 -07:00
a8e2ede4f5 chore(deps): bump js-yaml from 3.14.0 to 4.0.0 (#2920)
* chore(deps): bump js-yaml from 3.14.0 to 4.0.0

Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.14.0 to 4.0.0.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.14.0...4.0.0)

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

* fix(src/node): replace yaml.safeLoad with load

Also update @types/yaml to ^4.0.0.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Akash Satheesan <akash@coder.com>
2021-03-18 16:30:10 -05:00
071c8e15fc Merge branch 'main' into jsjoeio/upgrade-vscode-1.54 2021-03-17 13:51:27 -07:00
45a1713767 Merge pull request #2906 from bpmct/rename-cloud
rename references of "coder could"
2021-03-17 18:28:14 +00:00
a097713829 remove references of coder could 2021-03-16 22:59:30 -04:00
0c2708302d refactor: remove --home flag/feature
We are removing this because it was removed upstream in PR~115599.
2021-03-16 14:25:28 -07:00
964ebe8d0a Replace fs-extra with fs.promises
Remove the Mac directory copy instead of refactoring it since we've had
this for a long time now and I think it's safe to assume that users
running code-server on Mac don't have the old directory anymore.
2021-03-16 12:51:08 -05:00
c08e3bb06d Add /absproxy to remove --proxy-path-passthrough
See https://github.com/cdr/code-server/issues/2222#issuecomment-765235938

Makes way more sense.
2021-02-05 11:44:34 -05:00
5c06646f58 Formatting and linting fixes 2021-01-20 02:06:44 -05:00
240c8e266e test: Implement integration.ts for near full stack integration testing 2021-01-20 02:06:44 -05:00
f169e3ac66 pathProxy.ts: Implement --proxy-path-passthrough
Closes #2222
2021-01-20 02:06:43 -05:00
60c270aef5 cli: hashedPassword -> hashed-password (#2454)
Capital letters in the CLI are evil.

cc @code-asher
2020-12-18 12:20:38 -05:00
f8b782bd68 Move ignore-last-opened to ipc.d.ts
This is so it can be used in VS Code. Don't tell anyone but I forgot to
run `yarn ci`.
2020-12-15 11:14:21 -06:00
cc584f86b9 Merge pull request #2435 from cdr/issue-2328-customize-go-home
cli: add --home flag to customize "Go Home" button
2020-12-15 09:52:39 -07:00
f4ca41329a Add --ignore-last-opened option (#2434)
This allows bypassing the last opened behavior for certain cases where that's not desirable.

Fixes #1951
2020-12-15 10:22:58 -06:00
8daba6ca80 feat: add home as a cli option 2020-12-14 16:23:35 -07:00
affb92f281 cli: Show beta flags in help output
Looks like

```
   -r --reuse-window         Force to open a file or folder in an already opened window.
 -vvv --verbose              Enable verbose logging.
      --link                 (beta) Securely bind code-server via Coder Cloud with the passed name. You'll get a URL like
                             https://myname.coder-cloud.com at which you can easily access your code-server instance.
                             Authorization is done via GitHub.
```

Based on commits by @JammSpread in #2405

Closes #2396
2020-12-08 19:00:33 -05:00
6c693000eb Merge pull request #2405 from JammSpread/master
Modify --link arg and README (Cdr Cloud)
2020-12-08 18:30:34 -05:00
1dd7e4b4e1 Add hashedPassword config (#2409)
Resolve #2225.
2020-12-08 14:54:17 -06:00
JK
4d295e3195 Modify link arg and its desc to not be beta 2020-12-05 01:23:48 +00:00
cc18175ce3 cli: Add --disable-update-check flag
Closes #2361
2020-11-30 15:30:06 -05:00
e1702a1d21 Merge branch master into code-asher/ch1385 2020-11-12 11:52:02 -06:00
75b93f9dc5 Fix bind address priority
Broke when converting to a loop.
2020-11-04 17:07:24 -06:00
3a074fd844 Skip unnecessary auth type check when using --link 2020-11-03 14:30:34 -06:00
8a9e61defb Use Addr interface everywhere and loop over arg sources 2020-11-03 14:28:49 -06:00
bae28727bd src/node/cli.ts: Add --cert-host to configure generated certificate hostname 2020-10-30 13:36:53 -04:00
8e93e28162 Strip config file password from debug log 2020-10-20 16:18:28 -05:00
2928d362fa Move heart and AuthType out of http
This file is going to get blasted in favor of Express.
2020-10-20 16:18:24 -05:00
dcb303a437 Move argument defaults into setDefaults 2020-10-20 16:15:13 -05:00
466a04f874 Remove pointless use of openInFlagCount
It'll always be zero here.
2020-10-09 16:57:45 -05:00
e0769dc13a Move config file info log
Otherwise it outputs when trying to open a file in an existing instance
externally. Externally there isn't an environment variable to branch on
to skip this line so instead output it with the other info lines in the
child process.
2020-10-09 16:57:44 -05:00
fe19391c03 Read most recent socket path from file 2020-10-09 16:57:43 -05:00
021c084e43 Move log level defaults into setDefaults
This will allow cliArgs to be only the actual arguments the user passed
which will be used for some logic around opening in existing instances.
2020-10-09 16:57:42 -05:00
1902296702 Remove references to --open-in flag 2020-10-09 16:57:41 -05:00
0a8e71c647 Refactor wrapper
- Immediately create ipcMain so it doesn't have to be a function which I
  think feels cleaner.
  - Move exit handling to a separate function to compensate (otherwise
    the VS Code CLI for example won't be able to exit on its own).
- New isChild prop that is clearer than checking for parentPid (IMO).
- Skip all the checks that aren't necessary for the child process (like
  --help, --version, etc).
  - Since we check if we're the child in entry go ahead and move the
    wrap code into entry as well since that's basically what it does.
- Use a single catch at the end of the entry.
- Split out the VS Code CLI and existing instance code into separate
  functions.
2020-10-09 16:57:40 -05:00
d67bd3f604 cloud: Rename --coder-bind to --link 2020-10-09 12:57:20 -04:00
a5b6d080bd Add CS_BETA and note --coder-bind is in beta 2020-10-09 07:50:51 -04:00