Compare commits

...

120 commits

Author SHA1 Message Date
Asher
472bf8a5fa
Remove homebrew step
It has been broken for a long time (No available formula with the name
"code-server") but it looks like they have their own bot publishing
updates anyway.
2025-12-02 13:38:27 -09:00
dependabot[bot]
eccb1eb537
chore: bump actions/setup-node from 4 to 6 (#7550) 2025-12-02 13:04:45 -09:00
Asher
f128a7ac11
Update actionlint to 1.7.9 2025-12-01 12:55:13 -09:00
Asher
80996d2e08
Add VS Code web to the bug template 2025-12-01 12:49:28 -09:00
dependabot[bot]
9819b91c74
chore: bump actions/checkout from 5 to 6 (#7585) 2025-12-01 12:47:25 -09:00
Olivier Benz
2ed1098c1e
Update Code to 1.106.3 (#7583) 2025-12-01 11:52:45 -09:00
Asher
85042e2910
Note settings change from VS Code web and Codespaces 2025-11-25 14:39:16 -09:00
Asher
904942a194
Increase build timeout 2025-11-19 14:02:53 -09:00
Olivier Benz
9a24e467b2
Update Code to 1.106.2 (#7571) 2025-11-19 12:54:38 -09:00
Olivier Benz
24a777491b
Update Code to 1.106.1 (#7570) 2025-11-19 09:09:30 -09:00
Asher
93c1f4f10c
Update macOS runner
Seems macos-13 is being deprecated.
2025-11-18 13:25:39 -09:00
Olivier Benz
339c3926c2
Update Code to 1.106.0 (#7569) 2025-11-18 11:21:41 -09:00
dependabot[bot]
897b5f13bc
chore: bump playwright and @playwright/test in /test (#7534) 2025-10-28 16:14:42 -08:00
SuitDeer
282f74d9f5
Update Node.js version in Android docs from 18 to 22 (#7542) 2025-10-28 16:14:17 -08:00
dependabot[bot]
7a2a5eb055
chore: bump eslint from 9.32.0 to 9.36.0 (#7513) 2025-10-28 16:13:34 -08:00
dependabot[bot]
af397f71e2
chore: bump globals from 16.1.0 to 16.4.0 (#7511) 2025-10-28 16:13:15 -08:00
dependabot[bot]
9d89b17fd7
chore: bump express and @types/express (#7510) 2025-10-28 16:12:45 -08:00
dependabot[bot]
35e7b09a85
chore: bump actions/checkout from 4 to 5 (#7508) 2025-10-28 16:12:00 -08:00
dependabot[bot]
7beb05d04f
chore: bump aquasecurity/trivy-action from 0.32.0 to 0.33.1 (#7507) 2025-10-28 16:11:42 -08:00
dependabot[bot]
add51d5c5b
chore: bump actions/download-artifact from 4 to 5 (#7506) 2025-10-28 16:11:23 -08:00
Andrew Baldwin
db8a41bce1
Add idle timeout (#7539) 2025-10-28 16:10:56 -08:00
Olivier Benz
811ec6c1d6
Update Code to 1.105.1 (#7531) 2025-10-17 14:32:32 -08:00
Olivier Benz
30321abfcd
Update Code to 1.105.0 (#7523) 2025-10-14 13:26:57 -08:00
Olivier Benz
cd40509fbb
Update Code to 1.104.3 (#7515) 2025-10-03 10:48:01 -08:00
Asher
9fd98d58e7
Release v4.104.1 and v4.104.2 2025-10-01 14:15:07 -08:00
Olivier Benz
b0992ddb3e
Update Code to 1.104.2 (#7503) 2025-09-26 10:36:08 -08:00
Olivier Benz
af19dedfa9
Update Code to 1.104.1 (#7495) 2025-09-19 10:01:30 -08:00
Asher
d1066af558
Release v4.104.0 2025-09-15 14:36:47 -08:00
Olivier Benz
ba774d989b
Update Code to 1.104.0 (#7488) 2025-09-12 12:41:54 -08:00
Jinvien
1a7b770f5b
Fix installing extensions from the Open VSX marketplace (#7479)
Open VSX uses a non-standard format for the `/latest` URL which must be added to the gallery config.
2025-09-11 14:26:49 -08:00
Anthony
626145cf66
Allow custom annotation to deployment (#7481) 2025-09-11 14:24:57 -08:00
Asher
b59a4f7366
Release v4.103.1 and v4.103.2 2025-08-28 11:55:58 -08:00
Olexandr88
54b33a75e0
Add Discord link to readme (#7465) 2025-08-25 10:32:11 -08:00
Olivier Benz
3c5deac16d
Update Code to 1.103.2 (#7463) 2025-08-25 09:32:20 -08:00
Olivier Benz
fbaadbcfbc
Update Code to 1.103.1 (#7459) 2025-08-15 12:31:17 -08:00
Asher
2bbb6e8cca
Release v4.103.0 2025-08-12 14:31:17 -08:00
Olivier Benz
f1236d80b9
Update Code to 1.103.0 (#7458) 2025-08-08 17:10:23 -08:00
dependabot[bot]
b27d982c67
chore: bump prettier from 3.4.2 to 3.6.2 (#7407) 2025-08-04 12:46:32 -08:00
Asher
3f23840756 Remove import from express-serve-static-core
Mostly because express-serve-static-core is an implicit dependency.  We
could make it explicit, but the type we imported from it is just an
alias for qs.ParsedQs anyway.
2025-08-04 12:26:46 -08:00
Asher
e54467fb85 Run npm audit fix 2025-08-04 12:26:46 -08:00
Asher
8f738d29f2 Remove unused supertest dependency 2025-08-04 12:26:46 -08:00
Asher
5c0ff5013f Remove direct safe-buffer dependency
We do not use it directly.
2025-08-04 12:26:46 -08:00
dependabot[bot]
8a378df6e5
chore: bump eslint-import-resolver-typescript from 3.8.3 to 4.4.4 (#7404) 2025-08-04 11:37:04 -08:00
dependabot[bot]
a7e77ce4af
chore: bump dawidd6/action-download-artifact from 10 to 11 (#7409)
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 10 to 11.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](https://github.com/dawidd6/action-download-artifact/compare/v10...v11)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-version: '11'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-04 11:35:59 -08:00
dependabot[bot]
794def9a77
chore: bump on-headers and compression (#7427)
Bumps [on-headers](https://github.com/jshttp/on-headers) to 1.1.0 and updates ancestor dependency [compression](https://github.com/expressjs/compression). These dependencies need to be updated together.


Updates `on-headers` from 1.0.2 to 1.1.0
- [Release notes](https://github.com/jshttp/on-headers/releases)
- [Changelog](https://github.com/jshttp/on-headers/blob/master/HISTORY.md)
- [Commits](https://github.com/jshttp/on-headers/compare/v1.0.2...v1.1.0)

Updates `compression` from 1.8.0 to 1.8.1
- [Release notes](https://github.com/expressjs/compression/releases)
- [Changelog](https://github.com/expressjs/compression/blob/master/HISTORY.md)
- [Commits](https://github.com/expressjs/compression/compare/1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: on-headers
  dependency-version: 1.1.0
  dependency-type: indirect
- dependency-name: compression
  dependency-version: 1.8.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-04 11:33:51 -08:00
Asher
b5a2ce2522
Use error handler in session server (#7455) 2025-08-04 11:05:48 -08:00
dependabot[bot]
bc15fa461c
chore: bump form-data in /test (#7430)
---
updated-dependencies:
- dependency-name: form-data
  dependency-version: 4.0.4
  dependency-type: indirect
- dependency-name: form-data
  dependency-version: 4.0.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-04 10:31:50 -08:00
dependabot[bot]
1805daed07
chore: bump aquasecurity/trivy-action from 0.31.0 to 0.32.0 (#7450)
Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.31.0 to 0.32.0.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](76071ef0d7...dc5a429b52)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-version: 0.32.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-04 10:31:21 -08:00
Olivier Benz
6f3d0a7e5a
Update Code to 1.102.3 (#7444) 2025-07-30 11:28:34 -08:00
Asher
b1ad6ffcb9
Release v4.102.2 2025-07-24 14:08:12 -08:00
Olivier Benz
9f6d18ea26
Update Code to 1.102.2 (#7436) 2025-07-24 12:07:27 -08:00
Sheldon Tsen
fe7db4900a
Update values.yaml to better support dind (#7431) 2025-07-22 09:17:44 -08:00
Asher
84728f0b21
Release v4.102.1 2025-07-17 13:25:16 -08:00
Asher
aaf2d91a21
Deleted unused and outdated afdesign file 2025-07-17 13:25:15 -08:00
Olivier Benz
47e9d43922
Update Code to 1.102.1 (#7424) 2025-07-17 10:55:37 -08:00
Asher
f26309a23c
Release v4.102.0 2025-07-16 18:56:42 -08:00
Asher
0f9a0e8fb3
Revert escaping for i18n strings
Looks like the library already escapes, so we were getting double
escaping.
2025-07-16 18:10:11 -08:00
Asher
4029c1ec8f
Use Debian archives
Looks like buster has reached the end of its life, but updating to
bullseye would increase the glibc version.
2025-07-15 15:03:43 -08:00
dependabot[bot]
bbe1b7fecb
chore: bump i18next from 23.16.4 to 25.3.0 (#7406)
Bumps [i18next](https://github.com/i18next/i18next) from 23.16.4 to 25.3.0.
- [Release notes](https://github.com/i18next/i18next/releases)
- [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next/compare/v23.16.4...v25.3.0)

---
updated-dependencies:
- dependency-name: i18next
  dependency-version: 25.3.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-15 12:40:04 -08:00
dependabot[bot]
740a2d3aa3
chore: bump aquasecurity/trivy-action from 0.30.0 to 0.31.0 (#7408)
Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.30.0 to 0.31.0.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](6c175e9c40...76071ef0d7)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-version: 0.31.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-15 12:39:08 -08:00
Alex Strick van Linschoten
92fca0dcc3
Add language customization flag (#7374)
This allows you to customize any string (that has a translation) or add your own translations.
2025-07-15 12:38:27 -08:00
Frank Lemanschik
8b3d9b9e0a
Use native node -p to get exec path (#7420) 2025-07-15 12:08:37 -08:00
Olivier Benz
cdac5bff64
Update Code to 1.102.0 (#7418)
* Update Code to 1.102.0
* Increase maximum memory for building
2025-07-15 12:04:46 -08:00
Asher
70be9fe541
Add non-maskable PWA icons
It seems Chromium cannot use maskable icons.  It complains that the
"purpose" must contain "any", however maskable icons are not suitable
for the "any" purpose.

So, add pre-masked icons to be used for the "any" purpose.
2025-07-07 14:40:01 -08:00
Asher
729456b10d
Release v4.101.2 2025-07-07 14:20:38 -08:00
Asher
aff005e196
Update Code to 1.101.2 2025-06-25 11:43:13 -08:00
Asher
53dccbb5ca
Report if using hashed-password from config 2025-06-25 11:20:25 -08:00
Asher
1b1440ffd2
Update logo 2025-06-25 10:32:43 -08:00
Asher
c5c764d78f
Do not use module type for service worker
It seems that this causes browser to not send cookies, which can result
in a 401.

Fixes #7389.
2025-06-25 10:32:35 -08:00
Asher
3a8fbeb4da
Release v4.101.0 and v4.101.1 2025-06-25 10:32:09 -08:00
Olivier Benz
bd34cd510f
Update Code to 1.101.1 (#7383) 2025-06-20 16:08:36 -08:00
Asher
27a112c3a7
Upgrade brace-expansion sub-dependency
Courtesy of `npm audit fix`.
2025-06-16 17:00:51 -08:00
dependabot[bot]
74cc50d5e6
chore: bump qs from 6.13.0 to 6.14.0 (#7363)
Bumps [qs](https://github.com/ljharb/qs) from 6.13.0 to 6.14.0.
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.13.0...v6.14.0)

---
updated-dependencies:
- dependency-name: qs
  dependency-version: 6.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-16 15:32:23 -08:00
dependabot[bot]
85ee441006
chore: bump typescript from 5.6.2 to 5.8.3 (#7335)
* chore: bump typescript from 5.6.2 to 5.8.3

Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.6.2 to 5.8.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release-publish.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.2...v5.8.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 5.8.3
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

* as T

* Update JSON error

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Asher <ash@coder.com>
2025-06-16 15:32:00 -08:00
dependabot[bot]
a56769b2c3
chore: bump heyhusen/archlinux-package-action from 2.2.1 to 2.4.0 (#7362)
Bumps [heyhusen/archlinux-package-action](https://github.com/heyhusen/archlinux-package-action) from 2.2.1 to 2.4.0.
- [Release notes](https://github.com/heyhusen/archlinux-package-action/releases)
- [Changelog](https://github.com/heyhusen/archlinux-package-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/heyhusen/archlinux-package-action/compare/v2.2.1...v2.4.0)

---
updated-dependencies:
- dependency-name: heyhusen/archlinux-package-action
  dependency-version: 2.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-16 13:07:03 -08:00
dependabot[bot]
05d8904ec5
chore: bump dawidd6/action-download-artifact from 9 to 10 (#7361)
Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 9 to 10.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](https://github.com/dawidd6/action-download-artifact/compare/v9...v10)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-version: '10'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-16 13:06:23 -08:00
dependabot[bot]
3669c96c9c
chore: bump @types/compression from 1.7.5 to 1.8.0 (#7364)
Bumps [@types/compression](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/compression) from 1.7.5 to 1.8.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/compression)

---
updated-dependencies:
- dependency-name: "@types/compression"
  dependency-version: 1.8.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-16 13:05:03 -08:00
dependabot[bot]
37357b0142
chore: bump typescript-eslint from 8.29.0 to 8.33.0 (#7365)
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.29.0 to 8.33.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.33.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-version: 8.33.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-16 13:04:33 -08:00
Olivier Benz
405eb0f511
Update Code to 1.101.0 (#7376) 2025-06-16 13:03:47 -08:00
Jakub Domeracki
6e26dad1b1
fix: update GitHub Actions Runner images (#7379) 2025-06-16 12:04:57 -08:00
Asher
1671bf1c18
Release v4.100.3 2025-06-03 13:10:14 -08:00
Asher
1face85ad9
Sort some imports 2025-06-03 13:10:13 -08:00
Asher
9ec786b62a
Ask not to put "latest" in bug report
Maybe this will help...
2025-06-03 13:10:11 -08:00
Olivier Benz
409c64e0df
Update Code to 1.100.3 (#7367) 2025-06-03 11:06:54 -08:00
dependabot[bot]
35e78fe35b
chore: bump globals from 15.14.0 to 16.0.0 (#7333)
Bumps [globals](https://github.com/sindresorhus/globals) from 15.14.0 to 16.0.0.
- [Release notes](https://github.com/sindresorhus/globals/releases)
- [Commits](https://github.com/sindresorhus/globals/compare/v15.14.0...v16.0.0)

---
updated-dependencies:
- dependency-name: globals
  dependency-version: 16.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-19 12:09:04 -08:00
Asher
cade03e321
Release v4.100.1 and v4.100.2 2025-05-19 10:34:54 -08:00
Olivier Benz
9dd999ba78
Update Code to 1.100.2 (#7348) 2025-05-15 11:00:20 -08:00
Olivier Benz
1aca01f8d8
Update Code to 1.101 (#7347) 2025-05-13 14:07:46 -08:00
Asher
e05219d9c0
Release v4.100.0 2025-05-12 11:35:42 -08:00
Asher
d0e20d514d
Update devcontainer feature link
I think we meant to link to the feature readme rather than the general
repo readme.
2025-05-08 14:24:05 -08:00
Asher
9bd3b83ef5
Fix port parseInt error handling
parseInt returns NaN rather than throwing.
2025-05-08 14:21:17 -08:00
Olivier Benz
2c9b4e7fd5
Update Code to 1.100.0 (#7343) 2025-05-08 14:19:03 -08:00
Bartek Gatz
7af90ea623
Mention code-server devcontainer feature (#7342) 2025-05-06 14:49:38 -08:00
dependabot[bot]
8b55b5003d
chore: bump eslint from 9.23.0 to 9.25.1 (#7332)
Bumps [eslint](https://github.com/eslint/eslint) from 9.23.0 to 9.25.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.23.0...v9.25.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.25.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-06 11:34:30 -08:00
dependabot[bot]
e5b8d447e5
chore: bump @types/semver from 7.5.8 to 7.7.0 2025-05-06 11:34:09 -08:00
Asher
c8257a3074 Fix repeatable flags in config
Fixes #6149.
2025-05-06 11:28:45 -08:00
Asher
0c72b20fa7 Place locale and abs-proxy-base-path in correct interfaces 2025-05-06 11:28:45 -08:00
Asher
ea2caf00ac Allow setting trusted domains for links at run-time
It can be set either:

1. In the product.json (normally the product.json is embedded during the
   build and not read at run-time).
2. With the --link-protection-trusted-domains flag.
2025-05-06 11:28:45 -08:00
Asher
3f2e3340d8
Release v4.99.4 2025-05-05 11:56:00 -08:00
Kyle Carberry
47d6d3ada5
fix: parse part in path proxy (#7337) 2025-05-02 10:08:18 -08:00
Asher
dded82bb47
Release v4.99.3 2025-04-28 14:28:51 -08:00
Asher
5d5b7b1944
Use ubuntu-latest in Docker publish step
Seems 20.04 has been removed.
2025-04-17 10:46:50 -08:00
Olivier Benz
c36b2d3edd
Update Code to 1.99.3 (#7314) 2025-04-16 14:18:00 -08:00
dependabot[bot]
3b7634c578
chore: bump @babel/runtime from 7.25.7 to 7.27.0 (#7312)
Bumps [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime) from 7.25.7 to 7.27.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.27.0/packages/babel-runtime)

---
updated-dependencies:
- dependency-name: "@babel/runtime"
  dependency-version: 7.27.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-14 12:03:25 -08:00
partev
ec0899a81b
Remove extra closing parentheses from docs (#7309) 2025-04-14 11:27:44 -08:00
helgehatt
bbf2e24648
Add skip-auth-preflight flag to allow OPTIONS requests through proxy (#7284) 2025-04-14 11:27:02 -08:00
dependabot[bot]
9045919d2b
chore: bump robinraju/release-downloader from 1.11 to 1.12 (#7289)
Bumps [robinraju/release-downloader](https://github.com/robinraju/release-downloader) from 1.11 to 1.12.
- [Release notes](https://github.com/robinraju/release-downloader/releases)
- [Commits](https://github.com/robinraju/release-downloader/compare/v1.11...v1.12)

---
updated-dependencies:
- dependency-name: robinraju/release-downloader
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-14 11:01:03 -08:00
dependabot[bot]
cb29e65982
chore: bump proxy-agent from 6.4.0 to 6.5.0 (#7294)
Bumps [proxy-agent](https://github.com/TooTallNate/proxy-agents/tree/HEAD/packages/proxy-agent) from 6.4.0 to 6.5.0.
- [Release notes](https://github.com/TooTallNate/proxy-agents/releases)
- [Changelog](https://github.com/TooTallNate/proxy-agents/blob/main/packages/proxy-agent/CHANGELOG.md)
- [Commits](https://github.com/TooTallNate/proxy-agents/commits/proxy-agent@6.5.0/packages/proxy-agent)

---
updated-dependencies:
- dependency-name: proxy-agent
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-14 11:00:47 -08:00
dependabot[bot]
7eb8f4be87
chore: bump @eslint/eslintrc from 3.2.0 to 3.3.1 (#7292)
Bumps [@eslint/eslintrc](https://github.com/eslint/eslintrc) from 3.2.0 to 3.3.1.
- [Release notes](https://github.com/eslint/eslintrc/releases)
- [Changelog](https://github.com/eslint/eslintrc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslintrc/compare/v3.2.0...v3.3.1)

---
updated-dependencies:
- dependency-name: "@eslint/eslintrc"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-14 10:58:54 -08:00
dependabot[bot]
cd4d1b614d
chore: bump eslint from 9.13.0 to 9.23.0 (#7291)
Bumps [eslint](https://github.com/eslint/eslint) from 9.13.0 to 9.23.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.13.0...v9.23.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-14 10:58:42 -08:00
dependabot[bot]
5051c0f9e4
chore: bump typescript-eslint from 8.12.2 to 8.29.0 (#7290)
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.12.2 to 8.29.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.29.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: typescript-eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-14 10:58:33 -08:00
dependabot[bot]
b07335a0f1
chore: bump aquasecurity/trivy-action from 0.29.0 to 0.30.0 (#7288)
Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.29.0 to 0.30.0.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](18f2510ee3...6c175e9c40)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-14 10:57:40 -08:00
Asher
e3c09efcbc
Release v4.99.2 2025-04-11 11:42:17 -08:00
Olivier Benz
e0c960b30e
Update Code to 1.99.2 (#7306) 2025-04-10 11:13:29 -08:00
Asher
55b311a954
Release v4.99.1 2025-04-08 13:36:03 -08:00
Olivier Benz
0a92b76304
Update Code to 1.99.1 (#7304) 2025-04-08 10:51:30 -08:00
Asher
400ac7b8d0
Release v4.99.0 2025-04-07 16:52:11 -08:00
Olivier Benz
53722c5361
Update Code to 1.99.0 (#7300) 2025-04-04 10:22:23 -08:00
Olivier Benz
e2c489dd00 Update Code to 1.98.2 2025-03-14 10:58:50 -08:00
Olivier Benz
e1c84998d7 Update Code to 1.98.1 2025-03-12 10:30:45 -08:00
83 changed files with 2538 additions and 1438 deletions

View file

@ -20,6 +20,8 @@ body:
- **Remote OS**: Ubuntu - **Remote OS**: Ubuntu
- **Remote Architecture**: amd64 - **Remote Architecture**: amd64
- **`code-server --version`**: 4.0.1 - **`code-server --version`**: 4.0.1
Please do not just put "latest" for the version.
value: | value: |
- Web Browser: - Web Browser:
- Local OS: - Local OS:
@ -84,6 +86,18 @@ body:
validations: validations:
required: true required: true
- type: dropdown
attributes:
label: Does this bug reproduce in VS Code web?
description: If the bug reproduces in VS Code web, submit the issue upstream instead (https://github.com/microsoft/vscode). You can run VS Code web with `code serve-web`.
options:
- Yes, this is also broken in VS Code web
- No, this works as expected in VS Code web
- This cannot be tested in VS Code web
- I did not test VS Code web
validations:
required: true
- type: dropdown - type: dropdown
attributes: attributes:
label: Does this bug reproduce in GitHub Codespaces? label: Does this bug reproduce in GitHub Codespaces?

View file

@ -32,7 +32,7 @@ jobs:
helm: ${{ steps.filter.outputs.helm }} helm: ${{ steps.filter.outputs.helm }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Check changed files - name: Check changed files
uses: dorny/paths-filter@v3 uses: dorny/paths-filter@v3
id: filter id: filter
@ -64,8 +64,8 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions/setup-node@v4 - uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -82,8 +82,8 @@ jobs:
needs: changes needs: changes
if: needs.changes.outputs.docs == 'true' if: needs.changes.outputs.docs == 'true'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions/setup-node@v4 - uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -100,7 +100,7 @@ jobs:
needs: changes needs: changes
if: needs.changes.outputs.helm == 'true' if: needs.changes.outputs.helm == 'true'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: azure/setup-helm@v4 - uses: azure/setup-helm@v4
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@ -114,8 +114,8 @@ jobs:
needs: changes needs: changes
if: needs.changes.outputs.code == 'true' if: needs.changes.outputs.code == 'true'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions/setup-node@v4 - uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -132,11 +132,11 @@ jobs:
if: needs.changes.outputs.ci == 'true' if: needs.changes.outputs.ci == 'true'
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Check workflow files - name: Check workflow files
run: | run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.1 bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.9
./actionlint -color -shellcheck= -ignore "set-output" ./actionlint -color -shellcheck= -ignore "softprops/action-gh-release"
shell: bash shell: bash
test-unit: test-unit:
@ -146,8 +146,8 @@ jobs:
needs: changes needs: changes
if: needs.changes.outputs.code == 'true' if: needs.changes.outputs.code == 'true'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions/setup-node@v4 - uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -164,12 +164,12 @@ jobs:
build: build:
name: Build code-server name: Build code-server
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
timeout-minutes: 60 timeout-minutes: 70
env: env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
DISABLE_V8_COMPILE_CACHE: 1 DISABLE_V8_COMPILE_CACHE: 1
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
with: with:
submodules: true submodules: true
- run: sudo apt update && sudo apt install -y libkrb5-dev - run: sudo apt update && sudo apt install -y libkrb5-dev
@ -178,7 +178,7 @@ jobs:
packages: quilt packages: quilt
version: 1.0 version: 1.0
- run: quilt push -a - run: quilt push -a
- uses: actions/setup-node@v4 - uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -231,9 +231,9 @@ jobs:
needs: [changes, build] needs: [changes, build]
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- run: sudo apt update && sudo apt install -y libkrb5-dev - run: sudo apt update && sudo apt install -y libkrb5-dev
- uses: actions/setup-node@v4 - uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -241,7 +241,7 @@ jobs:
package-lock.json package-lock.json
test/package-lock.json test/package-lock.json
- run: SKIP_SUBMODULE_DEPS=1 npm ci - run: SKIP_SUBMODULE_DEPS=1 npm ci
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v5
with: with:
name: npm-package name: npm-package
- run: tar -xzf package.tar.gz - run: tar -xzf package.tar.gz
@ -265,9 +265,9 @@ jobs:
needs: [changes, build] needs: [changes, build]
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- run: sudo apt update && sudo apt install -y libkrb5-dev - run: sudo apt update && sudo apt install -y libkrb5-dev
- uses: actions/setup-node@v4 - uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -275,7 +275,7 @@ jobs:
package-lock.json package-lock.json
test/package-lock.json test/package-lock.json
- run: SKIP_SUBMODULE_DEPS=1 npm ci - run: SKIP_SUBMODULE_DEPS=1 npm ci
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v5
with: with:
name: npm-package name: npm-package
- run: tar -xzf package.tar.gz - run: tar -xzf package.tar.gz

View file

@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install code-server - name: Install code-server
run: ./install.sh run: ./install.sh
@ -44,7 +44,7 @@ jobs:
container: "alpine:3.17" container: "alpine:3.17"
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install curl - name: Install curl
run: apk add curl run: apk add curl
@ -67,7 +67,7 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install code-server - name: Install code-server
run: ./install.sh run: ./install.sh

View file

@ -25,15 +25,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code-server - name: Checkout code-server
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
- name: Download npm package from release artifacts - name: Download npm package from release artifacts
uses: robinraju/release-downloader@v1.11 uses: robinraju/release-downloader@v1.12
with: with:
repository: "coder/code-server" repository: "coder/code-server"
tag: ${{ github.event.inputs.version || github.ref_name }} tag: ${{ github.event.inputs.version || github.ref_name }}
@ -53,38 +53,6 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_ENVIRONMENT: "production" NPM_ENVIRONMENT: "production"
homebrew:
needs: npm
runs-on: ubuntu-latest
steps:
# Ensure things are up to date
# Suggested by homebrew maintainers
# https://github.com/Homebrew/discussions/discussions/1532#discussioncomment-782633
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Checkout code-server
uses: actions/checkout@v4
- name: Configure git
run: |
git config --global user.name cdrci
git config --global user.email opensource@coder.com
# Strip out the v (v4.9.1 -> 4.9.1).
- name: Get and set VERSION
run: |
TAG="${{ github.event.inputs.version || github.ref_name }}"
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Bump code-server homebrew version
env:
VERSION: ${{ env.VERSION }}
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}}
run: ./ci/steps/brew-bump.sh
aur: aur:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10 timeout-minutes: 10
@ -94,13 +62,13 @@ jobs:
steps: steps:
# We need to checkout code-server so we can get the version # We need to checkout code-server so we can get the version
- name: Checkout code-server - name: Checkout code-server
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
path: "./code-server" path: "./code-server"
- name: Checkout code-server-aur repo - name: Checkout code-server-aur repo
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
repository: "cdrci/code-server-aur" repository: "cdrci/code-server-aur"
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
@ -124,7 +92,7 @@ jobs:
echo "VERSION=${TAG#v}" >> $GITHUB_ENV echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Validate package - name: Validate package
uses: heyhusen/archlinux-package-action@v2.2.1 uses: heyhusen/archlinux-package-action@v2.4.0
env: env:
VERSION: ${{ env.VERSION }} VERSION: ${{ env.VERSION }}
with: with:
@ -145,10 +113,10 @@ jobs:
gh pr create --repo coder/code-server-aur --title "chore: bump version to ${{ env.VERSION }}" --body "PR opened by @$GITHUB_ACTOR" --assignee $GITHUB_ACTOR gh pr create --repo coder/code-server-aur --title "chore: bump version to ${{ env.VERSION }}" --body "PR opened by @$GITHUB_ACTOR" --assignee $GITHUB_ACTOR
docker: docker:
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
steps: steps:
- name: Checkout code-server - name: Checkout code-server
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
@ -176,7 +144,7 @@ jobs:
echo "VERSION=${TAG#v}" >> $GITHUB_ENV echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Download deb artifacts - name: Download deb artifacts
uses: robinraju/release-downloader@v1.11 uses: robinraju/release-downloader@v1.12
with: with:
repository: "coder/code-server" repository: "coder/code-server"
tag: v${{ env.VERSION }} tag: v${{ env.VERSION }}
@ -184,7 +152,7 @@ jobs:
out-file-path: "release-packages" out-file-path: "release-packages"
- name: Download rpm artifacts - name: Download rpm artifacts
uses: robinraju/release-downloader@v1.11 uses: robinraju/release-downloader@v1.12
with: with:
repository: "coder/code-server" repository: "coder/code-server"
tag: v${{ env.VERSION }} tag: v${{ env.VERSION }}

View file

@ -60,10 +60,10 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -73,6 +73,7 @@ jobs:
- name: Install cross-compiler and system dependencies - name: Install cross-compiler and system dependencies
run: | run: |
sed -i 's/deb\.debian\.org/archive.debian.org/g' /etc/apt/sources.list
dpkg --add-architecture $TARGET_ARCH dpkg --add-architecture $TARGET_ARCH
apt update && apt install -y --no-install-recommends \ apt update && apt install -y --no-install-recommends \
crossbuild-essential-$TARGET_ARCH \ crossbuild-essential-$TARGET_ARCH \
@ -93,7 +94,7 @@ jobs:
echo "$HOME/.local/bin" >> $GITHUB_PATH echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Download npm package - name: Download npm package
uses: actions/download-artifact@v4 uses: actions/download-artifact@v5
with: with:
name: npm-release-package name: npm-release-package
@ -125,7 +126,7 @@ jobs:
package-macos-amd64: package-macos-amd64:
name: x86-64 macOS build name: x86-64 macOS build
runs-on: macos-13 runs-on: macos-15-intel
timeout-minutes: 15 timeout-minutes: 15
needs: npm-version needs: npm-version
env: env:
@ -133,10 +134,10 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -159,7 +160,7 @@ jobs:
- run: brew install python-setuptools - run: brew install python-setuptools
- name: Download npm package - name: Download npm package
uses: actions/download-artifact@v4 uses: actions/download-artifact@v5
with: with:
name: npm-release-package name: npm-release-package
@ -194,10 +195,10 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
cache: npm cache: npm
@ -220,7 +221,7 @@ jobs:
- run: brew install python-setuptools - run: brew install python-setuptools
- name: Download npm package - name: Download npm package
uses: actions/download-artifact@v4 uses: actions/download-artifact@v5
with: with:
name: npm-release-package name: npm-release-package
@ -252,7 +253,7 @@ jobs:
needs: npm-version needs: npm-version
steps: steps:
- name: Download npm package - name: Download npm package
uses: actions/download-artifact@v4 uses: actions/download-artifact@v5
with: with:
name: npm-release-package name: npm-release-package
@ -268,7 +269,7 @@ jobs:
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- name: Download artifacts - name: Download artifacts
uses: dawidd6/action-download-artifact@v9 uses: dawidd6/action-download-artifact@v11
id: download id: download
with: with:
branch: ${{ github.ref }} branch: ${{ github.ref }}

View file

@ -41,7 +41,7 @@ jobs:
container: "alpine:3.17" container: "alpine:3.17"
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install test utilities - name: Install test utilities
run: apk add bats checkbashisms run: apk add bats checkbashisms
@ -58,7 +58,7 @@ jobs:
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install lint utilities - name: Install lint utilities
run: sudo apt install shellcheck run: sudo apt install shellcheck

View file

@ -25,12 +25,12 @@ jobs:
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version-file: .node-version node-version-file: .node-version
@ -43,15 +43,15 @@ jobs:
permissions: permissions:
contents: read # for actions/checkout to fetch code contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Run Trivy vulnerability scanner in repo mode - name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
with: with:
scan-type: "fs" scan-type: "fs"
scan-ref: "." scan-ref: "."
@ -72,11 +72,11 @@ jobs:
contents: read # for actions/checkout to fetch code contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/autobuild to send a status report security-events: write # for github/codeql-action/autobuild to send a status report
name: Analyze with CodeQL name: Analyze with CodeQL
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v6
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL

View file

@ -44,14 +44,14 @@ concurrency:
jobs: jobs:
trivy-scan-image: trivy-scan-image:
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Run Trivy vulnerability scanner in image mode - name: Run Trivy vulnerability scanner in image mode
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
with: with:
image-ref: "docker.io/codercom/code-server:latest" image-ref: "docker.io/codercom/code-server:latest"
ignore-unfixed: true ignore-unfixed: true

View file

@ -1 +1 @@
20.18.2 22.20.0

View file

@ -22,6 +22,219 @@ Code v99.99.999
## Unreleased ## Unreleased
## [4.104.2](https://github.com/coder/code-server/releases/tag/v4.104.2) - 2025-09-26
Code v1.104.2
### Changed
- Update to Code 1.104.2.
## [4.104.1](https://github.com/coder/code-server/releases/tag/v4.104.1) - 2025-09-19
Code v1.104.1
### Changed
- Update to Code 1.104.1.
## [4.104.0](https://github.com/coder/code-server/releases/tag/v4.104.0) - 2025-09-15
Code v1.104.0
### Fixed
- Fix "extension not found" errors from Open VSX when trying to install the
latest version of an extension.
### Changed
- Update to Code 1.104.0.
## [4.103.2](https://github.com/coder/code-server/releases/tag/v4.103.2) - 2025-08-25
Code v1.103.2
### Changed
- Update to Code 1.103.2.
## [4.103.1](https://github.com/coder/code-server/releases/tag/v4.103.1) - 2025-08-15
Code v1.103.1
### Changed
- Update to Code 1.103.1.
## [4.103.0](https://github.com/coder/code-server/releases/tag/v4.103.0) - 2025-08-12
Code v1.103.0
### Changed
- Update to Code 1.103.0.
## [4.102.2](https://github.com/coder/code-server/releases/tag/v4.102.2) - 2025-07-24
Code v1.102.2
### Changed
- Update to Code 1.102.2.
## [4.102.1](https://github.com/coder/code-server/releases/tag/v4.102.1) - 2025-07-17
Code v1.102.1
### Changed
- Update to Code 1.102.1.
## [4.102.0](https://github.com/coder/code-server/releases/tag/v4.102.0) - 2025-07-16
Code v1.102.0
### Changed
- Update to Code 1.102.0.
### Added
- Custom strings can be configured using the `--i18n` flag set to a JSON
file. This can be used for either translation (and can be used alongside
`--locale`) or for customizing the strings. See
[./src/node/i18n/locales/en.json](./src/node/i18n/locales/en.json) for the
available keys.
## [4.101.2](https://github.com/coder/code-server/releases/tag/v4.101.2) - 2025-06-25
Code v1.101.2
### Changed
- Update to Code 1.101.2.
### Fixed
- Fix web views not loading due to 401 when requesting the service worker.
## [4.101.1](https://github.com/coder/code-server/releases/tag/v4.101.1) - 2025-06-20
Code v1.101.1
### Changed
- Update to Code 1.101.1.
## [4.101.0](https://github.com/coder/code-server/releases/tag/v4.101.0) - 2025-06-20
Code v1.101.0
### Changed
- Update to Code 1.101.0.
## [4.100.3](https://github.com/coder/code-server/releases/tag/v4.100.3) - 2025-06-03
Code v1.100.3
### Changed
- Update to Code 1.100.3.
## [4.100.2](https://github.com/coder/code-server/releases/tag/v4.100.2) - 2025-05-15
Code v1.100.2
### Changed
- Update to Code 1.100.2.
## [4.100.1](https://github.com/coder/code-server/releases/tag/v4.100.1) - 2025-05-13
Code v1.100.1
### Changed
- Update to Code 1.100.1.
## [4.100.0](https://github.com/coder/code-server/releases/tag/v4.100.0) - 2025-05-12
Code v1.100.0
### Added
- Trusted domains for links can now be set at run-time by configuring
`linkProtectionTrustedDomains` in the `lib/vscode/product.json` file or via
the `--link-protection-trusted-domains` flag.
### Changed
- Update to Code 1.100.0.
- Disable extension signature verification, which previously was skipped by
default (the package used for verification is not available to OSS builds of
VS Code) but now reportedly throws hard errors making it impossible to install
extensions.
### Fixed
- Flags with repeatable options now work via the config file.
## [4.99.4](https://github.com/coder/code-server/releases/tag/v4.99.4) - 2025-05-02
Code v1.99.3
### Security
- Validate that ports in the path proxy are numbers, to prevent proxying to
arbitrary domains.
## [4.99.3](https://github.com/coder/code-server/releases/tag/v4.99.3) - 2025-04-17
Code v1.99.3
### Added
- Added `--skip-auth-preflight` flag to let preflight requests through the
proxy.
### Changed
- Update to Code 1.99.3.
## [4.99.2](https://github.com/coder/code-server/releases/tag/v4.99.2) - 2025-04-10
Code v1.99.2
### Changed
- Update to Code 1.99.2.
## [4.99.1](https://github.com/coder/code-server/releases/tag/v4.99.1) - 2025-04-08
Code v1.99.1
### Changed
- Update to Code 1.99.1.
## [4.99.0](https://github.com/coder/code-server/releases/tag/v4.99.0) - 2025-04-07
Code v1.99.0
### Changed
- Update to Code 1.99.0.
## [4.98.0](https://github.com/coder/code-server/releases/tag/v4.98.0) - 2025-03-07
Code v1.98.0
### Changed
- Update to Code 1.98.0.
## [4.97.2](https://github.com/coder/code-server/releases/tag/v4.96.4) - 2025-02-18 ## [4.97.2](https://github.com/coder/code-server/releases/tag/v4.96.4) - 2025-02-18
Code v1.97.2 Code v1.97.2
@ -650,7 +863,6 @@ Code v1.68.1
would be accessible at `my.domain/proxy/8000/` without any authentication. would be accessible at `my.domain/proxy/8000/` without any authentication.
If all of the following apply to you please update as soon as possible: If all of the following apply to you please update as soon as possible:
- You run code-server with the built-in password authentication. - You run code-server with the built-in password authentication.
- You run unprotected HTTP services on ports accessible by code-server. - You run unprotected HTTP services on ports accessible by code-server.

View file

@ -16,7 +16,7 @@ main() {
# Package managers may shim their own "node" wrapper into the PATH, so run # Package managers may shim their own "node" wrapper into the PATH, so run
# node and ask it for its true path. # node and ask it for its true path.
local node_path local node_path
node_path="$(node <<< 'console.info(process.execPath)')" node_path="$(node -p process.execPath)"
mkdir -p "$RELEASE_PATH/bin" mkdir -p "$RELEASE_PATH/bin"
mkdir -p "$RELEASE_PATH/lib" mkdir -p "$RELEASE_PATH/lib"

View file

@ -112,7 +112,9 @@ EOF
# this because we have an NPM package that could be installed on any platform. # this because we have an NPM package that could be installed on any platform.
# The correct platform dependencies and scripts will be installed as part of # The correct platform dependencies and scripts will be installed as part of
# the post-install during `npm install` or when building a standalone release. # the post-install during `npm install` or when building a standalone release.
npm run gulp "vscode-reh-web-linux-x64${MINIFY:+-min}" node --max-old-space-size=16384 --optimize-for-size \
./node_modules/gulp/bin/gulp.js \
"vscode-reh-web-linux-x64${MINIFY:+-min}"
# Reset so if you develop after building you will not be stuck with the wrong # Reset so if you develop after building you will not be stuck with the wrong
# commit (the dev client will use `oss-dev` but the dev server will still use # commit (the dev client will use `oss-dev` but the dev server will still use

View file

@ -76,8 +76,8 @@ main() {
echo "USE AT YOUR OWN RISK!" echo "USE AT YOUR OWN RISK!"
fi fi
if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-20}" ]; then if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-22}" ]; then
echo "ERROR: code-server currently requires node v20." echo "ERROR: code-server currently requires node v22."
if [ -n "$FORCE_NODE_VERSION" ]; then if [ -n "$FORCE_NODE_VERSION" ]; then
echo "However, you have overrided the version check to use v$FORCE_NODE_VERSION." echo "However, you have overrided the version check to use v$FORCE_NODE_VERSION."
fi fi

View file

@ -1,44 +1,50 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
# Generate icons from a single favicon.svg. favicon.svg should have no fill
# colors set.
main() { main() {
cd src/browser/media cd src/browser/media
# We need .ico for backwards compatibility. # We need .ico for backwards compatibility. The other two are the only icon
# The other two are the only icon sizes required by Chrome and # sizes required by Chrome and we use them for stuff like apple-touch-icon as
# we use them for stuff like apple-touch-icon as well. # well. https://web.dev/add-manifest/
# https://web.dev/add-manifest/
# #
# This should be enough and we can always add more if there are problems. # This should be enough and we can always add more if there are problems.
#
# -quiet to avoid https://github.com/ImageMagick/ImageMagick/issues/884
# -background defaults to white but we want it transparent. # -background defaults to white but we want it transparent.
# -density somehow makes the image both sharper and smaller in file size.
#
# https://imagemagick.org/script/command-line-options.php#background # https://imagemagick.org/script/command-line-options.php#background
convert -quiet -background transparent -resize 256x256 favicon.svg favicon.ico convert -quiet -background transparent \
# We do not generate the pwa-icon from the favicon as they are slightly different -resize 256x256 -density 256x256 \
# designs and sizes. favicon.svg favicon.ico
# See favicon.afdesign and #2401 for details on the differences.
convert -quiet -background transparent -resize 192x192 pwa-icon.png pwa-icon-192.png
convert -quiet -background transparent -resize 512x512 pwa-icon.png pwa-icon-512.png
# We use -quiet above to avoid https://github.com/ImageMagick/ImageMagick/issues/884 # Generate PWA icons. There should be enough padding to support masking.
convert -quiet -border 60x60 -bordercolor white -background white \
-resize 192x192 -density 192x192 \
favicon.svg pwa-icon-maskable-192.png
convert -quiet -border 160x160 -bordercolor white -background white \
-resize 512x512 -density 512x512 \
favicon.svg pwa-icon-maskable-512.png
# The following adds dark mode support for the favicon as favicon-dark-support.svg # Generate non-maskable PWA icons.
# There is no similar capability for pwas or .ico so we can only add support to the svg. magick pwa-icon-maskable-192.png \
favicon_dark_style="<style> \( +clone -threshold 101% -fill white -draw "roundRectangle 0,0 %[fx:int(w)],%[fx:int(h)] 50,50" \) \
@media (prefers-color-scheme: dark) { -channel-fx "| gray=>alpha" \
* { pwa-icon-192.png
fill: white; magick pwa-icon-maskable-512.png \
} \( +clone -threshold 101% -fill white -draw "roundRectangle 0,0 %[fx:int(w)],%[fx:int(h)] 100,100" \) \
} -channel-fx "| gray=>alpha" \
</style>" pwa-icon-512.png
# See https://stackoverflow.com/a/22901380/4283659
# This escapes all newlines so that sed will accept them. # The following adds dark mode support for the favicon as
favicon_dark_style="$(printf "%s\n" "$favicon_dark_style" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\n/g')" # favicon-dark-support.svg There is no similar capability for pwas or .ico so
sed "$( # we can only add support to the svg.
cat -n << EOF favicon_dark_style="<style>@media (prefers-color-scheme: dark) {* { fill: white; }}</style>"
s%<rect id="favicon"%$favicon_dark_style<rect id="favicon"% cp favicon.svg favicon-dark-support.svg
EOF sed "s%<path%$favicon_dark_style\n <path%" favicon.svg > favicon-dark-support.svg
)" favicon.svg > favicon-dark-support.svg
} }
main "$@" main "$@"

View file

@ -15,9 +15,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 3.25.3 version: 3.31.2
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 4.96.4 appVersion: 4.104.2

View file

@ -7,6 +7,9 @@ metadata:
helm.sh/chart: {{ include "code-server.chart" . }} helm.sh/chart: {{ include "code-server.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.annotations }}
annotations: {{- toYaml .Values.annotations | nindent 4 }}
{{- end }}
spec: spec:
replicas: {{ .Values.replicaCount | default 1 }} replicas: {{ .Values.replicaCount | default 1 }}
strategy: strategy:

View file

@ -6,7 +6,7 @@ replicaCount: 1
image: image:
repository: codercom/code-server repository: codercom/code-server
tag: '4.96.4' tag: '4.104.2'
pullPolicy: Always pullPolicy: Always
# Specifies one or more secrets to be used when pulling images from a # Specifies one or more secrets to be used when pulling images from a
@ -31,6 +31,9 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template # If not set and create is true, a name is generated using the fullname template
name: "" name: ""
# Specifies annotations for deployment
annotations: {}
podAnnotations: {} podAnnotations: {}
podSecurityContext: {} podSecurityContext: {}
@ -75,8 +78,9 @@ extraArgs: []
extraVars: [] extraVars: []
# - name: DISABLE_TELEMETRY # - name: DISABLE_TELEMETRY
# value: "true" # value: "true"
# if dind is desired:
# - name: DOCKER_HOST # - name: DOCKER_HOST
# value: "tcp://localhost:2375" # value: "tcp://localhost:2376"
## ##
## Init containers parameters: ## Init containers parameters:
@ -139,25 +143,39 @@ lifecycle:
# - -c # - -c
# - curl -s -L SOME_SCRIPT | bash # - curl -s -L SOME_SCRIPT | bash
# for dind, the following may be helpful
# postStart:
# exec:
# command:
# - /bin/sh
# - -c
# - |
# sudo apt-get update \
# && sudo apt-get install -y docker.io
## Enable an Specify container in extraContainers. ## Enable an Specify container in extraContainers.
## This is meant to allow adding code-server dependencies, like docker-dind. ## This is meant to allow adding code-server dependencies, like docker-dind.
extraContainers: | extraContainers: |
# If docker-dind is used, DOCKER_HOST env is mandatory to set in "extraVars" # If docker-dind is used, DOCKER_HOST env is mandatory to set in "extraVars"
#- name: docker-dind # - name: docker-dind
# image: docker:19.03-dind # image: docker:28.3.2-dind
# imagePullPolicy: IfNotPresent # imagePullPolicy: IfNotPresent
# resources: # resources:
# requests: # requests:
# cpu: 250m # cpu: 1
# memory: 256M # ephemeral-storage: "50Gi"
# securityContext: # memory: 10Gi
# privileged: true # securityContext:
# procMount: Default # privileged: true
# env: # procMount: Default
# - name: DOCKER_TLS_CERTDIR # env:
# value: "" # - name: DOCKER_TLS_CERTDIR
# - name: DOCKER_DRIVER # value: "" # disable TLS setup
# value: "overlay2" # command:
# - dockerd
# - --host=unix:///var/run/docker.sock
# - --host=tcp://0.0.0.0:2376
extraInitContainers: | extraInitContainers: |
# - name: customization # - name: customization

View file

@ -32,7 +32,7 @@ The prerequisites for contributing to code-server are almost the same as those
for [VS Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites). for [VS Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
Here is what is needed: Here is what is needed:
- `node` v20.x - `node` v22.x
- `git` v2.x or greater - `git` v2.x or greater
- [`git-lfs`](https://git-lfs.github.com) - [`git-lfs`](https://git-lfs.github.com)
- [`npm`](https://www.npmjs.com/) - [`npm`](https://www.npmjs.com/)

View file

@ -31,6 +31,7 @@
- [What's the difference between code-server and Theia?](#whats-the-difference-between-code-server-and-theia) - [What's the difference between code-server and Theia?](#whats-the-difference-between-code-server-and-theia)
- [What's the difference between code-server and OpenVSCode-Server?](#whats-the-difference-between-code-server-and-openvscode-server) - [What's the difference between code-server and OpenVSCode-Server?](#whats-the-difference-between-code-server-and-openvscode-server)
- [What's the difference between code-server and GitHub Codespaces?](#whats-the-difference-between-code-server-and-github-codespaces) - [What's the difference between code-server and GitHub Codespaces?](#whats-the-difference-between-code-server-and-github-codespaces)
- [What's the difference between code-server and VS Code web?](#whats-the-difference-between-code-server-and-vs-code-web)
- [Does code-server have any security login validation?](#does-code-server-have-any-security-login-validation) - [Does code-server have any security login validation?](#does-code-server-have-any-security-login-validation)
- [Are there community projects involving code-server?](#are-there-community-projects-involving-code-server) - [Are there community projects involving code-server?](#are-there-community-projects-involving-code-server)
- [How do I change the port?](#how-do-i-change-the-port) - [How do I change the port?](#how-do-i-change-the-port)
@ -322,12 +323,8 @@ As long as there is an active browser connection, code-server touches
`~/.local/share/code-server/heartbeat` once a minute. `~/.local/share/code-server/heartbeat` once a minute.
If you want to shutdown code-server if there hasn't been an active connection If you want to shutdown code-server if there hasn't been an active connection
after a predetermined amount of time, you can do so by checking continuously for after a predetermined amount of time, you can use the --idle-timeout-seconds flag
the last modified time on the heartbeat file. If it is older than X minutes (or or set an `CODE_SERVER_IDLE_TIMEOUT_SECONDS` environment variable.
whatever amount of time you'd like), you can kill code-server.
Eventually, [#1636](https://github.com/coder/code-server/issues/1636) will make
this process better.
## How do I change the password? ## How do I change the password?
@ -383,6 +380,9 @@ mount into `/home/coder/myproject` from inside the `code-server` container. You
need to make sure the Docker daemon's `/home/coder/myproject` is the same as the need to make sure the Docker daemon's `/home/coder/myproject` is the same as the
one mounted inside the `code-server` container, and the mount will work. one mounted inside the `code-server` container, and the mount will work.
If you want Docker enabled when deploying on Kubernetes, look at the `values.yaml`
file for the 3 fields: `extraVars`, `lifecycle.postStart`, and `extraContainers`.
## How do I disable telemetry? ## How do I disable telemetry?
Use the `--disable-telemetry` flag to disable telemetry. Use the `--disable-telemetry` flag to disable telemetry.
@ -440,6 +440,8 @@ Specific changes include:
- The ability to use your own marketplace and collect your own telemetry - The ability to use your own marketplace and collect your own telemetry
- Built-in proxy for accessing ports on the remote machine integrated into - Built-in proxy for accessing ports on the remote machine integrated into
VS Code's ports panel VS Code's ports panel
- Settings are stored on disk like desktop VS Code, instead of in browser
storage (note that state is still stored in browser storage).
- Wrapper process that spawns VS Code on-demand and has a separate CLI - Wrapper process that spawns VS Code on-demand and has a separate CLI
- Notification when updates are available - Notification when updates are available
- [Some other things](https://github.com/coder/code-server/tree/main/patches) - [Some other things](https://github.com/coder/code-server/tree/main/patches)
@ -448,6 +450,12 @@ Some of these changes appear very unlikely to ever be adopted by Microsoft.
Some may make their way upstream, further closing the gap, but at the moment it Some may make their way upstream, further closing the gap, but at the moment it
looks like there will always be some subtle differences. looks like there will always be some subtle differences.
## What's the difference between code-server and VS Code web?
VS Code web (which can be ran using `code serve-web`) has the same differences
as the Codespaces section above. VS Code web can be a better choice if you need
access to the official Microsoft marketplace.
## Does code-server have any security login validation? ## Does code-server have any security login validation?
code-server supports setting a single password and limits logins to two per code-server supports setting a single password and limits logins to two per

View file

@ -1,6 +1,6 @@
# code-server # code-server
[!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.com/community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) [![codecov](https://codecov.io/gh/coder/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/coder/code-server) [![See latest](https://img.shields.io/static/v1?label=Docs&message=see%20latest&color=blue)](https://coder.com/docs/code-server/latest) [!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.com/community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) [![Discord](https://img.shields.io/discord/747933592273027093)](https://discord.com/invite/coder) [![codecov](https://codecov.io/gh/coder/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/coder/code-server) [![See latest](https://img.shields.io/static/v1?label=Docs&message=see%20latest&color=blue)](https://coder.com/docs/code-server/latest)
Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and
access it in the browser. access it in the browser.
@ -24,7 +24,7 @@ on how to set up a Google VM on which you can install code-server.
## Getting started ## Getting started
There are four ways to get started: There are five ways to get started:
1. Using the [install 1. Using the [install
script](https://github.com/coder/code-server/blob/main/install.sh), which script](https://github.com/coder/code-server/blob/main/install.sh), which
@ -35,6 +35,9 @@ There are four ways to get started:
3. Deploy code-server to your team with [coder/coder](https://cdr.co/coder-github) 3. Deploy code-server to your team with [coder/coder](https://cdr.co/coder-github)
4. Using our one-click buttons and guides to [deploy code-server to a cloud 4. Using our one-click buttons and guides to [deploy code-server to a cloud
provider](https://github.com/coder/deploy-code-server) ⚡ provider](https://github.com/coder/deploy-code-server) ⚡
5. Using the [code-server feature for
devcontainers](https://github.com/coder/devcontainer-features/blob/main/src/code-server/README.md),
if you already use devcontainers in your project.
If you use the install script, you can preview what occurs during the install If you use the install script, you can preview what occurs during the install
process: process:

View file

@ -11,11 +11,11 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
``` ```
6. Exit the terminal using `exit` and then reopen the terminal 6. Exit the terminal using `exit` and then reopen the terminal
7. Install and use Node.js 20: 7. Install and use Node.js 22:
```shell ```shell
nvm install 18 nvm install 22
nvm use 18 nvm use 22
``` ```
8. Install code-server globally on device with: `npm install --global code-server` 8. Install code-server globally on device with: `npm install --global code-server`

View file

@ -21,6 +21,10 @@
- [Proxying to an Angular app](#proxying-to-an-angular-app) - [Proxying to an Angular app](#proxying-to-an-angular-app)
- [Proxying to a Svelte app](#proxying-to-a-svelte-app) - [Proxying to a Svelte app](#proxying-to-a-svelte-app)
- [Prefixing `/absproxy/<port>` with a path](#prefixing-absproxyport-with-a-path) - [Prefixing `/absproxy/<port>` with a path](#prefixing-absproxyport-with-a-path)
- [Preflight requests](#preflight-requests)
- [Internationalization and customization](#internationalization-and-customization)
- [Available keys and placeholders](#available-keys-and-placeholders)
- [Legacy flag](#legacy-flag)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end --> <!-- prettier-ignore-end -->
@ -119,22 +123,22 @@ access code-server on an iPad or do not want to use SSH port forwarding.
1. This option requires that the remote machine be exposed to the internet. Make sure that your instance allows HTTP/HTTPS traffic. 1. This option requires that the remote machine be exposed to the internet. Make sure that your instance allows HTTP/HTTPS traffic.
1. You'll need a domain name (if you don't have one, you can purchase one from 2. You'll need a domain name (if you don't have one, you can purchase one from
[Google Domains](https://domains.google.com) or the domain service of your [Google Domains](https://domains.google.com) or the domain service of your
choice)). Once you have a domain name, add an A record to your domain that contains your choice). Once you have a domain name, add an A record to your domain that contains your
instance's IP address. instance's IP address.
1. Install [Caddy](https://caddyserver.com/docs/download#debian-ubuntu-raspbian): 3. Install [Caddy](https://caddyserver.com/docs/download#debian-ubuntu-raspbian):
```console ```console
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update sudo apt update
sudo apt install caddy sudo apt install caddy
``` ```
1. Replace `/etc/caddy/Caddyfile` using `sudo` so that the file looks like this: 4. Replace `/etc/caddy/Caddyfile` using `sudo` so that the file looks like this:
```text ```text
mydomain.com { mydomain.com {
@ -153,7 +157,7 @@ sudo apt install caddy
Remember to replace `mydomain.com` with your domain name! Remember to replace `mydomain.com` with your domain name!
1. Reload Caddy: 5. Reload Caddy:
```console ```console
sudo systemctl reload caddy sudo systemctl reload caddy
@ -164,21 +168,22 @@ At this point, you should be able to access code-server via
### Using Let's Encrypt with NGINX ### Using Let's Encrypt with NGINX
1. This option requires that the remote machine be exposed to the internet. Make sure that your instance allows HTTP/HTTPS traffic. 1. This option requires that the remote machine be exposed to the internet. Make
sure that your instance allows HTTP/HTTPS traffic.
1. You'll need a domain name (if you don't have one, you can purchase one from 2. You'll need a domain name (if you don't have one, you can purchase one from
[Google Domains](https://domains.google.com) or the domain service of your [Google Domains](https://domains.google.com) or the domain service of your
choice)). Once you have a domain name, add an A record to your domain that contains your choice). Once you have a domain name, add an A record to your domain that contains your
instance's IP address. instance's IP address.
1. Install NGINX: 3. Install NGINX:
```bash ```bash
sudo apt update sudo apt update
sudo apt install -y nginx certbot python3-certbot-nginx sudo apt install -y nginx certbot python3-certbot-nginx
``` ```
1. Update `/etc/nginx/sites-available/code-server` using sudo with the following 4. Update `/etc/nginx/sites-available/code-server` using sudo with the following
configuration: configuration:
```text ```text
@ -199,13 +204,11 @@ At this point, you should be able to access code-server via
Be sure to replace `mydomain.com` with your domain name! Be sure to replace `mydomain.com` with your domain name!
1. Enable the config: 5. Enable the config:
```console ```console
sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server
sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m me@example.com sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m me@example.com
``` ```
Be sure to replace `me@example.com` with your actual email. Be sure to replace `me@example.com` with your actual email.
At this point, you should be able to access code-server via At this point, you should be able to access code-server via
@ -292,7 +295,9 @@ redirect all HTTP requests to HTTPS.
> You can use [Let's Encrypt](https://letsencrypt.org/) to get a TLS certificate > You can use [Let's Encrypt](https://letsencrypt.org/) to get a TLS certificate
> for free. > for free.
Note: if you set `proxy_set_header Host $host;` in your reverse proxy config, it will change the address displayed in the green section of code-server in the bottom left to show the correct address. Note: if you set `proxy_set_header Host $host;` in your reverse proxy config, it
will change the address displayed in the green section of code-server in the
bottom left to show the correct address.
## Accessing web services ## Accessing web services
@ -378,14 +383,16 @@ PUBLIC_URL=/absproxy/3000 \
BROWSER=none yarn start BROWSER=none yarn start
``` ```
You should then be able to visit `https://my-code-server-address.io/absproxy/3000` to see your app exposed through You should then be able to visit
code-server! `https://my-code-server-address.io/absproxy/3000` to see your app exposed
through code-server.
> We highly recommend using the subdomain approach instead to avoid this class of issue. > We highly recommend using the subdomain approach instead to avoid this class of issue.
### Proxying to a Vue app ### Proxying to a Vue app
Similar to the situation with React apps, you have to make a few modifications to proxy a Vue app. Similar to the situation with React apps, you have to make a few modifications
to proxy a Vue app.
1. add `vue.config.js` 1. add `vue.config.js`
2. update the values to match this (you can use any free port): 2. update the values to match this (you can use any free port):
@ -406,7 +413,8 @@ Read more about `publicPath` in the [Vue.js docs](https://cli.vuejs.org/config/#
### Proxying to an Angular app ### Proxying to an Angular app
In order to use code-server's built-in proxy with Angular, you need to make the following changes in your app: In order to use code-server's built-in proxy with Angular, you need to make the
following changes in your app:
1. use `<base href="./.">` in `src/index.html` 1. use `<base href="./.">` in `src/index.html`
2. add `--serve-path /absproxy/4200` to `ng serve` in your `package.json` 2. add `--serve-path /absproxy/4200` to `ng serve` in your `package.json`
@ -415,7 +423,8 @@ For additional context, see [this GitHub Discussion](https://github.com/coder/co
### Proxying to a Svelte app ### Proxying to a Svelte app
In order to use code-server's built-in proxy with Svelte, you need to make the following changes in your app: In order to use code-server's built-in proxy with Svelte, you need to make the
following changes in your app:
1. Add `svelte.config.js` if you don't already have one 1. Add `svelte.config.js` if you don't already have one
2. Update the values to match this (you can use any free port): 2. Update the values to match this (you can use any free port):
@ -436,9 +445,68 @@ For additional context, see [this Github Issue](https://github.com/sveltejs/kit/
### Prefixing `/absproxy/<port>` with a path ### Prefixing `/absproxy/<port>` with a path
This is a case where you need to serve an application via `absproxy` as explained above while serving `codeserver` itself from a path other than the root in your domain. This is a case where you need to serve an application via `absproxy` as
explained above while serving code-server itself from a path other than the root
in your domain.
For example: `http://my-code-server.com/user/123/workspace/my-app`. To achieve this result: For example: `http://my-code-server.com/user/123/workspace/my-app`. To achieve
this result:
1. Start code server with the switch `--abs-proxy-base-path=/user/123/workspace` 1. Start code-server with the switch `--abs-proxy-base-path=/user/123/workspace`
2. Follow one of the instructions above for your framework. 2. Follow one of the instructions above for your framework.
### Preflight requests
By default, if you have auth enabled, code-server will authenticate all proxied
requests including preflight requests. This can cause issues because preflight
requests do not typically include credentials. To allow all preflight requests
through the proxy without authentication, use `--skip-auth-preflight`.
## Internationalization and customization
code-server allows you to provide a JSON file to configure certain strings. This
can be used for both internationalization and customization.
Create a JSON file with your custom strings:
```json
{
"WELCOME": "Welcome to {{app}}",
"LOGIN_TITLE": "{{app}} Access Portal",
"LOGIN_BELOW": "Please log in to continue",
"PASSWORD_PLACEHOLDER": "Enter Password"
}
```
Then reference the file:
```shell
code-server --i18n /path/to/custom-strings.json
```
Or this can be done in the config file:
```yaml
i18n: /path/to/custom-strings.json
```
You can combine this with the `--locale` flag to configure language support for
both code-server and VS Code in cases where code-server has no support but VS
Code does. If you are using this for internationalization, please consider
sending us a pull request to contribute it to `src/node/i18n/locales`.
### Available keys and placeholders
Refer to [../src/node/i18n/locales/en.json](../src/node/i18n/locales/en.json)
for a full list of the available keys for translations. Note that the only
placeholders supported for each key are the ones used in the default string.
The `--app-name` flag controls the `{{app}}` placeholder in templates. If you
want to change the name, you can either:
1. Set `--app-name` (potentially alongside `--i18n`)
2. Use `--i18n` and hardcode the name in your strings
### Legacy flag
The `--welcome-text` flag is now deprecated. Use the `WELCOME` key instead.

View file

@ -82,13 +82,11 @@ _exact_ same commands presented in the rest of this document.
- For Arch Linux, code-server will install the AUR package. - For Arch Linux, code-server will install the AUR package.
- For any unrecognized Linux operating system, code-server will install the - For any unrecognized Linux operating system, code-server will install the
latest standalone release into `~/.local`. latest standalone release into `~/.local`.
- Ensure that you add `~/.local/bin` to your `$PATH` to run code-server. - Ensure that you add `~/.local/bin` to your `$PATH` to run code-server.
- For macOS, code-server will install the Homebrew package (if you don't have - For macOS, code-server will install the Homebrew package (if you don't have
Homebrew installed, code-server will install the latest standalone release Homebrew installed, code-server will install the latest standalone release
into `~/.local`). into `~/.local`).
- Ensure that you add `~/.local/bin` to your `$PATH` to run code-server. - Ensure that you add `~/.local/bin` to your `$PATH` to run code-server.
- For FreeBSD, code-server will install the [npm package](#npm) with `npm` - For FreeBSD, code-server will install the [npm package](#npm) with `npm`

View file

@ -30,7 +30,7 @@ includes installing instructions based on your operating system.
## Node.js version ## Node.js version
We use the same major version of Node.js shipped with Code's remote, which is We use the same major version of Node.js shipped with Code's remote, which is
currently `20.x`. VS Code also [lists Node.js currently `22.x`. VS Code also [lists Node.js
requirements](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites). requirements](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites).
Using other versions of Node.js [may lead to unexpected Using other versions of Node.js [may lead to unexpected
@ -78,7 +78,7 @@ Proceed to [installing](#installing)
## FreeBSD ## FreeBSD
```sh ```sh
pkg install -y git python npm-node20 pkgconf pkg install -y git python npm-node22 pkgconf
pkg install -y libinotify pkg install -y libinotify
``` ```

View file

@ -57,7 +57,7 @@ npm config set python python3
node -v node -v
``` ```
you will get Node version `v20` you will get Node version `v22`
5. Now install code-server following our guide on [installing with npm](./npm.md) 5. Now install code-server following our guide on [installing with npm](./npm.md)

View file

@ -10,10 +10,11 @@
flake-utils.lib.eachDefaultSystem flake-utils.lib.eachDefaultSystem
(system: (system:
let pkgs = nixpkgs.legacyPackages.${system}; let pkgs = nixpkgs.legacyPackages.${system};
nodejs = pkgs.nodejs_20; nodejs = pkgs.nodejs_22;
in { in {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
imagemagick
nodejs nodejs
python3 python3
pkg-config pkg-config

@ -1 +1 @@
Subproject commit 6609ac3d66f4eade5cf376d1cb76f13985724bcb Subproject commit bf9252a2fb45be6893dd8870c0bf37e2e1766d61

1562
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -47,7 +47,7 @@
"@types/express": "^5.0.0", "@types/express": "^5.0.0",
"@types/http-proxy": "1.17.7", "@types/http-proxy": "1.17.7",
"@types/js-yaml": "^4.0.6", "@types/js-yaml": "^4.0.6",
"@types/node": "20.x", "@types/node": "22.x",
"@types/pem": "^1.14.1", "@types/pem": "^1.14.1",
"@types/proxy-from-env": "^1.0.1", "@types/proxy-from-env": "^1.0.1",
"@types/safe-compare": "^1.1.0", "@types/safe-compare": "^1.1.0",
@ -57,11 +57,11 @@
"doctoc": "^2.2.1", "doctoc": "^2.2.1",
"eslint": "^9.12.0", "eslint": "^9.12.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.0", "eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.28.1", "eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0", "eslint-plugin-prettier": "^5.0.0",
"globals": "^15.10.0", "globals": "^16.1.0",
"prettier": "3.4.2", "prettier": "3.6.2",
"prettier-plugin-sh": "^0.14.0", "prettier-plugin-sh": "^0.14.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.6.2", "typescript": "^5.6.2",
@ -76,21 +76,20 @@
"express": "^5.0.1", "express": "^5.0.1",
"http-proxy": "^1.18.1", "http-proxy": "^1.18.1",
"httpolyglot": "^0.1.2", "httpolyglot": "^0.1.2",
"i18next": "^23.5.1", "i18next": "^25.3.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"limiter": "^2.1.0", "limiter": "^2.1.0",
"pem": "^1.14.8", "pem": "^1.14.8",
"proxy-agent": "^6.3.1", "proxy-agent": "^6.3.1",
"qs": "6.13.0", "qs": "6.14.0",
"rotating-file-stream": "^3.1.1", "rotating-file-stream": "^3.1.1",
"safe-buffer": "^5.2.1",
"safe-compare": "^1.1.4", "safe-compare": "^1.1.4",
"semver": "^7.5.4", "semver": "^7.5.4",
"ws": "^8.14.2", "ws": "^8.14.2",
"xdg-basedir": "^4.0.0" "xdg-basedir": "^4.0.0"
}, },
"resolutions": { "resolutions": {
"@types/node": "20.x" "@types/node": "22.x"
}, },
"bin": { "bin": {
"code-server": "out/node/entry.js" "code-server": "out/node/entry.js"
@ -105,7 +104,7 @@
"remote-development" "remote-development"
], ],
"engines": { "engines": {
"node": "20" "node": "22"
}, },
"jest": { "jest": {
"transform": { "transform": {

View file

@ -10,7 +10,7 @@ Index: code-server/lib/vscode/src/vs/base/common/network.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/network.ts --- code-server.orig/lib/vscode/src/vs/base/common/network.ts
+++ code-server/lib/vscode/src/vs/base/common/network.ts +++ code-server/lib/vscode/src/vs/base/common/network.ts
@@ -220,7 +220,9 @@ class RemoteAuthoritiesImpl { @@ -237,7 +237,9 @@ class RemoteAuthoritiesImpl {
return URI.from({ return URI.from({
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource, scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
authority: `${host}:${port}`, authority: `${host}:${port}`,
@ -99,19 +99,19 @@ Index: code-server/lib/vscode/src/vs/platform/remote/browser/browserSocketFactor
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.ts --- code-server.orig/lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.ts
+++ code-server/lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.ts +++ code-server/lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.ts
@@ -281,6 +281,7 @@ export class BrowserSocketFactory implem @@ -282,6 +282,7 @@ export class BrowserSocketFactory implem
connect({ host, port }: WebSocketRemoteConnection, path: string, query: string, debugLabel: string): Promise<ISocket> { connect({ host, port }: WebSocketRemoteConnection, path: string, query: string, debugLabel: string): Promise<ISocket> {
return new Promise<ISocket>((resolve, reject) => { return new Promise<ISocket>((resolve, reject) => {
const webSocketSchema = (/^https:/.test(mainWindow.location.href) ? 'wss' : 'ws'); const webSocketSchema = (/^https:/.test(mainWindow.location.href) ? 'wss' : 'ws');
+ path = (mainWindow.location.pathname + "/" + path).replace(/\/\/+/g, "/") + path = (mainWindow.location.pathname + "/" + path).replace(/\/\/+/g, "/")
const socket = this._webSocketFactory.create(`${webSocketSchema}://${(/:/.test(host) && !/\[/.test(host)) ? `[${host}]` : host}:${port}${path}?${query}&skipWebSocketFrames=false`, debugLabel); const socket = this._webSocketFactory.create(`${webSocketSchema}://${(/:/.test(host) && !/\[/.test(host)) ? `[${host}]` : host}:${port}${path}?${query}&skipWebSocketFrames=false`, debugLabel);
const errorListener = socket.onError(reject); const disposables = new DisposableStore();
socket.onOpen(() => { disposables.add(socket.onError(reject));
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -246,7 +246,9 @@ export class WebClientServer { @@ -245,7 +245,9 @@ export class WebClientServer {
}; };
// Prefix routes with basePath for clients // Prefix routes with basePath for clients
@ -122,7 +122,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
const queryConnectionToken = parsedUrl.query[connectionTokenQueryName]; const queryConnectionToken = parsedUrl.query[connectionTokenQueryName];
if (typeof queryConnectionToken === 'string') { if (typeof queryConnectionToken === 'string') {
@@ -285,10 +287,14 @@ export class WebClientServer { @@ -284,10 +286,14 @@ export class WebClientServer {
}; };
const useTestResolver = (!this._environmentService.isBuilt && this._environmentService.args['use-test-resolver']); const useTestResolver = (!this._environmentService.isBuilt && this._environmentService.args['use-test-resolver']);
@ -138,15 +138,15 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
); );
if (!remoteAuthority) { if (!remoteAuthority) {
return serveError(req, res, 400, `Bad request.`); return serveError(req, res, 400, `Bad request.`);
@@ -335,6 +341,7 @@ export class WebClientServer { @@ -334,6 +340,7 @@ export class WebClientServer {
const productConfiguration = { const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
codeServerVersion: this._productService.codeServerVersion, codeServerVersion: this._productService.codeServerVersion,
+ rootEndpoint: rootBase, + rootEndpoint: rootBase,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? { extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
...this._productService.extensionsGallery, ...this._productService.extensionsGallery,
@@ -382,7 +389,9 @@ export class WebClientServer { @@ -387,7 +394,9 @@ export class WebClientServer {
WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '', WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',
WORKBENCH_WEB_BASE_URL: staticRoute, WORKBENCH_WEB_BASE_URL: staticRoute,
WORKBENCH_NLS_URL, WORKBENCH_NLS_URL,
@ -157,7 +157,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
}; };
// DEV --------------------------------------------------------------------------------------- // DEV ---------------------------------------------------------------------------------------
@@ -419,7 +428,7 @@ export class WebClientServer { @@ -424,7 +433,7 @@ export class WebClientServer {
'default-src \'self\';', 'default-src \'self\';',
'img-src \'self\' https: data: blob:;', 'img-src \'self\' https: data: blob:;',
'media-src \'self\';', 'media-src \'self\';',
@ -166,7 +166,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
'child-src \'self\';', 'child-src \'self\';',
`frame-src 'self' https://*.vscode-cdn.net data:;`, `frame-src 'self' https://*.vscode-cdn.net data:;`,
'worker-src \'self\' data: blob:;', 'worker-src \'self\' data: blob:;',
@@ -492,3 +501,70 @@ export class WebClientServer { @@ -497,3 +506,70 @@ export class WebClientServer {
return void res.end(data); return void res.end(data);
} }
} }
@ -241,7 +241,7 @@ Index: code-server/lib/vscode/src/vs/base/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts --- code-server.orig/lib/vscode/src/vs/base/common/product.ts
+++ code-server/lib/vscode/src/vs/base/common/product.ts +++ code-server/lib/vscode/src/vs/base/common/product.ts
@@ -56,6 +56,7 @@ export type ExtensionVirtualWorkspaceSup @@ -65,6 +65,7 @@ export type ExtensionVirtualWorkspaceSup
export interface IProductConfiguration { export interface IProductConfiguration {
readonly codeServerVersion?: string readonly codeServerVersion?: string
@ -253,7 +253,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts --- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts +++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
@@ -317,7 +317,8 @@ class LocalStorageURLCallbackProvider ex @@ -339,7 +339,8 @@ class LocalStorageURLCallbackProvider ex
this.startListening(); this.startListening();
} }
@ -263,7 +263,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
} }
private startListening(): void { private startListening(): void {
@@ -563,17 +564,6 @@ class WorkspaceProvider implements IWork @@ -584,17 +585,6 @@ class WorkspaceProvider implements IWork
} }
} }
@ -281,7 +281,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
(function () { (function () {
// Find config by checking for DOM // Find config by checking for DOM
@@ -582,8 +572,8 @@ function readCookie(name: string): strin @@ -604,8 +594,8 @@ function readCookie(name: string): strin
if (!configElement || !configElementAttribute) { if (!configElement || !configElementAttribute) {
throw new Error('Missing web configuration element'); throw new Error('Missing web configuration element');
} }
@ -296,7 +296,7 @@ Index: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/ext
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts --- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
+++ code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts +++ code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
@@ -98,7 +98,7 @@ export abstract class AbstractExtensionR @@ -120,7 +120,7 @@ export abstract class AbstractExtensionR
: version, : version,
path: 'extension' path: 'extension'
})); }));

View file

@ -17,7 +17,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTe
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts --- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts
@@ -106,10 +106,14 @@ class RemoteTerminalBackend extends Base @@ -107,10 +107,14 @@ class RemoteTerminalBackend extends Base
} }
const reqId = e.reqId; const reqId = e.reqId;
const commandId = e.commandId; const commandId = e.commandId;

View file

@ -65,7 +65,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTe
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts --- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts
@@ -97,7 +97,7 @@ class RemoteTerminalBackend extends Base @@ -98,7 +98,7 @@ class RemoteTerminalBackend extends Base
} }
}); });
@ -78,19 +78,19 @@ Index: code-server/lib/vscode/src/vs/platform/environment/common/argv.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/environment/common/argv.ts --- code-server.orig/lib/vscode/src/vs/platform/environment/common/argv.ts
+++ code-server/lib/vscode/src/vs/platform/environment/common/argv.ts +++ code-server/lib/vscode/src/vs/platform/environment/common/argv.ts
@@ -122,6 +122,7 @@ export interface NativeParsedArgs { @@ -137,6 +137,7 @@ export interface NativeParsedArgs {
'disable-chromium-sandbox'?: boolean;
sandbox?: boolean; sandbox?: boolean;
'enable-coi'?: boolean; 'enable-coi'?: boolean;
+ 'stdin-to-clipboard'?: boolean; + 'stdin-to-clipboard'?: boolean;
'unresponsive-sample-interval'?: string;
// chromium command line args: https://electronjs.org/docs/all#supported-chrome-command-line-switches 'unresponsive-sample-period'?: string;
'no-proxy-server'?: boolean; 'enable-rdp-display-tracking'?: boolean;
Index: code-server/lib/vscode/src/vs/platform/environment/node/argv.ts Index: code-server/lib/vscode/src/vs/platform/environment/node/argv.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/environment/node/argv.ts --- code-server.orig/lib/vscode/src/vs/platform/environment/node/argv.ts
+++ code-server/lib/vscode/src/vs/platform/environment/node/argv.ts +++ code-server/lib/vscode/src/vs/platform/environment/node/argv.ts
@@ -91,6 +91,7 @@ export const OPTIONS: OptionDescriptions @@ -105,6 +105,7 @@ export const OPTIONS: OptionDescriptions
'user-data-dir': { type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") }, 'user-data-dir': { type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") },
'profile': { type: 'string', 'cat': 'o', args: 'profileName', description: localize('profileName', "Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created.") }, 'profile': { type: 'string', 'cat': 'o', args: 'profileName', description: localize('profileName', "Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created.") },
'help': { type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") }, 'help': { type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") },

View file

@ -7,7 +7,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts --- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
@@ -319,6 +319,10 @@ export class Extension implements IExten @@ -341,6 +341,10 @@ export class Extension implements IExten
if (this.type === ExtensionType.System && this.productService.quality === 'stable') { if (this.type === ExtensionType.System && this.productService.quality === 'stable') {
return false; return false;
} }

View file

@ -11,16 +11,16 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
+++ code-server/lib/vscode/src/vs/server/node/serverServices.ts +++ code-server/lib/vscode/src/vs/server/node/serverServices.ts
@@ -12,7 +12,7 @@ import * as path from '../../base/common @@ -12,7 +12,7 @@ import * as path from '../../base/common
import { IURITransformer } from '../../base/common/uriIpc.js'; import { IURITransformer } from '../../base/common/uriIpc.js';
import { getMachineId, getSqmMachineId, getdevDeviceId } from '../../base/node/id.js'; import { getMachineId, getSqmMachineId, getDevDeviceId } from '../../base/node/id.js';
import { Promises } from '../../base/node/pfs.js'; import { Promises } from '../../base/node/pfs.js';
-import { ClientConnectionEvent, IMessagePassingProtocol, IPCServer, StaticRouter } from '../../base/parts/ipc/common/ipc.js'; -import { ClientConnectionEvent, IMessagePassingProtocol, IPCServer, StaticRouter } from '../../base/parts/ipc/common/ipc.js';
+import { ClientConnectionEvent, IMessagePassingProtocol, IPCServer, ProxyChannel, StaticRouter } from '../../base/parts/ipc/common/ipc.js'; +import { ClientConnectionEvent, IMessagePassingProtocol, IPCServer, ProxyChannel, StaticRouter } from '../../base/parts/ipc/common/ipc.js';
import { ProtocolConstants } from '../../base/parts/ipc/common/ipc.net.js'; import { ProtocolConstants } from '../../base/parts/ipc/common/ipc.net.js';
import { IConfigurationService } from '../../platform/configuration/common/configuration.js'; import { IConfigurationService } from '../../platform/configuration/common/configuration.js';
import { ConfigurationService } from '../../platform/configuration/common/configurationService.js'; import { ConfigurationService } from '../../platform/configuration/common/configurationService.js';
@@ -246,6 +246,9 @@ export async function setupServerService @@ -272,6 +272,9 @@ export async function setupServerService
const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority));
socketServer.registerChannel('extensions', channel); socketServer.registerChannel('mcpManagement', new McpManagementChannel(mcpManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));
+ const languagePackChannel = ProxyChannel.fromService<RemoteAgentConnectionContext>(accessor.get(ILanguagePackService), disposables); + const languagePackChannel = ProxyChannel.fromService<RemoteAgentConnectionContext>(accessor.get(ILanguagePackService), disposables);
+ socketServer.registerChannel('languagePacks', languagePackChannel); + socketServer.registerChannel('languagePacks', languagePackChannel);
@ -32,7 +32,7 @@ Index: code-server/lib/vscode/src/vs/platform/environment/common/environmentServ
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/environment/common/environmentService.ts --- code-server.orig/lib/vscode/src/vs/platform/environment/common/environmentService.ts
+++ code-server/lib/vscode/src/vs/platform/environment/common/environmentService.ts +++ code-server/lib/vscode/src/vs/platform/environment/common/environmentService.ts
@@ -101,7 +101,7 @@ export abstract class AbstractNativeEnvi @@ -98,7 +98,7 @@ export abstract class AbstractNativeEnvi
return URI.file(join(vscodePortable, 'argv.json')); return URI.file(join(vscodePortable, 'argv.json'));
} }
@ -153,15 +153,15 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -26,6 +26,7 @@ import { URI } from '../../base/common/u @@ -25,6 +25,7 @@ import { URI } from '../../base/common/u
import { streamToBuffer } from '../../base/common/buffer.js'; import { streamToBuffer } from '../../base/common/buffer.js';
import { IProductConfiguration } from '../../base/common/product.js'; import { IProductConfiguration } from '../../base/common/product.js';
import { isString } from '../../base/common/types.js'; import { isString, Mutable } from '../../base/common/types.js';
+import { getLocaleFromConfig, getBrowserNLSConfiguration } from './remoteLanguagePacks.js'; +import { getLocaleFromConfig, getBrowserNLSConfiguration } from './remoteLanguagePacks.js';
import { CharCode } from '../../base/common/charCode.js'; import { CharCode } from '../../base/common/charCode.js';
import { IExtensionManifest } from '../../platform/extensions/common/extensions.js'; import { IExtensionManifest } from '../../platform/extensions/common/extensions.js';
import { ICSSDevelopmentService } from '../../platform/cssDev/node/cssDevService.js'; import { ICSSDevelopmentService } from '../../platform/cssDev/node/cssDevService.js';
@@ -380,14 +381,22 @@ export class WebClientServer { @@ -385,14 +386,22 @@ export class WebClientServer {
}; };
const cookies = cookie.parse(req.headers.cookie || ''); const cookies = cookie.parse(req.headers.cookie || '');
@ -190,7 +190,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts --- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts +++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
@@ -19,6 +19,7 @@ export const serverOptions: OptionDescri @@ -21,6 +21,7 @@ export const serverOptions: OptionDescri
'disable-file-downloads': { type: 'boolean' }, 'disable-file-downloads': { type: 'boolean' },
'disable-file-uploads': { type: 'boolean' }, 'disable-file-uploads': { type: 'boolean' },
'disable-getting-started-override': { type: 'boolean' }, 'disable-getting-started-override': { type: 'boolean' },
@ -198,7 +198,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -106,6 +107,7 @@ export interface ServerParsedArgs { @@ -110,6 +111,7 @@ export interface ServerParsedArgs {
'disable-file-downloads'?: boolean; 'disable-file-downloads'?: boolean;
'disable-file-uploads'?: boolean; 'disable-file-uploads'?: boolean;
'disable-getting-started-override'?: boolean, 'disable-getting-started-override'?: boolean,
@ -244,10 +244,10 @@ Index: code-server/lib/vscode/src/vs/platform/languagePacks/browser/languagePack
+ return this.languagePackService.getInstalledLanguages() + return this.languagePackService.getInstalledLanguages()
} }
} }
Index: code-server/lib/vscode/src/vs/workbench/services/localization/electron-sandbox/localeService.ts Index: code-server/lib/vscode/src/vs/workbench/services/localization/electron-browser/localeService.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/localization/electron-sandbox/localeService.ts --- code-server.orig/lib/vscode/src/vs/workbench/services/localization/electron-browser/localeService.ts
+++ code-server/lib/vscode/src/vs/workbench/services/localization/electron-sandbox/localeService.ts +++ code-server/lib/vscode/src/vs/workbench/services/localization/electron-browser/localeService.ts
@@ -51,7 +51,8 @@ class NativeLocaleService implements ILo @@ -51,7 +51,8 @@ class NativeLocaleService implements ILo
@IProductService private readonly productService: IProductService @IProductService private readonly productService: IProductService
) { } ) { }
@ -272,7 +272,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts --- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
@@ -435,9 +435,6 @@ export class InstallAction extends Exten @@ -475,9 +475,6 @@ export class InstallAction extends Exten
if (this.extension.isBuiltin) { if (this.extension.isBuiltin) {
return; return;
} }
@ -282,7 +282,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
if (this.extension.state !== ExtensionState.Uninstalled) { if (this.extension.state !== ExtensionState.Uninstalled) {
return; return;
} }
@@ -742,7 +739,7 @@ export abstract class InstallInOtherServ @@ -782,7 +779,7 @@ export abstract class InstallInOtherServ
} }
if (isLanguagePackExtension(this.extension.local.manifest)) { if (isLanguagePackExtension(this.extension.local.manifest)) {
@ -291,7 +291,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
} }
// Prefers to run on UI // Prefers to run on UI
@@ -2028,17 +2025,6 @@ export class SetLanguageAction extends E @@ -2073,17 +2070,6 @@ export class SetLanguageAction extends E
update(): void { update(): void {
this.enabled = false; this.enabled = false;
this.class = SetLanguageAction.DisabledClass; this.class = SetLanguageAction.DisabledClass;
@ -309,7 +309,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
} }
override async run(): Promise<any> { override async run(): Promise<any> {
@@ -2055,7 +2041,6 @@ export class ClearLanguageAction extends @@ -2100,7 +2086,6 @@ export class ClearLanguageAction extends
private static readonly DisabledClass = `${this.EnabledClass} disabled`; private static readonly DisabledClass = `${this.EnabledClass} disabled`;
constructor( constructor(
@ -317,7 +317,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
@ILocaleService private readonly localeService: ILocaleService, @ILocaleService private readonly localeService: ILocaleService,
) { ) {
super(ClearLanguageAction.ID, ClearLanguageAction.TITLE.value, ClearLanguageAction.DisabledClass, false); super(ClearLanguageAction.ID, ClearLanguageAction.TITLE.value, ClearLanguageAction.DisabledClass, false);
@@ -2065,17 +2050,6 @@ export class ClearLanguageAction extends @@ -2110,17 +2095,6 @@ export class ClearLanguageAction extends
update(): void { update(): void {
this.enabled = false; this.enabled = false;
this.class = ClearLanguageAction.DisabledClass; this.class = ClearLanguageAction.DisabledClass;
@ -335,28 +335,16 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
} }
override async run(): Promise<any> { override async run(): Promise<any> {
Index: code-server/lib/vscode/build/gulpfile.reh.js
===================================================================
--- code-server.orig/lib/vscode/build/gulpfile.reh.js
+++ code-server/lib/vscode/build/gulpfile.reh.js
@@ -58,6 +58,7 @@ const serverResourceIncludes = [
// NLS
'out-build/nls.messages.json',
+ 'out-build/nls.keys.json', // Required to generate translations.
// Process monitor
'out-build/vs/base/node/cpuUsage.sh',
Index: code-server/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts Index: code-server/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts --- code-server.orig/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts
+++ code-server/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts +++ code-server/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts
@@ -52,7 +52,7 @@ import './services/dialogs/browser/fileD @@ -55,7 +55,7 @@ import './services/dialogs/browser/fileD
import './services/host/browser/browserHostService.js'; import './services/host/browser/browserHostService.js';
import './services/lifecycle/browser/lifecycleService.js'; import './services/lifecycle/browser/lifecycleService.js';
import './services/clipboard/browser/clipboardService.js'; import './services/clipboard/browser/clipboardService.js';
-import './services/localization/browser/localeService.js'; -import './services/localization/browser/localeService.js';
+import './services/localization/electron-sandbox/localeService.js'; +import './services/localization/electron-browser/localeService.js';
import './services/path/browser/pathService.js'; import './services/path/browser/pathService.js';
import './services/themes/browser/browserHostColorSchemeService.js'; import './services/themes/browser/browserHostColorSchemeService.js';
import './services/encryption/browser/encryptionService.js'; import './services/encryption/browser/encryptionService.js';

View file

@ -90,7 +90,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts --- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts +++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
@@ -16,6 +16,8 @@ export const serverOptions: OptionDescri @@ -18,6 +18,8 @@ export const serverOptions: OptionDescri
/* ----- code-server ----- */ /* ----- code-server ----- */
'disable-update-check': { type: 'boolean' }, 'disable-update-check': { type: 'boolean' },
'auth': { type: 'string' }, 'auth': { type: 'string' },
@ -99,7 +99,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -100,6 +102,8 @@ export interface ServerParsedArgs { @@ -104,6 +106,8 @@ export interface ServerParsedArgs {
/* ----- code-server ----- */ /* ----- code-server ----- */
'disable-update-check'?: boolean; 'disable-update-check'?: boolean;
'auth'?: string; 'auth'?: string;
@ -112,7 +112,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -364,6 +364,8 @@ export class WebClientServer { @@ -369,6 +369,8 @@ export class WebClientServer {
serverBasePath: basePath, serverBasePath: basePath,
webviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', webviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
userDataPath: this._environmentService.userDataPath, userDataPath: this._environmentService.userDataPath,
@ -125,13 +125,12 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts +++ code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
@@ -7,11 +7,11 @@ import { Event } from '../../base/common @@ -6,10 +6,10 @@
import { Disposable } from '../../base/common/lifecycle.js'; import { Disposable } from '../../base/common/lifecycle.js';
import { IContextKeyService, IContextKey, setConstant as setConstantContextKey } from '../../platform/contextkey/common/contextkey.js'; import { IContextKeyService, IContextKey, setConstant as setConstantContextKey } from '../../platform/contextkey/common/contextkey.js';
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext, IsMobileContext } from '../../platform/contextkey/common/contextkeys.js'; import { IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext, IsMobileContext } from '../../platform/contextkey/common/contextkeys.js';
-import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext } from '../common/contextkeys.js'; -import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, AuxiliaryBarMaximizedContext, InAutomationContext } from '../common/contextkeys.js';
+import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, IsEnabledFileDownloads, IsEnabledFileUploads } from '../common/contextkeys.js'; +import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, AuxiliaryBarMaximizedContext, InAutomationContext, IsEnabledFileDownloads, IsEnabledFileUploads } from '../common/contextkeys.js';
import { trackFocus, addDisposableListener, EventType, onDidRegisterWindow, getActiveWindow, isEditableElement } from '../../base/browser/dom.js';
import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from '../services/editor/common/editorGroupsService.js'; import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from '../services/editor/common/editorGroupsService.js';
import { IConfigurationService } from '../../platform/configuration/common/configuration.js'; import { IConfigurationService } from '../../platform/configuration/common/configuration.js';
-import { IWorkbenchEnvironmentService } from '../services/environment/common/environmentService.js'; -import { IWorkbenchEnvironmentService } from '../services/environment/common/environmentService.js';
@ -139,7 +138,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
import { WorkbenchState, IWorkspaceContextService, isTemporaryWorkspace } from '../../platform/workspace/common/workspace.js'; import { WorkbenchState, IWorkspaceContextService, isTemporaryWorkspace } from '../../platform/workspace/common/workspace.js';
import { IWorkbenchLayoutService, Parts, positionToString } from '../services/layout/browser/layoutService.js'; import { IWorkbenchLayoutService, Parts, positionToString } from '../services/layout/browser/layoutService.js';
import { getRemoteName } from '../../platform/remote/common/remoteHosts.js'; import { getRemoteName } from '../../platform/remote/common/remoteHosts.js';
@@ -70,7 +70,7 @@ export class WorkbenchContextKeysHandler @@ -69,7 +69,7 @@ export class WorkbenchContextKeysHandler
@IContextKeyService private readonly contextKeyService: IContextKeyService, @IContextKeyService private readonly contextKeyService: IContextKeyService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IConfigurationService private readonly configurationService: IConfigurationService, @IConfigurationService private readonly configurationService: IConfigurationService,
@ -148,9 +147,9 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
@IProductService private readonly productService: IProductService, @IProductService private readonly productService: IProductService,
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
@IEditorService private readonly editorService: IEditorService, @IEditorService private readonly editorService: IEditorService,
@@ -197,6 +197,10 @@ export class WorkbenchContextKeysHandler @@ -199,6 +199,10 @@ export class WorkbenchContextKeysHandler
this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService); this.auxiliaryBarMaximizedContext = AuxiliaryBarMaximizedContext.bindTo(this.contextKeyService);
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(Parts.AUXILIARYBAR_PART)); this.auxiliaryBarMaximizedContext.set(this.layoutService.isAuxiliaryBarMaximized());
+ // code-server + // code-server
+ IsEnabledFileDownloads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileDownloads ?? true) + IsEnabledFileDownloads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileDownloads ?? true)
@ -208,16 +207,16 @@ Index: code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/common/contextkeys.ts --- code-server.orig/lib/vscode/src/vs/workbench/common/contextkeys.ts
+++ code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts +++ code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts
@@ -39,6 +39,9 @@ export const HasWebFileSystemAccess = ne @@ -39,6 +39,9 @@ export const EmbedderIdentifierContext =
export const EmbedderIdentifierContext = new RawContextKey<string | undefined>('embedderIdentifier', undefined, localize('embedderIdentifier', 'The identifier of the embedder according to the product service, if one is defined')); export const InAutomationContext = new RawContextKey<boolean>('inAutomation', false, localize('inAutomation', "Whether VS Code is running under automation/smoke test"));
+export const IsEnabledFileDownloads = new RawContextKey<boolean>('isEnabledFileDownloads', true, true); +export const IsEnabledFileDownloads = new RawContextKey<boolean>('isEnabledFileDownloads', true, true);
+export const IsEnabledFileUploads = new RawContextKey<boolean>('isEnabledFileUploads', true, true); +export const IsEnabledFileUploads = new RawContextKey<boolean>('isEnabledFileUploads', true, true);
+ +
//#endregion //#endregion
//#region < --- Window --- >
Index: code-server/lib/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts Index: code-server/lib/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts --- code-server.orig/lib/vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts
@ -240,8 +239,8 @@ Index: code-server/lib/vscode/src/vs/workbench/services/dialogs/browser/simpleFi
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService, @IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService,
@IPathService protected readonly pathService: IPathService, @IPathService protected readonly pathService: IPathService,
@IKeybindingService private readonly keybindingService: IKeybindingService, @IKeybindingService private readonly keybindingService: IKeybindingService,
@@ -310,20 +310,22 @@ export class SimpleFileDialog extends Di @@ -311,20 +311,22 @@ export class SimpleFileDialog extends Di
this.filePickBox.ignoreFocusOut = true; this.filePickBox.placeholder = nls.localize('remoteFileDialog.placeholder', "Folder path");
this.filePickBox.ok = true; this.filePickBox.ok = true;
this.filePickBox.okLabel = typeof this.options.openLabel === 'string' ? this.options.openLabel : this.options.openLabel?.withoutMnemonic; this.filePickBox.okLabel = typeof this.options.openLabel === 'string' ? this.options.openLabel : this.options.openLabel?.withoutMnemonic;
- if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) { - if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
@ -289,7 +288,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/views/explo
import { WorkbenchCompressibleAsyncDataTree } from '../../../../../platform/list/browser/listService.js'; import { WorkbenchCompressibleAsyncDataTree } from '../../../../../platform/list/browser/listService.js';
import { ISearchService, QueryType, getExcludes, ISearchConfiguration, ISearchComplete, IFileQuery } from '../../../../services/search/common/search.js'; import { ISearchService, QueryType, getExcludes, ISearchConfiguration, ISearchComplete, IFileQuery } from '../../../../services/search/common/search.js';
import { CancellationToken } from '../../../../../base/common/cancellation.js'; import { CancellationToken } from '../../../../../base/common/cancellation.js';
@@ -1601,7 +1602,8 @@ export class FileDragAndDrop implements @@ -1594,7 +1595,8 @@ export class FileDragAndDrop implements
@IConfigurationService private configurationService: IConfigurationService, @IConfigurationService private configurationService: IConfigurationService,
@IInstantiationService private instantiationService: IInstantiationService, @IInstantiationService private instantiationService: IInstantiationService,
@IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService, @IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService,
@ -299,7 +298,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/views/explo
) { ) {
const updateDropEnablement = (e: IConfigurationChangeEvent | undefined) => { const updateDropEnablement = (e: IConfigurationChangeEvent | undefined) => {
if (!e || e.affectsConfiguration('explorer.enableDragAndDrop')) { if (!e || e.affectsConfiguration('explorer.enableDragAndDrop')) {
@@ -1826,15 +1828,17 @@ export class FileDragAndDrop implements @@ -1819,15 +1821,17 @@ export class FileDragAndDrop implements
// External file DND (Import/Upload file) // External file DND (Import/Upload file)
if (data instanceof NativeDragAndDropData) { if (data instanceof NativeDragAndDropData) {
@ -330,7 +329,7 @@ Index: code-server/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderS
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderServer.ts --- code-server.orig/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderServer.ts
+++ code-server/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderServer.ts +++ code-server/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderServer.ts
@@ -92,6 +92,7 @@ export abstract class AbstractDiskFileSy @@ -99,6 +99,7 @@ export abstract class AbstractDiskFileSy
private async readFile(uriTransformer: IURITransformer, _resource: UriComponents, opts?: IFileAtomicReadOptions): Promise<VSBuffer> { private async readFile(uriTransformer: IURITransformer, _resource: UriComponents, opts?: IFileAtomicReadOptions): Promise<VSBuffer> {
const resource = this.transformIncoming(uriTransformer, _resource, true); const resource = this.transformIncoming(uriTransformer, _resource, true);
@ -338,7 +337,7 @@ Index: code-server/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderS
const buffer = await this.provider.readFile(resource, opts); const buffer = await this.provider.readFile(resource, opts);
return VSBuffer.wrap(buffer); return VSBuffer.wrap(buffer);
@@ -110,6 +111,7 @@ export abstract class AbstractDiskFileSy @@ -117,6 +118,7 @@ export abstract class AbstractDiskFileSy
} }
}); });
@ -346,7 +345,7 @@ Index: code-server/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderS
const fileStream = this.provider.readFileStream(resource, opts, cts.token); const fileStream = this.provider.readFileStream(resource, opts, cts.token);
listenStream(fileStream, { listenStream(fileStream, {
onData: chunk => emitter.fire(VSBuffer.wrap(chunk)), onData: chunk => emitter.fire(VSBuffer.wrap(chunk)),
@@ -130,7 +132,7 @@ export abstract class AbstractDiskFileSy @@ -137,7 +139,7 @@ export abstract class AbstractDiskFileSy
private writeFile(uriTransformer: IURITransformer, _resource: UriComponents, content: VSBuffer, opts: IFileWriteOptions): Promise<void> { private writeFile(uriTransformer: IURITransformer, _resource: UriComponents, content: VSBuffer, opts: IFileWriteOptions): Promise<void> {
const resource = this.transformIncoming(uriTransformer, _resource); const resource = this.transformIncoming(uriTransformer, _resource);

View file

@ -19,7 +19,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
import { renderFormattedText } from '../../../../base/browser/formattedTextRenderer.js'; import { renderFormattedText } from '../../../../base/browser/formattedTextRenderer.js';
import { StandardKeyboardEvent } from '../../../../base/browser/keyboardEvent.js'; import { StandardKeyboardEvent } from '../../../../base/browser/keyboardEvent.js';
import { Button } from '../../../../base/browser/ui/button/button.js'; import { Button } from '../../../../base/browser/ui/button/button.js';
@@ -54,7 +54,7 @@ import { IRecentFolder, IRecentWorkspace @@ -53,7 +53,7 @@ import { IRecentFolder, IRecentWorkspace
import { OpenRecentAction } from '../../../browser/actions/windowActions.js'; import { OpenRecentAction } from '../../../browser/actions/windowActions.js';
import { OpenFileFolderAction, OpenFolderAction, OpenFolderViaWorkspaceAction } from '../../../browser/actions/workspaceActions.js'; import { OpenFileFolderAction, OpenFolderAction, OpenFolderViaWorkspaceAction } from '../../../browser/actions/workspaceActions.js';
import { EditorPane } from '../../../browser/parts/editor/editorPane.js'; import { EditorPane } from '../../../browser/parts/editor/editorPane.js';
@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
import { IEditorOpenContext, IEditorSerializer } from '../../../common/editor.js'; import { IEditorOpenContext, IEditorSerializer } from '../../../common/editor.js';
import { IWebviewElement, IWebviewService } from '../../webview/browser/webview.js'; import { IWebviewElement, IWebviewService } from '../../webview/browser/webview.js';
import './gettingStartedColors.js'; import './gettingStartedColors.js';
@@ -870,6 +870,72 @@ export class GettingStartedPage extends @@ -902,6 +902,72 @@ export class GettingStartedPage extends
$('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved")) $('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved"))
); );
@ -101,7 +101,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
const leftColumn = $('.categories-column.categories-column-left', {},); const leftColumn = $('.categories-column.categories-column-left', {},);
const rightColumn = $('.categories-column.categories-column-right', {},); const rightColumn = $('.categories-column.categories-column-right', {},);
@@ -905,6 +971,9 @@ export class GettingStartedPage extends @@ -937,6 +1003,9 @@ export class GettingStartedPage extends
recentList.setLimit(5); recentList.setLimit(5);
reset(leftColumn, startList.getDomElement(), recentList.getDomElement()); reset(leftColumn, startList.getDomElement(), recentList.getDomElement());
} }
@ -181,7 +181,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts --- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts +++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
@@ -18,6 +18,7 @@ export const serverOptions: OptionDescri @@ -20,6 +20,7 @@ export const serverOptions: OptionDescri
'auth': { type: 'string' }, 'auth': { type: 'string' },
'disable-file-downloads': { type: 'boolean' }, 'disable-file-downloads': { type: 'boolean' },
'disable-file-uploads': { type: 'boolean' }, 'disable-file-uploads': { type: 'boolean' },
@ -189,7 +189,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -104,6 +105,7 @@ export interface ServerParsedArgs { @@ -108,6 +109,7 @@ export interface ServerParsedArgs {
'auth'?: string; 'auth'?: string;
'disable-file-downloads'?: boolean; 'disable-file-downloads'?: boolean;
'disable-file-uploads'?: boolean; 'disable-file-uploads'?: boolean;
@ -201,7 +201,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -368,6 +368,7 @@ export class WebClientServer { @@ -373,6 +373,7 @@ export class WebClientServer {
userDataPath: this._environmentService.userDataPath, userDataPath: this._environmentService.userDataPath,
isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'], isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'], isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'],
@ -213,16 +213,16 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts +++ code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
@@ -7,7 +7,7 @@ import { Event } from '../../base/common @@ -6,7 +6,7 @@
import { Disposable } from '../../base/common/lifecycle.js'; import { Disposable } from '../../base/common/lifecycle.js';
import { IContextKeyService, IContextKey, setConstant as setConstantContextKey } from '../../platform/contextkey/common/contextkey.js'; import { IContextKeyService, IContextKey, setConstant as setConstantContextKey } from '../../platform/contextkey/common/contextkey.js';
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext, IsMobileContext } from '../../platform/contextkey/common/contextkeys.js'; import { IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext, IsMobileContext } from '../../platform/contextkey/common/contextkeys.js';
-import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, IsEnabledFileDownloads, IsEnabledFileUploads } from '../common/contextkeys.js'; -import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, AuxiliaryBarMaximizedContext, InAutomationContext, IsEnabledFileDownloads, IsEnabledFileUploads } from '../common/contextkeys.js';
+import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, IsEnabledFileDownloads, IsEnabledFileUploads, IsEnabledCoderGettingStarted, } from '../common/contextkeys.js'; +import { SplitEditorsVertically, InEditorZenModeContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, TitleBarVisibleContext, TitleBarStyleContext, IsAuxiliaryWindowFocusedContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, AuxiliaryBarMaximizedContext, InAutomationContext, IsEnabledFileDownloads, IsEnabledFileUploads, IsEnabledCoderGettingStarted, } from '../common/contextkeys.js';
import { trackFocus, addDisposableListener, EventType, onDidRegisterWindow, getActiveWindow, isEditableElement } from '../../base/browser/dom.js';
import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from '../services/editor/common/editorGroupsService.js'; import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from '../services/editor/common/editorGroupsService.js';
import { IConfigurationService } from '../../platform/configuration/common/configuration.js'; import { IConfigurationService } from '../../platform/configuration/common/configuration.js';
@@ -200,6 +200,7 @@ export class WorkbenchContextKeysHandler import { IBrowserWorkbenchEnvironmentService } from '../services/environment/browser/environmentService.js';
@@ -202,6 +202,7 @@ export class WorkbenchContextKeysHandler
// code-server // code-server
IsEnabledFileDownloads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileDownloads ?? true) IsEnabledFileDownloads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileDownloads ?? true)
IsEnabledFileUploads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileUploads ?? true) IsEnabledFileUploads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileUploads ?? true)
@ -234,7 +234,7 @@ Index: code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/common/contextkeys.ts --- code-server.orig/lib/vscode/src/vs/workbench/common/contextkeys.ts
+++ code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts +++ code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts
@@ -41,6 +41,7 @@ export const EmbedderIdentifierContext = @@ -41,6 +41,7 @@ export const InAutomationContext = new R
export const IsEnabledFileDownloads = new RawContextKey<boolean>('isEnabledFileDownloads', true, true); export const IsEnabledFileDownloads = new RawContextKey<boolean>('isEnabledFileDownloads', true, true);
export const IsEnabledFileUploads = new RawContextKey<boolean>('isEnabledFileUploads', true, true); export const IsEnabledFileUploads = new RawContextKey<boolean>('isEnabledFileUploads', true, true);

View file

@ -109,24 +109,6 @@ Index: code-server/lib/vscode/src/vs/base/common/processes.ts
]; ];
const envKeys = Object.keys(env); const envKeys = Object.keys(env);
envKeys envKeys
Index: code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
@@ -79,8 +79,11 @@ export class BrowserDialogHandler extend
async about(): Promise<void> {
const detailString = (useAgo: boolean): string => {
- return localize('aboutDetail',
- "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
+ return localize('aboutCodeServerDetail',
+ "code-server: {0}",
+ this.productService.codeServerVersion ? `v${this.productService.codeServerVersion}` : 'Unknown'
+ ) + '\n' + localize('aboutDetail',
+ "Code: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
this.productService.version || 'Unknown',
this.productService.commit || 'Unknown',
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
=================================================================== ===================================================================
--- /dev/null --- /dev/null
@ -204,7 +186,7 @@ Index: code-server/lib/vscode/src/vs/base/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts --- code-server.orig/lib/vscode/src/vs/base/common/product.ts
+++ code-server/lib/vscode/src/vs/base/common/product.ts +++ code-server/lib/vscode/src/vs/base/common/product.ts
@@ -55,6 +55,8 @@ export type ExtensionVirtualWorkspaceSup @@ -64,6 +64,8 @@ export type ExtensionVirtualWorkspaceSup
}; };
export interface IProductConfiguration { export interface IProductConfiguration {
@ -269,10 +251,10 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -334,6 +334,7 @@ export class WebClientServer { @@ -333,6 +333,7 @@ export class WebClientServer {
} : undefined; } : undefined;
const productConfiguration = { const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
+ codeServerVersion: this._productService.codeServerVersion, + codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? { extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
@ -281,9 +263,9 @@ Index: code-server/lib/vscode/src/server-main.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/server-main.ts --- code-server.orig/lib/vscode/src/server-main.ts
+++ code-server/lib/vscode/src/server-main.ts +++ code-server/lib/vscode/src/server-main.ts
@@ -25,6 +25,9 @@ const __dirname = path.dirname(fileURLTo @@ -22,6 +22,9 @@ import { IServerAPI } from './vs/server/
perf.mark('code/server/start'); perf.mark('code/server/start');
(globalThis as any).vscodeServerStartTime = performance.now(); (globalThis as { vscodeServerStartTime?: number }).vscodeServerStartTime = performance.now();
+// This is not indented to make the diff less noisy. We need to move this out +// This is not indented to make the diff less noisy. We need to move this out
+// of the top-level so it will not run immediately and we can control the start. +// of the top-level so it will not run immediately and we can control the start.
@ -291,15 +273,15 @@ Index: code-server/lib/vscode/src/server-main.ts
// Do a quick parse to determine if a server or the cli needs to be started // Do a quick parse to determine if a server or the cli needs to be started
const parsedArgs = minimist(process.argv.slice(2), { const parsedArgs = minimist(process.argv.slice(2), {
boolean: ['start-server', 'list-extensions', 'print-ip-address', 'help', 'version', 'accept-server-license-terms', 'update-extensions'], boolean: ['start-server', 'list-extensions', 'print-ip-address', 'help', 'version', 'accept-server-license-terms', 'update-extensions'],
@@ -153,6 +156,7 @@ if (shouldSpawnCli) { @@ -150,6 +153,7 @@ if (shouldSpawnCli) {
} }
}); });
} }
+} +}
function sanitizeStringArg(val: any): string | undefined { function sanitizeStringArg(val: unknown): string | undefined {
if (Array.isArray(val)) { // if an argument is passed multiple times, minimist creates an array if (Array.isArray(val)) { // if an argument is passed multiple times, minimist creates an array
@@ -286,3 +290,22 @@ function prompt(question: string): Promi @@ -283,3 +287,22 @@ function prompt(question: string): Promi
}); });
}); });
} }
@ -310,7 +292,7 @@ Index: code-server/lib/vscode/src/server-main.ts
+ osLocale: 'en', + osLocale: 'en',
+ commit: product.commit, + commit: product.commit,
+ userDataPath: '', + userDataPath: '',
+ nlsMetadataPath: __dirname, + nlsMetadataPath: import.meta.dirname,
+ }); + });
+ return loadCode(nlsConfiguration); + return loadCode(nlsConfiguration);
+} +}
@ -322,3 +304,21 @@ Index: code-server/lib/vscode/src/server-main.ts
+if (!process.env.CODE_SERVER_PARENT_PID) { +if (!process.env.CODE_SERVER_PARENT_PID) {
+ start(); + start();
+} +}
Index: code-server/lib/vscode/src/vs/platform/dialogs/browser/dialog.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/dialogs/browser/dialog.ts
+++ code-server/lib/vscode/src/vs/platform/dialogs/browser/dialog.ts
@@ -45,8 +45,11 @@ export function createWorkbenchDialogOpt
export function createBrowserAboutDialogDetails(productService: IProductService): { title: string; details: string; detailsToCopy: string } {
const detailString = (useAgo: boolean): string => {
- return localize('aboutDetail',
- "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
+ return localize('aboutCodeServerDetail',
+ "code-server: {0}",
+ productService.codeServerVersion ? `v${productService.codeServerVersion}` : 'Unknown'
+ ) + '\n' + localize('aboutDetail',
+ "Code: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
productService.version || 'Unknown',
productService.commit || 'Unknown',
productService.date ? `${productService.date}${useAgo ? ' (' + fromNow(new Date(productService.date), true) + ')' : ''}` : 'Unknown',

View file

@ -18,7 +18,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -359,6 +359,7 @@ export class WebClientServer { @@ -364,6 +364,7 @@ export class WebClientServer {
remoteAuthority, remoteAuthority,
serverBasePath: basePath, serverBasePath: basePath,
webviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', webviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
@ -32,7 +32,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts +++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
@@ -298,6 +298,11 @@ export interface IWorkbenchConstructionO @@ -298,6 +298,11 @@ export interface IWorkbenchConstructionO
*/ */
readonly configurationDefaults?: Record<string, any>; readonly configurationDefaults?: Record<string, unknown>;
+ /** + /**
+ * Path to the user data directory. + * Path to the user data directory.
@ -79,7 +79,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/configuration/browser/co
}); });
})); }));
@@ -555,6 +557,12 @@ export class WorkspaceService extends Di @@ -556,6 +558,12 @@ export class WorkspaceService extends Di
previousFolders = this.workspace.folders; previousFolders = this.workspace.folders;
this.workspace.update(workspace); this.workspace.update(workspace);
} else { } else {

View file

@ -8,7 +8,7 @@ Index: code-server/lib/vscode/src/vs/base/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts --- code-server.orig/lib/vscode/src/vs/base/common/product.ts
+++ code-server/lib/vscode/src/vs/base/common/product.ts +++ code-server/lib/vscode/src/vs/base/common/product.ts
@@ -58,6 +58,7 @@ export interface IProductConfiguration { @@ -67,6 +67,7 @@ export interface IProductConfiguration {
readonly codeServerVersion?: string readonly codeServerVersion?: string
readonly rootEndpoint?: string readonly rootEndpoint?: string
readonly updateEndpoint?: string readonly updateEndpoint?: string
@ -20,7 +20,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts --- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts +++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
@@ -15,6 +15,7 @@ import { URI } from '../../base/common/u @@ -17,6 +17,7 @@ import { join } from '../../base/common/
export const serverOptions: OptionDescriptions<Required<ServerParsedArgs>> = { export const serverOptions: OptionDescriptions<Required<ServerParsedArgs>> = {
/* ----- code-server ----- */ /* ----- code-server ----- */
'disable-update-check': { type: 'boolean' }, 'disable-update-check': { type: 'boolean' },
@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -98,6 +99,7 @@ export const serverOptions: OptionDescri @@ -102,6 +103,7 @@ export const serverOptions: OptionDescri
export interface ServerParsedArgs { export interface ServerParsedArgs {
/* ----- code-server ----- */ /* ----- code-server ----- */
'disable-update-check'?: boolean; 'disable-update-check'?: boolean;
@ -40,14 +40,14 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -342,6 +342,7 @@ export class WebClientServer { @@ -341,6 +341,7 @@ export class WebClientServer {
codeServerVersion: this._productService.codeServerVersion, codeServerVersion: this._productService.codeServerVersion,
rootEndpoint: rootBase, rootEndpoint: rootBase,
updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined, updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
+ logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined, + logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
} satisfies Partial<IProductConfiguration>; };
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts

View file

@ -19,7 +19,7 @@ Index: code-server/lib/vscode/src/vs/platform/product/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts --- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts
+++ code-server/lib/vscode/src/vs/platform/product/common/product.ts +++ code-server/lib/vscode/src/vs/platform/product/common/product.ts
@@ -47,6 +47,16 @@ else if (globalThis._VSCODE_PRODUCT_JSON @@ -49,6 +49,17 @@ else if (globalThis._VSCODE_PRODUCT_JSON
version: pkg.version version: pkg.version
}); });
} }
@ -28,6 +28,7 @@ Index: code-server/lib/vscode/src/vs/platform/product/common/product.ts
+ extensionsGallery: env.EXTENSIONS_GALLERY ? JSON.parse(env.EXTENSIONS_GALLERY) : (product.extensionsGallery || { + extensionsGallery: env.EXTENSIONS_GALLERY ? JSON.parse(env.EXTENSIONS_GALLERY) : (product.extensionsGallery || {
+ serviceUrl: "https://open-vsx.org/vscode/gallery", + serviceUrl: "https://open-vsx.org/vscode/gallery",
+ itemUrl: "https://open-vsx.org/vscode/item", + itemUrl: "https://open-vsx.org/vscode/item",
+ extensionUrlTemplate: "https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest",
+ resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}", + resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",
+ controlUrl: "", + controlUrl: "",
+ recommendationsUrl: "", + recommendationsUrl: "",
@ -40,15 +41,15 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -327,7 +327,6 @@ export class WebClientServer { @@ -326,7 +326,6 @@ export class WebClientServer {
const staticRoute = posix.join(basePath, this._productPath, STATIC_PATH); const staticRoute = posix.join(basePath, this._productPath, STATIC_PATH);
const callbackRoute = posix.join(basePath, this._productPath, CALLBACK_PATH); const callbackRoute = posix.join(basePath, this._productPath, CALLBACK_PATH);
- const webExtensionRoute = posix.join(basePath, this._productPath, WEB_EXTENSION_PATH); - const webExtensionRoute = posix.join(basePath, this._productPath, WEB_EXTENSION_PATH);
const resolveWorkspaceURI = (defaultLocation?: string) => defaultLocation && URI.file(path.resolve(defaultLocation)).with({ scheme: Schemas.vscodeRemote, authority: remoteAuthority }); const resolveWorkspaceURI = (defaultLocation?: string) => defaultLocation && URI.file(resolve(defaultLocation)).with({ scheme: Schemas.vscodeRemote, authority: remoteAuthority });
@@ -343,14 +342,7 @@ export class WebClientServer { @@ -342,14 +341,7 @@ export class WebClientServer {
codeServerVersion: this._productService.codeServerVersion, codeServerVersion: this._productService.codeServerVersion,
rootEndpoint: rootBase, rootEndpoint: rootBase,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
@ -61,9 +62,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
- }).toString(true) - }).toString(true)
- } : undefined - } : undefined
+ extensionsGallery: this._productService.extensionsGallery, + extensionsGallery: this._productService.extensionsGallery,
} satisfies Partial<IProductConfiguration>; };
if (!this._environmentService.isBuilt) { const proposedApi = this._environmentService.args['enable-proposed-api'];
Index: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts Index: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts --- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
@ -74,9 +75,9 @@ Index: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/ext
import { getTelemetryLevel, supportsTelemetry } from '../../telemetry/common/telemetryUtils.js'; import { getTelemetryLevel, supportsTelemetry } from '../../telemetry/common/telemetryUtils.js';
-import { RemoteAuthorities } from '../../../base/common/network.js'; -import { RemoteAuthorities } from '../../../base/common/network.js';
import { TargetPlatform } from '../../extensions/common/extensions.js'; import { TargetPlatform } from '../../extensions/common/extensions.js';
import { ExtensionGalleryResourceType, getExtensionGalleryManifestResourceUri, IExtensionGalleryManifest, IExtensionGalleryManifestService } from '../../extensionManagement/common/extensionGalleryManifest.js';
const WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT = '/web-extension-resource/'; import { ILogService } from '../../log/common/log.js';
@@ -140,9 +139,9 @@ export abstract class AbstractExtensionR @@ -163,9 +162,9 @@ export abstract class AbstractExtensionR
} }
protected _isWebExtensionResourceEndPoint(uri: URI): boolean { protected _isWebExtensionResourceEndPoint(uri: URI): boolean {

View file

@ -10,7 +10,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/extensions/common/extens
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts --- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts
+++ code-server/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts +++ code-server/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts
@@ -314,10 +314,7 @@ function extensionDescriptionArrayToMap( @@ -321,10 +321,7 @@ function extensionDescriptionArrayToMap(
} }
export function isProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): boolean { export function isProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): boolean {

View file

@ -30,7 +30,7 @@ Index: code-server/lib/vscode/src/vs/base/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts --- code-server.orig/lib/vscode/src/vs/base/common/product.ts
+++ code-server/lib/vscode/src/vs/base/common/product.ts +++ code-server/lib/vscode/src/vs/base/common/product.ts
@@ -59,6 +59,7 @@ export interface IProductConfiguration { @@ -68,6 +68,7 @@ export interface IProductConfiguration {
readonly rootEndpoint?: string readonly rootEndpoint?: string
readonly updateEndpoint?: string readonly updateEndpoint?: string
readonly logoutEndpoint?: string readonly logoutEndpoint?: string
@ -71,19 +71,19 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -343,6 +343,7 @@ export class WebClientServer { @@ -342,6 +342,7 @@ export class WebClientServer {
rootEndpoint: rootBase, rootEndpoint: rootBase,
updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined, updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined, logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
+ proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? rootBase + '/proxy/{{port}}/', + proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? rootBase + '/proxy/{{port}}/',
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
} satisfies Partial<IProductConfiguration>; };
Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts --- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts
@@ -291,7 +291,7 @@ export async function createTerminalEnvi @@ -292,7 +292,7 @@ export async function createTerminalEnvi
// Sanitize the environment, removing any undesirable VS Code and Electron environment // Sanitize the environment, removing any undesirable VS Code and Electron environment
// variables // variables
@ -96,7 +96,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts --- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts +++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
@@ -19,6 +19,7 @@ import { ISecretStorageProvider } from ' @@ -20,6 +20,7 @@ import { ISecretStorageProvider } from '
import { isFolderToOpen, isWorkspaceToOpen } from '../../../platform/window/common/window.js'; import { isFolderToOpen, isWorkspaceToOpen } from '../../../platform/window/common/window.js';
import type { IWorkbenchConstructionOptions, IWorkspace, IWorkspaceProvider } from '../../../workbench/browser/web.api.js'; import type { IWorkbenchConstructionOptions, IWorkspace, IWorkspaceProvider } from '../../../workbench/browser/web.api.js';
import { AuthenticationSessionInfo } from '../../../workbench/services/authentication/browser/authenticationService.js'; import { AuthenticationSessionInfo } from '../../../workbench/services/authentication/browser/authenticationService.js';
@ -104,7 +104,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
import type { IURLCallbackProvider } from '../../../workbench/services/url/browser/urlService.js'; import type { IURLCallbackProvider } from '../../../workbench/services/url/browser/urlService.js';
import { create } from '../../../workbench/workbench.web.main.internal.js'; import { create } from '../../../workbench/workbench.web.main.internal.js';
@@ -584,6 +585,39 @@ class WorkspaceProvider implements IWork @@ -606,6 +607,39 @@ class WorkspaceProvider implements IWork
settingsSyncOptions: config.settingsSyncOptions ? { enabled: config.settingsSyncOptions.enabled, } : undefined, settingsSyncOptions: config.settingsSyncOptions ? { enabled: config.settingsSyncOptions.enabled, } : undefined,
workspaceProvider: WorkspaceProvider.create(config), workspaceProvider: WorkspaceProvider.create(config),
urlCallbackProvider: new LocalStorageURLCallbackProvider(config.callbackRoute), urlCallbackProvider: new LocalStorageURLCallbackProvider(config.callbackRoute),

View file

@ -20,3 +20,5 @@ getting-started.diff
keepalive.diff keepalive.diff
clipboard.diff clipboard.diff
display-language.diff display-language.diff
trusted-domains.diff
signature-verification.diff

View file

@ -6,7 +6,7 @@ Index: code-server/lib/vscode/src/vs/base/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts --- code-server.orig/lib/vscode/src/vs/base/common/product.ts
+++ code-server/lib/vscode/src/vs/base/common/product.ts +++ code-server/lib/vscode/src/vs/base/common/product.ts
@@ -60,6 +60,10 @@ export interface IProductConfiguration { @@ -69,6 +69,10 @@ export interface IProductConfiguration {
readonly updateEndpoint?: string readonly updateEndpoint?: string
readonly logoutEndpoint?: string readonly logoutEndpoint?: string
readonly proxyEndpointTemplate?: string readonly proxyEndpointTemplate?: string
@ -54,7 +54,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -344,6 +344,10 @@ export class WebClientServer { @@ -343,6 +343,10 @@ export class WebClientServer {
updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined, updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined, logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? rootBase + '/proxy/{{port}}/', proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? rootBase + '/proxy/{{port}}/',
@ -64,4 +64,4 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
+ }, + },
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
} satisfies Partial<IProductConfiguration>; };

View file

@ -0,0 +1,34 @@
Disable signature verification.
Extension signature verification is now mandatory for all platforms and needs to be disabled.
Index: code-server/lib/vscode/src/vs/platform/extensionManagement/node/extensionManagementService.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/extensionManagement/node/extensionManagementService.ts
+++ code-server/lib/vscode/src/vs/platform/extensionManagement/node/extensionManagementService.ts
@@ -34,6 +34,7 @@ import {
ExtensionSignatureVerificationCode,
computeSize,
IAllowedExtensionsService,
+ // @ts-expect-error no-unused-variable
VerifyExtensionSignatureConfigKey,
shouldRequireRepositorySignatureFor,
} from '../common/extensionManagement.js';
@@ -87,6 +88,7 @@ export class ExtensionManagementService
@IDownloadService private downloadService: IDownloadService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IFileService private readonly fileService: IFileService,
+ // @ts-expect-error no-unused-variable
@IConfigurationService private readonly configurationService: IConfigurationService,
@IExtensionGalleryManifestService protected readonly extensionGalleryManifestService: IExtensionGalleryManifestService,
@IProductService productService: IProductService,
@@ -339,8 +341,7 @@ export class ExtensionManagementService
private async downloadExtension(extension: IGalleryExtension, operation: InstallOperation, verifySignature: boolean, clientTargetPlatform?: TargetPlatform): Promise<{ readonly location: URI; readonly verificationStatus: ExtensionSignatureVerificationCode | undefined }> {
if (verifySignature) {
- const value = this.configurationService.getValue(VerifyExtensionSignatureConfigKey);
- verifySignature = isBoolean(value) ? value : true;
+ verifySignature = false;
}
const { location, verificationStatus } = await this.extensionsDownloader.download(extension, operation, verifySignature, clientTargetPlatform);
const shouldRequireSignature = shouldRequireRepositorySignatureFor(extension.private, await this.extensionGalleryManifestService.getExtensionGalleryManifest());

View file

@ -10,29 +10,29 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/build/gulpfile.reh.js --- code-server.orig/lib/vscode/build/gulpfile.reh.js
+++ code-server/lib/vscode/build/gulpfile.reh.js +++ code-server/lib/vscode/build/gulpfile.reh.js
@@ -256,8 +256,7 @@ function packageTask(type, platform, arc @@ -257,8 +257,7 @@ function packageTask(type, platform, arc
const src = gulp.src(sourceFolderName + '/**', { base: '.' }) const src = gulp.src(sourceFolderName + '/**', { base: '.' })
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); })) .pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); }))
- .pipe(util.setExecutableBit(['**/*.sh'])) - .pipe(util.setExecutableBit(['**/*.sh']))
- .pipe(filter(['**', '!**/*.js.map'])); - .pipe(filter(['**', '!**/*.{js,css}.map']));
+ .pipe(util.setExecutableBit(['**/*.sh'])); + .pipe(util.setExecutableBit(['**/*.sh']));
const workspaceExtensionPoints = ['debuggers', 'jsonValidation']; const workspaceExtensionPoints = ['debuggers', 'jsonValidation'];
const isUIExtension = (manifest) => { const isUIExtension = (manifest) => {
@@ -296,9 +295,9 @@ function packageTask(type, platform, arc @@ -297,9 +296,9 @@ function packageTask(type, platform, arc
.map(name => `.build/extensions/${name}/**`); .map(name => `.build/extensions/${name}/**`);
const extensions = gulp.src(extensionPaths, { base: '.build', dot: true }); const extensions = gulp.src(extensionPaths, { base: '.build', dot: true });
- const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true }); - const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true });
- const sources = es.merge(src, extensions, extensionsCommonDependencies) - const sources = es.merge(src, extensions, extensionsCommonDependencies)
+ const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true }) + const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true })
.pipe(filter(['**', '!**/*.js.map'], { dot: true })); .pipe(filter(['**', '!**/*.{js,css}.map'], { dot: true }));
+ const sources = es.merge(src, extensions, extensionsCommonDependencies); + const sources = es.merge(src, extensions, extensionsCommonDependencies);
let version = packageJson.version; let version = packageJson.version;
const quality = product.quality; const quality = product.quality;
@@ -457,7 +456,7 @@ function tweakProductForServerWeb(produc @@ -452,7 +451,7 @@ function tweakProductForServerWeb(produc
const minifyTask = task.define(`minify-vscode-${type}`, task.series( const minifyTask = task.define(`minify-vscode-${type}`, task.series(
bundleTask, bundleTask,
util.rimraf(`out-vscode-${type}-min`), util.rimraf(`out-vscode-${type}-min`),

View file

@ -21,18 +21,18 @@ Index: code-server/lib/vscode/src/vs/workbench/api/node/extHostExtensionService.
+import * as _http from 'http'; +import * as _http from 'http';
import * as performance from '../../../base/common/performance.js'; import * as performance from '../../../base/common/performance.js';
import type * as vscode from 'vscode';
import { createApiFactoryAndRegisterActors } from '../common/extHost.api.impl.js'; import { createApiFactoryAndRegisterActors } from '../common/extHost.api.impl.js';
import { RequireInterceptor } from '../common/extHostRequireInterceptor.js'; @@ -18,6 +19,7 @@ import { ExtensionRuntime } from '../com
@@ -17,6 +18,7 @@ import { ExtensionRuntime } from '../com
import { CLIServer } from './extHostCLIServer.js'; import { CLIServer } from './extHostCLIServer.js';
import { realpathSync } from '../../../base/node/extpath.js'; import { realpathSync } from '../../../base/node/pfs.js';
import { ExtHostConsoleForwarder } from './extHostConsoleForwarder.js'; import { ExtHostConsoleForwarder } from './extHostConsoleForwarder.js';
+import { IExtHostWorkspace } from '../common/extHostWorkspace.js'; +import { IExtHostWorkspace } from '../common/extHostWorkspace.js';
import { ExtHostDiskFileSystemProvider } from './extHostDiskFileSystemProvider.js'; import { ExtHostDiskFileSystemProvider } from './extHostDiskFileSystemProvider.js';
import { createRequire } from 'node:module'; import nodeModule from 'node:module';
const require = createRequire(import.meta.url); import { assertType } from '../../../base/common/types.js';
@@ -97,6 +99,52 @@ export class ExtHostExtensionService ext @@ -226,6 +228,52 @@ export class ExtHostExtensionService ext
await interceptor.install();
performance.mark('code/extHost/didInitAPI'); performance.mark('code/extHost/didInitAPI');
+ (async () => { + (async () => {
@ -96,7 +96,7 @@ Index: code-server/lib/vscode/src/vs/workbench/api/node/extensionHostProcess.ts
import minimist from 'minimist'; import minimist from 'minimist';
import * as nativeWatchdog from 'native-watchdog'; import * as nativeWatchdog from 'native-watchdog';
import * as net from 'net'; import * as net from 'net';
@@ -422,7 +423,28 @@ async function startExtensionHostProcess @@ -451,7 +452,28 @@ async function startExtensionHostProcess
); );
// rewrite onTerminate-function to be a proper shutdown // rewrite onTerminate-function to be a proper shutdown

View file

@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
import { NullPolicyService } from '../../platform/policy/common/policy.js'; import { NullPolicyService } from '../../platform/policy/common/policy.js';
import { OneDataSystemAppender } from '../../platform/telemetry/node/1dsAppender.js'; import { OneDataSystemAppender } from '../../platform/telemetry/node/1dsAppender.js';
import { LoggerService } from '../../platform/log/node/loggerService.js'; import { LoggerService } from '../../platform/log/node/loggerService.js';
@@ -153,11 +155,23 @@ export async function setupServerService @@ -166,11 +168,23 @@ export async function setupServerService
const requestService = new RequestService('remote', configurationService, environmentService, logService); const requestService = new RequestService('remote', configurationService, environmentService, logService);
services.set(IRequestService, requestService); services.set(IRequestService, requestService);
@ -134,7 +134,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -348,6 +348,8 @@ export class WebClientServer { @@ -347,6 +347,8 @@ export class WebClientServer {
scope: vscodeBase + '/', scope: vscodeBase + '/',
path: rootBase + '/_static/out/browser/serviceWorker.js', path: rootBase + '/_static/out/browser/serviceWorker.js',
}, },
@ -142,12 +142,12 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
+ telemetryEndpoint: this._productService.telemetryEndpoint, + telemetryEndpoint: this._productService.telemetryEndpoint,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
} satisfies Partial<IProductConfiguration>; };
Index: code-server/lib/vscode/src/vs/base/common/product.ts Index: code-server/lib/vscode/src/vs/base/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts --- code-server.orig/lib/vscode/src/vs/base/common/product.ts
+++ code-server/lib/vscode/src/vs/base/common/product.ts +++ code-server/lib/vscode/src/vs/base/common/product.ts
@@ -64,6 +64,7 @@ export interface IProductConfiguration { @@ -73,6 +73,7 @@ export interface IProductConfiguration {
readonly path: string; readonly path: string;
readonly scope: string; readonly scope: string;
} }
@ -159,7 +159,7 @@ Index: code-server/lib/vscode/src/vs/platform/product/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts --- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts
+++ code-server/lib/vscode/src/vs/platform/product/common/product.ts +++ code-server/lib/vscode/src/vs/platform/product/common/product.ts
@@ -55,7 +55,8 @@ else if (globalThis._VSCODE_PRODUCT_JSON @@ -58,7 +58,8 @@ else if (globalThis._VSCODE_PRODUCT_JSON
resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}", resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",
controlUrl: "", controlUrl: "",
recommendationsUrl: "", recommendationsUrl: "",

View file

@ -0,0 +1,49 @@
Allow configuring trusted domains via product.json or flag.
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
@@ -22,6 +22,7 @@ export const serverOptions: OptionDescri
'disable-file-uploads': { type: 'boolean' },
'disable-getting-started-override': { type: 'boolean' },
'locale': { type: 'string' },
+ 'link-protection-trusted-domains': { type: 'string[]' },
/* ----- server setup ----- */
@@ -112,6 +113,7 @@ export interface ServerParsedArgs {
'disable-file-uploads'?: boolean;
'disable-getting-started-override'?: boolean,
'locale'?: string
+ 'link-protection-trusted-domains'?: string[],
/* ----- server setup ----- */
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -338,6 +338,14 @@ export class WebClientServer {
scopes: [['user:email'], ['repo']]
} : undefined;
+ const linkProtectionTrustedDomains: string[] = [];
+ if (this._environmentService.args['link-protection-trusted-domains']) {
+ linkProtectionTrustedDomains.push(...this._environmentService.args['link-protection-trusted-domains']);
+ }
+ if (this._productService.linkProtectionTrustedDomains) {
+ linkProtectionTrustedDomains.push(...this._productService.linkProtectionTrustedDomains);
+ }
+
const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
codeServerVersion: this._productService.codeServerVersion,
rootEndpoint: rootBase,
@@ -352,6 +360,7 @@ export class WebClientServer {
telemetryEndpoint: this._productService.telemetryEndpoint,
embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery,
+ linkProtectionTrustedDomains,
};
const proposedApi = this._environmentService.args['enable-proposed-api'];

View file

@ -21,7 +21,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageS
export class BrowserStorageService extends AbstractStorageService { export class BrowserStorageService extends AbstractStorageService {
@@ -298,7 +299,11 @@ export class IndexedDBStorageDatabase ex @@ -300,7 +301,11 @@ export class IndexedDBStorageDatabase ex
} }
static async createWorkspaceStorage(workspaceId: string, logService: ILogService): Promise<IIndexedDBStorageDatabase> { static async createWorkspaceStorage(workspaceId: string, logService: ILogService): Promise<IIndexedDBStorageDatabase> {

View file

@ -93,7 +93,7 @@ Index: code-server/lib/vscode/src/vs/base/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts --- code-server.orig/lib/vscode/src/vs/base/common/product.ts
+++ code-server/lib/vscode/src/vs/base/common/product.ts +++ code-server/lib/vscode/src/vs/base/common/product.ts
@@ -57,6 +57,7 @@ export type ExtensionVirtualWorkspaceSup @@ -66,6 +66,7 @@ export type ExtensionVirtualWorkspaceSup
export interface IProductConfiguration { export interface IProductConfiguration {
readonly codeServerVersion?: string readonly codeServerVersion?: string
readonly rootEndpoint?: string readonly rootEndpoint?: string
@ -105,20 +105,20 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -341,6 +341,7 @@ export class WebClientServer { @@ -340,6 +340,7 @@ export class WebClientServer {
const productConfiguration = { const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
codeServerVersion: this._productService.codeServerVersion, codeServerVersion: this._productService.codeServerVersion,
rootEndpoint: rootBase, rootEndpoint: rootBase,
+ updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined, + updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
} satisfies Partial<IProductConfiguration>; };
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts --- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts +++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
@@ -13,6 +13,8 @@ import { memoize } from '../../base/comm @@ -15,6 +15,8 @@ import { joinPath } from '../../base/com
import { URI } from '../../base/common/uri.js'; import { join } from '../../base/common/path.js';
export const serverOptions: OptionDescriptions<Required<ServerParsedArgs>> = { export const serverOptions: OptionDescriptions<Required<ServerParsedArgs>> = {
+ /* ----- code-server ----- */ + /* ----- code-server ----- */
@ -126,7 +126,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -94,6 +96,8 @@ export const serverOptions: OptionDescri @@ -98,6 +100,8 @@ export const serverOptions: OptionDescri
}; };
export interface ServerParsedArgs { export interface ServerParsedArgs {

View file

@ -54,7 +54,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -355,6 +355,7 @@ export class WebClientServer { @@ -360,6 +360,7 @@ export class WebClientServer {
const workbenchWebConfiguration = { const workbenchWebConfiguration = {
remoteAuthority, remoteAuthority,
serverBasePath: basePath, serverBasePath: basePath,
@ -70,29 +70,21 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" <meta http-equiv="Content-Security-Policy"
- content="default-src 'none'; script-src 'sha256-DXeP32g8BdMsVuVabYTmznoTH59F7M7UtV0vXemEFqc=' 'self'; frame-src 'self'; style-src 'unsafe-inline';"> - content="default-src 'none'; script-src 'sha256-ZcIhtIuU4M9PbKfs7w/CLqHimFJRK8L7mYTXOfiUv0I=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
+ content="default-src 'none'; script-src 'sha256-z5v/0xE4zQPgV1fazhHB/UlsTzdm39hRMk3V8Av0HI4=' 'self'; frame-src 'self'; style-src 'unsafe-inline';"> + content="default-src 'none'; script-src 'sha256-dVbEBqfV68sWYG05nAX+55pv4dls0VnI6ZDMMV/0GYQ=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
<!-- Disable pinch zooming --> <!-- Disable pinch zooming -->
@@ -349,6 +349,12 @@ <meta name="viewport"
@@ -256,7 +256,7 @@
}
const hostname = location.hostname; const swPath = encodeURI(`service-worker.js?v=${expectedWorkerVersion}&vscode-resource-base-authority=${searchParams.get('vscode-resource-base-authority')}&remoteAuthority=${searchParams.get('remoteAuthority') ?? ''}`);
- navigator.serviceWorker.register(swPath, { type: 'module' })
+ // It is safe to run if we are on the same host. + navigator.serviceWorker.register(swPath)
+ const parent = new URL(parentOrigin) .then(async registration => {
+ if (parent.hostname === hostname) { /**
+ return start(parentOrigin) * @param {MessageEvent} event
+ } @@ -370,6 +370,12 @@
+
if (!crypto.subtle) {
// cannot validate, not running in a secure context
throw new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);
Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
+++ code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
@@ -343,6 +343,12 @@
const hostname = location.hostname; const hostname = location.hostname;

View file

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:625d2049c38ae27df0613fa533020e889fa98affd603050f46d3748be7b90d0b
size 38675

View file

@ -1,7 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 2250 2250" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><style> <svg width="100%" height="100%" viewBox="0 0 147 147" xmlns="http://www.w3.org/2000/svg">
@media (prefers-color-scheme: dark) { <style>@media (prefers-color-scheme: dark) {* { fill: white; }}</style>
* { <path d="m42.4214,39.655c-24.4057,0 -42.1554,13.1721 -42.1554,33.845c0,20.5814 18.4892,33.845 42.1554,33.845c23.6662,0 38.1803,-11.6171 38.7349,-28.7225l-21.0777,-0.4574c-0.9244,9.3303 -9.1059,15.1845 -17.6572,15.1845c-11.7406,0 -20.4306,-7.5922 -20.4306,-19.8496c0,-12.2574 8.69,-19.9868 20.4306,-20.2155c8.5513,-0.183 16.9177,5.9457 17.4723,15.276l21.0777,-0.6403c-0.4622,-16.8311 -14.1442,-28.2652 -38.55,-28.2652zm48.8446,2l55.468,0l0,64.0311l-55.468,0l0,-64.0311z" clip-rule="evenodd" fill-rule="evenodd"/>
fill: white; </svg>
}
}
</style><rect id="favicon" x="0" y="0" width="2250" height="2250" style="fill:none;"/><g id="favicon1" serif:id="favicon"><path d="M1991.66,1034.72c-38.493,0 -64.144,-22.57 -64.144,-68.897l-0,-266.084c-0,-169.867 -69.982,-263.709 -250.762,-263.709l-83.976,0l-0,179.368l25.661,0c71.144,0 104.967,39.201 104.967,109.285l0,235.201c0,102.156 30.324,143.733 96.806,165.114c-66.482,20.196 -96.806,62.958 -96.806,165.114l0,174.621c0,48.7 0,96.216 -12.829,144.917c-12.829,45.141 -33.823,87.903 -62.98,124.726c-16.329,21.386 -34.991,39.202 -55.981,55.835l-0,23.755l83.971,-0c180.781,-0 250.763,-93.843 250.763,-263.709l-0,-266.084c-0,-47.516 24.485,-68.897 64.144,-68.897l47.822,-0l-0,-179.37l-46.656,-0l0,-1.186Z" style="fill-rule:nonzero;"/><path d="M1420.16,706.904l-258.923,0c-5.833,0 -10.495,-4.752 -10.495,-10.691l-0,-20.192c-0,-5.941 4.662,-10.692 10.495,-10.692l260.089,0c5.83,0 10.495,4.751 10.495,10.692l0,20.192c0,5.939 -5.833,10.691 -11.661,10.691Z" style="fill-rule:nonzero;"/><path d="M1464.48,963.474l-188.942,0c-5.833,0 -10.501,-4.754 -10.501,-10.693l0,-20.192c0,-5.938 4.668,-10.691 10.501,-10.691l188.942,-0c5.833,-0 10.495,4.753 10.495,10.691l-0,20.192c-0,4.754 -4.662,10.693 -10.495,10.693Z" style="fill-rule:nonzero;"/><path d="M1539.12,835.188l-377.885,0c-5.833,0 -10.495,-4.75 -10.495,-10.689l-0,-20.196c-0,-5.939 4.662,-10.69 10.495,-10.69l376.719,0c5.833,0 10.499,4.751 10.499,10.69l-0,20.196c-0,4.75 -3.5,10.689 -9.333,10.689Z" style="fill-rule:nonzero;"/><path d="M861.493,765.074c25.658,0 51.319,2.376 75.811,8.316l0,-48.705c0,-68.897 34.989,-109.285 104.971,-109.285l25.658,0l-0,-179.368l-83.977,0c-180.781,0 -250.758,93.842 -250.758,263.709l0,87.901c40.819,-14.252 83.977,-22.568 128.295,-22.568Z" style="fill-rule:nonzero;"/><path d="M1618.44,1411.25c-18.662,-150.861 -132.962,-276.776 -279.919,-305.285c-40.818,-8.314 -81.642,-9.504 -121.295,-2.376c-1.166,-0 -1.166,-1.189 -2.332,-1.189c-64.148,-136.605 -201.772,-226.884 -351.063,-226.884c-149.289,-0 -285.747,87.905 -351.062,224.51c-1.166,-0 -1.166,1.188 -2.332,1.188c-41.987,-4.753 -83.975,-2.379 -125.963,8.314c-144.623,35.634 -254.257,159.175 -274.085,308.847c-2.332,15.441 -3.499,30.883 -3.499,45.141c0,45.136 30.325,86.713 74.645,92.652c54.817,8.317 102.636,-34.448 101.469,-89.089c0,-8.317 0,-17.821 1.167,-26.134c9.331,-76.025 66.48,-140.168 141.123,-157.99c23.328,-5.939 46.654,-7.124 68.814,-3.559c71.146,9.502 141.124,-27.324 171.449,-91.467c22.162,-47.516 57.151,-89.094 103.804,-111.664c51.314,-24.946 109.633,-28.506 163.286,-9.499c55.979,20.192 97.966,62.954 123.627,116.409c26.824,52.27 39.653,89.093 96.805,96.221c23.325,3.559 88.639,2.374 113.132,1.185c47.82,0 95.64,16.631 129.463,51.079c22.156,23.757 38.485,53.455 45.486,86.715c10.495,53.455 -2.334,106.908 -33.825,147.296c-22.162,28.509 -52.485,49.89 -86.308,59.394c-16.329,4.754 -32.657,5.939 -48.986,5.939l-257.757,0c-51.314,0 -92.138,-41.573 -92.138,-93.842l0,-348.049c0,-14.251 -11.661,-26.13 -25.658,-26.13l-36.156,0c-71.148,1.185 -128.295,81.964 -128.295,167.488l-0,312.415c-0,92.652 73.476,167.488 164.451,167.488c0,0 404.714,-1.19 410.544,-1.19c93.304,-9.503 179.614,-58.204 237.927,-133.04c58.319,-72.46 85.142,-167.492 73.481,-264.894Z" style="fill-rule:nonzero;"/></g></svg>

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -1 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 2250 2250" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><rect id="favicon" x="0" y="0" width="2250" height="2250" style="fill:none;"/><g id="favicon1" serif:id="favicon"><path d="M1991.66,1034.72c-38.493,0 -64.144,-22.57 -64.144,-68.897l-0,-266.084c-0,-169.867 -69.982,-263.709 -250.762,-263.709l-83.976,0l-0,179.368l25.661,0c71.144,0 104.967,39.201 104.967,109.285l0,235.201c0,102.156 30.324,143.733 96.806,165.114c-66.482,20.196 -96.806,62.958 -96.806,165.114l0,174.621c0,48.7 0,96.216 -12.829,144.917c-12.829,45.141 -33.823,87.903 -62.98,124.726c-16.329,21.386 -34.991,39.202 -55.981,55.835l-0,23.755l83.971,-0c180.781,-0 250.763,-93.843 250.763,-263.709l-0,-266.084c-0,-47.516 24.485,-68.897 64.144,-68.897l47.822,-0l-0,-179.37l-46.656,-0l0,-1.186Z" style="fill-rule:nonzero;"/><path d="M1420.16,706.904l-258.923,0c-5.833,0 -10.495,-4.752 -10.495,-10.691l-0,-20.192c-0,-5.941 4.662,-10.692 10.495,-10.692l260.089,0c5.83,0 10.495,4.751 10.495,10.692l0,20.192c0,5.939 -5.833,10.691 -11.661,10.691Z" style="fill-rule:nonzero;"/><path d="M1464.48,963.474l-188.942,0c-5.833,0 -10.501,-4.754 -10.501,-10.693l0,-20.192c0,-5.938 4.668,-10.691 10.501,-10.691l188.942,-0c5.833,-0 10.495,4.753 10.495,10.691l-0,20.192c-0,4.754 -4.662,10.693 -10.495,10.693Z" style="fill-rule:nonzero;"/><path d="M1539.12,835.188l-377.885,0c-5.833,0 -10.495,-4.75 -10.495,-10.689l-0,-20.196c-0,-5.939 4.662,-10.69 10.495,-10.69l376.719,0c5.833,0 10.499,4.751 10.499,10.69l-0,20.196c-0,4.75 -3.5,10.689 -9.333,10.689Z" style="fill-rule:nonzero;"/><path d="M861.493,765.074c25.658,0 51.319,2.376 75.811,8.316l0,-48.705c0,-68.897 34.989,-109.285 104.971,-109.285l25.658,0l-0,-179.368l-83.977,0c-180.781,0 -250.758,93.842 -250.758,263.709l0,87.901c40.819,-14.252 83.977,-22.568 128.295,-22.568Z" style="fill-rule:nonzero;"/><path d="M1618.44,1411.25c-18.662,-150.861 -132.962,-276.776 -279.919,-305.285c-40.818,-8.314 -81.642,-9.504 -121.295,-2.376c-1.166,-0 -1.166,-1.189 -2.332,-1.189c-64.148,-136.605 -201.772,-226.884 -351.063,-226.884c-149.289,-0 -285.747,87.905 -351.062,224.51c-1.166,-0 -1.166,1.188 -2.332,1.188c-41.987,-4.753 -83.975,-2.379 -125.963,8.314c-144.623,35.634 -254.257,159.175 -274.085,308.847c-2.332,15.441 -3.499,30.883 -3.499,45.141c0,45.136 30.325,86.713 74.645,92.652c54.817,8.317 102.636,-34.448 101.469,-89.089c0,-8.317 0,-17.821 1.167,-26.134c9.331,-76.025 66.48,-140.168 141.123,-157.99c23.328,-5.939 46.654,-7.124 68.814,-3.559c71.146,9.502 141.124,-27.324 171.449,-91.467c22.162,-47.516 57.151,-89.094 103.804,-111.664c51.314,-24.946 109.633,-28.506 163.286,-9.499c55.979,20.192 97.966,62.954 123.627,116.409c26.824,52.27 39.653,89.093 96.805,96.221c23.325,3.559 88.639,2.374 113.132,1.185c47.82,0 95.64,16.631 129.463,51.079c22.156,23.757 38.485,53.455 45.486,86.715c10.495,53.455 -2.334,106.908 -33.825,147.296c-22.162,28.509 -52.485,49.89 -86.308,59.394c-16.329,4.754 -32.657,5.939 -48.986,5.939l-257.757,0c-51.314,0 -92.138,-41.573 -92.138,-93.842l0,-348.049c0,-14.251 -11.661,-26.13 -25.658,-26.13l-36.156,0c-71.148,1.185 -128.295,81.964 -128.295,167.488l-0,312.415c-0,92.652 73.476,167.488 164.451,167.488c0,0 404.714,-1.19 410.544,-1.19c93.304,-9.503 179.614,-58.204 237.927,-133.04c58.319,-72.46 85.142,-167.492 73.481,-264.894Z" style="fill-rule:nonzero;"/></g></svg> <svg width="100%" height="100%" viewBox="0 0 147 147" xmlns="http://www.w3.org/2000/svg">
<path d="m42.4214,39.655c-24.4057,0 -42.1554,13.1721 -42.1554,33.845c0,20.5814 18.4892,33.845 42.1554,33.845c23.6662,0 38.1803,-11.6171 38.7349,-28.7225l-21.0777,-0.4574c-0.9244,9.3303 -9.1059,15.1845 -17.6572,15.1845c-11.7406,0 -20.4306,-7.5922 -20.4306,-19.8496c0,-12.2574 8.69,-19.9868 20.4306,-20.2155c8.5513,-0.183 16.9177,5.9457 17.4723,15.276l21.0777,-0.6403c-0.4622,-16.8311 -14.1442,-28.2652 -38.55,-28.2652zm48.8446,2l55.468,0l0,64.0311l-55.468,0l0,-64.0311z" clip-rule="evenodd" fill-rule="evenodd"/>
</svg>

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View file

@ -15,7 +15,8 @@ body {
color: #111; color: #111;
color: light-dark(#111, #ddd); color: light-dark(#111, #ddd);
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol"; "Segoe UI Emoji", "Segoe UI Symbol";
overflow: hidden; overflow: hidden;
} }

View file

@ -30,7 +30,7 @@ export enum LogLevel {
export class OptionalString extends Optional<string> {} export class OptionalString extends Optional<string> {}
/** /**
* Code flags provided by the user. * (VS) Code flags provided by the user.
*/ */
export interface UserProvidedCodeArgs { export interface UserProvidedCodeArgs {
"disable-telemetry"?: boolean "disable-telemetry"?: boolean
@ -53,7 +53,9 @@ export interface UserProvidedCodeArgs {
"disable-getting-started-override"?: boolean "disable-getting-started-override"?: boolean
"disable-proxy"?: boolean "disable-proxy"?: boolean
"session-socket"?: string "session-socket"?: string
"abs-proxy-base-path"?: string "link-protection-trusted-domains"?: string[]
// locale is used by both VS Code and code-server.
locale?: string
} }
/** /**
@ -73,7 +75,6 @@ export interface UserProvidedArgs extends UserProvidedCodeArgs {
enable?: string[] enable?: string[]
help?: boolean help?: boolean
host?: string host?: string
locale?: string
port?: number port?: number
json?: boolean json?: boolean
log?: LogLevel log?: LogLevel
@ -84,12 +85,16 @@ export interface UserProvidedArgs extends UserProvidedCodeArgs {
"trusted-origins"?: string[] "trusted-origins"?: string[]
version?: boolean version?: boolean
"proxy-domain"?: string[] "proxy-domain"?: string[]
"skip-auth-preflight"?: boolean
"reuse-window"?: boolean "reuse-window"?: boolean
"new-window"?: boolean "new-window"?: boolean
"ignore-last-opened"?: boolean "ignore-last-opened"?: boolean
verbose?: boolean verbose?: boolean
"app-name"?: string "app-name"?: string
"welcome-text"?: string "welcome-text"?: string
"abs-proxy-base-path"?: string
i18n?: string
"idle-timeout-seconds"?: number
/* Positional arguments. */ /* Positional arguments. */
_?: string[] _?: string[]
} }
@ -193,6 +198,10 @@ export const options: Options<Required<UserProvidedArgs>> = {
enable: { type: "string[]" }, enable: { type: "string[]" },
help: { type: "boolean", short: "h", description: "Show this output." }, help: { type: "boolean", short: "h", description: "Show this output." },
json: { type: "boolean" }, json: { type: "boolean" },
"link-protection-trusted-domains": {
type: "string[]",
description: "Links matching a trusted domain can be opened without link protection.",
},
locale: { locale: {
// The preferred way to set the locale is via the UI. // The preferred way to set the locale is via the UI.
type: "string", type: "string",
@ -252,6 +261,10 @@ export const options: Options<Required<UserProvidedArgs>> = {
description: "GitHub authentication token (can only be passed in via $GITHUB_TOKEN or the config file).", description: "GitHub authentication token (can only be passed in via $GITHUB_TOKEN or the config file).",
}, },
"proxy-domain": { type: "string[]", description: "Domain used for proxying ports." }, "proxy-domain": { type: "string[]", description: "Domain used for proxying ports." },
"skip-auth-preflight": {
type: "boolean",
description: "Allows preflight requests through proxy without authentication.",
},
"ignore-last-opened": { "ignore-last-opened": {
type: "boolean", type: "boolean",
short: "e", short: "e",
@ -273,17 +286,28 @@ export const options: Options<Required<UserProvidedArgs>> = {
"app-name": { "app-name": {
type: "string", type: "string",
short: "an", short: "an",
description: "The name to use in branding. Will be shown in titlebar and welcome message", description:
"Will replace the {{app}} placeholder in any strings, which by default includes the title bar and welcome message",
}, },
"welcome-text": { "welcome-text": {
type: "string", type: "string",
short: "w", short: "w",
description: "Text to show on login page", description: "Text to show on login page",
deprecated: true,
}, },
"abs-proxy-base-path": { "abs-proxy-base-path": {
type: "string", type: "string",
description: "The base path to prefix to all absproxy requests", description: "The base path to prefix to all absproxy requests",
}, },
i18n: {
type: "string",
path: true,
description: "Path to JSON file with custom translations. Merges with default strings and supports all i18n keys.",
},
"idle-timeout-seconds": {
type: "number",
description: "Timeout in seconds to wait before shutting down when idle.",
},
} }
export const optionDescriptions = (opts: Partial<Options<Required<UserProvidedArgs>>> = options): string[] => { export const optionDescriptions = (opts: Partial<Options<Required<UserProvidedArgs>>> = options): string[] => {
@ -377,6 +401,10 @@ export const parse = (
throw new Error("--github-auth can only be set in the config file or passed in via $GITHUB_TOKEN") throw new Error("--github-auth can only be set in the config file or passed in via $GITHUB_TOKEN")
} }
if (key === "idle-timeout-seconds" && Number(value) <= 60) {
throw new Error("--idle-timeout-seconds must be greater than 60 seconds.")
}
const option = options[key] const option = options[key]
if (option.type === "boolean") { if (option.type === "boolean") {
;(args[key] as boolean) = true ;(args[key] as boolean) = true
@ -592,6 +620,16 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
args["github-auth"] = process.env.GITHUB_TOKEN args["github-auth"] = process.env.GITHUB_TOKEN
} }
if (process.env.CODE_SERVER_IDLE_TIMEOUT_SECONDS) {
if (isNaN(Number(process.env.CODE_SERVER_IDLE_TIMEOUT_SECONDS))) {
logger.info("CODE_SERVER_IDLE_TIMEOUT_SECONDS must be a number")
}
if (Number(process.env.CODE_SERVER_IDLE_TIMEOUT_SECONDS) <= 60) {
throw new Error("--idle-timeout-seconds must be greater than 60 seconds.")
}
args["idle-timeout-seconds"] = Number(process.env.CODE_SERVER_IDLE_TIMEOUT_SECONDS)
}
// Ensure they're not readable by child processes. // Ensure they're not readable by child processes.
delete process.env.PASSWORD delete process.env.PASSWORD
delete process.env.HASHED_PASSWORD delete process.env.HASHED_PASSWORD
@ -702,12 +740,16 @@ export function parseConfigFile(configFile: string, configPath: string): ConfigA
// We convert the config file into a set of flags. // We convert the config file into a set of flags.
// This is a temporary measure until we add a proper CLI library. // This is a temporary measure until we add a proper CLI library.
const configFileArgv = Object.entries(config).map(([optName, opt]) => { const configFileArgv = Object.entries(config)
if (opt === true) { .map(([optName, opt]) => {
return `--${optName}` if (opt === true) {
} return `--${optName}`
return `--${optName}=${opt}` } else if (Array.isArray(opt)) {
}) return opt.map((o) => `--${optName}=${o}`)
}
return `--${optName}=${opt}`
})
.flat()
const args = parse(configFileArgv, { const args = parse(configFileArgv, {
configFile: configPath, configFile: configPath,
}) })

View file

@ -1,5 +1,6 @@
import { logger } from "@coder/logger" import { logger } from "@coder/logger"
import { promises as fs } from "fs" import { promises as fs } from "fs"
import { Emitter } from "../common/emitter"
/** /**
* Provides a heartbeat using a local file to indicate activity. * Provides a heartbeat using a local file to indicate activity.
@ -8,6 +9,9 @@ export class Heart {
private heartbeatTimer?: NodeJS.Timeout private heartbeatTimer?: NodeJS.Timeout
private heartbeatInterval = 60000 private heartbeatInterval = 60000
public lastHeartbeat = 0 public lastHeartbeat = 0
private readonly _onChange = new Emitter<"alive" | "expired" | "unknown">()
readonly onChange = this._onChange.event
private state: "alive" | "expired" | "unknown" = "expired"
public constructor( public constructor(
private readonly heartbeatPath: string, private readonly heartbeatPath: string,
@ -17,6 +21,13 @@ export class Heart {
this.alive = this.alive.bind(this) this.alive = this.alive.bind(this)
} }
private setState(state: typeof this.state) {
if (this.state !== state) {
this.state = state
this._onChange.emit(this.state)
}
}
public alive(): boolean { public alive(): boolean {
const now = Date.now() const now = Date.now()
return now - this.lastHeartbeat < this.heartbeatInterval return now - this.lastHeartbeat < this.heartbeatInterval
@ -28,6 +39,7 @@ export class Heart {
*/ */
public async beat(): Promise<void> { public async beat(): Promise<void> {
if (this.alive()) { if (this.alive()) {
this.setState("alive")
return return
} }
@ -36,7 +48,22 @@ export class Heart {
if (typeof this.heartbeatTimer !== "undefined") { if (typeof this.heartbeatTimer !== "undefined") {
clearTimeout(this.heartbeatTimer) clearTimeout(this.heartbeatTimer)
} }
this.heartbeatTimer = setTimeout(() => heartbeatTimer(this.isActive, this.beat), this.heartbeatInterval)
this.heartbeatTimer = setTimeout(async () => {
try {
if (await this.isActive()) {
this.beat()
} else {
this.setState("expired")
}
} catch (error: unknown) {
logger.warn((error as Error).message)
this.setState("unknown")
}
}, this.heartbeatInterval)
this.setState("alive")
try { try {
return await fs.writeFile(this.heartbeatPath, "") return await fs.writeFile(this.heartbeatPath, "")
} catch (error: any) { } catch (error: any) {
@ -53,20 +80,3 @@ export class Heart {
} }
} }
} }
/**
* Helper function for the heartbeatTimer.
*
* If heartbeat is active, call beat. Otherwise do nothing.
*
* Extracted to make it easier to test.
*/
export async function heartbeatTimer(isActive: Heart["isActive"], beat: Heart["beat"]) {
try {
if (await isActive()) {
beat()
}
} catch (error: unknown) {
logger.warn((error as Error).message)
}
}

View file

@ -1,9 +1,8 @@
import { field, logger } from "@coder/logger" import { field, logger } from "@coder/logger"
import * as express from "express" import * as express from "express"
import * as expressCore from "express-serve-static-core"
import * as http from "http" import * as http from "http"
import * as net from "net" import * as net from "net"
import * as qs from "qs" import qs from "qs"
import { Disposable } from "../common/emitter" import { Disposable } from "../common/emitter"
import { CookieKeys, HttpCode, HttpError } from "../common/http" import { CookieKeys, HttpCode, HttpError } from "../common/http"
import { normalize } from "../common/util" import { normalize } from "../common/util"
@ -185,12 +184,7 @@ export const constructRedirectPath = (req: express.Request, query: qs.ParsedQs,
* preserved. `to` should be a simple path without any query parameters * preserved. `to` should be a simple path without any query parameters
* `override` will merge with the existing query (use `undefined` to unset). * `override` will merge with the existing query (use `undefined` to unset).
*/ */
export const redirect = ( export const redirect = (req: express.Request, res: express.Response, to: string, override: qs.ParsedQs = {}): void => {
req: express.Request,
res: express.Response,
to: string,
override: expressCore.Query = {},
): void => {
const query = Object.assign({}, req.query, override) const query = Object.assign({}, req.query, override)
Object.keys(override).forEach((key) => { Object.keys(override).forEach((key) => {
if (typeof override[key] === "undefined") { if (typeof override[key] === "undefined") {

View file

@ -1,3 +1,4 @@
import { promises as fs } from "fs"
import i18next, { init } from "i18next" import i18next, { init } from "i18next"
import * as en from "./locales/en.json" import * as en from "./locales/en.json"
import * as ja from "./locales/ja.json" import * as ja from "./locales/ja.json"
@ -5,29 +6,54 @@ import * as th from "./locales/th.json"
import * as ur from "./locales/ur.json" import * as ur from "./locales/ur.json"
import * as zhCn from "./locales/zh-cn.json" import * as zhCn from "./locales/zh-cn.json"
const defaultResources = {
en: {
translation: en,
},
"zh-cn": {
translation: zhCn,
},
th: {
translation: th,
},
ja: {
translation: ja,
},
ur: {
translation: ur,
},
}
export async function loadCustomStrings(filePath: string): Promise<void> {
try {
// Read custom strings from file path only
const fileContent = await fs.readFile(filePath, "utf8")
const customStringsData = JSON.parse(fileContent)
// User-provided strings override all languages.
Object.keys(defaultResources).forEach((locale) => {
i18next.addResourceBundle(locale, "translation", customStringsData)
})
} catch (error) {
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
throw new Error(`Custom strings file not found: ${filePath}\nPlease ensure the file exists and is readable.`)
} else if (error instanceof SyntaxError) {
throw new Error(`Invalid JSON in custom strings file: ${filePath}\n${error.message}`)
} else {
throw new Error(
`Failed to load custom strings from ${filePath}: ${error instanceof Error ? error.message : String(error)}`,
)
}
}
}
init({ init({
lng: "en", lng: "en",
fallbackLng: "en", // language to use if translations in user language are not available. fallbackLng: "en", // language to use if translations in user language are not available.
returnNull: false, returnNull: false,
lowerCaseLng: true, lowerCaseLng: true,
debug: process.env.NODE_ENV === "development", debug: process.env.NODE_ENV === "development",
resources: { resources: defaultResources,
en: {
translation: en,
},
"zh-cn": {
translation: zhCn,
},
th: {
translation: th,
},
ja: {
translation: ja,
},
ur: {
translation: ur,
},
},
}) })
export default i18next export default i18next

View file

@ -1,15 +1,17 @@
import { field, logger } from "@coder/logger" import { field, logger } from "@coder/logger"
import http from "http" import http from "http"
import * as os from "os"
import * as path from "path" import * as path from "path"
import { Disposable } from "../common/emitter" import { Disposable } from "../common/emitter"
import { plural } from "../common/util" import { plural } from "../common/util"
import { createApp, ensureAddress } from "./app" import { createApp, ensureAddress } from "./app"
import { AuthType, DefaultedArgs, Feature, toCodeArgs, UserProvidedArgs } from "./cli" import { AuthType, DefaultedArgs, Feature, toCodeArgs, UserProvidedArgs } from "./cli"
import { commit, version, vsRootPath } from "./constants" import { commit, version, vsRootPath } from "./constants"
import { loadCustomStrings } from "./i18n"
import { register } from "./routes" import { register } from "./routes"
import { VSCodeModule } from "./routes/vscode" import { VSCodeModule } from "./routes/vscode"
import { isDirectory, open } from "./util" import { isDirectory, open } from "./util"
import * as os from "os" import { wrapper } from "./wrapper"
/** /**
* Return true if the user passed an extension-related VS Code flag. * Return true if the user passed an extension-related VS Code flag.
@ -122,6 +124,12 @@ export const runCodeServer = async (
): Promise<{ dispose: Disposable["dispose"]; server: http.Server }> => { ): Promise<{ dispose: Disposable["dispose"]; server: http.Server }> => {
logger.info(`code-server ${version} ${commit}`) logger.info(`code-server ${version} ${commit}`)
// Load custom strings if provided
if (args.i18n) {
await loadCustomStrings(args.i18n)
logger.info("Loaded custom strings")
}
logger.info(`Using user-data-dir ${args["user-data-dir"]}`) logger.info(`Using user-data-dir ${args["user-data-dir"]}`)
logger.debug(`Using extensions-dir ${args["extensions-dir"]}`) logger.debug(`Using extensions-dir ${args["extensions-dir"]}`)
@ -134,7 +142,7 @@ export const runCodeServer = async (
const app = await createApp(args) const app = await createApp(args)
const protocol = args.cert ? "https" : "http" const protocol = args.cert ? "https" : "http"
const serverAddress = ensureAddress(app.server, protocol) const serverAddress = ensureAddress(app.server, protocol)
const disposeRoutes = await register(app, args) const { disposeRoutes, heart } = await register(app, args)
logger.info(`Using config file ${args.config}`) logger.info(`Using config file ${args.config}`)
logger.info(`${protocol.toUpperCase()} server listening on ${serverAddress.toString()}`) logger.info(`${protocol.toUpperCase()} server listening on ${serverAddress.toString()}`)
@ -144,6 +152,8 @@ export const runCodeServer = async (
logger.info(" - Using password from $PASSWORD") logger.info(" - Using password from $PASSWORD")
} else if (args.usingEnvHashedPassword) { } else if (args.usingEnvHashedPassword) {
logger.info(" - Using password from $HASHED_PASSWORD") logger.info(" - Using password from $HASHED_PASSWORD")
} else if (args["hashed-password"]) {
logger.info(` - Using hashed-password from ${args.config}`)
} else { } else {
logger.info(` - Using password from ${args.config}`) logger.info(` - Using password from ${args.config}`)
} }
@ -157,12 +167,36 @@ export const runCodeServer = async (
logger.info(" - Not serving HTTPS") logger.info(" - Not serving HTTPS")
} }
if (args["idle-timeout-seconds"]) {
logger.info(` - Idle timeout set to ${args["idle-timeout-seconds"]} seconds`)
let idleShutdownTimer: NodeJS.Timeout | undefined
const startIdleShutdownTimer = () => {
idleShutdownTimer = setTimeout(() => {
logger.warn(`Idle timeout of ${args["idle-timeout-seconds"]} seconds exceeded`)
wrapper.exit(0)
}, args["idle-timeout-seconds"]! * 1000)
}
startIdleShutdownTimer()
heart.onChange((state) => {
clearTimeout(idleShutdownTimer)
if (state === "expired") {
startIdleShutdownTimer()
}
})
}
if (args["disable-proxy"]) { if (args["disable-proxy"]) {
logger.info(" - Proxy disabled") logger.info(" - Proxy disabled")
} else if (args["proxy-domain"].length > 0) { } else if (args["proxy-domain"].length > 0) {
logger.info(` - ${plural(args["proxy-domain"].length, "Proxying the following domain")}:`) logger.info(` - ${plural(args["proxy-domain"].length, "Proxying the following domain")}:`)
args["proxy-domain"].forEach((domain) => logger.info(` - ${domain}`)) args["proxy-domain"].forEach((domain) => logger.info(` - ${domain}`))
} }
if (args["skip-auth-preflight"]) {
logger.info(" - Skipping authentication for preflight requests")
}
if (process.env.VSCODE_PROXY_URI) { if (process.env.VSCODE_PROXY_URI) {
logger.info(`Using proxy URI in PORTS tab: ${process.env.VSCODE_PROXY_URI}`) logger.info(`Using proxy URI in PORTS tab: ${process.env.VSCODE_PROXY_URI}`)
} }

View file

@ -61,6 +61,11 @@ router.all(/.*/, async (req, res, next) => {
ensureProxyEnabled(req) ensureProxyEnabled(req)
if (req.method === "OPTIONS" && req.args["skip-auth-preflight"]) {
// Allow preflight requests with `skip-auth-preflight` flag
return next()
}
// Must be authenticated to use the proxy. // Must be authenticated to use the proxy.
const isAuthenticated = await authenticated(req) const isAuthenticated = await authenticated(req)
if (!isAuthenticated) { if (!isAuthenticated) {

View file

@ -3,10 +3,10 @@ import express from "express"
import { promises as fs } from "fs" import { promises as fs } from "fs"
import path from "path" import path from "path"
import { HttpCode } from "../../common/http" import { HttpCode } from "../../common/http"
import type { WebsocketRequest } from "../wsRouter"
import { rootPath } from "../constants" import { rootPath } from "../constants"
import { replaceTemplates } from "../http" import { replaceTemplates } from "../http"
import { escapeHtml, getMediaMime } from "../util" import { escapeHtml, getMediaMime } from "../util"
import type { WebsocketRequest } from "../wsRouter"
interface ErrorWithStatusCode { interface ErrorWithStatusCode {
statusCode: number statusCode: number

View file

@ -14,8 +14,8 @@ import { Heart } from "../heart"
import { redirect } from "../http" import { redirect } from "../http"
import { CoderSettings, SettingsProvider } from "../settings" import { CoderSettings, SettingsProvider } from "../settings"
import { UpdateProvider } from "../update" import { UpdateProvider } from "../update"
import type { WebsocketRequest } from "../wsRouter"
import { getMediaMime, paths } from "../util" import { getMediaMime, paths } from "../util"
import type { WebsocketRequest } from "../wsRouter"
import * as domainProxy from "./domainProxy" import * as domainProxy from "./domainProxy"
import { errorHandler, wsErrorHandler } from "./errors" import { errorHandler, wsErrorHandler } from "./errors"
import * as health from "./health" import * as health from "./health"
@ -28,7 +28,10 @@ import * as vscode from "./vscode"
/** /**
* Register all routes and middleware. * Register all routes and middleware.
*/ */
export const register = async (app: App, args: DefaultedArgs): Promise<Disposable["dispose"]> => { export const register = async (
app: App,
args: DefaultedArgs,
): Promise<{ disposeRoutes: Disposable["dispose"]; heart: Heart }> => {
const heart = new Heart(path.join(paths.data, "heartbeat"), async () => { const heart = new Heart(path.join(paths.data, "heartbeat"), async () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// getConnections appears to not call the callback when there are no more // getConnections appears to not call the callback when there are no more
@ -173,8 +176,11 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
app.router.use(errorHandler) app.router.use(errorHandler)
app.wsRouter.use(wsErrorHandler) app.wsRouter.use(wsErrorHandler)
return () => { return {
heart.dispose() disposeRoutes: () => {
vscode.dispose() heart.dispose()
vscode.dispose()
},
heart,
} }
} }

View file

@ -32,6 +32,8 @@ const getRoot = async (req: Request, error?: Error): Promise<string> => {
i18n.changeLanguage(locale) i18n.changeLanguage(locale)
const appName = req.args["app-name"] || "code-server" const appName = req.args["app-name"] || "code-server"
const welcomeText = req.args["welcome-text"] || (i18n.t("WELCOME", { app: appName }) as string) const welcomeText = req.args["welcome-text"] || (i18n.t("WELCOME", { app: appName }) as string)
// Determine password message using i18n
let passwordMsg = i18n.t("LOGIN_PASSWORD", { configFile: req.args.config }) let passwordMsg = i18n.t("LOGIN_PASSWORD", { configFile: req.args.config })
if (req.args.usingEnvPassword) { if (req.args.usingEnvPassword) {
passwordMsg = i18n.t("LOGIN_USING_ENV_PASSWORD") passwordMsg = i18n.t("LOGIN_USING_ENV_PASSWORD")

View file

@ -13,7 +13,11 @@ const getProxyTarget = (
): string => { ): string => {
// If there is a base path, strip it out. // If there is a base path, strip it out.
const base = (req as any).base || "" const base = (req as any).base || ""
return `http://0.0.0.0:${req.params.port}${opts?.proxyBasePath || ""}/${req.originalUrl.slice(base.length)}` const port = parseInt(req.params.port, 10)
if (isNaN(port)) {
throw new HttpError("Invalid port", HttpCode.BadRequest)
}
return `http://0.0.0.0:${port}${opts?.proxyBasePath || ""}/${req.originalUrl.slice(base.length)}`
} }
export async function proxy( export async function proxy(
@ -26,7 +30,9 @@ export async function proxy(
): Promise<void> { ): Promise<void> {
ensureProxyEnabled(req) ensureProxyEnabled(req)
if (!(await authenticated(req))) { if (req.method === "OPTIONS" && req.args["skip-auth-preflight"]) {
// Allow preflight requests with `skip-auth-preflight` flag
} else if (!(await authenticated(req))) {
// If visiting the root (/:port only) redirect to the login page. // If visiting the root (/:port only) redirect to the login page.
if (!req.params.path || req.params.path === "/") { if (!req.params.path || req.params.path === "/") {
const to = self(req) const to = self(req)

View file

@ -4,8 +4,8 @@ import * as express from "express"
import { promises as fs } from "fs" import { promises as fs } from "fs"
import * as http from "http" import * as http from "http"
import * as net from "net" import * as net from "net"
import * as path from "path"
import * as os from "os" import * as os from "os"
import * as path from "path"
import { logError } from "../../common/util" import { logError } from "../../common/util"
import { CodeArgs, toCodeArgs } from "../cli" import { CodeArgs, toCodeArgs } from "../cli"
import { isDevMode, vsRootPath } from "../constants" import { isDevMode, vsRootPath } from "../constants"
@ -186,11 +186,22 @@ router.get("/manifest.json", async (req, res) => {
display: "fullscreen", display: "fullscreen",
display_override: ["window-controls-overlay"], display_override: ["window-controls-overlay"],
description: "Run Code on a remote server.", description: "Run Code on a remote server.",
icons: [192, 512].map((size) => ({ icons: [192, 512]
src: `{{BASE}}/_static/src/browser/media/pwa-icon-${size}.png`, .map((size) => [
type: "image/png", {
sizes: `${size}x${size}`, src: `{{BASE}}/_static/src/browser/media/pwa-icon-${size}.png`,
})), type: "image/png",
sizes: `${size}x${size}`,
purpose: "any",
},
{
src: `{{BASE}}/_static/src/browser/media/pwa-icon-maskable-${size}.png`,
type: "image/png",
sizes: `${size}x${size}`,
purpose: "maskable",
},
])
.flat(),
}, },
null, null,
2, 2,

View file

@ -1,5 +1,5 @@
import { logger } from "@coder/logger" import { logger } from "@coder/logger"
import { Query } from "express-serve-static-core" import type { ParsedQs } from "qs"
import { promises as fs } from "fs" import { promises as fs } from "fs"
export type Settings = { [key: string]: Settings | string | boolean | number } export type Settings = { [key: string]: Settings | string | boolean | number }
@ -17,7 +17,7 @@ export class SettingsProvider<T> {
public async read(): Promise<T> { public async read(): Promise<T> {
try { try {
const raw = (await fs.readFile(this.settingsPath, "utf8")).trim() const raw = (await fs.readFile(this.settingsPath, "utf8")).trim()
return raw ? JSON.parse(raw) : {} return raw ? JSON.parse(raw) : ({} as T)
} catch (error: any) { } catch (error: any) {
if (error.code !== "ENOENT") { if (error.code !== "ENOENT") {
logger.warn(error.message) logger.warn(error.message)
@ -52,5 +52,5 @@ export interface UpdateSettings {
* Global code-server settings. * Global code-server settings.
*/ */
export interface CoderSettings extends UpdateSettings { export interface CoderSettings extends UpdateSettings {
query?: Query query?: ParsedQs
} }

View file

@ -2,8 +2,9 @@ import { logger } from "@coder/logger"
import express from "express" import express from "express"
import * as http from "http" import * as http from "http"
import * as path from "path" import * as path from "path"
import { HttpCode } from "../common/http" import { HttpCode, HttpError } from "../common/http"
import { listen } from "./app" import { listen } from "./app"
import { errorHandler } from "./routes/errors"
import { canConnect } from "./util" import { canConnect } from "./util"
export interface EditorSessionEntry { export interface EditorSessionEntry {
@ -44,24 +45,18 @@ export async function makeEditorSessionManagerServer(
async (req, res) => { async (req, res) => {
const filePath = req.query.filePath const filePath = req.query.filePath
if (!filePath) { if (!filePath) {
res.status(HttpCode.BadRequest).send("filePath is required") throw new HttpError("filePath is required", HttpCode.BadRequest)
return
}
try {
const socketPath = await editorSessionManager.getConnectedSocketPath(filePath)
const response: GetSessionResponse = { socketPath }
res.json(response)
} catch (error: unknown) {
res.status(HttpCode.ServerError).send(error)
} }
const socketPath = await editorSessionManager.getConnectedSocketPath(filePath)
const response: GetSessionResponse = { socketPath }
res.json(response)
}, },
) )
router.post<{}, string, AddSessionRequest | undefined>("/add-session", async (req, res) => { router.post<{}, string, AddSessionRequest | undefined>("/add-session", async (req, res) => {
const entry = req.body?.entry const entry = req.body?.entry
if (!entry) { if (!entry) {
res.status(400).send("entry is required") throw new HttpError("entry is required", HttpCode.BadRequest)
return
} }
editorSessionManager.addSession(entry) editorSessionManager.addSession(entry)
res.status(200).send("session added") res.status(200).send("session added")
@ -70,13 +65,14 @@ export async function makeEditorSessionManagerServer(
router.post<{}, string, DeleteSessionRequest | undefined>("/delete-session", async (req, res) => { router.post<{}, string, DeleteSessionRequest | undefined>("/delete-session", async (req, res) => {
const socketPath = req.body?.socketPath const socketPath = req.body?.socketPath
if (!socketPath) { if (!socketPath) {
res.status(400).send("socketPath is required") throw new HttpError("socketPath is required", HttpCode.BadRequest)
return
} }
editorSessionManager.deleteSession(socketPath) editorSessionManager.deleteSession(socketPath)
res.status(200).send("session deleted") res.status(200).send("session deleted")
}) })
router.use(errorHandler)
const server = http.createServer(router) const server = http.createServer(router)
try { try {
await listen(server, { socket: codeServerSocketPath }) await listen(server, { socket: codeServerSocketPath })

447
test/package-lock.json generated
View file

@ -7,11 +7,10 @@
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@jest-mock/express": "^1.4.5", "@jest-mock/express": "^1.4.5",
"@playwright/test": "^1.46.0", "@playwright/test": "^1.56.1",
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
"@types/jsdom": "^16.2.13", "@types/jsdom": "^16.2.13",
"@types/node-fetch": "^2.5.8", "@types/node-fetch": "^2.5.8",
"@types/supertest": "^2.0.11",
"@types/wtfnode": "^0.7.0", "@types/wtfnode": "^0.7.0",
"argon2": "^0.28.0", "argon2": "^0.28.0",
"extract-zip": "^2.0.1", "extract-zip": "^2.0.1",
@ -19,8 +18,7 @@
"jest-fetch-mock": "^3.0.3", "jest-fetch-mock": "^3.0.3",
"jsdom": "^16.4.0", "jsdom": "^16.4.0",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.7",
"playwright": "^1.46.0", "playwright": "^1.56.1",
"supertest": "^6.1.6",
"ts-jest": "^27.0.7", "ts-jest": "^27.0.7",
"wtfnode": "^0.9.1" "wtfnode": "^0.9.1"
} }
@ -1014,13 +1012,13 @@
} }
}, },
"node_modules/@playwright/test": { "node_modules/@playwright/test": {
"version": "1.47.2", "version": "1.56.1",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.47.2.tgz", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.1.tgz",
"integrity": "sha512-jTXRsoSPONAs8Za9QEQdyjFn+0ZQFjCiIztAIF6bi1HqhBzG9Ma7g1WotyiGqFSBRZjIEqMdT8RUlbk1QVhzCQ==", "integrity": "sha512-vSMYtL/zOcFpvJCW71Q/OEGQb7KYBPAdKh35WNSkaZA75JlAO8ED8UN6GUNTm3drWomcbcqRPFqQbLae8yBTdg==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"playwright": "1.47.2" "playwright": "1.56.1"
}, },
"bin": { "bin": {
"playwright": "cli.js" "playwright": "cli.js"
@ -1104,13 +1102,6 @@
"@babel/types": "^7.20.7" "@babel/types": "^7.20.7"
} }
}, },
"node_modules/@types/cookiejar": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.5.tgz",
"integrity": "sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/graceful-fs": { "node_modules/@types/graceful-fs": {
"version": "4.1.9", "version": "4.1.9",
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz",
@ -1171,13 +1162,6 @@
"@types/tough-cookie": "*" "@types/tough-cookie": "*"
} }
}, },
"node_modules/@types/methods": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@types/methods/-/methods-1.1.4.tgz",
"integrity": "sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "22.7.4", "version": "22.7.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz",
@ -1220,29 +1204,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/superagent": {
"version": "8.1.9",
"resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-8.1.9.tgz",
"integrity": "sha512-pTVjI73witn+9ILmoJdajHGW2jkSaOzhiFYF1Rd3EQ94kymLqB9PjD9ISg7WaALC7+dCHT0FGe9T2LktLq/3GQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/cookiejar": "^2.1.5",
"@types/methods": "^1.1.4",
"@types/node": "*",
"form-data": "^4.0.0"
}
},
"node_modules/@types/supertest": {
"version": "2.0.16",
"resolved": "https://registry.npmjs.org/@types/supertest/-/supertest-2.0.16.tgz",
"integrity": "sha512-6c2ogktZ06tr2ENoZivgm7YnprnhYE4ZoXGMY+oA7IuAf17M8FWvujXZGmxLv8y0PTyts4x5A+erSwVUFA8XSg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/superagent": "*"
}
},
"node_modules/@types/tough-cookie": { "node_modules/@types/tough-cookie": {
"version": "4.0.5", "version": "4.0.5",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz",
@ -1464,13 +1425,6 @@
"sprintf-js": "~1.0.2" "sprintf-js": "~1.0.2"
} }
}, },
"node_modules/asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
"integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==",
"dev": true,
"license": "MIT"
},
"node_modules/asynckit": { "node_modules/asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@ -1689,24 +1643,18 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/call-bind": { "node_modules/call-bind-apply-helpers": {
"version": "1.0.7", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0", "es-errors": "^1.3.0",
"function-bind": "^1.1.2", "function-bind": "^1.1.2"
"get-intrinsic": "^1.2.4",
"set-function-length": "^1.2.1"
}, },
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/callsites": { "node_modules/callsites": {
@ -1883,16 +1831,6 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/component-emitter": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz",
"integrity": "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/concat-map": { "node_modules/concat-map": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@ -1914,13 +1852,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/cookiejar": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz",
"integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==",
"dev": true,
"license": "MIT"
},
"node_modules/cross-fetch": { "node_modules/cross-fetch": {
"version": "3.1.8", "version": "3.1.8",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz",
@ -2030,24 +1961,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/define-data-property": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"gopd": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/delayed-stream": { "node_modules/delayed-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -2085,17 +1998,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/dezalgo": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz",
"integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==",
"dev": true,
"license": "ISC",
"dependencies": {
"asap": "^2.0.0",
"wrappy": "1"
}
},
"node_modules/diff-sequences": { "node_modules/diff-sequences": {
"version": "27.5.1", "version": "27.5.1",
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz",
@ -2130,6 +2032,21 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"dev": true,
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.32", "version": "1.5.32",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.32.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.32.tgz",
@ -2178,14 +2095,11 @@
} }
}, },
"node_modules/es-define-property": { "node_modules/es-define-property": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": {
"get-intrinsic": "^1.2.4"
},
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
} }
@ -2200,6 +2114,35 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-set-tostringtag": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.6",
"has-tostringtag": "^1.0.2",
"hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escalade": { "node_modules/escalade": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
@ -2366,13 +2309,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/fast-safe-stringify": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
"integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==",
"dev": true,
"license": "MIT"
},
"node_modules/fb-watchman": { "node_modules/fb-watchman": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
@ -2421,36 +2357,22 @@
} }
}, },
"node_modules/form-data": { "node_modules/form-data": {
"version": "4.0.0", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"asynckit": "^0.4.0", "asynckit": "^0.4.0",
"combined-stream": "^1.0.8", "combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.2",
"mime-types": "^2.1.12" "mime-types": "^2.1.12"
}, },
"engines": { "engines": {
"node": ">= 6" "node": ">= 6"
} }
}, },
"node_modules/formidable": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz",
"integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==",
"dev": true,
"license": "MIT",
"dependencies": {
"dezalgo": "^1.0.4",
"hexoid": "^1.0.0",
"once": "^1.4.0",
"qs": "^6.11.0"
},
"funding": {
"url": "https://ko-fi.com/tunnckoCore/commissions"
}
},
"node_modules/fs-minipass": { "node_modules/fs-minipass": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
@ -2559,17 +2481,22 @@
} }
}, },
"node_modules/get-intrinsic": { "node_modules/get-intrinsic": {
"version": "1.2.4", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0", "es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2", "function-bind": "^1.1.2",
"has-proto": "^1.0.1", "get-proto": "^1.0.1",
"has-symbols": "^1.0.3", "gopd": "^1.2.0",
"hasown": "^2.0.0" "has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
}, },
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
@ -2588,6 +2515,20 @@
"node": ">=8.0.0" "node": ">=8.0.0"
} }
}, },
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"dev": true,
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/get-stream": { "node_modules/get-stream": {
"version": "5.2.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
@ -2637,13 +2578,13 @@
} }
}, },
"node_modules/gopd": { "node_modules/gopd": {
"version": "1.0.1", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "engines": {
"get-intrinsic": "^1.1.3" "node": ">= 0.4"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
@ -2666,23 +2607,10 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/has-property-descriptors": { "node_modules/has-symbols": {
"version": "1.0.2", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-proto": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz",
"integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@ -2692,12 +2620,15 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/has-symbols": { "node_modules/has-tostringtag": {
"version": "1.0.3", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": {
"has-symbols": "^1.0.3"
},
"engines": { "engines": {
"node": ">= 0.4" "node": ">= 0.4"
}, },
@ -2725,16 +2656,6 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/hexoid": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz",
"integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/html-encoding-sniffer": { "node_modules/html-encoding-sniffer": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz",
@ -3764,15 +3685,17 @@
} }
}, },
"node_modules/jsdom/node_modules/form-data": { "node_modules/jsdom/node_modules/form-data": {
"version": "3.0.1", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.4.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", "integrity": "sha512-f0cRzm6dkyVYV3nPoooP8XlccPQukegwhAnpoLcXy+X+A8KfpGOoXwDr9FLZd3wzgLaBGQBE3lY93Zm/i1JvIQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"asynckit": "^0.4.0", "asynckit": "^0.4.0",
"combined-stream": "^1.0.8", "combined-stream": "^1.0.8",
"mime-types": "^2.1.12" "es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.2",
"mime-types": "^2.1.35"
}, },
"engines": { "engines": {
"node": ">= 6" "node": ">= 6"
@ -3918,6 +3841,16 @@
"tmpl": "1.0.5" "tmpl": "1.0.5"
} }
}, },
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/merge-stream": { "node_modules/merge-stream": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@ -3925,16 +3858,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/micromatch": { "node_modules/micromatch": {
"version": "4.0.8", "version": "4.0.8",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
@ -3949,19 +3872,6 @@
"node": ">=8.6" "node": ">=8.6"
} }
}, },
"node_modules/mime": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz",
"integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==",
"dev": true,
"license": "MIT",
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/mime-db": { "node_modules/mime-db": {
"version": "1.52.0", "version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@ -4216,19 +4126,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/object-inspect": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
"integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/once": { "node_modules/once": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@ -4408,13 +4305,13 @@
} }
}, },
"node_modules/playwright": { "node_modules/playwright": {
"version": "1.47.2", "version": "1.56.1",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.47.2.tgz", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz",
"integrity": "sha512-nx1cLMmQWqmA3UsnjaaokyoUpdVaaDhJhMoxX2qj3McpjnsqFHs516QAKYhqHAgOP+oCFTEOCOAaD1RgD/RQfA==", "integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"playwright-core": "1.47.2" "playwright-core": "1.56.1"
}, },
"bin": { "bin": {
"playwright": "cli.js" "playwright": "cli.js"
@ -4427,9 +4324,9 @@
} }
}, },
"node_modules/playwright-core": { "node_modules/playwright-core": {
"version": "1.47.2", "version": "1.56.1",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.47.2.tgz", "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz",
"integrity": "sha512-3JvMfF+9LJfe16l7AbSmU555PaTl2tPyQsVInqm3id16pdDfvZ8TTZ/pyzmkbDrZTQefyzU7AIHlZqQnxpqHVQ==", "integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
@ -4531,22 +4428,6 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/qs": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"side-channel": "^1.0.6"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/querystringify": { "node_modules/querystringify": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
@ -4722,24 +4603,6 @@
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
"dev": true,
"license": "MIT",
"dependencies": {
"define-data-property": "^1.1.4",
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.4",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/shebang-command": { "node_modules/shebang-command": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@ -4763,25 +4626,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/side-channel": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
"integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
"dev": true,
"license": "MIT",
"dependencies": {
"call-bind": "^1.0.7",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.4",
"object-inspect": "^1.13.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/signal-exit": { "node_modules/signal-exit": {
"version": "3.0.7", "version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
@ -4932,43 +4776,6 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/superagent": {
"version": "8.1.2",
"resolved": "https://registry.npmjs.org/superagent/-/superagent-8.1.2.tgz",
"integrity": "sha512-6WTxW1EB6yCxV5VFOIPQruWGHqc3yI7hEmZK6h+pyk69Lk/Ut7rLUY6W/ONF2MjBuGjvmMiIpsrVJ2vjrHlslA==",
"deprecated": "Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net",
"dev": true,
"license": "MIT",
"dependencies": {
"component-emitter": "^1.3.0",
"cookiejar": "^2.1.4",
"debug": "^4.3.4",
"fast-safe-stringify": "^2.1.1",
"form-data": "^4.0.0",
"formidable": "^2.1.2",
"methods": "^1.1.2",
"mime": "2.6.0",
"qs": "^6.11.0",
"semver": "^7.3.8"
},
"engines": {
"node": ">=6.4.0 <13 || >=14"
}
},
"node_modules/supertest": {
"version": "6.3.4",
"resolved": "https://registry.npmjs.org/supertest/-/supertest-6.3.4.tgz",
"integrity": "sha512-erY3HFDG0dPnhw4U+udPfrzXa4xhSG+n4rxfRuZWCUvjFWwKl+OxWf/7zk50s84/fAAs7vf5QAb9uRa0cCykxw==",
"dev": true,
"license": "MIT",
"dependencies": {
"methods": "^1.1.2",
"superagent": "^8.1.2"
},
"engines": {
"node": ">=6.4.0"
}
},
"node_modules/supports-color": { "node_modules/supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",

View file

@ -3,11 +3,10 @@
"#": "We must put jest in a sub-directory otherwise VS Code somehow picks up the types and generates conflicts with mocha.", "#": "We must put jest in a sub-directory otherwise VS Code somehow picks up the types and generates conflicts with mocha.",
"devDependencies": { "devDependencies": {
"@jest-mock/express": "^1.4.5", "@jest-mock/express": "^1.4.5",
"@playwright/test": "^1.46.0", "@playwright/test": "^1.56.1",
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
"@types/jsdom": "^16.2.13", "@types/jsdom": "^16.2.13",
"@types/node-fetch": "^2.5.8", "@types/node-fetch": "^2.5.8",
"@types/supertest": "^2.0.11",
"@types/wtfnode": "^0.7.0", "@types/wtfnode": "^0.7.0",
"argon2": "^0.28.0", "argon2": "^0.28.0",
"extract-zip": "^2.0.1", "extract-zip": "^2.0.1",
@ -15,8 +14,7 @@
"jest-fetch-mock": "^3.0.3", "jest-fetch-mock": "^3.0.3",
"jsdom": "^16.4.0", "jsdom": "^16.4.0",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.7",
"playwright": "^1.46.0", "playwright": "^1.56.1",
"supertest": "^6.1.6",
"ts-jest": "^27.0.7", "ts-jest": "^27.0.7",
"wtfnode": "^0.9.1" "wtfnode": "^0.9.1"
}, },

View file

@ -6,6 +6,7 @@ import {
bindAddrFromArgs, bindAddrFromArgs,
defaultConfigFile, defaultConfigFile,
parse, parse,
parseConfigFile,
setDefaults, setDefaults,
shouldOpenInExistingInstance, shouldOpenInExistingInstance,
toCodeArgs, toCodeArgs,
@ -74,6 +75,7 @@ describe("parser", () => {
"--verbose", "--verbose",
["--app-name", "custom instance name"], ["--app-name", "custom instance name"],
["--welcome-text", "welcome to code"], ["--welcome-text", "welcome to code"],
["--i18n", "path/to/custom-strings.json"],
"2", "2",
["--locale", "ja"], ["--locale", "ja"],
@ -108,6 +110,8 @@ describe("parser", () => {
["--abs-proxy-base-path", "/codeserver/app1"], ["--abs-proxy-base-path", "/codeserver/app1"],
"--skip-auth-preflight",
["--session-socket", "/tmp/override-code-server-ipc-socket"], ["--session-socket", "/tmp/override-code-server-ipc-socket"],
["--host", "0.0.0.0"], ["--host", "0.0.0.0"],
@ -142,10 +146,12 @@ describe("parser", () => {
verbose: true, verbose: true,
"app-name": "custom instance name", "app-name": "custom instance name",
"welcome-text": "welcome to code", "welcome-text": "welcome to code",
i18n: path.resolve("path/to/custom-strings.json"),
version: true, version: true,
"bind-addr": "192.169.0.1:8080", "bind-addr": "192.169.0.1:8080",
"session-socket": "/tmp/override-code-server-ipc-socket", "session-socket": "/tmp/override-code-server-ipc-socket",
"abs-proxy-base-path": "/codeserver/app1", "abs-proxy-base-path": "/codeserver/app1",
"skip-auth-preflight": true,
}) })
}) })
@ -284,12 +290,17 @@ describe("parser", () => {
}) })
it("should support repeatable flags", async () => { it("should support repeatable flags", async () => {
expect(() => parse(["--proxy-domain", ""])).toThrowError(/--proxy-domain requires a value/)
expect(parse(["--proxy-domain", "*.coder.com"])).toEqual({ expect(parse(["--proxy-domain", "*.coder.com"])).toEqual({
"proxy-domain": ["*.coder.com"], "proxy-domain": ["*.coder.com"],
}) })
expect(parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "test.com"])).toEqual({ expect(parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "test.com"])).toEqual({
"proxy-domain": ["*.coder.com", "test.com"], "proxy-domain": ["*.coder.com", "test.com"],
}) })
// Commas are literal, at the moment.
expect(parse(["--proxy-domain", "*.coder.com,test.com"])).toEqual({
"proxy-domain": ["*.coder.com,test.com"],
})
}) })
it("should enforce cert-key with cert value or otherwise generate one", async () => { it("should enforce cert-key with cert value or otherwise generate one", async () => {
@ -338,6 +349,28 @@ describe("parser", () => {
}) })
}) })
it("should parse i18n flag with file path", async () => {
// Test with file path (no validation at CLI parsing level)
const args = parse(["--i18n", "/path/to/custom-strings.json"])
expect(args).toEqual({
i18n: "/path/to/custom-strings.json",
})
})
it("should parse i18n flag with relative file path", async () => {
// Test with relative file path
expect(() => parse(["--i18n", "./custom-strings.json"])).not.toThrow()
expect(() => parse(["--i18n", "strings.json"])).not.toThrow()
})
it("should support app-name and deprecated welcome-text flags", async () => {
const args = parse(["--app-name", "My App", "--welcome-text", "Welcome!"])
expect(args).toEqual({
"app-name": "My App",
"welcome-text": "Welcome!",
})
})
it("should use env var github token", async () => { it("should use env var github token", async () => {
process.env.GITHUB_TOKEN = "ga-foo" process.env.GITHUB_TOKEN = "ga-foo"
const args = parse([]) const args = parse([])
@ -487,6 +520,20 @@ describe("parser", () => {
}), }),
).toThrowError(expectedErrMsg) ).toThrowError(expectedErrMsg)
}) })
it("should fail to parse invalid config", () => {
expect(() => parseConfigFile("test", "/fake-config-path")).toThrowError("invalid config: test")
})
it("should parse repeatable options", () => {
const configContents = `
install-extension:
- extension.number1
- extension.number2
`
expect(parseConfigFile(configContents, "/fake-config-path")).toEqual({
config: "/fake-config-path",
"install-extension": ["extension.number1", "extension.number2"],
})
})
it("should ignore optional strings set to false", async () => { it("should ignore optional strings set to false", async () => {
expect(parse(["--cert=false"])).toEqual({}) expect(parse(["--cert=false"])).toEqual({})
}) })

View file

@ -1,6 +1,6 @@
import { logger } from "@coder/logger" import { logger } from "@coder/logger"
import { readFile, writeFile, stat, utimes } from "fs/promises" import { readFile, writeFile, stat, utimes } from "fs/promises"
import { Heart, heartbeatTimer } from "../../../src/node/heart" import { Heart } from "../../../src/node/heart"
import { clean, mockLogger, tmpdir } from "../../utils/helpers" import { clean, mockLogger, tmpdir } from "../../utils/helpers"
const mockIsActive = (resolveTo: boolean) => jest.fn().mockResolvedValue(resolveTo) const mockIsActive = (resolveTo: boolean) => jest.fn().mockResolvedValue(resolveTo)
@ -82,7 +82,52 @@ describe("Heart", () => {
}) })
describe("heartbeatTimer", () => { describe("heartbeatTimer", () => {
beforeAll(() => { const testName = "heartbeatTimer"
let testDir = ""
beforeAll(async () => {
await clean(testName)
testDir = await tmpdir(testName)
mockLogger()
})
afterAll(() => {
jest.restoreAllMocks()
})
beforeEach(() => {
jest.useFakeTimers()
})
afterEach(() => {
jest.resetAllMocks()
jest.clearAllTimers()
jest.useRealTimers()
})
it("should call isActive when timeout expires", async () => {
const isActive = true
const mockIsActive = jest.fn().mockResolvedValue(isActive)
const heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive)
await heart.beat()
jest.advanceTimersByTime(60 * 1000)
expect(mockIsActive).toHaveBeenCalled()
})
it("should log a warning when isActive rejects", async () => {
const errorMsg = "oh no"
const error = new Error(errorMsg)
const mockIsActive = jest.fn().mockRejectedValue(error)
const heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive)
await heart.beat()
jest.advanceTimersByTime(60 * 1000)
expect(mockIsActive).toHaveBeenCalled()
expect(logger.warn).toHaveBeenCalledWith(errorMsg)
})
})
describe("stateChange", () => {
const testName = "stateChange"
let testDir = ""
let heart: Heart
beforeAll(async () => {
await clean(testName)
testDir = await tmpdir(testName)
mockLogger() mockLogger()
}) })
afterAll(() => { afterAll(() => {
@ -90,23 +135,28 @@ describe("heartbeatTimer", () => {
}) })
afterEach(() => { afterEach(() => {
jest.resetAllMocks() jest.resetAllMocks()
if (heart) {
heart.dispose()
}
}) })
it("should call beat when isActive resolves to true", async () => { it("should change to alive after a beat", async () => {
const isActive = true heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive(true))
const mockIsActive = jest.fn().mockResolvedValue(isActive) const mockOnChange = jest.fn()
const mockBeatFn = jest.fn() heart.onChange(mockOnChange)
await heartbeatTimer(mockIsActive, mockBeatFn) await heart.beat()
expect(mockIsActive).toHaveBeenCalled()
expect(mockBeatFn).toHaveBeenCalled() expect(mockOnChange.mock.calls[0][0]).toBe("alive")
}) })
it("should log a warning when isActive rejects", async () => { it.only("should change to expired when not active", async () => {
const errorMsg = "oh no" jest.useFakeTimers()
const error = new Error(errorMsg) heart = new Heart(`${testDir}/shutdown.txt`, () => new Promise((resolve) => resolve(false)))
const mockIsActive = jest.fn().mockRejectedValue(error) const mockOnChange = jest.fn()
const mockBeatFn = jest.fn() heart.onChange(mockOnChange)
await heartbeatTimer(mockIsActive, mockBeatFn) await heart.beat()
expect(mockIsActive).toHaveBeenCalled()
expect(mockBeatFn).not.toHaveBeenCalled() await jest.advanceTimersByTime(60 * 1000)
expect(logger.warn).toHaveBeenCalledWith(errorMsg) expect(mockOnChange.mock.calls[1][0]).toBe("expired")
jest.clearAllTimers()
jest.useRealTimers()
}) })
}) })

154
test/unit/node/i18n.test.ts Normal file
View file

@ -0,0 +1,154 @@
import { promises as fs } from "fs"
import * as os from "os"
import * as path from "path"
import { loadCustomStrings } from "../../../src/node/i18n"
describe("i18n", () => {
let tempDir: string
let validJsonFile: string
let invalidJsonFile: string
let nonExistentFile: string
beforeEach(async () => {
// Create temporary directory for test files
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "code-server-i18n-test-"))
// Create test files
validJsonFile = path.join(tempDir, "valid.json")
invalidJsonFile = path.join(tempDir, "invalid.json")
nonExistentFile = path.join(tempDir, "does-not-exist.json")
// Write valid JSON file
await fs.writeFile(
validJsonFile,
JSON.stringify({
WELCOME: "Custom Welcome",
LOGIN_TITLE: "My Custom App",
LOGIN_BELOW: "Please log in to continue",
}),
)
// Write invalid JSON file
await fs.writeFile(invalidJsonFile, '{"WELCOME": "Missing closing quote}')
})
afterEach(async () => {
// Clean up temporary directory
await fs.rmdir(tempDir, { recursive: true })
})
describe("loadCustomStrings", () => {
it("should load valid JSON file successfully", async () => {
// Should not throw an error
await expect(loadCustomStrings(validJsonFile)).resolves.toBeUndefined()
})
it("should throw clear error for non-existent file", async () => {
await expect(loadCustomStrings(nonExistentFile)).rejects.toThrow(
`Custom strings file not found: ${nonExistentFile}\nPlease ensure the file exists and is readable.`,
)
})
it("should throw clear error for invalid JSON", async () => {
await expect(loadCustomStrings(invalidJsonFile)).rejects.toThrow(
`Invalid JSON in custom strings file: ${invalidJsonFile}`,
)
})
it("should handle empty JSON object", async () => {
const emptyJsonFile = path.join(tempDir, "empty.json")
await fs.writeFile(emptyJsonFile, "{}")
await expect(loadCustomStrings(emptyJsonFile)).resolves.toBeUndefined()
})
it("should handle nested JSON objects", async () => {
const nestedJsonFile = path.join(tempDir, "nested.json")
await fs.writeFile(
nestedJsonFile,
JSON.stringify({
WELCOME: "Hello World",
NESTED: {
KEY: "Value",
},
}),
)
await expect(loadCustomStrings(nestedJsonFile)).resolves.toBeUndefined()
})
it("should handle special characters and unicode", async () => {
const unicodeJsonFile = path.join(tempDir, "unicode.json")
await fs.writeFile(
unicodeJsonFile,
JSON.stringify({
WELCOME: "欢迎来到 code-server",
LOGIN_TITLE: "Willkommen bei {{app}}",
SPECIAL: "Special chars: àáâãäåæçèéêë 🚀 ♠️ ∆",
}),
"utf8",
)
await expect(loadCustomStrings(unicodeJsonFile)).resolves.toBeUndefined()
})
it("should handle generic errors that are not ENOENT or SyntaxError", async () => {
const testFile = path.join(tempDir, "test.json")
await fs.writeFile(testFile, "{}")
// Mock fs.readFile to throw a generic error
const originalReadFile = fs.readFile
const mockError = new Error("Permission denied")
fs.readFile = jest.fn().mockRejectedValue(mockError)
await expect(loadCustomStrings(testFile)).rejects.toThrow(
`Failed to load custom strings from ${testFile}: Permission denied`,
)
// Restore original function
fs.readFile = originalReadFile
})
it("should handle errors that are not Error instances", async () => {
const testFile = path.join(tempDir, "test.json")
await fs.writeFile(testFile, "{}")
// Mock fs.readFile to throw a non-Error object
const originalReadFile = fs.readFile
fs.readFile = jest.fn().mockRejectedValue("String error")
await expect(loadCustomStrings(testFile)).rejects.toThrow(
`Failed to load custom strings from ${testFile}: String error`,
)
// Restore original function
fs.readFile = originalReadFile
})
it("should handle null/undefined errors", async () => {
const testFile = path.join(tempDir, "test.json")
await fs.writeFile(testFile, "{}")
// Mock fs.readFile to throw null
const originalReadFile = fs.readFile
fs.readFile = jest.fn().mockRejectedValue(null)
await expect(loadCustomStrings(testFile)).rejects.toThrow(`Failed to load custom strings from ${testFile}: null`)
// Restore original function
fs.readFile = originalReadFile
})
it("should complete without errors for valid input", async () => {
const testFile = path.join(tempDir, "resource-test.json")
const customStrings = {
WELCOME: "Custom Welcome Message",
LOGIN_TITLE: "Custom Login Title",
}
await fs.writeFile(testFile, JSON.stringify(customStrings))
// Should not throw any errors
await expect(loadCustomStrings(testFile)).resolves.toBeUndefined()
})
})
})

176
test/unit/node/main.test.ts Normal file
View file

@ -0,0 +1,176 @@
import { promises as fs } from "fs"
import * as path from "path"
import { setDefaults, parse } from "../../../src/node/cli"
import { loadCustomStrings } from "../../../src/node/i18n"
import { tmpdir } from "../../utils/helpers"
// Mock the i18n module
jest.mock("../../../src/node/i18n", () => ({
loadCustomStrings: jest.fn(),
}))
// Mock logger to avoid console output during tests
jest.mock("@coder/logger", () => ({
logger: {
info: jest.fn(),
debug: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
named: jest.fn(),
level: 0,
},
field: jest.fn(),
Level: {
Trace: 0,
Debug: 1,
Info: 2,
Warn: 3,
Error: 4,
},
}))
const mockedLoadCustomStrings = loadCustomStrings as jest.MockedFunction<typeof loadCustomStrings>
describe("main", () => {
let tempDir: string
let mockServer: any
beforeEach(async () => {
tempDir = await tmpdir("code-server-main-test")
// Reset mocks
jest.clearAllMocks()
// Mock the server creation to avoid actually starting a server
mockServer = {
server: {
listen: jest.fn(),
address: jest.fn(() => ({ address: "127.0.0.1", port: 8080 })),
close: jest.fn(),
},
editorSessionManagerServer: {
address: jest.fn(() => null),
},
dispose: jest.fn(),
}
})
afterEach(async () => {
// Clean up temp directory
try {
await fs.rmdir(tempDir, { recursive: true })
} catch (error) {
// Ignore cleanup errors
}
})
describe("runCodeServer", () => {
it("should load custom strings when i18n flag is provided", async () => {
// Create a test custom strings file
const customStringsFile = path.join(tempDir, "custom-strings.json")
await fs.writeFile(
customStringsFile,
JSON.stringify({
WELCOME: "Custom Welcome",
LOGIN_TITLE: "My App",
}),
)
// Create args with i18n flag
const cliArgs = parse([
`--config=${path.join(tempDir, "config.yaml")}`,
`--user-data-dir=${tempDir}`,
"--bind-addr=localhost:0",
"--log=warn",
"--auth=none",
`--i18n=${customStringsFile}`,
])
const args = await setDefaults(cliArgs)
// Mock the app module
jest.doMock("../../../src/node/app", () => ({
createApp: jest.fn().mockResolvedValue(mockServer),
ensureAddress: jest.fn().mockReturnValue(new URL("http://localhost:8080")),
}))
// Mock routes module
jest.doMock("../../../src/node/routes", () => ({
register: jest.fn().mockResolvedValue({ disposeRoutes: jest.fn() }),
}))
// Mock loadCustomStrings to succeed
mockedLoadCustomStrings.mockResolvedValue(undefined)
// Import runCodeServer after mocking
const mainModule = await import("../../../src/node/main")
const result = await mainModule.runCodeServer(args)
// Verify that loadCustomStrings was called with the correct file path
expect(mockedLoadCustomStrings).toHaveBeenCalledWith(customStringsFile)
expect(mockedLoadCustomStrings).toHaveBeenCalledTimes(1)
// Clean up
await result.dispose()
})
it("should not load custom strings when i18n flag is not provided", async () => {
// Create args without i18n flag
const cliArgs = parse([
`--config=${path.join(tempDir, "config.yaml")}`,
`--user-data-dir=${tempDir}`,
"--bind-addr=localhost:0",
"--log=warn",
"--auth=none",
])
const args = await setDefaults(cliArgs)
// Mock the app module
jest.doMock("../../../src/node/app", () => ({
createApp: jest.fn().mockResolvedValue(mockServer),
ensureAddress: jest.fn().mockReturnValue(new URL("http://localhost:8080")),
}))
// Mock routes module
jest.doMock("../../../src/node/routes", () => ({
register: jest.fn().mockResolvedValue({ disposeRoutes: jest.fn() }),
}))
// Import runCodeServer after mocking
const mainModule = await import("../../../src/node/main")
const result = await mainModule.runCodeServer(args)
// Verify that loadCustomStrings was NOT called
expect(mockedLoadCustomStrings).not.toHaveBeenCalled()
// Clean up
await result.dispose()
})
it("should handle errors when loadCustomStrings fails", async () => {
// Create args with i18n flag pointing to non-existent file
const nonExistentFile = path.join(tempDir, "does-not-exist.json")
const cliArgs = parse([
`--config=${path.join(tempDir, "config.yaml")}`,
`--user-data-dir=${tempDir}`,
"--bind-addr=localhost:0",
"--log=warn",
"--auth=none",
`--i18n=${nonExistentFile}`,
])
const args = await setDefaults(cliArgs)
// Mock loadCustomStrings to throw an error
const mockError = new Error("Custom strings file not found")
mockedLoadCustomStrings.mockRejectedValue(mockError)
// Import runCodeServer after mocking
const mainModule = await import("../../../src/node/main")
// Verify that runCodeServer throws the error from loadCustomStrings
await expect(mainModule.runCodeServer(args)).rejects.toThrow("Custom strings file not found")
// Verify that loadCustomStrings was called
expect(mockedLoadCustomStrings).toHaveBeenCalledWith(nonExistentFile)
})
})
})

View file

@ -268,6 +268,21 @@ describe("proxy", () => {
const text = await resp.text() const text = await resp.text()
expect(text).toBe("app being served behind a prefixed path") expect(text).toBe("app being served behind a prefixed path")
}) })
it("should not allow OPTIONS without authentication by default", async () => {
process.env.PASSWORD = "test"
codeServer = await integration.setup(["--auth=password"])
const resp = await codeServer.fetch(proxyPath, { method: "OPTIONS" })
expect(resp.status).toBe(401)
})
it("should allow OPTIONS with `skip-auth-preflight` flag", async () => {
process.env.PASSWORD = "test"
codeServer = await integration.setup(["--auth=password", "--skip-auth-preflight"])
e.post("/wsup", (req, res) => {})
const resp = await codeServer.fetch(proxyPath, { method: "OPTIONS" })
expect(resp.status).toBe(200)
})
}) })
// NOTE@jsjoeio // NOTE@jsjoeio

View file

@ -29,7 +29,7 @@ describe("settings", () => {
const settings = new SettingsProvider<CoderSettings>(pathToMockSettingsFile) const settings = new SettingsProvider<CoderSettings>(pathToMockSettingsFile)
await settings.read() await settings.read()
// This happens when we can't parse a JSON (usually error in file) // This happens when we can't parse a JSON (usually error in file)
expect(logger.warn).toHaveBeenCalledWith(expect.stringMatching(/Unexpected token/)) expect(logger.warn).toHaveBeenCalledWith(expect.stringMatching(/Expected ':'/))
}) })
}) })
describe("with invalid settings file path", () => { describe("with invalid settings file path", () => {