mirror of
https://github.com/coder/code-server.git
synced 2026-06-23 18:37:10 +02:00
Compare commits
49 Commits
v4.121.0
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cfd8f7041 | ||
|
|
8009d3c360 | ||
|
|
4ae1fc202e | ||
|
|
a59c3ab990 | ||
|
|
a7f457046f | ||
|
|
25e847dc94 | ||
|
|
e1c839fb1d | ||
|
|
7dfd68589a | ||
|
|
72086edbdb | ||
|
|
7617ab2b92 | ||
|
|
d31d0347cf | ||
|
|
5dca609c2a | ||
|
|
87ac56bf8c | ||
|
|
a056406eff | ||
|
|
24811a6269 | ||
|
|
53ed1e30d2 | ||
|
|
7393d50b09 | ||
|
|
f7663cc34c | ||
|
|
71ba0191f2 | ||
|
|
19be49ebe4 | ||
|
|
9fe7eb79d5 | ||
|
|
1ccd4f04d2 | ||
|
|
364cf99338 | ||
|
|
92a7dce46f | ||
|
|
d0d53d924e | ||
|
|
77d880d0c3 | ||
|
|
559d73a636 | ||
|
|
6fd40c04c7 | ||
|
|
63c071959f | ||
|
|
7be257b252 | ||
|
|
923cb753b8 | ||
|
|
6cad75773e | ||
|
|
cb2548f989 | ||
|
|
f87e243225 | ||
|
|
d98fcd3598 | ||
|
|
93d3ee8ab1 | ||
|
|
030bdcf771 | ||
|
|
4a50b99b67 | ||
|
|
382aa3ba87 | ||
|
|
2243efb2e6 | ||
|
|
477c0b11b8 | ||
|
|
2396092ae9 | ||
|
|
4f9c23893a | ||
|
|
62e5c450f7 | ||
|
|
265713561c | ||
|
|
c9faf343ba | ||
|
|
99bfbd5931 | ||
|
|
238769e535 | ||
|
|
bf61384523 |
2
.github/dependabot.yaml
vendored
2
.github/dependabot.yaml
vendored
@@ -16,8 +16,6 @@ updates:
|
|||||||
interval: "monthly"
|
interval: "monthly"
|
||||||
time: "06:00"
|
time: "06:00"
|
||||||
timezone: "America/Chicago"
|
timezone: "America/Chicago"
|
||||||
commit-message:
|
|
||||||
prefix: "chore"
|
|
||||||
labels: []
|
labels: []
|
||||||
ignore:
|
ignore:
|
||||||
# Ignore patch updates for all dependencies
|
# Ignore patch updates for all dependencies
|
||||||
|
|||||||
26
.github/workflows/build.yaml
vendored
26
.github/workflows/build.yaml
vendored
@@ -25,8 +25,8 @@ jobs:
|
|||||||
docs: ${{ steps.filter.outputs.docs }}
|
docs: ${{ steps.filter.outputs.docs }}
|
||||||
helm: ${{ steps.filter.outputs.helm }}
|
helm: ${{ steps.filter.outputs.helm }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590 # v3
|
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
|
||||||
id: filter
|
id: filter
|
||||||
with:
|
with:
|
||||||
filters: |
|
filters: |
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
name: Run prettier check
|
name: Run prettier check
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
@@ -72,7 +72,7 @@ jobs:
|
|||||||
needs: changes
|
needs: changes
|
||||||
if: needs.changes.outputs.docs == 'true'
|
if: needs.changes.outputs.docs == 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
needs: changes
|
needs: changes
|
||||||
if: needs.changes.outputs.helm == 'true'
|
if: needs.changes.outputs.helm == 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
|
- uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -103,7 +103,7 @@ jobs:
|
|||||||
needs: changes
|
needs: changes
|
||||||
if: needs.changes.outputs.code == 'true'
|
if: needs.changes.outputs.code == 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
@@ -121,7 +121,7 @@ jobs:
|
|||||||
if: needs.changes.outputs.ci == 'true'
|
if: needs.changes.outputs.ci == 'true'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- name: Check workflow files
|
- name: Check workflow files
|
||||||
run: |
|
run: |
|
||||||
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.9
|
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.9
|
||||||
@@ -134,7 +134,7 @@ jobs:
|
|||||||
needs: changes
|
needs: changes
|
||||||
if: needs.changes.outputs.code == 'true'
|
if: needs.changes.outputs.code == 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
@@ -144,7 +144,7 @@ jobs:
|
|||||||
test/package-lock.json
|
test/package-lock.json
|
||||||
- run: SKIP_SUBMODULE_DEPS=1 npm ci
|
- run: SKIP_SUBMODULE_DEPS=1 npm ci
|
||||||
- run: npm run test:unit
|
- run: npm run test:unit
|
||||||
- uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
|
- uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
|
||||||
if: success()
|
if: success()
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
@@ -163,12 +163,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: sudo apt update && sudo apt install -y libkrb5-dev
|
- run: sudo apt update && sudo apt install -y libkrb5-dev
|
||||||
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest
|
- uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # latest
|
||||||
with:
|
with:
|
||||||
packages: quilt
|
packages: quilt
|
||||||
version: 1.0
|
version: 1.0
|
||||||
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- run: quilt push -a
|
- run: quilt push -a
|
||||||
@@ -219,7 +219,7 @@ jobs:
|
|||||||
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' || needs.changes.outputs.ci == 'true'
|
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' || needs.changes.outputs.ci == 'true'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
@@ -269,7 +269,7 @@ jobs:
|
|||||||
mkdir -p ~/.cache/caddy
|
mkdir -p ~/.cache/caddy
|
||||||
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
|
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
|
||||||
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
|
|||||||
6
.github/workflows/installer.yaml
vendored
6
.github/workflows/installer.yaml
vendored
@@ -30,7 +30,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
|
|
||||||
- name: Install code-server
|
- name: Install code-server
|
||||||
run: ./install.sh
|
run: ./install.sh
|
||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
container: "alpine:3.17"
|
container: "alpine:3.17"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
|
|
||||||
- name: Install curl
|
- name: Install curl
|
||||||
run: apk add curl
|
run: apk add curl
|
||||||
@@ -67,7 +67,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
|
|
||||||
- name: Install code-server
|
- name: Install code-server
|
||||||
run: ./install.sh
|
run: ./install.sh
|
||||||
|
|||||||
26
.github/workflows/publish.yaml
vendored
26
.github/workflows/publish.yaml
vendored
@@ -33,12 +33,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
node-version-file: .node-version
|
||||||
|
|
||||||
- uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
|
- uses: robinraju/release-downloader@28fc21f50d76778e7023361aa1f863e717d3d56f # v1.13
|
||||||
with:
|
with:
|
||||||
repository: "coder/code-server"
|
repository: "coder/code-server"
|
||||||
tag: ${{ env.TAG }}
|
tag: ${{ env.TAG }}
|
||||||
@@ -64,7 +64,7 @@ jobs:
|
|||||||
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Checkout code-server-aur repo
|
- name: Checkout code-server-aur repo
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
with:
|
with:
|
||||||
repository: "cdrci/code-server-aur"
|
repository: "cdrci/code-server-aur"
|
||||||
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
|
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
|
||||||
@@ -93,7 +93,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git checkout -b update-version-${{ env.VERSION }}
|
git checkout -b update-version-${{ env.VERSION }}
|
||||||
git add .
|
git add .
|
||||||
git commit -m "chore: updating version to ${{ env.VERSION }}"
|
git commit -m "Update to ${{ env.VERSION }}"
|
||||||
git push -u origin $(git branch --show)
|
git push -u origin $(git branch --show)
|
||||||
gh pr create --repo coder/code-server-aur --title "chore: bump version to ${{ env.VERSION }}" --body "PR opened by @$GITHUB_ACTOR" --assignee $GITHUB_ACTOR
|
gh pr create --repo coder/code-server-aur --title "chore: bump version to ${{ env.VERSION }}" --body "PR opened by @$GITHUB_ACTOR" --assignee $GITHUB_ACTOR
|
||||||
|
|
||||||
@@ -108,27 +108,27 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
- uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
|
- uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
|
||||||
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
||||||
|
|
||||||
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
|
- uses: robinraju/release-downloader@28fc21f50d76778e7023361aa1f863e717d3d56f # v1.13
|
||||||
with:
|
with:
|
||||||
repository: "coder/code-server"
|
repository: "coder/code-server"
|
||||||
tag: v${{ env.VERSION }}
|
tag: v${{ env.VERSION }}
|
||||||
fileName: "*.deb"
|
fileName: "*.deb"
|
||||||
out-file-path: "release-packages"
|
out-file-path: "release-packages"
|
||||||
- uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
|
- uses: robinraju/release-downloader@28fc21f50d76778e7023361aa1f863e717d3d56f # v1.13
|
||||||
with:
|
with:
|
||||||
repository: "coder/code-server"
|
repository: "coder/code-server"
|
||||||
tag: v${{ env.VERSION }}
|
tag: v${{ env.VERSION }}
|
||||||
@@ -149,7 +149,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
|
|
||||||
- run: ./ci/build/update-repo.sh
|
- run: ./ci/build/update-repo.sh
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ jobs:
|
|||||||
git config --global user.email opensource@coder.com
|
git config --global user.email opensource@coder.com
|
||||||
git checkout -b "helm/$VERSION"
|
git checkout -b "helm/$VERSION"
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Update to $VERSION"
|
git commit -m "Update Helm chart and changelog with $VERSION"
|
||||||
git push -u origin "$(git branch --show)"
|
git push -u origin "$(git branch --show)"
|
||||||
gh pr create \
|
gh pr create \
|
||||||
--repo coder/code-server \
|
--repo coder/code-server \
|
||||||
|
|||||||
29
.github/workflows/release.yaml
vendored
29
.github/workflows/release.yaml
vendored
@@ -39,9 +39,6 @@ jobs:
|
|||||||
- npm_arch: arm64
|
- npm_arch: arm64
|
||||||
vscode_arch: arm64
|
vscode_arch: arm64
|
||||||
package_arch: arm64
|
package_arch: arm64
|
||||||
- npm_arch: arm
|
|
||||||
vscode_arch: armhf
|
|
||||||
package_arch: armv7l
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -62,7 +59,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: sudo apt update && sudo apt install -y libkrb5-dev
|
- run: sudo apt update && sudo apt install -y libkrb5-dev
|
||||||
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest
|
- uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # latest
|
||||||
with:
|
with:
|
||||||
packages: quilt
|
packages: quilt
|
||||||
version: 1.0
|
version: 1.0
|
||||||
@@ -72,12 +69,14 @@ jobs:
|
|||||||
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
|
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Strip update/ and v from tag
|
- name: Strip update/ and v from tag and set major version
|
||||||
run: |
|
run: |
|
||||||
version=${TAG#update/}
|
version=${TAG#update/}
|
||||||
echo "VERSION=${version#v}" >> $GITHUB_ENV
|
version=${version#v}
|
||||||
|
version=4${version:1}
|
||||||
|
echo "VERSION=$version" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- run: quilt push -a
|
- run: quilt push -a
|
||||||
@@ -111,7 +110,7 @@ jobs:
|
|||||||
- run: |
|
- run: |
|
||||||
sed "/^## Unreleased/,/^## / ! d" CHANGELOG.md | head -n -2 | tail -n +3 > .cache/release-notes
|
sed "/^## Unreleased/,/^## / ! d" CHANGELOG.md | head -n -2 | tail -n +3 > .cache/release-notes
|
||||||
if: ${{ matrix.vscode_arch == 'x64' }}
|
if: ${{ matrix.vscode_arch == 'x64' }}
|
||||||
- uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
|
- uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
|
||||||
if: ${{ matrix.vscode_arch == 'x64' }}
|
if: ${{ matrix.vscode_arch == 'x64' }}
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
@@ -124,7 +123,7 @@ jobs:
|
|||||||
# Platform-specific release.
|
# Platform-specific release.
|
||||||
- run: KEEP_MODULES=1 npm run release
|
- run: KEEP_MODULES=1 npm run release
|
||||||
- run: npm run package
|
- run: npm run package
|
||||||
- uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
|
- uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
discussion_category_name: "📣 Announcements"
|
discussion_category_name: "📣 Announcements"
|
||||||
@@ -148,7 +147,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
VSCODE_TARGET: ${{ matrix.vscode_target }}
|
VSCODE_TARGET: ${{ matrix.vscode_target }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
TAG: ${{ inputs.version || github.ref_name }}
|
TAG: ${{ inputs.version || github.event.pull_request.head.ref || github.ref_name }}
|
||||||
# Ensure native modules are built from source to avoid prebuilds.
|
# Ensure native modules are built from source to avoid prebuilds.
|
||||||
npm_config_build_from_source: true
|
npm_config_build_from_source: true
|
||||||
|
|
||||||
@@ -164,12 +163,14 @@ jobs:
|
|||||||
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
|
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Strip update/ and v from tag
|
- name: Strip update/ and v from tag and set major version
|
||||||
run: |
|
run: |
|
||||||
version=${TAG#update/}
|
version=${TAG#update/}
|
||||||
echo "VERSION=${version#v}" >> $GITHUB_ENV
|
version=${version#v}
|
||||||
|
version=4${version:1}
|
||||||
|
echo "VERSION=$version" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- run: quilt push -a
|
- run: quilt push -a
|
||||||
@@ -188,7 +189,7 @@ jobs:
|
|||||||
- run: npm run test:native
|
- run: npm run test:native
|
||||||
|
|
||||||
- run: npm run package
|
- run: npm run package
|
||||||
- uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
|
- uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
discussion_category_name: "📣 Announcements"
|
discussion_category_name: "📣 Announcements"
|
||||||
|
|||||||
4
.github/workflows/scripts.yaml
vendored
4
.github/workflows/scripts.yaml
vendored
@@ -41,7 +41,7 @@ jobs:
|
|||||||
container: "alpine:3.17"
|
container: "alpine:3.17"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
|
|
||||||
- name: Install test utilities
|
- name: Install test utilities
|
||||||
run: apk add bats checkbashisms
|
run: apk add bats checkbashisms
|
||||||
@@ -58,7 +58,7 @@ jobs:
|
|||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
|
|
||||||
- name: Install lint utilities
|
- name: Install lint utilities
|
||||||
run: sudo apt install shellcheck
|
run: sudo apt install shellcheck
|
||||||
|
|||||||
16
.github/workflows/security.yaml
vendored
16
.github/workflows/security.yaml
vendored
@@ -25,7 +25,7 @@ jobs:
|
|||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -46,12 +46,12 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in repo mode
|
- name: Run Trivy vulnerability scanner in repo mode
|
||||||
uses: aquasecurity/trivy-action@97e0b3872f55f89b95b2f65b3dbab56962816478 # latest
|
uses: aquasecurity/trivy-action@314ff8b43182423b84c50b1670b0e10f858f2d98 # latest
|
||||||
with:
|
with:
|
||||||
scan-type: "fs"
|
scan-type: "fs"
|
||||||
scan-ref: "."
|
scan-ref: "."
|
||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
severity: "HIGH,CRITICAL"
|
severity: "HIGH,CRITICAL"
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4
|
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
|
||||||
with:
|
with:
|
||||||
sarif_file: "trivy-repo-results.sarif"
|
sarif_file: "trivy-repo-results.sarif"
|
||||||
|
|
||||||
@@ -76,17 +76,17 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4
|
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
|
||||||
with:
|
with:
|
||||||
config-file: ./.github/codeql-config.yml
|
config-file: ./.github/codeql-config.yml
|
||||||
languages: javascript
|
languages: javascript
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4
|
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4
|
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
|
||||||
|
|||||||
6
.github/workflows/trivy-docker.yaml
vendored
6
.github/workflows/trivy-docker.yaml
vendored
@@ -46,10 +46,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner in image mode
|
- name: Run Trivy vulnerability scanner in image mode
|
||||||
uses: aquasecurity/trivy-action@97e0b3872f55f89b95b2f65b3dbab56962816478 # latest
|
uses: aquasecurity/trivy-action@314ff8b43182423b84c50b1670b0e10f858f2d98 # latest
|
||||||
with:
|
with:
|
||||||
image-ref: "docker.io/codercom/code-server:latest"
|
image-ref: "docker.io/codercom/code-server:latest"
|
||||||
ignore-unfixed: true
|
ignore-unfixed: true
|
||||||
@@ -58,6 +58,6 @@ jobs:
|
|||||||
severity: "HIGH,CRITICAL"
|
severity: "HIGH,CRITICAL"
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4
|
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
|
||||||
with:
|
with:
|
||||||
sarif_file: "trivy-image-results.sarif"
|
sarif_file: "trivy-image-results.sarif"
|
||||||
|
|||||||
4
.github/workflows/update.yaml
vendored
4
.github/workflows/update.yaml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
echo done=false >> $GITHUB_OUTPUT
|
echo done=false >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest
|
- uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # latest
|
||||||
if: steps.check.outputs.done == 'false'
|
if: steps.check.outputs.done == 'false'
|
||||||
with:
|
with:
|
||||||
packages: quilt
|
packages: quilt
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
22.22.1
|
24.15.0
|
||||||
|
|||||||
54
CHANGELOG.md
54
CHANGELOG.md
@@ -22,6 +22,60 @@ Code v99.99.999
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## [4.124.2](https://github.com/coder/code-server/releases/tag/v4.124.2) - 2026-06-16
|
||||||
|
|
||||||
|
Code v1.124.2
|
||||||
|
|
||||||
|
### Security
|
||||||
|
|
||||||
|
- Strip code-server's session token from the cookie before proxying to a local
|
||||||
|
port. Previously, when you used built-in password authentication, the cookie
|
||||||
|
would be sent to the local proxied port, which meant if the service was
|
||||||
|
malicious and not already running as your code-server user it could use the
|
||||||
|
cookie to log into code-server and execute commands as your code-server user.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Update to Code 1.124.2
|
||||||
|
|
||||||
|
## [4.123.0](https://github.com/coder/code-server/releases/tag/v4.123.0) - 2026-06-03
|
||||||
|
|
||||||
|
Code v1.123.0
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Update to Code 1.123.0
|
||||||
|
- Microsoft dropped support for armhf remotes so there will no longer be any
|
||||||
|
builds for armhf.
|
||||||
|
|
||||||
|
## [4.122.1](https://github.com/coder/code-server/releases/tag/v4.122.1) - 2026-06-02
|
||||||
|
|
||||||
|
Code v1.122.1
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Update to Code 1.122.1
|
||||||
|
|
||||||
|
## [4.122.0](https://github.com/coder/code-server/releases/tag/v4.122.0) - 2026-05-29
|
||||||
|
|
||||||
|
Code v1.122.0
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Update to Code 1.122.0
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `--app-name` will now affect window titles within the editor (it is now used
|
||||||
|
as the value for `${appName}` in the title template) as well as some other
|
||||||
|
places like the help > about dialog.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- App name can now be set with the `CODE_SERVER_APP_NAME` environment variable.
|
||||||
|
|
||||||
|
## [4.121.0](https://github.com/coder/code-server/releases/tag/v4.121.0) - 2026-05-20
|
||||||
|
|
||||||
Code v1.121.0
|
Code v1.121.0
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -128,7 +128,9 @@ bundle_vscode() {
|
|||||||
|
|
||||||
# Merge the package.json for the web/remote server so we can include
|
# Merge the package.json for the web/remote server so we can include
|
||||||
# dependencies, since we want to ship this via NPM.
|
# dependencies, since we want to ship this via NPM.
|
||||||
jq --slurp '.[0] * .[1]' \
|
# Also override the name to prevent vulnerability scanners from
|
||||||
|
# misidentifying this package as VS Code (see #7071).
|
||||||
|
jq --slurp '.[0] * .[1] | .name = "code-oss-dev"' \
|
||||||
"$VSCODE_SRC_PATH/remote/package.json" \
|
"$VSCODE_SRC_PATH/remote/package.json" \
|
||||||
"$VSCODE_OUT_PATH/package.json" > "$VSCODE_OUT_PATH/package.json.merged"
|
"$VSCODE_OUT_PATH/package.json" > "$VSCODE_OUT_PATH/package.json.merged"
|
||||||
mv "$VSCODE_OUT_PATH/package.json.merged" "$VSCODE_OUT_PATH/package.json"
|
mv "$VSCODE_OUT_PATH/package.json.merged" "$VSCODE_OUT_PATH/package.json"
|
||||||
|
|||||||
@@ -2,16 +2,65 @@
|
|||||||
|
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
function update_helm() {
|
# Given versions $1 and $2 figure out the first component that is different
|
||||||
local current
|
# (major, minor, patch).
|
||||||
current=$(yq .version ci/helm-chart/Chart.yaml)
|
function find_version_diff() {
|
||||||
local next
|
# shellcheck disable=SC2206
|
||||||
next=$(semver "$current" -i minor)
|
local a=( ${1//./ } )
|
||||||
echo "Bumping version from $current to $next..."
|
# shellcheck disable=SC2206
|
||||||
sed -i.bak "s/^version: $current\$/version: $next/" ci/helm-chart/Chart.yaml
|
local b=( ${2//./ } )
|
||||||
|
|
||||||
echo "Setting app version and image to $version..."
|
if [[ ${a[0]} != "${b[0]}" ]] ; then
|
||||||
|
echo major
|
||||||
|
elif [[ ${a[1]} != "${b[1]}" ]] ; then
|
||||||
|
echo minor
|
||||||
|
else
|
||||||
|
echo patch
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Bump $1 by the bump type (major, minor, patch) in $2.
|
||||||
|
function bump_version() {
|
||||||
|
# shellcheck disable=SC2206
|
||||||
|
local a=( ${1//./ } )
|
||||||
|
case $2 in
|
||||||
|
major)
|
||||||
|
((a[0]++))
|
||||||
|
a[1]=0
|
||||||
|
a[2]=0
|
||||||
|
;;
|
||||||
|
minor)
|
||||||
|
((a[1]++))
|
||||||
|
a[2]=0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
((a[2]++))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo "${a[0]}.${a[1]}.${a[2]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_helm() {
|
||||||
|
local chart_version
|
||||||
|
chart_version=$(yq .version ci/helm-chart/Chart.yaml)
|
||||||
|
local app_version
|
||||||
|
app_version=$(yq .appVersion ci/helm-chart/Chart.yaml)
|
||||||
|
local image_version
|
||||||
|
image_version=$(yq .image.tag ci/helm-chart/values.yaml)
|
||||||
|
|
||||||
|
local bump_type
|
||||||
|
bump_type=$(find_version_diff "$app_version" "$version")
|
||||||
|
local chart_version_bump
|
||||||
|
chart_version_bump=$(bump_version "$chart_version" "$bump_type")
|
||||||
|
|
||||||
|
# Use sed to replace because yq will reformat.
|
||||||
|
echo "Bumping version from $chart_version to $chart_version_bump..."
|
||||||
|
sed -i.bak "s/^version: $chart_version\$/version: $chart_version_bump/" ci/helm-chart/Chart.yaml
|
||||||
|
|
||||||
|
echo "Bumping app version from $app_version to $version..."
|
||||||
sed -i.bak "s/^appVersion: .\+\$/appVersion: $version/" ci/helm-chart/Chart.yaml
|
sed -i.bak "s/^appVersion: .\+\$/appVersion: $version/" ci/helm-chart/Chart.yaml
|
||||||
|
|
||||||
|
echo "Bumping image version from $image_version to $version..."
|
||||||
sed -i.bak "s/^ tag: .\+\$/ tag: '$version'/" ci/helm-chart/values.yaml
|
sed -i.bak "s/^ tag: .\+\$/ tag: '$version'/" ci/helm-chart/values.yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +86,8 @@ function main() {
|
|||||||
"Update changelog" "update_changelog"
|
"Update changelog" "update_changelog"
|
||||||
)
|
)
|
||||||
|
|
||||||
run-steps "${steps[@]}"
|
# Even if a step failed, still output the last checkmark.
|
||||||
|
run-steps "${steps[@]}" || true
|
||||||
|
|
||||||
# This step is always manual.
|
# This step is always manual.
|
||||||
echo "- [ ] https://github.com/coder/code-server-aur/pulls" >> .cache/checklist
|
echo "- [ ] https://github.com/coder/code-server-aur/pulls" >> .cache/checklist
|
||||||
|
|||||||
@@ -146,7 +146,8 @@ function main() {
|
|||||||
"Add changelog note" "add_changelog"
|
"Add changelog note" "add_changelog"
|
||||||
)
|
)
|
||||||
|
|
||||||
run-steps "${steps[@]}"
|
# Even if a step failed, still output the last checkmark.
|
||||||
|
run-steps "${steps[@]}" || true
|
||||||
|
|
||||||
# This step is always manual.
|
# This step is always manual.
|
||||||
echo "- [ ] Verify changelog" >> .cache/checklist
|
echo "- [ ] Verify changelog" >> .cache/checklist
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ type: application
|
|||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 3.35.0
|
version: 3.39.0
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
appVersion: 4.116.0
|
appVersion: 4.124.2
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ replicaCount: 1
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
repository: codercom/code-server
|
repository: codercom/code-server
|
||||||
tag: '4.116.0'
|
tag: '4.124.2'
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
|
|
||||||
# Specifies one or more secrets to be used when pulling images from a
|
# Specifies one or more secrets to be used when pulling images from a
|
||||||
|
|||||||
@@ -101,9 +101,8 @@ _exact_ same commands presented in the rest of this document.
|
|||||||
We recommend installing with `npm` when:
|
We recommend installing with `npm` when:
|
||||||
|
|
||||||
1. You aren't using a machine with `amd64` or `arm64`.
|
1. You aren't using a machine with `amd64` or `arm64`.
|
||||||
2. You are installing code-server on Windows.
|
2. You're on Linux with `glibc` < v2.28 or `glibcxx` < v3.4.21.
|
||||||
3. You're on Linux with `glibc` < v2.28 or `glibcxx` < v3.4.21.
|
3. You're running Alpine Linux or are using a non-glibc libc. See
|
||||||
4. You're running Alpine Linux or are using a non-glibc libc. See
|
|
||||||
[#1430](https://github.com/coder/code-server/issues/1430#issuecomment-629883198)
|
[#1430](https://github.com/coder/code-server/issues/1430#issuecomment-629883198)
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
@@ -296,8 +295,7 @@ You can install code-server using the [Helm package manager](https://coder.com/d
|
|||||||
## Windows
|
## Windows
|
||||||
|
|
||||||
We currently [do not publish Windows
|
We currently [do not publish Windows
|
||||||
releases](https://github.com/coder/code-server/issues/1397). We recommend
|
releases](https://github.com/coder/code-server/issues/1397).
|
||||||
installing code-server onto Windows with [`npm`](#npm).
|
|
||||||
|
|
||||||
## Raspberry Pi
|
## Raspberry Pi
|
||||||
|
|
||||||
|
|||||||
Submodule lib/vscode updated: 987c959751...6928394f91
611
package-lock.json
generated
611
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -59,8 +59,8 @@
|
|||||||
"eslint-import-resolver-typescript": "^4.4.4",
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
"eslint-plugin-import": "^2.28.1",
|
"eslint-plugin-import": "^2.28.1",
|
||||||
"eslint-plugin-prettier": "^5.0.0",
|
"eslint-plugin-prettier": "^5.0.0",
|
||||||
"globals": "^16.1.0",
|
"globals": "^17.6.0",
|
||||||
"prettier": "3.6.2",
|
"prettier": "3.8.3",
|
||||||
"prettier-plugin-sh": "^0.18.0",
|
"prettier-plugin-sh": "^0.18.0",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^5.6.2",
|
"typescript": "^5.6.2",
|
||||||
@@ -70,16 +70,17 @@
|
|||||||
"@coder/logger": "^3.0.1",
|
"@coder/logger": "^3.0.1",
|
||||||
"argon2": "^0.44.0",
|
"argon2": "^0.44.0",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
|
"cookie": "^1.1.1",
|
||||||
"cookie-parser": "^1.4.6",
|
"cookie-parser": "^1.4.6",
|
||||||
"env-paths": "^2.2.1",
|
"env-paths": "^2.2.1",
|
||||||
"express": "^5.0.1",
|
"express": "^5.0.1",
|
||||||
"http-proxy": "^1.18.1",
|
"http-proxy": "^1.18.1",
|
||||||
"httpolyglot": "^0.1.2",
|
"httpolyglot": "^0.1.2",
|
||||||
"i18next": "^25.8.3",
|
"i18next": "^26.3.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"limiter": "^2.1.0",
|
"limiter": "^2.1.0",
|
||||||
"pem": "^1.14.8",
|
"pem": "^1.14.8",
|
||||||
"proxy-agent": "^6.3.1",
|
"proxy-agent": "^8.0.2",
|
||||||
"qs": "^6.15.0",
|
"qs": "^6.15.0",
|
||||||
"rotating-file-stream": "^3.1.1",
|
"rotating-file-stream": "^3.1.1",
|
||||||
"safe-compare": "^1.1.4",
|
"safe-compare": "^1.1.4",
|
||||||
|
|||||||
46
patches/app-name.diff
Normal file
46
patches/app-name.diff
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
Apply --app-name to VS Code web page titles
|
||||||
|
|
||||||
|
VS Code's `${appName}` title variable comes from `productService.nameLong` in the
|
||||||
|
web client. code-server already injects per-request product configuration into
|
||||||
|
VS Code's web bootstrap, so set `nameShort`/`nameLong` from the existing
|
||||||
|
`--app-name` CLI arg there.
|
||||||
|
|
||||||
|
This keeps the patch minimal and makes browser tab titles honor `--app-name`
|
||||||
|
without changing unrelated product metadata.
|
||||||
|
|
||||||
|
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
|
||||||
|
@@ -24,6 +24,7 @@ export const serverOptions: OptionDescri
|
||||||
|
'disable-getting-started-override': { type: 'boolean' },
|
||||||
|
'locale': { type: 'string' },
|
||||||
|
'link-protection-trusted-domains': { type: 'string[]' },
|
||||||
|
+ 'app-name': { type: 'string' },
|
||||||
|
|
||||||
|
/* ----- server setup ----- */
|
||||||
|
|
||||||
|
@@ -124,6 +125,7 @@ export interface ServerParsedArgs {
|
||||||
|
'disable-getting-started-override'?: boolean,
|
||||||
|
'locale'?: string
|
||||||
|
'link-protection-trusted-domains'?: string[],
|
||||||
|
+ 'app-name'?: 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
|
||||||
|
@@ -366,8 +366,11 @@ export class WebClientServer {
|
||||||
|
linkProtectionTrustedDomains.push(...this._productService.linkProtectionTrustedDomains);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ const appName = this._environmentService.args['app-name'];
|
||||||
|
const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
|
||||||
|
codeServerVersion: this._productService.codeServerVersion,
|
||||||
|
+ nameShort: appName,
|
||||||
|
+ nameLong: appName,
|
||||||
|
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,
|
||||||
@@ -263,7 +263,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
|
|||||||
}
|
}
|
||||||
|
|
||||||
private startListening(): void {
|
private startListening(): void {
|
||||||
@@ -584,17 +585,6 @@ class WorkspaceProvider implements IWork
|
@@ -590,17 +591,6 @@ class WorkspaceProvider implements IWork
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
|
|||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
// Find config by checking for DOM
|
// Find config by checking for DOM
|
||||||
@@ -604,8 +594,8 @@ function readCookie(name: string): strin
|
@@ -610,8 +600,8 @@ function readCookie(name: string): strin
|
||||||
if (!configElement || !configElementAttribute) {
|
if (!configElement || !configElementAttribute) {
|
||||||
throw new Error('Missing web configuration element');
|
throw new Error('Missing web configuration element');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ Index: code-server/lib/vscode/build/gulpfile.extensions.ts
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- code-server.orig/lib/vscode/build/gulpfile.extensions.ts
|
--- code-server.orig/lib/vscode/build/gulpfile.extensions.ts
|
||||||
+++ code-server/lib/vscode/build/gulpfile.extensions.ts
|
+++ code-server/lib/vscode/build/gulpfile.extensions.ts
|
||||||
@@ -294,6 +294,29 @@ export const compileCopilotExtensionBuil
|
@@ -291,6 +291,29 @@ export const compileCopilotExtensionBuil
|
||||||
gulp.task(compileCopilotExtensionBuildTask);
|
task.task(compileCopilotExtensionBuildTask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+ * Compiles the built-in copilot extension with proper `.vscodeignore` filtering
|
+ * Compiles the built-in copilot extension with proper `.vscodeignore` filtering
|
||||||
@@ -26,7 +26,7 @@ Index: code-server/lib/vscode/build/gulpfile.extensions.ts
|
|||||||
+ return Promise.resolve();
|
+ return Promise.resolve();
|
||||||
+ })
|
+ })
|
||||||
+));
|
+));
|
||||||
+gulp.task(compileCopilotExtensionFullBuildTask);
|
+task.task(compileCopilotExtensionFullBuildTask);
|
||||||
+
|
+
|
||||||
+/**
|
+/**
|
||||||
* Compiles the extensions for the build.
|
* Compiles the extensions for the build.
|
||||||
@@ -36,15 +36,15 @@ Index: code-server/lib/vscode/build/lib/extensions.ts
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- code-server.orig/lib/vscode/build/lib/extensions.ts
|
--- code-server.orig/lib/vscode/build/lib/extensions.ts
|
||||||
+++ code-server/lib/vscode/build/lib/extensions.ts
|
+++ code-server/lib/vscode/build/lib/extensions.ts
|
||||||
@@ -24,6 +24,7 @@ import { getProductionDependencies } fro
|
@@ -21,6 +21,7 @@ import { getProductionDependencies } fro
|
||||||
import { type IExtensionDefinition, getExtensionStream } from './builtInExtensions.ts';
|
import { type IExtensionDefinition, getExtensionStream } from './builtInExtensions.ts';
|
||||||
import { fetchUrls, fetchGithub } from './fetch.ts';
|
import { fetchUrls, fetchGithub } from './fetch.ts';
|
||||||
import { createTsgoStream, spawnTsgo } from './tsgo.ts';
|
import { createTsgoStream, spawnTsgo } from './tsgo.ts';
|
||||||
+import { prepareBuiltInCopilotRipgrepShim } from './copilot.ts';
|
+import { prepareBuiltInCopilotRipgrepShim } from './copilot.ts';
|
||||||
import vzip from 'gulp-vinyl-zip';
|
import watcher from './watch/index.ts';
|
||||||
|
|
||||||
import { createRequire } from 'module';
|
import { createRequire } from 'module';
|
||||||
@@ -492,6 +493,116 @@ export function packageCopilotExtensionS
|
@@ -483,6 +484,116 @@ export function packageCopilotExtensionS
|
||||||
).pipe(util2.setExecutableBit(['**/*.sh']));
|
).pipe(util2.setExecutableBit(['**/*.sh']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
|
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
|
||||||
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
|
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
|
||||||
@@ -342,6 +342,10 @@ export class Extension implements IExten
|
@@ -345,6 +345,10 @@ export class Extension implements IExten
|
||||||
if (this.type === ExtensionType.System && this.productService.quality === 'stable' && !this.productService.builtInExtensionsEnabledWithAutoUpdates?.some(id => id.toLowerCase() === this.identifier.id.toLowerCase())) {
|
if (this.type === ExtensionType.System && this.productService.quality === 'stable' && !this.productService.builtInExtensionsEnabledWithAutoUpdates?.some(id => id.toLowerCase() === this.identifier.id.toLowerCase())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
|
|||||||
import { ProtocolConstants } from '../../base/parts/ipc/common/ipc.net.js';
|
import { ProtocolConstants } from '../../base/parts/ipc/common/ipc.net.js';
|
||||||
import { IConfigurationService } from '../../platform/configuration/common/configuration.js';
|
import { IConfigurationService } from '../../platform/configuration/common/configuration.js';
|
||||||
import { ConfigurationService } from '../../platform/configuration/common/configurationService.js';
|
import { ConfigurationService } from '../../platform/configuration/common/configurationService.js';
|
||||||
@@ -358,6 +358,9 @@ export async function setupServerService
|
@@ -359,6 +359,9 @@ export async function setupServerService
|
||||||
|
|
||||||
socketServer.registerChannel('mcpManagement', new McpManagementChannel(mcpManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));
|
socketServer.registerChannel('mcpManagement', new McpManagementChannel(mcpManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)));
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
|
|||||||
import type { IURLCallbackProvider } from '../../../workbench/services/url/browser/urlService.js';
|
import type { IURLCallbackProvider } from '../../../workbench/services/url/browser/urlService.js';
|
||||||
import { create } from '../../../workbench/workbench.web.main.internal.js';
|
import { create } from '../../../workbench/workbench.web.main.internal.js';
|
||||||
|
|
||||||
@@ -606,6 +607,39 @@ class WorkspaceProvider implements IWork
|
@@ -612,6 +613,39 @@ class WorkspaceProvider implements IWork
|
||||||
settingsSyncOptions: config.settingsSyncOptions ? { enabled: config.settingsSyncOptions.enabled, } : undefined,
|
settingsSyncOptions: config.settingsSyncOptions ? { enabled: config.settingsSyncOptions.enabled, } : undefined,
|
||||||
workspaceProvider: WorkspaceProvider.create(config),
|
workspaceProvider: WorkspaceProvider.create(config),
|
||||||
urlCallbackProvider: new LocalStorageURLCallbackProvider(config.callbackRoute),
|
urlCallbackProvider: new LocalStorageURLCallbackProvider(config.callbackRoute),
|
||||||
|
|||||||
@@ -23,3 +23,4 @@ display-language.diff
|
|||||||
trusted-domains.diff
|
trusted-domains.diff
|
||||||
signature-verification.diff
|
signature-verification.diff
|
||||||
copilot.diff
|
copilot.diff
|
||||||
|
app-name.diff
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.ts
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- code-server.orig/lib/vscode/build/gulpfile.reh.ts
|
--- code-server.orig/lib/vscode/build/gulpfile.reh.ts
|
||||||
+++ code-server/lib/vscode/build/gulpfile.reh.ts
|
+++ code-server/lib/vscode/build/gulpfile.reh.ts
|
||||||
@@ -261,10 +261,15 @@ function packageTask(type: string, platf
|
@@ -296,10 +296,15 @@ function packageTask(type: string, platf
|
||||||
const destination = path.join(BUILD_ROOT, destinationFolderName);
|
const destination = path.join(BUILD_ROOT, destinationFolderName);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/environment/browser/envi
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- code-server.orig/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts
|
--- code-server.orig/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts
|
||||||
+++ code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts
|
+++ code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts
|
||||||
@@ -223,7 +223,7 @@ export class BrowserWorkbenchEnvironment
|
@@ -226,7 +226,7 @@ export class BrowserWorkbenchEnvironment
|
||||||
|
|
||||||
@memoize
|
@memoize
|
||||||
get webviewExternalEndpoint(): string {
|
get webviewExternalEndpoint(): string {
|
||||||
@@ -70,8 +70,8 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
|
||||||
<meta http-equiv="Content-Security-Policy"
|
<meta http-equiv="Content-Security-Policy"
|
||||||
- content="default-src 'none'; script-src 'sha256-q+WTr+fBXpLLE3++yWNaxT6BTWQtsKscoeIlynBRk4E=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
|
- content="default-src 'none'; script-src 'sha256-nXjtuhBilO++r8hfxl5VjEScSmdm07wDAk6jw228DgM=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
|
||||||
+ content="default-src 'none'; script-src 'sha256-m1DlJtsIJd46QuWYNcsaYIG1xI+9FyjKQu+cfp+zq5Q=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
|
+ content="default-src 'none'; script-src 'sha256-A6/szVNdTzyi4hDa+9OLbzS8tSd2iUV4CqimLNWex2Y=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
|
||||||
|
|
||||||
<!-- Disable pinch zooming -->
|
<!-- Disable pinch zooming -->
|
||||||
<meta name="viewport"
|
<meta name="viewport"
|
||||||
|
|||||||
@@ -677,9 +677,7 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
|
|||||||
}
|
}
|
||||||
args["proxy-domain"] = finalProxies
|
args["proxy-domain"] = finalProxies
|
||||||
|
|
||||||
if (!args["app-name"]) {
|
args["app-name"] ??= process.env.CODE_SERVER_APP_NAME || "code-server"
|
||||||
args["app-name"] = "code-server"
|
|
||||||
}
|
|
||||||
|
|
||||||
args._ = getResolvedPathsFromArgs(args)
|
args._ = getResolvedPathsFromArgs(args)
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ init({
|
|||||||
lowerCaseLng: true,
|
lowerCaseLng: true,
|
||||||
debug: process.env.NODE_ENV === "development",
|
debug: process.env.NODE_ENV === "development",
|
||||||
resources: defaultResources,
|
resources: defaultResources,
|
||||||
showSupportNotice: false,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export default i18next
|
export default i18next
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
import * as cookie from "cookie"
|
||||||
|
import type { Request } from "express"
|
||||||
import proxyServer from "http-proxy"
|
import proxyServer from "http-proxy"
|
||||||
import { HttpCode } from "../common/http"
|
import { getCookieSessionName, HttpCode } from "../common/http"
|
||||||
|
|
||||||
export const proxy = proxyServer.createProxyServer({})
|
export const proxy = proxyServer.createProxyServer({})
|
||||||
|
|
||||||
@@ -18,6 +20,19 @@ proxy.on("error", (error, _, res) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Strip the code-server cookie if it exists to avoid transmitting the cookie
|
||||||
|
// to potentially malicious local ports.
|
||||||
|
proxy.on("proxyReq", (preq, req) => {
|
||||||
|
const cookieSessionName = getCookieSessionName((req as Request).args["cookie-suffix"])
|
||||||
|
preq.setHeader(
|
||||||
|
"Cookie",
|
||||||
|
cookie.stringifyCookie({
|
||||||
|
...(req as Request).cookies,
|
||||||
|
[cookieSessionName]: undefined,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
// Intercept the response to rewrite absolute redirects against the base path.
|
// Intercept the response to rewrite absolute redirects against the base path.
|
||||||
// Is disabled when the request has no base path which means /absproxy is in use.
|
// Is disabled when the request has no base path which means /absproxy is in use.
|
||||||
proxy.on("proxyRes", (res, req) => {
|
proxy.on("proxyRes", (res, req) => {
|
||||||
|
|||||||
9
test/e2e/appName.test.ts
Normal file
9
test/e2e/appName.test.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { version } from "../../src/node/constants"
|
||||||
|
import { describe, test, expect } from "./baseFixture"
|
||||||
|
|
||||||
|
const appName = "testnäme"
|
||||||
|
describe("--app-name", [`--app-name=${appName}`], {}, () => {
|
||||||
|
test("should use app-name for the title", async ({ codeServerPage }) => {
|
||||||
|
expect(await codeServerPage.page.title()).toContain(appName)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -32,7 +32,7 @@ describe("code-server", ["--disable-workspace-trust"], {}, () => {
|
|||||||
|
|
||||||
test("should show the Integrated Terminal", async ({ codeServerPage }) => {
|
test("should show the Integrated Terminal", async ({ codeServerPage }) => {
|
||||||
await codeServerPage.focusTerminal()
|
await codeServerPage.focusTerminal()
|
||||||
expect(await codeServerPage.page.isVisible("#terminal")).toBe(true)
|
await expect(codeServerPage.page.locator("#terminal")).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should open a file", async ({ codeServerPage }) => {
|
test("should open a file", async ({ codeServerPage }) => {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ describe("Downloads (enabled)", ["--disable-workspace-trust"], {}, async () => {
|
|||||||
// Action
|
// Action
|
||||||
await codeServerPage.openContextMenu("text=unique-file.txt")
|
await codeServerPage.openContextMenu("text=unique-file.txt")
|
||||||
|
|
||||||
expect(await codeServerPage.page.isVisible("text=Download...")).toBe(true)
|
await expect(codeServerPage.page.locator("text=Download...")).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should see the 'Show Local' button on Save As", async ({ codeServerPage }) => {
|
test("should see the 'Show Local' button on Save As", async ({ codeServerPage }) => {
|
||||||
@@ -37,7 +37,7 @@ describe("Downloads (enabled)", ["--disable-workspace-trust"], {}, async () => {
|
|||||||
await codeServerPage.page.keyboard.type("Making some edits.")
|
await codeServerPage.page.keyboard.type("Making some edits.")
|
||||||
await codeServerPage.navigateMenus(["File", "Save As..."])
|
await codeServerPage.navigateMenus(["File", "Save As..."])
|
||||||
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
||||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(true)
|
await expect(codeServerPage.page.locator("text=Show Local")).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should see the 'Show Local' button on Save File", async ({ codeServerPage }) => {
|
test("should see the 'Show Local' button on Save File", async ({ codeServerPage }) => {
|
||||||
@@ -46,14 +46,14 @@ describe("Downloads (enabled)", ["--disable-workspace-trust"], {}, async () => {
|
|||||||
await codeServerPage.waitForTab("Untitled-1")
|
await codeServerPage.waitForTab("Untitled-1")
|
||||||
await codeServerPage.navigateMenus(["File", "Save"])
|
await codeServerPage.navigateMenus(["File", "Save"])
|
||||||
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
||||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(true)
|
await expect(codeServerPage.page.locator("text=Show Local")).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should see the 'Show Local' button on Save Workspace As", async ({ codeServerPage }) => {
|
test("should see the 'Show Local' button on Save Workspace As", async ({ codeServerPage }) => {
|
||||||
// Action
|
// Action
|
||||||
await codeServerPage.navigateMenus(["File", "Save Workspace As..."])
|
await codeServerPage.navigateMenus(["File", "Save Workspace As..."])
|
||||||
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
||||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(true)
|
await expect(codeServerPage.page.locator("text=Show Local")).toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ describe("Downloads (disabled)", ["--disable-workspace-trust", "--disable-file-d
|
|||||||
// Action
|
// Action
|
||||||
await codeServerPage.openContextMenu("text=unique-file.txt")
|
await codeServerPage.openContextMenu("text=unique-file.txt")
|
||||||
|
|
||||||
expect(await codeServerPage.page.isVisible("text=Download...")).toBe(false)
|
await expect(codeServerPage.page.locator("text=Download...")).not.toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should not see the 'Show Local' button on Save as", async ({ codeServerPage }) => {
|
test("should not see the 'Show Local' button on Save as", async ({ codeServerPage }) => {
|
||||||
@@ -87,7 +87,7 @@ describe("Downloads (disabled)", ["--disable-workspace-trust", "--disable-file-d
|
|||||||
await codeServerPage.openFile(fileName)
|
await codeServerPage.openFile(fileName)
|
||||||
await codeServerPage.page.click(".tab")
|
await codeServerPage.page.click(".tab")
|
||||||
await codeServerPage.navigateMenus(["File", "Save As..."])
|
await codeServerPage.navigateMenus(["File", "Save As..."])
|
||||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(false)
|
await expect(codeServerPage.page.locator("text=Show Local")).not.toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should not see the 'Show Local' button on Save File", async ({ codeServerPage }) => {
|
test("should not see the 'Show Local' button on Save File", async ({ codeServerPage }) => {
|
||||||
@@ -96,13 +96,13 @@ describe("Downloads (disabled)", ["--disable-workspace-trust", "--disable-file-d
|
|||||||
await codeServerPage.waitForTab("Untitled-1")
|
await codeServerPage.waitForTab("Untitled-1")
|
||||||
await codeServerPage.navigateMenus(["File", "Save"])
|
await codeServerPage.navigateMenus(["File", "Save"])
|
||||||
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
||||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(false)
|
await expect(codeServerPage.page.locator("text=Show Local")).not.toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should not see the 'Show Local' button on Save Workspace As", async ({ codeServerPage }) => {
|
test("should not see the 'Show Local' button on Save Workspace As", async ({ codeServerPage }) => {
|
||||||
// Action
|
// Action
|
||||||
await codeServerPage.navigateMenus(["File", "Save Workspace As..."])
|
await codeServerPage.navigateMenus(["File", "Save Workspace As..."])
|
||||||
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
||||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(false)
|
await expect(codeServerPage.page.locator("text=Show Local")).not.toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function runTestExtensionTests() {
|
|||||||
|
|
||||||
// Remove end slash in address.
|
// Remove end slash in address.
|
||||||
const normalizedAddress = address.replace(/\/+$/, "")
|
const normalizedAddress = address.replace(/\/+$/, "")
|
||||||
await codeServerPage.page.getByText(`Info: proxyUri: ${normalizedAddress}/proxy/{{port}}/`)
|
await expect(codeServerPage.page.getByText(`Info: proxyUri: ${normalizedAddress}/proxy/{{port}}/`)).toBeVisible()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ if (process.env.GITHUB_TOKEN) {
|
|||||||
await codeServerPage.page.click("text=Allow")
|
await codeServerPage.page.click("text=Allow")
|
||||||
// It should ask to select an account, one of which will be the one we
|
// It should ask to select an account, one of which will be the one we
|
||||||
// pre-injected.
|
// pre-injected.
|
||||||
expect(await codeServerPage.page.isVisible("text=Select an account")).toBe(false)
|
await expect(codeServerPage.page.locator("text=Select an account")).not.toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ if (process.env.GITHUB_TOKEN) {
|
|||||||
await codeServerPage.page.click("text=Allow")
|
await codeServerPage.page.click("text=Allow")
|
||||||
// Since there is no account it will ask directly for the token (because
|
// Since there is no account it will ask directly for the token (because
|
||||||
// we are on localhost; otherwise it would initiate the oauth flow).
|
// we are on localhost; otherwise it would initiate the oauth flow).
|
||||||
expect(await codeServerPage.page.isVisible("text=GitHub Personal Access Token")).toBe(false)
|
await expect(codeServerPage.page.locator("text=GitHub Personal Access Token")).not.toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ describe("login", ["--disable-workspace-trust", "--auth", "password"], {}, () =>
|
|||||||
// Skip entering password
|
// Skip entering password
|
||||||
// Click the submit button and login
|
// Click the submit button and login
|
||||||
await codeServerPage.page.click(".submit")
|
await codeServerPage.page.click(".submit")
|
||||||
await codeServerPage.page.waitForLoadState("networkidle")
|
// The required input blocks empty submits, so the server-side error can't render.
|
||||||
expect(await codeServerPage.page.isVisible("text=Missing password"))
|
await expect(codeServerPage.page.locator("input.password:invalid")).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should see an error message for incorrect password", async ({ codeServerPage }) => {
|
test("should see an error message for incorrect password", async ({ codeServerPage }) => {
|
||||||
@@ -34,28 +34,29 @@ describe("login", ["--disable-workspace-trust", "--auth", "password"], {}, () =>
|
|||||||
// Click the submit button and login
|
// Click the submit button and login
|
||||||
await codeServerPage.page.click(".submit")
|
await codeServerPage.page.click(".submit")
|
||||||
await codeServerPage.page.waitForLoadState("networkidle")
|
await codeServerPage.page.waitForLoadState("networkidle")
|
||||||
expect(await codeServerPage.page.isVisible("text=Incorrect password"))
|
await expect(codeServerPage.page.locator("text=Incorrect password")).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should hit the rate limiter for too many unsuccessful logins", async ({ codeServerPage }) => {
|
test("should hit the rate limiter for too many unsuccessful logins", async ({ codeServerPage }) => {
|
||||||
// Type in password
|
test.slow()
|
||||||
await codeServerPage.page.fill(".password", "password123")
|
|
||||||
// Click the submit button and login
|
// Click the submit button and login
|
||||||
// The current RateLimiter allows 2 logins per minute plus
|
// The current RateLimiter allows 2 logins per minute plus
|
||||||
// 12 logins per hour for a total of 14
|
// 12 logins per hour for a total of 14
|
||||||
// See: src/node/routes/login.ts
|
// See: src/node/routes/login.ts
|
||||||
for (let i = 1; i <= 14; i++) {
|
for (let i = 1; i <= 14; i++) {
|
||||||
|
await codeServerPage.page.fill(".password", "password123")
|
||||||
await codeServerPage.page.click(".submit")
|
await codeServerPage.page.click(".submit")
|
||||||
await codeServerPage.page.waitForLoadState("networkidle")
|
await codeServerPage.page.waitForLoadState("networkidle")
|
||||||
// We double-check that the correct error message shows
|
// We double-check that the correct error message shows
|
||||||
// which should be for incorrect password
|
// which should be for incorrect password
|
||||||
expect(await codeServerPage.page.isVisible("text=Incorrect password"))
|
await expect(codeServerPage.page.locator("text=Incorrect password")).toBeVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
// The 15th should fail for a different reason:
|
// The 15th should fail for a different reason:
|
||||||
// login rate
|
// login rate
|
||||||
|
await codeServerPage.page.fill(".password", "password123")
|
||||||
await codeServerPage.page.click(".submit")
|
await codeServerPage.page.click(".submit")
|
||||||
await codeServerPage.page.waitForLoadState("networkidle")
|
await codeServerPage.page.waitForLoadState("networkidle")
|
||||||
expect(await codeServerPage.page.isVisible("text=Login rate limited!"))
|
await expect(codeServerPage.page.locator("text=Login rate limited!")).toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ describe("Uploads (enabled)", ["--disable-workspace-trust"], {}, () => {
|
|||||||
// Action
|
// Action
|
||||||
await codeServerPage.openContextMenu('span:has-text("test-directory")')
|
await codeServerPage.openContextMenu('span:has-text("test-directory")')
|
||||||
|
|
||||||
expect(await codeServerPage.page.isVisible("text=Upload...")).toBe(true)
|
await expect(codeServerPage.page.locator("text=Upload...")).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should see the 'Show Local' button on Open File", async ({ codeServerPage }) => {
|
test("should see the 'Show Local' button on Open File", async ({ codeServerPage }) => {
|
||||||
// Action
|
// Action
|
||||||
await codeServerPage.navigateMenus(["File", "Open File..."])
|
await codeServerPage.navigateMenus(["File", "Open File..."])
|
||||||
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
||||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(true)
|
await expect(codeServerPage.page.locator("text=Show Local")).toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -44,13 +44,13 @@ describe("Uploads (disabled)", ["--disable-workspace-trust", "--disable-file-upl
|
|||||||
// Action
|
// Action
|
||||||
await codeServerPage.openContextMenu('span:has-text("test-directory")')
|
await codeServerPage.openContextMenu('span:has-text("test-directory")')
|
||||||
|
|
||||||
expect(await codeServerPage.page.isVisible("text=Upload...")).toBe(false)
|
await expect(codeServerPage.page.locator("text=Upload...")).not.toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should not see the 'Show Local' button on Open File", async ({ codeServerPage }) => {
|
test("should not see the 'Show Local' button on Open File", async ({ codeServerPage }) => {
|
||||||
// Action
|
// Action
|
||||||
await codeServerPage.navigateMenus(["File", "Open File..."])
|
await codeServerPage.navigateMenus(["File", "Open File..."])
|
||||||
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
||||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(false)
|
await expect(codeServerPage.page.locator("text=Show Local")).not.toBeVisible()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
97
test/package-lock.json
generated
97
test/package-lock.json
generated
@@ -7,7 +7,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest-mock/express": "^1.4.5",
|
"@jest-mock/express": "^1.4.5",
|
||||||
"@playwright/test": "^1.56.1",
|
"@playwright/test": "^1.61.0",
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
"@types/jsdom": "^16.2.13",
|
"@types/jsdom": "^16.2.13",
|
||||||
"@types/node-fetch": "^2.5.8",
|
"@types/node-fetch": "^2.5.8",
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"jest-fetch-mock": "^3.0.3",
|
"jest-fetch-mock": "^3.0.3",
|
||||||
"jsdom": "^16.4.0",
|
"jsdom": "^16.4.0",
|
||||||
"node-fetch": "^2.6.7",
|
"node-fetch": "^2.6.7",
|
||||||
"playwright": "^1.59.1",
|
"playwright": "^1.61.0",
|
||||||
"ts-jest": "^27.0.7",
|
"ts-jest": "^27.0.7",
|
||||||
"wtfnode": "^0.9.1"
|
"wtfnode": "^0.9.1"
|
||||||
}
|
}
|
||||||
@@ -998,13 +998,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@playwright/test": {
|
"node_modules/@playwright/test": {
|
||||||
"version": "1.56.1",
|
"version": "1.61.0",
|
||||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.1.tgz",
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.61.0.tgz",
|
||||||
"integrity": "sha512-vSMYtL/zOcFpvJCW71Q/OEGQb7KYBPAdKh35WNSkaZA75JlAO8ED8UN6GUNTm3drWomcbcqRPFqQbLae8yBTdg==",
|
"integrity": "sha512-cKA5B6lpFEMyMGjxF54QihfYpB4FkEGH+qZhtArDEG+wezQAJY8Pq6C7T1SjWz+FFzt3TbyoXBQYk/0292TdJA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"playwright": "1.56.1"
|
"playwright": "1.61.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
@@ -1013,53 +1013,6 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@playwright/test/node_modules/fsevents": {
|
|
||||||
"version": "2.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
|
||||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
|
||||||
"dev": true,
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@playwright/test/node_modules/playwright": {
|
|
||||||
"version": "1.56.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz",
|
|
||||||
"integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"playwright-core": "1.56.1"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"playwright": "cli.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
|
||||||
"fsevents": "2.3.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@playwright/test/node_modules/playwright-core": {
|
|
||||||
"version": "1.56.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz",
|
|
||||||
"integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"bin": {
|
|
||||||
"playwright-core": "cli.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@sinonjs/commons": {
|
"node_modules/@sinonjs/commons": {
|
||||||
"version": "1.8.6",
|
"version": "1.8.6",
|
||||||
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz",
|
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz",
|
||||||
@@ -2336,17 +2289,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/form-data": {
|
"node_modules/form-data": {
|
||||||
"version": "4.0.4",
|
"version": "4.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz",
|
||||||
"integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
|
"integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"asynckit": "^0.4.0",
|
"asynckit": "^0.4.0",
|
||||||
"combined-stream": "^1.0.8",
|
"combined-stream": "^1.0.8",
|
||||||
"es-set-tostringtag": "^2.1.0",
|
"es-set-tostringtag": "^2.1.0",
|
||||||
"hasown": "^2.0.2",
|
"hasown": "^2.0.4",
|
||||||
"mime-types": "^2.1.12"
|
"mime-types": "^2.1.35"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
@@ -2561,9 +2514,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/hasown": {
|
"node_modules/hasown": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -3602,16 +3555,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/jsdom/node_modules/form-data": {
|
"node_modules/jsdom/node_modules/form-data": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.5.tgz",
|
||||||
"integrity": "sha512-f0cRzm6dkyVYV3nPoooP8XlccPQukegwhAnpoLcXy+X+A8KfpGOoXwDr9FLZd3wzgLaBGQBE3lY93Zm/i1JvIQ==",
|
"integrity": "sha512-j23EibVLnp4zNXGW7LjryXYa2X6U/M96yoOX+ybZxwkYajdxRNEqYY3zhh7y0i6kfISKS2jr+EJq1YTUDEv5+w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"asynckit": "^0.4.0",
|
"asynckit": "^0.4.0",
|
||||||
"combined-stream": "^1.0.8",
|
"combined-stream": "^1.0.8",
|
||||||
"es-set-tostringtag": "^2.1.0",
|
"es-set-tostringtag": "^2.1.0",
|
||||||
"hasown": "^2.0.2",
|
"hasown": "^2.0.4",
|
||||||
"mime-types": "^2.1.35"
|
"mime-types": "^2.1.35"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -4114,13 +4067,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/playwright": {
|
"node_modules/playwright": {
|
||||||
"version": "1.59.1",
|
"version": "1.61.0",
|
||||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.59.1.tgz",
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.61.0.tgz",
|
||||||
"integrity": "sha512-C8oWjPR3F81yljW9o5OxcWzfh6avkVwDD2VYdwIGqTkl+OGFISgypqzfu7dOe4QNLL2aqcWBmI3PMtLIK233lw==",
|
"integrity": "sha512-Z+7BeeqQPRRzklHsVFP4KTGIyMxKUmfeRA4WisM6G3/XW6nwGeX6fX9qYaDa+CiUqpOkb2f6X3nar05R3kSuJQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"playwright-core": "1.59.1"
|
"playwright-core": "1.61.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
@@ -4133,9 +4086,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/playwright-core": {
|
"node_modules/playwright-core": {
|
||||||
"version": "1.59.1",
|
"version": "1.61.0",
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.59.1.tgz",
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.61.0.tgz",
|
||||||
"integrity": "sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==",
|
"integrity": "sha512-caX7TrY3Ml6egyDX0WUcTHDxodl/b51y5wJOdCEA36QviK/s2g081hvmGs8eaE3DWb6NYZQ6BjO/QkNRPenoPA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"#": "We must put jest in a sub-directory otherwise VS Code somehow picks up the types and generates conflicts with mocha.",
|
"#": "We must put jest in a sub-directory otherwise VS Code somehow picks up the types and generates conflicts with mocha.",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest-mock/express": "^1.4.5",
|
"@jest-mock/express": "^1.4.5",
|
||||||
"@playwright/test": "^1.56.1",
|
"@playwright/test": "^1.61.0",
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
"@types/jsdom": "^16.2.13",
|
"@types/jsdom": "^16.2.13",
|
||||||
"@types/node-fetch": "^2.5.8",
|
"@types/node-fetch": "^2.5.8",
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"jest-fetch-mock": "^3.0.3",
|
"jest-fetch-mock": "^3.0.3",
|
||||||
"jsdom": "^16.4.0",
|
"jsdom": "^16.4.0",
|
||||||
"node-fetch": "^2.6.7",
|
"node-fetch": "^2.6.7",
|
||||||
"playwright": "^1.59.1",
|
"playwright": "^1.61.0",
|
||||||
"ts-jest": "^27.0.7",
|
"ts-jest": "^27.0.7",
|
||||||
"wtfnode": "^0.9.1"
|
"wtfnode": "^0.9.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import path from "path"
|
|||||||
// The default configuration runs all tests in three browsers with workers equal
|
// The default configuration runs all tests in three browsers with workers equal
|
||||||
// to half the available threads. See 'npm run test:e2e --help' to customize
|
// to half the available threads. See 'npm run test:e2e --help' to customize
|
||||||
// from the command line. For example:
|
// from the command line. For example:
|
||||||
// npm run test:e2e --workers 1 # Run with one worker
|
// npm run test:e2e -- --workers 1 # Run with one worker
|
||||||
// npm run test:e2e --project Chromium # Only run on Chromium
|
// npm run test:e2e -- --project Chromium # Only run on Chromium
|
||||||
// npm run test:e2e --grep login # Run tests matching "login"
|
// npm run test:e2e -- --grep login # Run tests matching "login"
|
||||||
// PWDEBUG=1 npm run test:e2e # Run Playwright inspector
|
// PWDEBUG=1 npm run test:e2e # Run Playwright inspector
|
||||||
const config: PlaywrightTestConfig = {
|
const config: PlaywrightTestConfig = {
|
||||||
testDir: path.join(__dirname, "e2e"), // Search for tests in this directory.
|
testDir: path.join(__dirname, "e2e"), // Search for tests in this directory.
|
||||||
timeout: 60000, // Each test is given 60 seconds.
|
timeout: 60000, // Each test is given 60 seconds.
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { logger } from "@coder/logger"
|
import { logger } from "@coder/logger"
|
||||||
import { readFile, writeFile, stat, utimes } from "fs/promises"
|
import { readFile, writeFile, stat, utimes } from "fs/promises"
|
||||||
|
import { setImmediate } from "timers"
|
||||||
import { Heart } from "../../../src/node/heart"
|
import { Heart } from "../../../src/node/heart"
|
||||||
import { clean, mockLogger, tmpdir } from "../../utils/helpers"
|
import { clean, mockLogger, tmpdir } from "../../utils/helpers"
|
||||||
|
|
||||||
const mockIsActive = (resolveTo: boolean) => jest.fn().mockResolvedValue(resolveTo)
|
|
||||||
|
|
||||||
describe("Heart", () => {
|
describe("Heart", () => {
|
||||||
const testName = "heartTests"
|
const testName = "heartTests"
|
||||||
let testDir = ""
|
let testDir = ""
|
||||||
@@ -15,12 +14,15 @@ describe("Heart", () => {
|
|||||||
await clean(testName)
|
await clean(testName)
|
||||||
testDir = await tmpdir(testName)
|
testDir = await tmpdir(testName)
|
||||||
})
|
})
|
||||||
beforeEach(() => {
|
|
||||||
heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive(true))
|
|
||||||
})
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
jest.restoreAllMocks()
|
jest.restoreAllMocks()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
heart = new Heart(`${testDir}/shutdown.txt`, jest.fn().mockResolvedValue(true))
|
||||||
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
jest.resetAllMocks()
|
jest.resetAllMocks()
|
||||||
jest.useRealTimers()
|
jest.useRealTimers()
|
||||||
@@ -28,6 +30,7 @@ describe("Heart", () => {
|
|||||||
heart.dispose()
|
heart.dispose()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should write to a file when given a valid file path", async () => {
|
it("should write to a file when given a valid file path", async () => {
|
||||||
// Set up heartbeat file with contents
|
// Set up heartbeat file with contents
|
||||||
const text = "test"
|
const text = "test"
|
||||||
@@ -42,7 +45,7 @@ describe("Heart", () => {
|
|||||||
|
|
||||||
expect(fileContents).toBe(text)
|
expect(fileContents).toBe(text)
|
||||||
|
|
||||||
heart = new Heart(pathToFile, mockIsActive(true))
|
heart = new Heart(pathToFile, jest.fn().mockResolvedValue(true))
|
||||||
await heart.beat()
|
await heart.beat()
|
||||||
// Check that the heart wrote to the heartbeatFilePath and overwrote our text
|
// Check that the heart wrote to the heartbeatFilePath and overwrote our text
|
||||||
const fileContentsAfterBeat = await readFile(pathToFile, { encoding: "utf8" })
|
const fileContentsAfterBeat = await readFile(pathToFile, { encoding: "utf8" })
|
||||||
@@ -51,31 +54,30 @@ describe("Heart", () => {
|
|||||||
const fileStatusAfterEdit = await stat(pathToFile)
|
const fileStatusAfterEdit = await stat(pathToFile)
|
||||||
expect(fileStatusAfterEdit.mtimeMs).toBeGreaterThan(0)
|
expect(fileStatusAfterEdit.mtimeMs).toBeGreaterThan(0)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should log a warning when given an invalid file path", async () => {
|
it("should log a warning when given an invalid file path", async () => {
|
||||||
heart = new Heart(`fakeDir/fake.txt`, mockIsActive(false))
|
heart = new Heart(`fakeDir/fake.txt`, jest.fn().mockResolvedValue(false))
|
||||||
await heart.beat()
|
await heart.beat()
|
||||||
expect(logger.warn).toHaveBeenCalled()
|
expect(logger.warn).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should be active after calling beat", async () => {
|
it("should be active after calling beat", async () => {
|
||||||
await heart.beat()
|
await heart.beat()
|
||||||
|
|
||||||
const isAlive = heart.alive()
|
const isAlive = heart.alive()
|
||||||
expect(isAlive).toBe(true)
|
expect(isAlive).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should not be active after dispose is called", () => {
|
it("should not be active after dispose is called", () => {
|
||||||
heart.dispose()
|
heart.dispose()
|
||||||
|
|
||||||
const isAlive = heart.alive()
|
const isAlive = heart.alive()
|
||||||
expect(isAlive).toBe(false)
|
expect(isAlive).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should beat twice without warnings", async () => {
|
it("should beat twice without warnings", async () => {
|
||||||
// Use fake timers so we can speed up setTimeout
|
heart = new Heart(`${testDir}/hello.txt`, jest.fn().mockResolvedValue(true))
|
||||||
jest.useFakeTimers()
|
|
||||||
heart = new Heart(`${testDir}/hello.txt`, mockIsActive(true))
|
|
||||||
await heart.beat()
|
await heart.beat()
|
||||||
// we need to speed up clocks, timeouts
|
|
||||||
// call heartbeat again (and it won't be alive I think)
|
|
||||||
// then assert no warnings were called
|
|
||||||
jest.runAllTimers()
|
jest.runAllTimers()
|
||||||
expect(logger.warn).not.toHaveBeenCalled()
|
expect(logger.warn).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
@@ -84,40 +86,48 @@ describe("Heart", () => {
|
|||||||
describe("heartbeatTimer", () => {
|
describe("heartbeatTimer", () => {
|
||||||
const testName = "heartbeatTimer"
|
const testName = "heartbeatTimer"
|
||||||
let testDir = ""
|
let testDir = ""
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await clean(testName)
|
await clean(testName)
|
||||||
testDir = await tmpdir(testName)
|
testDir = await tmpdir(testName)
|
||||||
mockLogger()
|
mockLogger()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
jest.restoreAllMocks()
|
jest.restoreAllMocks()
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.useFakeTimers()
|
jest.useFakeTimers()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
jest.resetAllMocks()
|
jest.resetAllMocks()
|
||||||
jest.clearAllTimers()
|
jest.clearAllTimers()
|
||||||
jest.useRealTimers()
|
jest.useRealTimers()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should call isActive when timeout expires", async () => {
|
it("should call isActive when timeout expires", async () => {
|
||||||
const isActive = true
|
const mockIsActive = jest.fn().mockResolvedValue(true)
|
||||||
const mockIsActive = jest.fn().mockResolvedValue(isActive)
|
|
||||||
const heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive)
|
const heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive)
|
||||||
await heart.beat()
|
await heart.beat()
|
||||||
jest.advanceTimersByTime(60 * 1000)
|
jest.advanceTimersByTime(60 * 1000)
|
||||||
expect(mockIsActive).toHaveBeenCalled()
|
expect(mockIsActive).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should log a warning when isActive rejects", async () => {
|
it("should log a warning when isActive rejects", async () => {
|
||||||
const errorMsg = "oh no"
|
const error = new Error("oh no")
|
||||||
const error = new Error(errorMsg)
|
|
||||||
const mockIsActive = jest.fn().mockRejectedValue(error)
|
const mockIsActive = jest.fn().mockRejectedValue(error)
|
||||||
const heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive)
|
const heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive)
|
||||||
await heart.beat()
|
await heart.beat()
|
||||||
jest.advanceTimersByTime(60 * 1000)
|
jest.advanceTimersByTime(60 * 1000)
|
||||||
|
|
||||||
expect(mockIsActive).toHaveBeenCalled()
|
expect(mockIsActive).toHaveBeenCalled()
|
||||||
expect(logger.warn).toHaveBeenCalledWith(errorMsg)
|
|
||||||
|
// The timer callback waits on mockIsActive, so we need to yield to let the
|
||||||
|
// callback finish.
|
||||||
|
await new Promise((resolve) => setImmediate(resolve))
|
||||||
|
|
||||||
|
expect(logger.warn).toHaveBeenCalledWith(error.message)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -125,38 +135,54 @@ describe("stateChange", () => {
|
|||||||
const testName = "stateChange"
|
const testName = "stateChange"
|
||||||
let testDir = ""
|
let testDir = ""
|
||||||
let heart: Heart
|
let heart: Heart
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await clean(testName)
|
await clean(testName)
|
||||||
testDir = await tmpdir(testName)
|
testDir = await tmpdir(testName)
|
||||||
mockLogger()
|
mockLogger()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
jest.restoreAllMocks()
|
jest.restoreAllMocks()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
jest.resetAllMocks()
|
jest.resetAllMocks()
|
||||||
|
jest.useRealTimers()
|
||||||
if (heart) {
|
if (heart) {
|
||||||
heart.dispose()
|
heart.dispose()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should change to alive after a beat", async () => {
|
it("should change to alive after a beat", async () => {
|
||||||
heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive(true))
|
const mockIsActive = jest.fn().mockResolvedValue(true)
|
||||||
|
heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive)
|
||||||
const mockOnChange = jest.fn()
|
const mockOnChange = jest.fn()
|
||||||
heart.onChange(mockOnChange)
|
heart.onChange(mockOnChange)
|
||||||
|
|
||||||
await heart.beat()
|
await heart.beat()
|
||||||
|
|
||||||
expect(mockOnChange.mock.calls[0][0]).toBe("alive")
|
expect(mockOnChange.mock.calls[0][0]).toBe("alive")
|
||||||
})
|
})
|
||||||
it.only("should change to expired when not active", async () => {
|
|
||||||
jest.useFakeTimers()
|
it("should change to expired when not active", async () => {
|
||||||
heart = new Heart(`${testDir}/shutdown.txt`, () => new Promise((resolve) => resolve(false)))
|
const mockIsActive = jest.fn().mockResolvedValue(false)
|
||||||
|
heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive)
|
||||||
const mockOnChange = jest.fn()
|
const mockOnChange = jest.fn()
|
||||||
heart.onChange(mockOnChange)
|
heart.onChange(mockOnChange)
|
||||||
await heart.beat()
|
|
||||||
|
|
||||||
await jest.advanceTimersByTime(60 * 1000)
|
await heart.beat()
|
||||||
|
jest.advanceTimersByTime(60 * 1000)
|
||||||
|
expect(mockIsActive).toHaveBeenCalled()
|
||||||
|
|
||||||
|
// The timer callback waits on the isActive promise, so we need to yield to
|
||||||
|
// let the callback finish.
|
||||||
|
await new Promise((resolve) => setImmediate(resolve))
|
||||||
|
|
||||||
expect(mockOnChange.mock.calls[1][0]).toBe("expired")
|
expect(mockOnChange.mock.calls[1][0]).toBe("expired")
|
||||||
jest.clearAllTimers()
|
|
||||||
jest.useRealTimers()
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
import * as express from "express"
|
import * as express from "express"
|
||||||
import * as http from "http"
|
|
||||||
import nodeFetch from "node-fetch"
|
|
||||||
import { HttpCode } from "../../../src/common/http"
|
import { HttpCode } from "../../../src/common/http"
|
||||||
import { proxy } from "../../../src/node/proxy"
|
|
||||||
import { wss, Router as WsRouter } from "../../../src/node/wsRouter"
|
import { wss, Router as WsRouter } from "../../../src/node/wsRouter"
|
||||||
import { getAvailablePort, mockLogger } from "../../utils/helpers"
|
import { mockLogger } from "../../utils/helpers"
|
||||||
import * as httpserver from "../../utils/httpserver"
|
import * as httpserver from "../../utils/httpserver"
|
||||||
import * as integration from "../../utils/integration"
|
import * as integration from "../../utils/integration"
|
||||||
|
|
||||||
describe("proxy", () => {
|
describe("proxy", () => {
|
||||||
const nhooyrDevServer = new httpserver.HttpServer()
|
const proxyTarget = new httpserver.HttpServer()
|
||||||
const wsApp = express.default()
|
const wsApp = express.default()
|
||||||
const wsRouter = WsRouter()
|
const wsRouter = WsRouter()
|
||||||
let codeServer: httpserver.HttpServer | undefined
|
let codeServer: httpserver.HttpServer | undefined
|
||||||
@@ -19,21 +16,22 @@ describe("proxy", () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
wsApp.use("/", wsRouter.router)
|
wsApp.use("/", wsRouter.router)
|
||||||
await nhooyrDevServer.listen((req, res) => {
|
await proxyTarget.listen((req, res) => {
|
||||||
e(req, res)
|
e(req, res)
|
||||||
})
|
})
|
||||||
nhooyrDevServer.listenUpgrade(wsApp)
|
proxyTarget.listenUpgrade(wsApp)
|
||||||
proxyPath = `/proxy/${nhooyrDevServer.port()}/wsup`
|
proxyPath = `/proxy/${proxyTarget.port()}/wsup`
|
||||||
absProxyPath = proxyPath.replace("/proxy/", "/absproxy/")
|
absProxyPath = proxyPath.replace("/proxy/", "/absproxy/")
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await nhooyrDevServer.dispose()
|
await proxyTarget.dispose()
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
e = express.default()
|
e = express.default()
|
||||||
mockLogger()
|
mockLogger()
|
||||||
|
delete process.env.PASSWORD
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
@@ -283,65 +281,42 @@ describe("proxy", () => {
|
|||||||
const resp = await codeServer.fetch(proxyPath, { method: "OPTIONS" })
|
const resp = await codeServer.fetch(proxyPath, { method: "OPTIONS" })
|
||||||
expect(resp.status).toBe(200)
|
expect(resp.status).toBe(200)
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
// NOTE@jsjoeio
|
it("should return a 500 when no target is running ", async () => {
|
||||||
// Both this test suite and the one above it are very similar
|
const target = new httpserver.HttpServer()
|
||||||
// The main difference is this one uses http and node-fetch
|
await target.listen(() => {})
|
||||||
// and specifically tests the proxy in isolation vs. using
|
const port = target.port()
|
||||||
// the httpserver abstraction we've built.
|
target.dispose()
|
||||||
//
|
codeServer = await integration.setup(["--auth=none"], "")
|
||||||
// Leaving this as a separate test suite for now because
|
const resp = await codeServer.fetch(`/proxy/${port}/wsup`)
|
||||||
// we may consider refactoring the httpserver abstraction
|
expect(resp.status).toBe(HttpCode.ServerError)
|
||||||
// in the future.
|
expect(resp.statusText).toBe("Internal Server Error")
|
||||||
//
|
})
|
||||||
// If you're writing a test specifically for code in
|
|
||||||
// src/node/proxy.ts, you should probably add it to
|
|
||||||
// this test suite.
|
|
||||||
describe("proxy (standalone)", () => {
|
|
||||||
let URL = ""
|
|
||||||
let PROXY_URL = ""
|
|
||||||
let testServer: http.Server
|
|
||||||
let proxyTarget: http.Server
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
it("should strip token cookie", async () => {
|
||||||
const PORT = await getAvailablePort()
|
const token = "my-super-secure-token"
|
||||||
const PROXY_PORT = await getAvailablePort()
|
process.env.HASHED_PASSWORD = token
|
||||||
URL = `http://localhost:${PORT}`
|
codeServer = await integration.setup(["--auth=password"])
|
||||||
PROXY_URL = `http://localhost:${PROXY_PORT}`
|
|
||||||
// Define server and a proxy server
|
// Set up a listener that just prints the cookies it got.
|
||||||
testServer = http.createServer((req, res) => {
|
e.get("/wsup/cookies", (req, res) => {
|
||||||
proxy.web(req, res, {
|
res.writeHead(HttpCode.Ok, { "Content-Type": "text/plain" })
|
||||||
target: PROXY_URL,
|
res.end(req.headers.cookie)
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
proxyTarget = http.createServer((req, res) => {
|
// Send the token along with other cookies which should be preserved.
|
||||||
res.writeHead(200, { "Content-Type": "text/plain" })
|
// Encode one to make sure they are being re-encoded properly.
|
||||||
res.end()
|
const value = "hello=there"
|
||||||
|
const encodedValue = encodeURIComponent(value)
|
||||||
|
const resp = await codeServer.fetch(proxyPath + "/cookies", {
|
||||||
|
headers: {
|
||||||
|
cookie: `cookie1=${encodedValue}; code-server-session=${token}; cookie2=hello;`,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Start both servers
|
// The proxied listener should not have printed the code-server token.
|
||||||
proxyTarget.listen(PROXY_PORT)
|
|
||||||
testServer.listen(PORT)
|
|
||||||
})
|
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
testServer.close()
|
|
||||||
proxyTarget.close()
|
|
||||||
})
|
|
||||||
|
|
||||||
it("should return a 500 when proxy target errors ", async () => {
|
|
||||||
// Close the proxy target so that proxy errors
|
|
||||||
proxyTarget.close()
|
|
||||||
const errorResp = await nodeFetch(`${URL}/error`)
|
|
||||||
expect(errorResp.status).toBe(HttpCode.ServerError)
|
|
||||||
expect(errorResp.statusText).toBe("Internal Server Error")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("should proxy correctly", async () => {
|
|
||||||
const resp = await nodeFetch(`${URL}/route`)
|
|
||||||
expect(resp.status).toBe(200)
|
expect(resp.status).toBe(200)
|
||||||
expect(resp.statusText).toBe("OK")
|
const text = await resp.text()
|
||||||
|
expect(text).toBe(`cookie1=${encodedValue}; cookie2=hello`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user