* Stop generating shrinkwraps
npm 12 removes support for shrinkwraps. Additionally, VS Code has
switched to pnpm and this will make generating the shrinkwraps less
straightforward.
Exact pins in the package.json would not be a sufficient replacement
since that does not cover transitive dependencies.
The recommendation for end user packages installed globally with npm
seems to be to be to bundle dependencies.
One idea would be to build for every platform and bundle them all, but
the whole reason we have the npm package is to support platforms for
which we are not building. If we build them, we could just add a
regular release for that platform on GitHub.
So instead for each native module we would need to add rebuild commands
in the postinstall. And ideally remove the current platform builds to
at least try keeping the tarball size down.
I am not sure it is worth the effort for what it feels like fighting
with npm, so this change does not attempt that.
* Remove devDependencies from extensions package.json
Not strictly necessary since we only install production dependencies in
the postinstall, but might as well save some bytes.
* Update Code to 1.146.0
* Support pnpm for post-install
* Get Node version from package.json
lib/vscode/remote/.npmrc no longer exists
* Switch to pnpm
VS Code recently switched to pnpm so various scripts needed to be
updated, and we might as well follow suite with code-server's own
dependencies.
In general this change just swaps out "npm" invocations for "pnpm" plus
any necessary flag changes to match but to call out some less obvious
changes:
1. The extensions directory no longer has a post-install script, so
there is no need to copy one anymore.
2. When merging the remote package.json, only copy the dependencies
since that is all we need, to avoid copying in new properties like
packageManager.
3. Remove unused publish:npm. It points to a nonexistent file anyway.
4. Remove publish:docker and just call the script directly, to avoid an
npm/pnpm dependency in a job that really has no need for it.
* Update nfpm maintainer
The base path of /proxy/<port> requests was computed by splitting the
request path on path.sep, which is a backslash on Windows, so the whole
path became the base. Requests were proxied to / on the target port and
redirects were rewritten against the wrong base. URL paths always use /.
authenticateOrigin() lowercases the host of the origin and
isTrustedOrigin() lowercases the domain of *.example.com entries, but
exact entries were compared as written, so an entry with an uppercase
letter (for example a Windows host name like DESKTOP-ABC123:8080) never
matched and requests from that origin were refused.
The browser writes some workspace files to the client disk during normal
use. The webview service worker stores resources that have an ETag in
Cache Storage, and responses from /vscode-remote-resource can end up in
the HTTP disk cache. --disable-file-downloads does not cover either.
With --disable-file-cache, the webview resource loader sends no ETag for
a resource outside the webview's own extension, so the service worker
does not store it. /vscode-remote-resource responds with
`Cache-Control: no-store` for files outside the extension directories.
Extension files keep their ETags, so webviews still load extension code
from the cache. The flag is off by default.
The --socket-fd flag never worked. The wrapper forks the process that
listens, but only the IPC channel was inherited as fd 3, so the socket
passed by the caller was not available to the child. Node then tried to
listen on the IPC pipe and failed with "listen EEXIST".
Pass the socket to the child as stdio entry 4 and tell the child to use
that fd in the handshake.
Node also reports no address for a Unix socket adopted by fd, which made
startup fail with "Server has no address". Log the listener as fd:<n>
in that case.
Add an integration test that starts the code-server binary with a Unix
or TCP socket as fd 3 and checks that /healthz answers over it.
The origin check compared the host header to the origin's host as plain
strings, so `example.com:443` did not match `https://example.com`, and a
proxy forwarding `$host` (no port) together with X-Forwarded-Port failed
on any non-default port.
Default ports (80 for http, 443 for https) are now treated as no port,
and when X-Forwarded-Host has no port the port from X-Forwarded-Port is
used. Everything else is still an exact match. getHost() is unchanged
for the domain proxy.
The shell expands ~ in command-line arguments, but values read from
config.yaml were passed to path.resolve as-is, so
`user-data-dir: ~/.config/code-server-data` resolved to
`<cwd>/~/.config/code-server-data`.
Options like `enable-remote-storage: false` in config.yaml are converted to
`--enable-remote-storage=false`, but the parser set any boolean option to
true regardless of its value. Booleans set to false are now ignored, the
same way optional strings set to false already are.
* Update Code to 1.139.1
* Bump proxy-addr to 2.0.8
* Add preinstall setup to build
Already had this in the release build step, not sure why it is not in
the main build step. But we started getting errors building native
modules in ci, and this seems to be why.
* Fix quick input
It types too quickly, before the input is visible.
The lower bound check ran before the parser had resolved the value, so it
only saw a value with the --idle-timeout-seconds=<value> form. With the
space-separated form the value was still undefined at that point,
Number(undefined) is NaN, and NaN <= 60 is false, so anything got through.
Move the check below the block that pulls the value from the next
argument so both forms are validated the same way.
* Update Code to 1.136.1
* Do not click on tab during test file opens
It will already be the selected tab, and if any other tab is already
open (like the welcome tab), it will click that instead.
We disable the welcome page so this is not supposed to actually matter,
but that Setting appears not to be working.
Also add the quick input widget selector in the disabled downloads test,
since if the widget never shows up it would mistakenly pass.
We use the cookie parser to remove the code-server token but by default
it encodes using encodeURIComponent, which encodes more than is strictly
necessary and can break proxied applications.
Now we pass the cookies through unchanged (other than removing the
code-server token).
Fixes#7927.
- Get rid of the global isActive mock; in particular the way it shadows
local ones seemed sketchy.
- No need for requireActual from my testing.
- Reword the comment for why we need setImmediate.
- Add the setImmediate to another test that seemed to only pass because
of an await on the timer call which is not actually a promise but had
the side effect of yielding.
- Always set fake/real timers in the before/after handlers and never in
individual tests.
Since this functionality requires information placed onto the request by
code-server (req.args) and Express (req.cookies), move the standalone
tests into the integration tests as the proxy can no longer run
correctly on its own without that context.
We could strip the header elsewhere or refactor in some way (pass in a
callback function for the stripping or something) but this seems like
the simplest and safest place at the moment to ensure we catch all uses
of the proxy.
In any case, I think it does lend more confidence to know we are testing
the proxy the way it will be used in practice. The downside is some
additional complexity when setting up tests, but at the moment I do not
think that exchange is overly burdensome.
* Update Code to 1.116.0
* Add copilot extension build
Seems the vscode build requires this separately now.
* Disable welcome popup
A giant modal window asking you to sign in for AI features is blocking
the tests. Rather than have to click through it, disable it. It looks like
this has to be a user setting, so switch to that instead of machine (we
used machine because user settings were in the browser, but they have
been since moved back to disk).
---------
Co-authored-by: Asher <ash@coder.com>
* feat: expose --reconnection-grace-time CLI flag
Pass through VS Code Server's --reconnection-grace-time argument,
allowing users to configure how long the server waits for a
disconnected client to reconnect before cleaning up the session.
This is useful for users whose client machines sleep overnight, causing
the default 3-hour grace period to expire and forcing a "Reload Window"
on wake. The flag can also be set via CODE_SERVER_RECONNECTION_GRACE_TIME
env var or in config.yaml.