Compare commits
59 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f9a0e8fb3 | ||
|
|
4029c1ec8f | ||
|
|
bbe1b7fecb | ||
|
|
740a2d3aa3 | ||
|
|
92fca0dcc3 | ||
|
|
8b3d9b9e0a | ||
|
|
cdac5bff64 | ||
|
|
70be9fe541 | ||
|
|
729456b10d | ||
|
|
aff005e196 | ||
|
|
53dccbb5ca | ||
|
|
1b1440ffd2 | ||
|
|
c5c764d78f | ||
|
|
3a8fbeb4da | ||
|
|
bd34cd510f | ||
|
|
27a112c3a7 | ||
|
|
74cc50d5e6 | ||
|
|
85ee441006 | ||
|
|
a56769b2c3 | ||
|
|
05d8904ec5 | ||
|
|
3669c96c9c | ||
|
|
37357b0142 | ||
|
|
405eb0f511 | ||
|
|
6e26dad1b1 | ||
|
|
1671bf1c18 | ||
|
|
1face85ad9 | ||
|
|
9ec786b62a | ||
|
|
409c64e0df | ||
|
|
35e78fe35b | ||
|
|
cade03e321 | ||
|
|
9dd999ba78 | ||
|
|
1aca01f8d8 | ||
|
|
e05219d9c0 | ||
|
|
d0e20d514d | ||
|
|
9bd3b83ef5 | ||
|
|
2c9b4e7fd5 | ||
|
|
7af90ea623 | ||
|
|
8b55b5003d | ||
|
|
e5b8d447e5 | ||
|
|
c8257a3074 | ||
|
|
0c72b20fa7 | ||
|
|
ea2caf00ac | ||
|
|
3f2e3340d8 | ||
|
|
47d6d3ada5 | ||
|
|
dded82bb47 | ||
|
|
5d5b7b1944 | ||
|
|
c36b2d3edd | ||
|
|
3b7634c578 | ||
|
|
ec0899a81b | ||
|
|
bbf2e24648 | ||
|
|
9045919d2b | ||
|
|
cb29e65982 | ||
|
|
7eb8f4be87 | ||
|
|
cd4d1b614d | ||
|
|
5051c0f9e4 | ||
|
|
b07335a0f1 | ||
|
|
e3c09efcbc | ||
|
|
e0c960b30e | ||
|
|
55b311a954 |
2
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -20,6 +20,8 @@ body:
|
||||
- **Remote OS**: Ubuntu
|
||||
- **Remote Architecture**: amd64
|
||||
- **`code-server --version`**: 4.0.1
|
||||
|
||||
Please do not just put "latest" for the version.
|
||||
value: |
|
||||
- Web Browser:
|
||||
- Local OS:
|
||||
|
||||
10
.github/workflows/publish.yaml
vendored
@@ -33,7 +33,7 @@ jobs:
|
||||
node-version-file: .node-version
|
||||
|
||||
- name: Download npm package from release artifacts
|
||||
uses: robinraju/release-downloader@v1.11
|
||||
uses: robinraju/release-downloader@v1.12
|
||||
with:
|
||||
repository: "coder/code-server"
|
||||
tag: ${{ github.event.inputs.version || github.ref_name }}
|
||||
@@ -124,7 +124,7 @@ jobs:
|
||||
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||
|
||||
- name: Validate package
|
||||
uses: heyhusen/archlinux-package-action@v2.2.1
|
||||
uses: heyhusen/archlinux-package-action@v2.4.0
|
||||
env:
|
||||
VERSION: ${{ env.VERSION }}
|
||||
with:
|
||||
@@ -145,7 +145,7 @@ 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
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code-server
|
||||
uses: actions/checkout@v4
|
||||
@@ -176,7 +176,7 @@ jobs:
|
||||
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||
|
||||
- name: Download deb artifacts
|
||||
uses: robinraju/release-downloader@v1.11
|
||||
uses: robinraju/release-downloader@v1.12
|
||||
with:
|
||||
repository: "coder/code-server"
|
||||
tag: v${{ env.VERSION }}
|
||||
@@ -184,7 +184,7 @@ jobs:
|
||||
out-file-path: "release-packages"
|
||||
|
||||
- name: Download rpm artifacts
|
||||
uses: robinraju/release-downloader@v1.11
|
||||
uses: robinraju/release-downloader@v1.12
|
||||
with:
|
||||
repository: "coder/code-server"
|
||||
tag: v${{ env.VERSION }}
|
||||
|
||||
3
.github/workflows/release.yaml
vendored
@@ -73,6 +73,7 @@ jobs:
|
||||
|
||||
- name: Install cross-compiler and system dependencies
|
||||
run: |
|
||||
sed -i 's/deb\.debian\.org/archive.debian.org/g' /etc/apt/sources.list
|
||||
dpkg --add-architecture $TARGET_ARCH
|
||||
apt update && apt install -y --no-install-recommends \
|
||||
crossbuild-essential-$TARGET_ARCH \
|
||||
@@ -268,7 +269,7 @@ jobs:
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: dawidd6/action-download-artifact@v9
|
||||
uses: dawidd6/action-download-artifact@v10
|
||||
id: download
|
||||
with:
|
||||
branch: ${{ github.ref }}
|
||||
|
||||
6
.github/workflows/security.yaml
vendored
@@ -43,7 +43,7 @@ jobs:
|
||||
permissions:
|
||||
contents: read # for actions/checkout to fetch code
|
||||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run Trivy vulnerability scanner in repo mode
|
||||
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0
|
||||
uses: aquasecurity/trivy-action@76071ef0d7ec797419534a183b498b4d6366cf37
|
||||
with:
|
||||
scan-type: "fs"
|
||||
scan-ref: "."
|
||||
@@ -72,7 +72,7 @@ jobs:
|
||||
contents: read # for actions/checkout to fetch code
|
||||
security-events: write # for github/codeql-action/autobuild to send a status report
|
||||
name: Analyze with CodeQL
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
|
||||
4
.github/workflows/trivy-docker.yaml
vendored
@@ -44,14 +44,14 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
trivy-scan-image:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Trivy vulnerability scanner in image mode
|
||||
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0
|
||||
uses: aquasecurity/trivy-action@76071ef0d7ec797419534a183b498b4d6366cf37
|
||||
with:
|
||||
image-ref: "docker.io/codercom/code-server:latest"
|
||||
ignore-unfixed: true
|
||||
|
||||
@@ -1 +1 @@
|
||||
20.18.3
|
||||
22.15.1
|
||||
|
||||
112
CHANGELOG.md
@@ -22,6 +22,118 @@ Code v99.99.999
|
||||
|
||||
## Unreleased
|
||||
|
||||
## [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
|
||||
|
||||
@@ -16,7 +16,7 @@ main() {
|
||||
# Package managers may shim their own "node" wrapper into the PATH, so run
|
||||
# node and ask it for its true 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/lib"
|
||||
|
||||
@@ -112,7 +112,9 @@ EOF
|
||||
# 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 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
|
||||
# commit (the dev client will use `oss-dev` but the dev server will still use
|
||||
|
||||
@@ -76,8 +76,8 @@ main() {
|
||||
echo "USE AT YOUR OWN RISK!"
|
||||
fi
|
||||
|
||||
if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-20}" ]; then
|
||||
echo "ERROR: code-server currently requires node v20."
|
||||
if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-22}" ]; then
|
||||
echo "ERROR: code-server currently requires node v22."
|
||||
if [ -n "$FORCE_NODE_VERSION" ]; then
|
||||
echo "However, you have overrided the version check to use v$FORCE_NODE_VERSION."
|
||||
fi
|
||||
|
||||
@@ -1,44 +1,50 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# Generate icons from a single favicon.svg. favicon.svg should have no fill
|
||||
# colors set.
|
||||
main() {
|
||||
cd src/browser/media
|
||||
|
||||
# We need .ico for backwards compatibility.
|
||||
# The other two are the only icon sizes required by Chrome and
|
||||
# we use them for stuff like apple-touch-icon as well.
|
||||
# https://web.dev/add-manifest/
|
||||
# We need .ico for backwards compatibility. The other two are the only icon
|
||||
# sizes required by Chrome and we use them for stuff like apple-touch-icon as
|
||||
# well. https://web.dev/add-manifest/
|
||||
#
|
||||
# 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.
|
||||
# -density somehow makes the image both sharper and smaller in file size.
|
||||
#
|
||||
# https://imagemagick.org/script/command-line-options.php#background
|
||||
convert -quiet -background transparent -resize 256x256 favicon.svg favicon.ico
|
||||
# We do not generate the pwa-icon from the favicon as they are slightly different
|
||||
# designs and sizes.
|
||||
# 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
|
||||
convert -quiet -background transparent \
|
||||
-resize 256x256 -density 256x256 \
|
||||
favicon.svg favicon.ico
|
||||
|
||||
# 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
|
||||
# There is no similar capability for pwas or .ico so we can only add support to the svg.
|
||||
favicon_dark_style="<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
* {
|
||||
fill: white;
|
||||
}
|
||||
}
|
||||
</style>"
|
||||
# See https://stackoverflow.com/a/22901380/4283659
|
||||
# This escapes all newlines so that sed will accept them.
|
||||
favicon_dark_style="$(printf "%s\n" "$favicon_dark_style" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\n/g')"
|
||||
sed "$(
|
||||
cat -n << EOF
|
||||
s%<rect id="favicon"%$favicon_dark_style<rect id="favicon"%
|
||||
EOF
|
||||
)" favicon.svg > favicon-dark-support.svg
|
||||
# Generate non-maskable PWA icons.
|
||||
magick pwa-icon-maskable-192.png \
|
||||
\( +clone -threshold 101% -fill white -draw "roundRectangle 0,0 %[fx:int(w)],%[fx:int(h)] 50,50" \) \
|
||||
-channel-fx "| gray=>alpha" \
|
||||
pwa-icon-192.png
|
||||
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" \
|
||||
pwa-icon-512.png
|
||||
|
||||
# The following adds dark mode support for the favicon as
|
||||
# favicon-dark-support.svg There is no similar capability for pwas or .ico so
|
||||
# we can only add support to the svg.
|
||||
favicon_dark_style="<style>@media (prefers-color-scheme: dark) {* { fill: white; }}</style>"
|
||||
cp favicon.svg favicon-dark-support.svg
|
||||
sed "s%<path%$favicon_dark_style\n <path%" favicon.svg > favicon-dark-support.svg
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -15,9 +15,9 @@ type: application
|
||||
# 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.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 3.26.0
|
||||
version: 3.28.1
|
||||
|
||||
# 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
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
appVersion: 4.99.0
|
||||
appVersion: 4.101.2
|
||||
|
||||
@@ -6,7 +6,7 @@ replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: codercom/code-server
|
||||
tag: '4.99.0'
|
||||
tag: '4.101.2'
|
||||
pullPolicy: Always
|
||||
|
||||
# Specifies one or more secrets to be used when pulling images from a
|
||||
|
||||
@@ -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).
|
||||
Here is what is needed:
|
||||
|
||||
- `node` v20.x
|
||||
- `node` v22.x
|
||||
- `git` v2.x or greater
|
||||
- [`git-lfs`](https://git-lfs.github.com)
|
||||
- [`npm`](https://www.npmjs.com/)
|
||||
|
||||
@@ -24,7 +24,7 @@ on how to set up a Google VM on which you can install code-server.
|
||||
|
||||
## Getting started
|
||||
|
||||
There are four ways to get started:
|
||||
There are five ways to get started:
|
||||
|
||||
1. Using the [install
|
||||
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)
|
||||
4. Using our one-click buttons and guides to [deploy code-server to a cloud
|
||||
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
|
||||
process:
|
||||
|
||||
@@ -11,7 +11,7 @@ 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
|
||||
7. Install and use Node.js 20:
|
||||
7. Install and use Node.js 22:
|
||||
|
||||
```shell
|
||||
nvm install 18
|
||||
|
||||
119
docs/guide.md
@@ -21,6 +21,10 @@
|
||||
- [Proxying to an Angular app](#proxying-to-an-angular-app)
|
||||
- [Proxying to a Svelte app](#proxying-to-a-svelte-app)
|
||||
- [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 -->
|
||||
<!-- 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. 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
|
||||
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.
|
||||
|
||||
1. Install [Caddy](https://caddyserver.com/docs/download#debian-ubuntu-raspbian):
|
||||
3. Install [Caddy](https://caddyserver.com/docs/download#debian-ubuntu-raspbian):
|
||||
|
||||
```console
|
||||
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/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
|
||||
sudo apt update
|
||||
sudo apt install caddy
|
||||
```
|
||||
```console
|
||||
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/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
|
||||
sudo apt update
|
||||
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
|
||||
mydomain.com {
|
||||
@@ -153,7 +157,7 @@ sudo apt install caddy
|
||||
|
||||
Remember to replace `mydomain.com` with your domain name!
|
||||
|
||||
1. Reload Caddy:
|
||||
5. Reload Caddy:
|
||||
|
||||
```console
|
||||
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
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
1. Install NGINX:
|
||||
3. Install NGINX:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
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:
|
||||
|
||||
```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!
|
||||
|
||||
1. Enable the config:
|
||||
|
||||
5. Enable the config:
|
||||
```console
|
||||
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
|
||||
```
|
||||
|
||||
Be sure to replace `me@example.com` with your actual email.
|
||||
|
||||
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
|
||||
> 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
|
||||
|
||||
@@ -378,14 +383,16 @@ PUBLIC_URL=/absproxy/3000 \
|
||||
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
|
||||
code-server!
|
||||
You should then be able to visit
|
||||
`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.
|
||||
|
||||
### 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`
|
||||
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
|
||||
|
||||
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`
|
||||
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
|
||||
|
||||
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
|
||||
2. Update the values to match this (you can use any free port):
|
||||
@@ -436,9 +445,61 @@ For additional context, see [this Github Issue](https://github.com/sveltejs/kit/
|
||||
|
||||
### 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.
|
||||
|
||||
### 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.
|
||||
|
||||
@@ -30,7 +30,7 @@ includes installing instructions based on your operating system.
|
||||
## Node.js version
|
||||
|
||||
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).
|
||||
|
||||
Using other versions of Node.js [may lead to unexpected
|
||||
@@ -78,7 +78,7 @@ Proceed to [installing](#installing)
|
||||
## FreeBSD
|
||||
|
||||
```sh
|
||||
pkg install -y git python npm-node20 pkgconf
|
||||
pkg install -y git python npm-node22 pkgconf
|
||||
pkg install -y libinotify
|
||||
```
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ npm config set python python3
|
||||
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)
|
||||
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
nodejs = pkgs.nodejs_20;
|
||||
nodejs = pkgs.nodejs_22;
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
imagemagick
|
||||
nodejs
|
||||
python3
|
||||
pkg-config
|
||||
|
||||
783
package-lock.json
generated
12
package.json
@@ -47,7 +47,7 @@
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/http-proxy": "1.17.7",
|
||||
"@types/js-yaml": "^4.0.6",
|
||||
"@types/node": "20.x",
|
||||
"@types/node": "22.x",
|
||||
"@types/pem": "^1.14.1",
|
||||
"@types/proxy-from-env": "^1.0.1",
|
||||
"@types/safe-compare": "^1.1.0",
|
||||
@@ -60,7 +60,7 @@
|
||||
"eslint-import-resolver-typescript": "^3.6.0",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"globals": "^15.10.0",
|
||||
"globals": "^16.1.0",
|
||||
"prettier": "3.4.2",
|
||||
"prettier-plugin-sh": "^0.14.0",
|
||||
"ts-node": "^10.9.1",
|
||||
@@ -76,12 +76,12 @@
|
||||
"express": "^5.0.1",
|
||||
"http-proxy": "^1.18.1",
|
||||
"httpolyglot": "^0.1.2",
|
||||
"i18next": "^23.5.1",
|
||||
"i18next": "^25.3.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"limiter": "^2.1.0",
|
||||
"pem": "^1.14.8",
|
||||
"proxy-agent": "^6.3.1",
|
||||
"qs": "6.13.0",
|
||||
"qs": "6.14.0",
|
||||
"rotating-file-stream": "^3.1.1",
|
||||
"safe-buffer": "^5.2.1",
|
||||
"safe-compare": "^1.1.4",
|
||||
@@ -90,7 +90,7 @@
|
||||
"xdg-basedir": "^4.0.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/node": "20.x"
|
||||
"@types/node": "22.x"
|
||||
},
|
||||
"bin": {
|
||||
"code-server": "out/node/entry.js"
|
||||
@@ -105,7 +105,7 @@
|
||||
"remote-development"
|
||||
],
|
||||
"engines": {
|
||||
"node": "20"
|
||||
"node": "22"
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
|
||||
@@ -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/lib/vscode/src/vs/base/common/network.ts
|
||||
@@ -220,7 +220,9 @@ class RemoteAuthoritiesImpl {
|
||||
@@ -223,7 +223,9 @@ class RemoteAuthoritiesImpl {
|
||||
return URI.from({
|
||||
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
|
||||
authority: `${host}:${port}`,
|
||||
@@ -111,7 +111,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/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
|
||||
@@ -122,7 +122,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
|
||||
const queryConnectionToken = parsedUrl.query[connectionTokenQueryName];
|
||||
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']);
|
||||
@@ -138,15 +138,15 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
);
|
||||
if (!remoteAuthority) {
|
||||
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,
|
||||
+ rootEndpoint: rootBase,
|
||||
embedderIdentifier: 'server-distro',
|
||||
extensionsGallery: this._webExtensionResourceUrlTemplate && 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_WEB_BASE_URL: staticRoute,
|
||||
WORKBENCH_NLS_URL,
|
||||
@@ -157,7 +157,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
};
|
||||
|
||||
// DEV ---------------------------------------------------------------------------------------
|
||||
@@ -419,7 +428,7 @@ export class WebClientServer {
|
||||
@@ -424,7 +433,7 @@ export class WebClientServer {
|
||||
'default-src \'self\';',
|
||||
'img-src \'self\' https: data: blob:;',
|
||||
'media-src \'self\';',
|
||||
@@ -166,7 +166,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
'child-src \'self\';',
|
||||
`frame-src 'self' https://*.vscode-cdn.net data:;`,
|
||||
'worker-src \'self\' data: blob:;',
|
||||
@@ -492,3 +501,70 @@ export class WebClientServer {
|
||||
@@ -497,3 +506,70 @@ export class WebClientServer {
|
||||
return void res.end(data);
|
||||
}
|
||||
}
|
||||
@@ -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/lib/vscode/src/vs/code/browser/workbench/workbench.ts
|
||||
@@ -332,7 +332,8 @@ class LocalStorageURLCallbackProvider ex
|
||||
@@ -333,7 +333,8 @@ class LocalStorageURLCallbackProvider ex
|
||||
this.startListening();
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
|
||||
}
|
||||
|
||||
private startListening(): void {
|
||||
@@ -579,17 +580,6 @@ class WorkspaceProvider implements IWork
|
||||
@@ -578,17 +579,6 @@ class WorkspaceProvider implements IWork
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
|
||||
(function () {
|
||||
|
||||
// Find config by checking for DOM
|
||||
@@ -598,8 +588,8 @@ function readCookie(name: string): strin
|
||||
@@ -597,8 +587,8 @@ function readCookie(name: string): strin
|
||||
if (!configElement || !configElementAttribute) {
|
||||
throw new Error('Missing web configuration element');
|
||||
}
|
||||
|
||||
@@ -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/lib/vscode/src/vs/platform/environment/common/argv.ts
|
||||
@@ -122,6 +122,7 @@ export interface NativeParsedArgs {
|
||||
@@ -134,6 +134,7 @@ export interface NativeParsedArgs {
|
||||
'disable-chromium-sandbox'?: boolean;
|
||||
sandbox?: boolean;
|
||||
'enable-coi'?: boolean;
|
||||
+ 'stdin-to-clipboard'?: boolean;
|
||||
'unresponsive-sample-interval'?: string;
|
||||
'unresponsive-sample-period'?: string;
|
||||
|
||||
'enable-rdp-display-tracking'?: boolean;
|
||||
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/lib/vscode/src/vs/platform/environment/node/argv.ts
|
||||
@@ -91,6 +91,7 @@ export const OPTIONS: OptionDescriptions
|
||||
@@ -104,6 +104,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.") },
|
||||
'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.") },
|
||||
|
||||
@@ -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/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
|
||||
@@ -326,6 +326,10 @@ export class Extension implements IExten
|
||||
@@ -340,6 +340,10 @@ export class Extension implements IExten
|
||||
if (this.type === ExtensionType.System && this.productService.quality === 'stable') {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
|
||||
import { ProtocolConstants } from '../../base/parts/ipc/common/ipc.net.js';
|
||||
import { IConfigurationService } from '../../platform/configuration/common/configuration.js';
|
||||
import { ConfigurationService } from '../../platform/configuration/common/configurationService.js';
|
||||
@@ -255,6 +255,9 @@ export async function setupServerService
|
||||
const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority));
|
||||
socketServer.registerChannel('extensions', channel);
|
||||
@@ -267,6 +267,9 @@ export async function setupServerService
|
||||
|
||||
socketServer.registerChannel('mcpManagement', new McpManagementChannel(mcpManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));
|
||||
|
||||
+ const languagePackChannel = ProxyChannel.fromService<RemoteAgentConnectionContext>(accessor.get(ILanguagePackService), disposables);
|
||||
+ 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/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'));
|
||||
}
|
||||
|
||||
@@ -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/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 { 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 { CharCode } from '../../base/common/charCode.js';
|
||||
import { IExtensionManifest } from '../../platform/extensions/common/extensions.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 || '');
|
||||
@@ -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/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-uploads': { 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 ----- */
|
||||
|
||||
@@ -106,6 +107,7 @@ export interface ServerParsedArgs {
|
||||
@@ -109,6 +110,7 @@ export interface ServerParsedArgs {
|
||||
'disable-file-downloads'?: boolean;
|
||||
'disable-file-uploads'?: 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()
|
||||
}
|
||||
}
|
||||
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/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-browser/localeService.ts
|
||||
@@ -51,7 +51,8 @@ class NativeLocaleService implements ILo
|
||||
@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/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
|
||||
@@ -445,9 +445,6 @@ export class InstallAction extends Exten
|
||||
@@ -475,9 +475,6 @@ export class InstallAction extends Exten
|
||||
if (this.extension.isBuiltin) {
|
||||
return;
|
||||
}
|
||||
@@ -282,7 +282,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
|
||||
if (this.extension.state !== ExtensionState.Uninstalled) {
|
||||
return;
|
||||
}
|
||||
@@ -752,7 +749,7 @@ export abstract class InstallInOtherServ
|
||||
@@ -782,7 +779,7 @@ export abstract class InstallInOtherServ
|
||||
}
|
||||
|
||||
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
|
||||
@@ -2039,17 +2036,6 @@ export class SetLanguageAction extends E
|
||||
@@ -2073,17 +2070,6 @@ export class SetLanguageAction extends E
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
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> {
|
||||
@@ -2066,7 +2052,6 @@ export class ClearLanguageAction extends
|
||||
@@ -2100,7 +2086,6 @@ export class ClearLanguageAction extends
|
||||
private static readonly DisabledClass = `${this.EnabledClass} disabled`;
|
||||
|
||||
constructor(
|
||||
@@ -317,7 +317,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
|
||||
@ILocaleService private readonly localeService: ILocaleService,
|
||||
) {
|
||||
super(ClearLanguageAction.ID, ClearLanguageAction.TITLE.value, ClearLanguageAction.DisabledClass, false);
|
||||
@@ -2076,17 +2061,6 @@ export class ClearLanguageAction extends
|
||||
@@ -2110,17 +2095,6 @@ export class ClearLanguageAction extends
|
||||
update(): void {
|
||||
this.enabled = false;
|
||||
this.class = ClearLanguageAction.DisabledClass;
|
||||
@@ -335,18 +335,6 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
|
||||
}
|
||||
|
||||
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
|
||||
===================================================================
|
||||
--- code-server.orig/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts
|
||||
@@ -356,7 +344,7 @@ Index: code-server/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts
|
||||
import './services/lifecycle/browser/lifecycleService.js';
|
||||
import './services/clipboard/browser/clipboardService.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/themes/browser/browserHostColorSchemeService.js';
|
||||
import './services/encryption/browser/encryptionService.js';
|
||||
|
||||
@@ -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/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 ----- */
|
||||
'disable-update-check': { type: 'boolean' },
|
||||
'auth': { type: 'string' },
|
||||
@@ -99,7 +99,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
|
||||
|
||||
/* ----- server setup ----- */
|
||||
|
||||
@@ -100,6 +102,8 @@ export interface ServerParsedArgs {
|
||||
@@ -103,6 +105,8 @@ export interface ServerParsedArgs {
|
||||
/* ----- code-server ----- */
|
||||
'disable-update-check'?: boolean;
|
||||
'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/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
@@ -364,6 +364,8 @@ export class WebClientServer {
|
||||
@@ -369,6 +369,8 @@ export class WebClientServer {
|
||||
serverBasePath: basePath,
|
||||
webviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
|
||||
userDataPath: this._environmentService.userDataPath,
|
||||
@@ -126,11 +126,11 @@ Index: code-server/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
|
||||
@@ -7,11 +7,11 @@ import { Event } from '../../base/common
|
||||
import { Disposable } from '../../base/common/lifecycle.js';
|
||||
import { Disposable, DisposableStore } from '../../base/common/lifecycle.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 { 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, 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 } 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, 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 { IConfigurationService } from '../../platform/configuration/common/configuration.js';
|
||||
@@ -139,7 +139,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
|
||||
import { WorkbenchState, IWorkspaceContextService, isTemporaryWorkspace } from '../../platform/workspace/common/workspace.js';
|
||||
import { IWorkbenchLayoutService, Parts, positionToString } from '../services/layout/browser/layoutService.js';
|
||||
import { getRemoteName } from '../../platform/remote/common/remoteHosts.js';
|
||||
@@ -70,7 +70,7 @@ export class WorkbenchContextKeysHandler
|
||||
@@ -71,7 +71,7 @@ export class WorkbenchContextKeysHandler
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@@ -148,9 +148,9 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
|
||||
@IEditorService private readonly editorService: IEditorService,
|
||||
@@ -197,6 +197,10 @@ export class WorkbenchContextKeysHandler
|
||||
this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService);
|
||||
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(Parts.AUXILIARYBAR_PART));
|
||||
@@ -200,6 +200,10 @@ export class WorkbenchContextKeysHandler
|
||||
this.auxiliaryBarMaximizedContext = AuxiliaryBarMaximizedContext.bindTo(this.contextKeyService);
|
||||
this.auxiliaryBarMaximizedContext.set(this.layoutService.isAuxiliaryBarMaximized());
|
||||
|
||||
+ // code-server
|
||||
+ IsEnabledFileDownloads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileDownloads ?? true)
|
||||
@@ -208,7 +208,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/lib/vscode/src/vs/workbench/common/contextkeys.ts
|
||||
@@ -39,6 +39,9 @@ export const HasWebFileSystemAccess = ne
|
||||
@@ -36,6 +36,9 @@ export const HasWebFileSystemAccess = ne
|
||||
|
||||
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'));
|
||||
|
||||
@@ -217,7 +217,7 @@ Index: code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts
|
||||
+
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region < --- Window --- >
|
||||
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
|
||||
@@ -330,7 +330,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/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> {
|
||||
const resource = this.transformIncoming(uriTransformer, _resource, true);
|
||||
@@ -338,7 +338,7 @@ Index: code-server/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderS
|
||||
const buffer = await this.provider.readFile(resource, opts);
|
||||
|
||||
return VSBuffer.wrap(buffer);
|
||||
@@ -110,6 +111,7 @@ export abstract class AbstractDiskFileSy
|
||||
@@ -117,6 +118,7 @@ export abstract class AbstractDiskFileSy
|
||||
}
|
||||
});
|
||||
|
||||
@@ -346,7 +346,7 @@ Index: code-server/lib/vscode/src/vs/platform/files/node/diskFileSystemProviderS
|
||||
const fileStream = this.provider.readFileStream(resource, opts, cts.token);
|
||||
listenStream(fileStream, {
|
||||
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> {
|
||||
const resource = this.transformIncoming(uriTransformer, _resource);
|
||||
|
||||
@@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
|
||||
import { IEditorOpenContext, IEditorSerializer } from '../../../common/editor.js';
|
||||
import { IWebviewElement, IWebviewService } from '../../webview/browser/webview.js';
|
||||
import './gettingStartedColors.js';
|
||||
@@ -872,6 +872,72 @@ export class GettingStartedPage extends
|
||||
@@ -876,6 +876,72 @@ export class GettingStartedPage extends
|
||||
$('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 rightColumn = $('.categories-column.categories-column-right', {},);
|
||||
|
||||
@@ -907,6 +973,9 @@ export class GettingStartedPage extends
|
||||
@@ -911,6 +977,9 @@ export class GettingStartedPage extends
|
||||
recentList.setLimit(5);
|
||||
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/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' },
|
||||
'disable-file-downloads': { type: 'boolean' },
|
||||
'disable-file-uploads': { type: 'boolean' },
|
||||
@@ -189,7 +189,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
|
||||
|
||||
/* ----- server setup ----- */
|
||||
|
||||
@@ -104,6 +105,7 @@ export interface ServerParsedArgs {
|
||||
@@ -107,6 +108,7 @@ export interface ServerParsedArgs {
|
||||
'auth'?: string;
|
||||
'disable-file-downloads'?: 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/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,
|
||||
isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
|
||||
isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'],
|
||||
@@ -214,15 +214,15 @@ Index: code-server/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
|
||||
@@ -7,7 +7,7 @@ import { Event } from '../../base/common
|
||||
import { Disposable } from '../../base/common/lifecycle.js';
|
||||
import { Disposable, DisposableStore } from '../../base/common/lifecycle.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 { 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, 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, 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, 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 { IConfigurationService } from '../../platform/configuration/common/configuration.js';
|
||||
@@ -200,6 +200,7 @@ export class WorkbenchContextKeysHandler
|
||||
@@ -203,6 +203,7 @@ export class WorkbenchContextKeysHandler
|
||||
// code-server
|
||||
IsEnabledFileDownloads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileDownloads ?? 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/lib/vscode/src/vs/workbench/common/contextkeys.ts
|
||||
@@ -41,6 +41,7 @@ export const EmbedderIdentifierContext =
|
||||
@@ -38,6 +38,7 @@ export const EmbedderIdentifierContext =
|
||||
|
||||
export const IsEnabledFileDownloads = new RawContextKey<boolean>('isEnabledFileDownloads', true, true);
|
||||
export const IsEnabledFileUploads = new RawContextKey<boolean>('isEnabledFileUploads', true, true);
|
||||
|
||||
@@ -269,10 +269,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/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
@@ -334,6 +334,7 @@ export class WebClientServer {
|
||||
@@ -333,6 +333,7 @@ export class WebClientServer {
|
||||
} : undefined;
|
||||
|
||||
const productConfiguration = {
|
||||
const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
|
||||
+ codeServerVersion: this._productService.codeServerVersion,
|
||||
embedderIdentifier: 'server-distro',
|
||||
extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
|
||||
|
||||
@@ -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/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
@@ -359,6 +359,7 @@ export class WebClientServer {
|
||||
@@ -364,6 +364,7 @@ export class WebClientServer {
|
||||
remoteAuthority,
|
||||
serverBasePath: basePath,
|
||||
webviewEndpoint: staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
|
||||
|
||||
@@ -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/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>> = {
|
||||
/* ----- code-server ----- */
|
||||
'disable-update-check': { type: 'boolean' },
|
||||
@@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
|
||||
|
||||
/* ----- server setup ----- */
|
||||
|
||||
@@ -98,6 +99,7 @@ export const serverOptions: OptionDescri
|
||||
@@ -101,6 +102,7 @@ export const serverOptions: OptionDescri
|
||||
export interface ServerParsedArgs {
|
||||
/* ----- code-server ----- */
|
||||
'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/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,
|
||||
rootEndpoint: rootBase,
|
||||
updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
|
||||
+ logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
|
||||
embedderIdentifier: 'server-distro',
|
||||
extensionsGallery: this._productService.extensionsGallery,
|
||||
} satisfies Partial<IProductConfiguration>;
|
||||
};
|
||||
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
|
||||
===================================================================
|
||||
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts
|
||||
|
||||
@@ -40,15 +40,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/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 callbackRoute = posix.join(basePath, this._productPath, CALLBACK_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,
|
||||
rootEndpoint: rootBase,
|
||||
embedderIdentifier: 'server-distro',
|
||||
@@ -61,9 +61,9 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
- }).toString(true)
|
||||
- } : undefined
|
||||
+ 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
|
||||
===================================================================
|
||||
--- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
|
||||
|
||||
@@ -71,14 +71,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/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
@@ -343,6 +343,7 @@ export class WebClientServer {
|
||||
@@ -342,6 +342,7 @@ export class WebClientServer {
|
||||
rootEndpoint: rootBase,
|
||||
updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
|
||||
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
|
||||
+ proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? rootBase + '/proxy/{{port}}/',
|
||||
embedderIdentifier: 'server-distro',
|
||||
extensionsGallery: this._productService.extensionsGallery,
|
||||
} satisfies Partial<IProductConfiguration>;
|
||||
};
|
||||
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
|
||||
@@ -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/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 type { IWorkbenchConstructionOptions, IWorkspace, IWorkspaceProvider } from '../../../workbench/browser/web.api.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 { create } from '../../../workbench/workbench.web.main.internal.js';
|
||||
|
||||
@@ -600,6 +601,39 @@ class WorkspaceProvider implements IWork
|
||||
@@ -599,6 +600,39 @@ class WorkspaceProvider implements IWork
|
||||
settingsSyncOptions: config.settingsSyncOptions ? { enabled: config.settingsSyncOptions.enabled, } : undefined,
|
||||
workspaceProvider: WorkspaceProvider.create(config),
|
||||
urlCallbackProvider: new LocalStorageURLCallbackProvider(config.callbackRoute),
|
||||
|
||||
@@ -20,3 +20,5 @@ getting-started.diff
|
||||
keepalive.diff
|
||||
clipboard.diff
|
||||
display-language.diff
|
||||
trusted-domains.diff
|
||||
signature-verification.diff
|
||||
|
||||
@@ -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/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,
|
||||
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
|
||||
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',
|
||||
extensionsGallery: this._productService.extensionsGallery,
|
||||
} satisfies Partial<IProductConfiguration>;
|
||||
};
|
||||
|
||||
34
patches/signature-verification.diff
Normal 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());
|
||||
@@ -10,29 +10,29 @@ 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
|
||||
@@ -256,8 +256,7 @@ function packageTask(type, platform, arc
|
||||
@@ -257,8 +257,7 @@ function packageTask(type, platform, arc
|
||||
|
||||
const src = gulp.src(sourceFolderName + '/**', { base: '.' })
|
||||
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); }))
|
||||
- .pipe(util.setExecutableBit(['**/*.sh']))
|
||||
- .pipe(filter(['**', '!**/*.js.map']));
|
||||
- .pipe(filter(['**', '!**/*.{js,css}.map']));
|
||||
+ .pipe(util.setExecutableBit(['**/*.sh']));
|
||||
|
||||
const workspaceExtensionPoints = ['debuggers', 'jsonValidation'];
|
||||
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}/**`);
|
||||
|
||||
const extensions = gulp.src(extensionPaths, { base: '.build', dot: true });
|
||||
- const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true });
|
||||
- const sources = es.merge(src, extensions, extensionsCommonDependencies)
|
||||
+ 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);
|
||||
|
||||
let version = packageJson.version;
|
||||
const quality = product.quality;
|
||||
@@ -451,7 +450,7 @@ function tweakProductForServerWeb(produc
|
||||
@@ -452,7 +451,7 @@ function tweakProductForServerWeb(produc
|
||||
const minifyTask = task.define(`minify-vscode-${type}`, task.series(
|
||||
bundleTask,
|
||||
util.rimraf(`out-vscode-${type}-min`),
|
||||
|
||||
@@ -21,18 +21,18 @@ Index: code-server/lib/vscode/src/vs/workbench/api/node/extHostExtensionService.
|
||||
|
||||
+import * as _http from 'http';
|
||||
import * as performance from '../../../base/common/performance.js';
|
||||
import type * as vscode from 'vscode';
|
||||
import { createApiFactoryAndRegisterActors } from '../common/extHost.api.impl.js';
|
||||
import { RequireInterceptor } from '../common/extHostRequireInterceptor.js';
|
||||
@@ -17,6 +18,7 @@ import { ExtensionRuntime } from '../com
|
||||
@@ -18,6 +19,7 @@ import { ExtensionRuntime } from '../com
|
||||
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 { IExtHostWorkspace } from '../common/extHostWorkspace.js';
|
||||
import { ExtHostDiskFileSystemProvider } from './extHostDiskFileSystemProvider.js';
|
||||
import { createRequire } from 'node:module';
|
||||
const require = createRequire(import.meta.url);
|
||||
@@ -97,6 +99,52 @@ export class ExtHostExtensionService ext
|
||||
await interceptor.install();
|
||||
import nodeModule from 'node:module';
|
||||
import { assertType } from '../../../base/common/types.js';
|
||||
@@ -226,6 +228,52 @@ export class ExtHostExtensionService ext
|
||||
|
||||
performance.mark('code/extHost/didInitAPI');
|
||||
|
||||
+ (async () => {
|
||||
@@ -96,7 +96,7 @@ Index: code-server/lib/vscode/src/vs/workbench/api/node/extensionHostProcess.ts
|
||||
import minimist from 'minimist';
|
||||
import * as nativeWatchdog from 'native-watchdog';
|
||||
import * as net from 'net';
|
||||
@@ -423,7 +424,28 @@ async function startExtensionHostProcess
|
||||
@@ -436,7 +437,28 @@ async function startExtensionHostProcess
|
||||
);
|
||||
|
||||
// rewrite onTerminate-function to be a proper shutdown
|
||||
|
||||
@@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
|
||||
import { NullPolicyService } from '../../platform/policy/common/policy.js';
|
||||
import { OneDataSystemAppender } from '../../platform/telemetry/node/1dsAppender.js';
|
||||
import { LoggerService } from '../../platform/log/node/loggerService.js';
|
||||
@@ -158,11 +160,23 @@ export async function setupServerService
|
||||
@@ -163,11 +165,23 @@ export async function setupServerService
|
||||
const requestService = new RequestService('remote', configurationService, environmentService, logService);
|
||||
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/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
@@ -348,6 +348,8 @@ export class WebClientServer {
|
||||
@@ -347,6 +347,8 @@ export class WebClientServer {
|
||||
scope: vscodeBase + '/',
|
||||
path: rootBase + '/_static/out/browser/serviceWorker.js',
|
||||
},
|
||||
@@ -142,7 +142,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
+ telemetryEndpoint: this._productService.telemetryEndpoint,
|
||||
embedderIdentifier: 'server-distro',
|
||||
extensionsGallery: this._productService.extensionsGallery,
|
||||
} satisfies Partial<IProductConfiguration>;
|
||||
};
|
||||
Index: code-server/lib/vscode/src/vs/base/common/product.ts
|
||||
===================================================================
|
||||
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts
|
||||
|
||||
49
patches/trusted-domains.diff
Normal 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 ----- */
|
||||
|
||||
@@ -111,6 +112,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'];
|
||||
@@ -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/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
@@ -341,6 +341,7 @@ export class WebClientServer {
|
||||
const productConfiguration = {
|
||||
@@ -340,6 +340,7 @@ export class WebClientServer {
|
||||
const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
|
||||
codeServerVersion: this._productService.codeServerVersion,
|
||||
rootEndpoint: rootBase,
|
||||
+ updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
|
||||
embedderIdentifier: 'server-distro',
|
||||
extensionsGallery: this._productService.extensionsGallery,
|
||||
} satisfies Partial<IProductConfiguration>;
|
||||
};
|
||||
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
|
||||
@@ -13,6 +13,8 @@ import { memoize } from '../../base/comm
|
||||
import { URI } from '../../base/common/uri.js';
|
||||
@@ -15,6 +15,8 @@ import { joinPath } from '../../base/com
|
||||
import { join } from '../../base/common/path.js';
|
||||
|
||||
export const serverOptions: OptionDescriptions<Required<ServerParsedArgs>> = {
|
||||
+ /* ----- code-server ----- */
|
||||
@@ -126,7 +126,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
|
||||
|
||||
/* ----- server setup ----- */
|
||||
|
||||
@@ -94,6 +96,8 @@ export const serverOptions: OptionDescri
|
||||
@@ -97,6 +99,8 @@ export const serverOptions: OptionDescri
|
||||
};
|
||||
|
||||
export interface ServerParsedArgs {
|
||||
|
||||
@@ -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/lib/vscode/src/vs/server/node/webClientServer.ts
|
||||
@@ -355,6 +355,7 @@ export class WebClientServer {
|
||||
@@ -360,6 +360,7 @@ export class WebClientServer {
|
||||
const workbenchWebConfiguration = {
|
||||
remoteAuthority,
|
||||
serverBasePath: basePath,
|
||||
@@ -70,29 +70,21 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<meta http-equiv="Content-Security-Policy"
|
||||
- content="default-src 'none'; script-src 'sha256-nlLyDpnjtftJG2xvXh2vuy77l7xFTjfOz7Jnj1iXNmA=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
|
||||
+ content="default-src 'none'; script-src 'sha256-ap/AtocvSWp0rrxaO19DJy/nOpazT6M5Cv9utUWe7MA=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
|
||||
|
||||
- content="default-src 'none'; script-src 'sha256-gEAyFzmkyqMoTTnN+3KReFUYoHsK4RAJEb+6eiul+UY=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
|
||||
+ content="default-src 'none'; script-src 'sha256-Oi71Tq4Buohx0KDH3yEbVJUzABnqYv9iVLo420HZXqI=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
|
||||
|
||||
<!-- Disable pinch zooming -->
|
||||
@@ -349,6 +349,12 @@
|
||||
<meta name="viewport"
|
||||
@@ -238,7 +238,7 @@
|
||||
}
|
||||
|
||||
const hostname = location.hostname;
|
||||
|
||||
+ // It is safe to run if we are on the same host.
|
||||
+ const parent = new URL(parentOrigin)
|
||||
+ if (parent.hostname === hostname) {
|
||||
+ return start(parentOrigin)
|
||||
+ }
|
||||
+
|
||||
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 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' })
|
||||
+ navigator.serviceWorker.register(swPath)
|
||||
.then(async registration => {
|
||||
/**
|
||||
* @param {MessageEvent} event
|
||||
@@ -351,6 +351,12 @@
|
||||
|
||||
const hostname = location.hostname;
|
||||
|
||||
|
||||
@@ -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>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
* {
|
||||
fill: white;
|
||||
}
|
||||
}
|
||||
</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>
|
||||
<svg width="100%" height="100%" viewBox="0 0 147 147" xmlns="http://www.w3.org/2000/svg">
|
||||
<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"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 685 B |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -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 |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 8.3 KiB |
BIN
src/browser/media/pwa-icon-maskable-192.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/browser/media/pwa-icon-maskable-512.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 19 KiB |
@@ -30,7 +30,7 @@ export enum LogLevel {
|
||||
export class OptionalString extends Optional<string> {}
|
||||
|
||||
/**
|
||||
* Code flags provided by the user.
|
||||
* (VS) Code flags provided by the user.
|
||||
*/
|
||||
export interface UserProvidedCodeArgs {
|
||||
"disable-telemetry"?: boolean
|
||||
@@ -53,7 +53,9 @@ export interface UserProvidedCodeArgs {
|
||||
"disable-getting-started-override"?: boolean
|
||||
"disable-proxy"?: boolean
|
||||
"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[]
|
||||
help?: boolean
|
||||
host?: string
|
||||
locale?: string
|
||||
port?: number
|
||||
json?: boolean
|
||||
log?: LogLevel
|
||||
@@ -84,12 +85,15 @@ export interface UserProvidedArgs extends UserProvidedCodeArgs {
|
||||
"trusted-origins"?: string[]
|
||||
version?: boolean
|
||||
"proxy-domain"?: string[]
|
||||
"skip-auth-preflight"?: boolean
|
||||
"reuse-window"?: boolean
|
||||
"new-window"?: boolean
|
||||
"ignore-last-opened"?: boolean
|
||||
verbose?: boolean
|
||||
"app-name"?: string
|
||||
"welcome-text"?: string
|
||||
"abs-proxy-base-path"?: string
|
||||
i18n?: string
|
||||
/* Positional arguments. */
|
||||
_?: string[]
|
||||
}
|
||||
@@ -193,6 +197,10 @@ export const options: Options<Required<UserProvidedArgs>> = {
|
||||
enable: { type: "string[]" },
|
||||
help: { type: "boolean", short: "h", description: "Show this output." },
|
||||
json: { type: "boolean" },
|
||||
"link-protection-trusted-domains": {
|
||||
type: "string[]",
|
||||
description: "Links matching a trusted domain can be opened without link protection.",
|
||||
},
|
||||
locale: {
|
||||
// The preferred way to set the locale is via the UI.
|
||||
type: "string",
|
||||
@@ -252,6 +260,10 @@ export const options: Options<Required<UserProvidedArgs>> = {
|
||||
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." },
|
||||
"skip-auth-preflight": {
|
||||
type: "boolean",
|
||||
description: "Allows preflight requests through proxy without authentication.",
|
||||
},
|
||||
"ignore-last-opened": {
|
||||
type: "boolean",
|
||||
short: "e",
|
||||
@@ -273,17 +285,24 @@ export const options: Options<Required<UserProvidedArgs>> = {
|
||||
"app-name": {
|
||||
type: "string",
|
||||
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": {
|
||||
type: "string",
|
||||
short: "w",
|
||||
description: "Text to show on login page",
|
||||
deprecated: true,
|
||||
},
|
||||
"abs-proxy-base-path": {
|
||||
type: "string",
|
||||
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.",
|
||||
},
|
||||
}
|
||||
|
||||
export const optionDescriptions = (opts: Partial<Options<Required<UserProvidedArgs>>> = options): string[] => {
|
||||
@@ -702,12 +721,16 @@ export function parseConfigFile(configFile: string, configPath: string): ConfigA
|
||||
|
||||
// We convert the config file into a set of flags.
|
||||
// This is a temporary measure until we add a proper CLI library.
|
||||
const configFileArgv = Object.entries(config).map(([optName, opt]) => {
|
||||
if (opt === true) {
|
||||
return `--${optName}`
|
||||
}
|
||||
return `--${optName}=${opt}`
|
||||
})
|
||||
const configFileArgv = Object.entries(config)
|
||||
.map(([optName, opt]) => {
|
||||
if (opt === true) {
|
||||
return `--${optName}`
|
||||
} else if (Array.isArray(opt)) {
|
||||
return opt.map((o) => `--${optName}=${o}`)
|
||||
}
|
||||
return `--${optName}=${opt}`
|
||||
})
|
||||
.flat()
|
||||
const args = parse(configFileArgv, {
|
||||
configFile: configPath,
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { promises as fs } from "fs"
|
||||
import i18next, { init } from "i18next"
|
||||
import * as en from "./locales/en.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 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({
|
||||
lng: "en",
|
||||
fallbackLng: "en", // language to use if translations in user language are not available.
|
||||
returnNull: false,
|
||||
lowerCaseLng: true,
|
||||
debug: process.env.NODE_ENV === "development",
|
||||
resources: {
|
||||
en: {
|
||||
translation: en,
|
||||
},
|
||||
"zh-cn": {
|
||||
translation: zhCn,
|
||||
},
|
||||
th: {
|
||||
translation: th,
|
||||
},
|
||||
ja: {
|
||||
translation: ja,
|
||||
},
|
||||
ur: {
|
||||
translation: ur,
|
||||
},
|
||||
},
|
||||
resources: defaultResources,
|
||||
})
|
||||
|
||||
export default i18next
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { field, logger } from "@coder/logger"
|
||||
import http from "http"
|
||||
import * as os from "os"
|
||||
import * as path from "path"
|
||||
import { Disposable } from "../common/emitter"
|
||||
import { plural } from "../common/util"
|
||||
import { createApp, ensureAddress } from "./app"
|
||||
import { AuthType, DefaultedArgs, Feature, toCodeArgs, UserProvidedArgs } from "./cli"
|
||||
import { commit, version, vsRootPath } from "./constants"
|
||||
import { loadCustomStrings } from "./i18n"
|
||||
import { register } from "./routes"
|
||||
import { VSCodeModule } from "./routes/vscode"
|
||||
import { isDirectory, open } from "./util"
|
||||
import * as os from "os"
|
||||
|
||||
/**
|
||||
* Return true if the user passed an extension-related VS Code flag.
|
||||
@@ -122,6 +123,12 @@ export const runCodeServer = async (
|
||||
): Promise<{ dispose: Disposable["dispose"]; server: http.Server }> => {
|
||||
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.debug(`Using extensions-dir ${args["extensions-dir"]}`)
|
||||
|
||||
@@ -144,6 +151,8 @@ export const runCodeServer = async (
|
||||
logger.info(" - Using password from $PASSWORD")
|
||||
} else if (args.usingEnvHashedPassword) {
|
||||
logger.info(" - Using password from $HASHED_PASSWORD")
|
||||
} else if (args["hashed-password"]) {
|
||||
logger.info(` - Using hashed-password from ${args.config}`)
|
||||
} else {
|
||||
logger.info(` - Using password from ${args.config}`)
|
||||
}
|
||||
@@ -163,6 +172,9 @@ export const runCodeServer = async (
|
||||
logger.info(` - ${plural(args["proxy-domain"].length, "Proxying the following 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) {
|
||||
logger.info(`Using proxy URI in PORTS tab: ${process.env.VSCODE_PROXY_URI}`)
|
||||
}
|
||||
|
||||
@@ -61,6 +61,11 @@ router.all(/.*/, async (req, res, next) => {
|
||||
|
||||
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.
|
||||
const isAuthenticated = await authenticated(req)
|
||||
if (!isAuthenticated) {
|
||||
|
||||
@@ -3,10 +3,10 @@ import express from "express"
|
||||
import { promises as fs } from "fs"
|
||||
import path from "path"
|
||||
import { HttpCode } from "../../common/http"
|
||||
import type { WebsocketRequest } from "../wsRouter"
|
||||
import { rootPath } from "../constants"
|
||||
import { replaceTemplates } from "../http"
|
||||
import { escapeHtml, getMediaMime } from "../util"
|
||||
import type { WebsocketRequest } from "../wsRouter"
|
||||
|
||||
interface ErrorWithStatusCode {
|
||||
statusCode: number
|
||||
|
||||
@@ -14,8 +14,8 @@ import { Heart } from "../heart"
|
||||
import { redirect } from "../http"
|
||||
import { CoderSettings, SettingsProvider } from "../settings"
|
||||
import { UpdateProvider } from "../update"
|
||||
import type { WebsocketRequest } from "../wsRouter"
|
||||
import { getMediaMime, paths } from "../util"
|
||||
import type { WebsocketRequest } from "../wsRouter"
|
||||
import * as domainProxy from "./domainProxy"
|
||||
import { errorHandler, wsErrorHandler } from "./errors"
|
||||
import * as health from "./health"
|
||||
|
||||
@@ -32,6 +32,8 @@ const getRoot = async (req: Request, error?: Error): Promise<string> => {
|
||||
i18n.changeLanguage(locale)
|
||||
const appName = req.args["app-name"] || "code-server"
|
||||
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 })
|
||||
if (req.args.usingEnvPassword) {
|
||||
passwordMsg = i18n.t("LOGIN_USING_ENV_PASSWORD")
|
||||
|
||||
@@ -13,7 +13,11 @@ const getProxyTarget = (
|
||||
): string => {
|
||||
// If there is a base path, strip it out.
|
||||
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(
|
||||
@@ -26,7 +30,9 @@ export async function proxy(
|
||||
): Promise<void> {
|
||||
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 (!req.params.path || req.params.path === "/") {
|
||||
const to = self(req)
|
||||
|
||||
@@ -4,8 +4,8 @@ import * as express from "express"
|
||||
import { promises as fs } from "fs"
|
||||
import * as http from "http"
|
||||
import * as net from "net"
|
||||
import * as path from "path"
|
||||
import * as os from "os"
|
||||
import * as path from "path"
|
||||
import { logError } from "../../common/util"
|
||||
import { CodeArgs, toCodeArgs } from "../cli"
|
||||
import { isDevMode, vsRootPath } from "../constants"
|
||||
@@ -186,11 +186,22 @@ router.get("/manifest.json", async (req, res) => {
|
||||
display: "fullscreen",
|
||||
display_override: ["window-controls-overlay"],
|
||||
description: "Run Code on a remote server.",
|
||||
icons: [192, 512].map((size) => ({
|
||||
src: `{{BASE}}/_static/src/browser/media/pwa-icon-${size}.png`,
|
||||
type: "image/png",
|
||||
sizes: `${size}x${size}`,
|
||||
})),
|
||||
icons: [192, 512]
|
||||
.map((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,
|
||||
2,
|
||||
|
||||
@@ -17,7 +17,7 @@ export class SettingsProvider<T> {
|
||||
public async read(): Promise<T> {
|
||||
try {
|
||||
const raw = (await fs.readFile(this.settingsPath, "utf8")).trim()
|
||||
return raw ? JSON.parse(raw) : {}
|
||||
return raw ? JSON.parse(raw) : ({} as T)
|
||||
} catch (error: any) {
|
||||
if (error.code !== "ENOENT") {
|
||||
logger.warn(error.message)
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
bindAddrFromArgs,
|
||||
defaultConfigFile,
|
||||
parse,
|
||||
parseConfigFile,
|
||||
setDefaults,
|
||||
shouldOpenInExistingInstance,
|
||||
toCodeArgs,
|
||||
@@ -74,6 +75,7 @@ describe("parser", () => {
|
||||
"--verbose",
|
||||
["--app-name", "custom instance name"],
|
||||
["--welcome-text", "welcome to code"],
|
||||
["--i18n", "path/to/custom-strings.json"],
|
||||
"2",
|
||||
|
||||
["--locale", "ja"],
|
||||
@@ -108,6 +110,8 @@ describe("parser", () => {
|
||||
|
||||
["--abs-proxy-base-path", "/codeserver/app1"],
|
||||
|
||||
"--skip-auth-preflight",
|
||||
|
||||
["--session-socket", "/tmp/override-code-server-ipc-socket"],
|
||||
|
||||
["--host", "0.0.0.0"],
|
||||
@@ -142,10 +146,12 @@ describe("parser", () => {
|
||||
verbose: true,
|
||||
"app-name": "custom instance name",
|
||||
"welcome-text": "welcome to code",
|
||||
i18n: path.resolve("path/to/custom-strings.json"),
|
||||
version: true,
|
||||
"bind-addr": "192.169.0.1:8080",
|
||||
"session-socket": "/tmp/override-code-server-ipc-socket",
|
||||
"abs-proxy-base-path": "/codeserver/app1",
|
||||
"skip-auth-preflight": true,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -284,12 +290,17 @@ describe("parser", () => {
|
||||
})
|
||||
|
||||
it("should support repeatable flags", async () => {
|
||||
expect(() => parse(["--proxy-domain", ""])).toThrowError(/--proxy-domain requires a value/)
|
||||
expect(parse(["--proxy-domain", "*.coder.com"])).toEqual({
|
||||
"proxy-domain": ["*.coder.com"],
|
||||
})
|
||||
expect(parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "test.com"])).toEqual({
|
||||
"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 () => {
|
||||
@@ -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 () => {
|
||||
process.env.GITHUB_TOKEN = "ga-foo"
|
||||
const args = parse([])
|
||||
@@ -487,6 +520,20 @@ describe("parser", () => {
|
||||
}),
|
||||
).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 () => {
|
||||
expect(parse(["--cert=false"])).toEqual({})
|
||||
})
|
||||
|
||||
154
test/unit/node/i18n.test.ts
Normal 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()
|
||||
})
|
||||
})
|
||||
})
|
||||
175
test/unit/node/main.test.ts
Normal file
@@ -0,0 +1,175 @@
|
||||
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(),
|
||||
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(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(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)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -268,6 +268,21 @@ describe("proxy", () => {
|
||||
const text = await resp.text()
|
||||
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
|
||||
|
||||
@@ -29,7 +29,7 @@ describe("settings", () => {
|
||||
const settings = new SettingsProvider<CoderSettings>(pathToMockSettingsFile)
|
||||
await settings.read()
|
||||
// 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", () => {
|
||||
|
||||