Merge branch 'main' into master

This commit is contained in:
Meng Jun 2022-05-24 09:57:30 +08:00 committed by GitHub
commit 003f57ca2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
88 changed files with 1481 additions and 810 deletions

View File

@ -57,7 +57,7 @@ body:
id: logs id: logs
attributes: attributes:
label: Logs label: Logs
description: Run code-server with the --verbose flag and then paste any relevant logs from the server, from the browser console and/or the browser network tab. For issues with installation, include installation logs (i.e. output of `npm install -g code-server`). description: Run code-server with the --verbose flag and then paste any relevant logs from the server, from the browser console and/or the browser network tab. For issues with installation, include installation logs (i.e. output of `yarn global add code-server`).
- type: textarea - type: textarea
attributes: attributes:
label: Screenshot/Video label: Screenshot/Video

View File

@ -33,13 +33,13 @@ jobs:
fetch-depth: 0 fetch-depth: 0
submodules: true submodules: true
- name: Install Node.js v14 - name: Install Node.js v16
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "14" node-version: "16"
- name: Install helm - name: Install helm
uses: azure/setup-helm@v1.1 uses: azure/setup-helm@v2.1
- name: Fetch dependencies from cache - name: Fetch dependencies from cache
id: cache-yarn id: cache-yarn
@ -74,10 +74,10 @@ jobs:
fetch-depth: 0 fetch-depth: 0
submodules: true submodules: true
- name: Install Node.js v14 - name: Install Node.js v16
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "14" node-version: "16"
- name: Fetch dependencies from cache - name: Fetch dependencies from cache
id: cache-yarn id: cache-yarn
@ -116,10 +116,10 @@ jobs:
- name: Patch Code - name: Patch Code
run: quilt push -a run: quilt push -a
- name: Install Node.js v14 - name: Install Node.js v16
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "14" node-version: "16"
- name: Fetch dependencies from cache - name: Fetch dependencies from cache
id: cache-yarn id: cache-yarn
@ -217,6 +217,26 @@ jobs:
# Instead, itis determined in publish-npm.sh script # Instead, itis determined in publish-npm.sh script
# using GITHUB environment variables # using GITHUB environment variables
- name: Comment npm information
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ github.token }}
header: npm-dev-build
message: |
✨ code-server dev build published to npm for PR #${{ github.event.number }}!
* _Last publish status_: success
* _Commit_: ${{ github.event.pull_request.head.sha }}
To install in a local project, run:
```shell-session
npm install @coder/code-server-pr@${{ github.event.number }}
```
To install globally, run:
```shell-session
npm install -g @coder/code-server-pr@${{ github.event.number }}
```
# TODO: cache building yarn --production # TODO: cache building yarn --production
# possibly 2m30s of savings(?) # possibly 2m30s of savings(?)
# this requires refactoring our release scripts # this requires refactoring our release scripts
@ -233,20 +253,21 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install Node.js v14 - name: Install Node.js v16
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "14" node-version: "16"
- name: Install development tools - name: Install development tools
run: | run: |
yum install -y epel-release centos-release-scl yum install -y epel-release centos-release-scl
yum install -y devtoolset-9-{make,gcc,gcc-c++} jq rsync yum install -y devtoolset-9-{make,gcc,gcc-c++} jq rsync python3
- name: Install nfpm and envsubst - name: Install nfpm and envsubst
run: | run: |
curl -sfL https://install.goreleaser.com/github.com/goreleaser/nfpm.sh | sh -s -- -b ~/.local/bin v2.3.1 mkdir -p ~/.local/bin
curl -L https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m` -o envsubst 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/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m` -o envsubst
chmod +x envsubst chmod +x envsubst
mv envsubst ~/.local/bin mv envsubst ~/.local/bin
echo "$HOME/.local/bin" >> $GITHUB_PATH echo "$HOME/.local/bin" >> $GITHUB_PATH
@ -317,7 +338,7 @@ jobs:
CXX: ${{ format('{0}-g++', matrix.prefix) }} CXX: ${{ format('{0}-g++', matrix.prefix) }}
LINK: ${{ format('{0}-g++', matrix.prefix) }} LINK: ${{ format('{0}-g++', matrix.prefix) }}
NPM_CONFIG_ARCH: ${{ matrix.arch }} NPM_CONFIG_ARCH: ${{ matrix.arch }}
NODE_VERSION: v14.17.4 NODE_VERSION: v16.13.0
steps: steps:
- name: Checkout repo - name: Checkout repo
@ -325,14 +346,15 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install Node.js v14 - name: Install Node.js v16
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "14" node-version: "16"
- name: Install nfpm - name: Install nfpm
run: | run: |
curl -sfL https://install.goreleaser.com/github.com/goreleaser/nfpm.sh | sh -s -- -b ~/.local/bin v2.3.1 mkdir -p ~/.local/bin
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: Install cross-compiler - name: Install cross-compiler
@ -377,14 +399,15 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install Node.js v14 - name: Install Node.js v16
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "14" node-version: "16"
- name: Install nfpm - name: Install nfpm
run: | run: |
curl -sfL https://install.goreleaser.com/github.com/goreleaser/nfpm.sh | sh -s -- -b ~/.local/bin v2.3.1 mkdir -p ~/.local/bin
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: Download npm package - name: Download npm package
@ -426,10 +449,10 @@ jobs:
fetch-depth: 0 fetch-depth: 0
submodules: true submodules: true
- name: Install Node.js v14 - name: Install Node.js v16
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "14" node-version: "16"
- name: Fetch dependencies from cache - name: Fetch dependencies from cache
id: cache-yarn id: cache-yarn
@ -475,6 +498,9 @@ jobs:
run: rm -rf ./release-packages ./test/test-results run: rm -rf ./release-packages ./test/test-results
trivy-scan-repo: trivy-scan-repo:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout repo - name: Checkout repo
@ -483,7 +509,7 @@ jobs:
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@296212627a1e693efa09c00adc3e03b2ba8edf18 uses: aquasecurity/trivy-action@4b9b6fb4ef28b31450391a93ade098bb00de584e
with: with:
scan-type: "fs" scan-type: "fs"
scan-ref: "." scan-ref: "."
@ -494,6 +520,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@v1 uses: github/codeql-action/upload-sarif@v2
with: with:
sarif_file: "trivy-repo-results.sarif" sarif_file: "trivy-repo-results.sarif"

View File

@ -17,8 +17,15 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }} cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs: jobs:
analyze: analyze:
permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/autobuild to send a status report
name: Analyze name: Analyze
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -28,13 +35,13 @@ jobs:
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v1 uses: github/codeql-action/init@v2
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@v1 uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1 uses: github/codeql-action/analyze@v2

View File

@ -24,32 +24,37 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version - name: Get version
id: version id: version
run: echo "::set-output name=version::$(jq -r .version package.json)" run: echo "::set-output name=version::$(jq -r .version package.json)"
- name: Download artifact - name: Download release artifacts
uses: dawidd6/action-download-artifact@v2 uses: robinraju/release-downloader@v1.3
id: download
with: with:
branch: v${{ steps.version.outputs.version }} repository: "coder/code-server"
workflow: ci.yaml tag: v${{ steps.version.outputs.version }}
workflow_conclusion: completed fileName: "*"
name: "release-packages" out-file-path: "release-packages"
path: release-packages
- name: Run ./ci/steps/docker-buildx-push.sh - name: Publish to Docker
run: ./ci/steps/docker-buildx-push.sh run: yarn publish:docker
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}

View File

@ -30,7 +30,11 @@ jobs:
- name: Comment Credentials - name: Comment Credentials
uses: marocchino/sticky-pull-request-comment@v2 uses: marocchino/sticky-pull-request-comment@v2
# Only run if PR comes from base repo
# Reason: forks cannot access secrets and this will always fail
if: github.event.pull_request.head.repo.full_name == github.repository
with: with:
GITHUB_TOKEN: ${{ github.token }}
header: codercom-preview-docs header: codercom-preview-docs
message: | message: |
✨ code-server docs for PR #${{ github.event.number }} is ready! It will be updated on every commit. ✨ code-server docs for PR #${{ github.event.number }} is ready! It will be updated on every commit.

View File

@ -19,6 +19,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }} cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs: jobs:
ubuntu: ubuntu:
name: Test installer on Ubuntu name: Test installer on Ubuntu

View File

@ -60,8 +60,8 @@ jobs:
- name: Configure git - name: Configure git
run: | run: |
git config user.name cdrci git config --global user.name cdrci
git config user.email opensource@coder.com git config --global user.email opensource@coder.com
- name: Bump code-server homebrew version - name: Bump code-server homebrew version
env: env:

View File

@ -51,7 +51,7 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Run Trivy vulnerability scanner in image mode - name: Run Trivy vulnerability scanner in image mode
uses: aquasecurity/trivy-action@296212627a1e693efa09c00adc3e03b2ba8edf18 uses: aquasecurity/trivy-action@4b9b6fb4ef28b31450391a93ade098bb00de584e
with: with:
image-ref: "docker.io/codercom/code-server:latest" image-ref: "docker.io/codercom/code-server:latest"
ignore-unfixed: true ignore-unfixed: true
@ -60,6 +60,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@v1 uses: github/codeql-action/upload-sarif@v2
with: with:
sarif_file: "trivy-image-results.sarif" sarif_file: "trivy-image-results.sarif"

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ test/test-results
# Quilt's internal data. # Quilt's internal data.
/.pc /.pc
/patches/*.diff~

View File

@ -1 +1 @@
14 16

View File

@ -50,7 +50,7 @@
{ {
"file": "src/node/heart.ts", "file": "src/node/heart.ts",
"line": 7, "line": 7,
"description": "code-server's heart beats to indicate recent activity.\n\nAlso documented here: [https://github.com/coder/code-server/blob/master/docs/FAQ.md#heartbeat-file](https://github.com/coder/code-server/blob/master/docs/FAQ.md#heartbeat-file)" "description": "code-server's heart beats to indicate recent activity.\n\nAlso documented here: [https://github.com/coder/code-server/blob/main/docs/FAQ.md#heartbeat-file](https://github.com/coder/code-server/blob/main/docs/FAQ.md#heartbeat-file)"
}, },
{ {
"file": "src/node/socket.ts", "file": "src/node/socket.ts",
@ -80,12 +80,12 @@
{ {
"file": "src/node/routes/domainProxy.ts", "file": "src/node/routes/domainProxy.ts",
"line": 18, "line": 18,
"description": "code-server provides a built-in proxy to help in developing web-based applications. This is the code for the domain-based proxy.\n\nAlso documented here: [https://github.com/coder/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/coder/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services)" "description": "code-server provides a built-in proxy to help in developing web-based applications. This is the code for the domain-based proxy.\n\nAlso documented here: [https://github.com/coder/code-server/blob/main/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/coder/code-server/blob/main/docs/FAQ.md#how-do-i-securely-access-web-services)"
}, },
{ {
"file": "src/node/routes/pathProxy.ts", "file": "src/node/routes/pathProxy.ts",
"line": 19, "line": 19,
"description": "Here is the path-based version of the proxy.\n\nAlso documented here: [https://github.com/coder/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/coder/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services)" "description": "Here is the path-based version of the proxy.\n\nAlso documented here: [https://github.com/coder/code-server/blob/main/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/coder/code-server/blob/main/docs/FAQ.md#how-do-i-securely-access-web-services)"
}, },
{ {
"file": "src/node/proxy.ts", "file": "src/node/proxy.ts",
@ -95,7 +95,7 @@
{ {
"file": "src/node/routes/health.ts", "file": "src/node/routes/health.ts",
"line": 5, "line": 5,
"description": "A simple endpoint that lets you see if code-server is up.\n\nAlso documented here: [https://github.com/coder/code-server/blob/master/docs/FAQ.md#healthz-endpoint](https://github.com/coder/code-server/blob/master/docs/FAQ.md#healthz-endpoint)" "description": "A simple endpoint that lets you see if code-server is up.\n\nAlso documented here: [https://github.com/coder/code-server/blob/main/docs/FAQ.md#healthz-endpoint](https://github.com/coder/code-server/blob/main/docs/FAQ.md#healthz-endpoint)"
}, },
{ {
"file": "src/node/routes/login.ts", "file": "src/node/routes/login.ts",
@ -145,7 +145,7 @@
{ {
"directory": "lib/vscode", "directory": "lib/vscode",
"line": 1, "line": 1,
"description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible." "description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible."
} }
] ]
} }

View File

@ -5,7 +5,7 @@
{ {
"file": "package.json", "file": "package.json",
"line": 31, "line": 31,
"description": "## Commands\n\nTo start developing, make sure you have Node 14+ and the [required dependencies](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites) installed. Then, run the following commands:\n\n1. Install dependencies:\n>> yarn\n\n3. Start development mode (and watch for changes):\n>> yarn watch" "description": "## Commands\n\nTo start developing, make sure you have Node 16+ and the [required dependencies](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites) installed. Then, run the following commands:\n\n1. Install dependencies:\n>> yarn\n\n3. Start development mode (and watch for changes):\n>> yarn watch"
}, },
{ {
"file": "src/node/app.ts", "file": "src/node/app.ts",
@ -20,7 +20,7 @@
{ {
"file": "src/node/app.ts", "file": "src/node/app.ts",
"line": 62, "line": 62,
"description": "## That's it!\n\n\nThat's all there is to it! When this tour ends, your terminal session may stop, but just use `yarn watch` to start developing from here on out!\n\n\nIf you haven't already, be sure to check out these resources:\n- [Tour: Contributing](command:codetour.startTourByTitle?[\"Contributing\")\n- [Docs: FAQ.md](https://github.com/coder/code-server/blob/master/docs/FAQ.md)\n- [Docs: CONTRIBUTING.md](https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md)\n- [Community: GitHub Discussions](https://github.com/coder/code-server/discussions)\n- [Community: Slack](https://community.coder.com)" "description": "## That's it!\n\n\nThat's all there is to it! When this tour ends, your terminal session may stop, but just use `yarn watch` to start developing from here on out!\n\n\nIf you haven't already, be sure to check out these resources:\n- [Tour: Contributing](command:codetour.startTourByTitle?[\"Contributing\"])\n- [Docs: FAQ.md](https://github.com/coder/code-server/blob/main/docs/FAQ.md)\n- [Docs: CONTRIBUTING.md](https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md)\n- [Community: GitHub Discussions](https://github.com/coder/code-server/discussions)\n- [Community: Slack](https://community.coder.com)"
} }
] ]
} }

View File

@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [9.99.999] - 9090-09-09 ## [9.99.999] - 9090-09-09
VS Code v99.99.999 Code v99.99.999
### Changed ### Changed
### Added ### Added
@ -20,6 +20,57 @@ VS Code v99.99.999
--> -->
## [4.4.0](https://github.com/coder/code-server/releases/tag/v4.4.0) - 2022-05-06
Code v1.66.2
### Changed
- Refactored methods in `Heart` class and made `Heart.beat()` async to make
testing easier.
- Upgraded to Code 1.66.2.
### Added
- Added back telemetry patch which was removed in the Code reachitecture.
- Added support to use `true` for `CS_DISABLE_FILE_DOWNLOADS` environment
variable. This means you can disable file downloads by setting
`CS_DISABLE_FILE_DOWNLOADS` to `true` or `1`.
- Added tests for `Heart` class.
### Fixed
- Fixed installation issue in AUR after LICENSE rename.
- Fixed issue with listening on IPv6 addresses.
- Fixed issue with Docker publish action not being able to find artifacts. Now
it downloads the release assets from the release.
## [4.3.0](https://github.com/coder/code-server/releases/tag/v4.3.0) - 2022-04-14
Code v1.65.2
### Changed
- Excluded .deb files from release Docker image which drops the compressed and
uncompressed size by 58% and 34%.
- Upgraded to Code 1.65.2.
### Added
- Added a new CLI flag called `--disable-file-downloads` which allows you to
disable the "Download..." option that shows in the UI when right-clicking on a
file. This can also set by running `CS_DISABLE_FILE_DOWNLOADS=1`.
- Aligned the dependencies for binary and npm release artifacts.
### Fixed
- Fixed the code-server version from not displaying in the Help > About dialog.
- Fixed issues with the TypeScript and JavaScript Language Features Extension
failing to activate.
- Fixed missing files in ipynb extension.
- Fixed the homebrew release workflow.
- Fixed the Docker release workflow from not always publishing version tags.
## [4.2.0](https://github.com/coder/code-server/releases/tag/v4.2.0) - 2022-03-22 ## [4.2.0](https://github.com/coder/code-server/releases/tag/v4.2.0) - 2022-03-22
Code v1.64.2 Code v1.64.2

View File

@ -24,7 +24,7 @@ main() {
bundle_vscode bundle_vscode
rsync ./docs/README.md "$RELEASE_PATH" rsync ./docs/README.md "$RELEASE_PATH"
rsync LICENSE.txt "$RELEASE_PATH" rsync LICENSE "$RELEASE_PATH"
rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH" rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH"
} }
@ -78,11 +78,25 @@ EOF
bundle_vscode() { bundle_vscode() {
mkdir -p "$VSCODE_OUT_PATH" mkdir -p "$VSCODE_OUT_PATH"
# - Some extensions have a .gitignore which excludes their built source from local rsync_opts=()
# the npm package so exclude any .gitignore files. if [[ ${DEBUG-} = 1 ]]; then
# - Exclude Node as we will add it ourselves for the standalone and will not rsync_opts+=(-vh)
fi
# Some extensions have a .gitignore which excludes their built source from the
# npm package so exclude any .gitignore files.
rsync_opts+=(--exclude .gitignore)
# Exclude Node as we will add it ourselves for the standalone and will not
# need it for the npm package. # need it for the npm package.
rsync -avh --exclude .gitignore --exclude /node ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH" rsync_opts+=(--exclude /node)
# Exclude Node modules.
if [[ $KEEP_MODULES = 0 ]]; then
rsync_opts+=(--exclude node_modules)
fi
rsync "${rsync_opts[@]}" ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH"
# Add the commit, date, our name, links, and enable telemetry. This just makes # Add the commit, date, our name, links, and enable telemetry. This just makes
# telemetry available; telemetry can still be disabled by flag or setting. # telemetry available; telemetry can still be disabled by flag or setting.
@ -99,7 +113,7 @@ bundle_vscode() {
"applicationName": "code-server", "applicationName": "code-server",
"dataFolderName": ".code-server", "dataFolderName": ".code-server",
"win32MutexName": "codeserver", "win32MutexName": "codeserver",
"licenseUrl": "https://github.com/coder/code-server/blob/main/LICENSE.txt", "licenseUrl": "https://github.com/coder/code-server/blob/main/LICENSE",
"win32DirName": "code-server", "win32DirName": "code-server",
"win32NameVersion": "code-server", "win32NameVersion": "code-server",
"win32AppUserModelId": "coder.code-server", "win32AppUserModelId": "coder.code-server",
@ -122,19 +136,17 @@ EOF
) > "$VSCODE_OUT_PATH/product.json" ) > "$VSCODE_OUT_PATH/product.json"
# Use the package.json for the web/remote server. It does not have the right # Use the package.json for the web/remote server. It does not have the right
# version though so pull that from the main package.json. Also remove keytar # version though so pull that from the main package.json.
# since the web does not rely on it and that removes the dependency on jq --slurp '.[0] * {version: .[1].version}' \
# libsecret.
jq --slurp '.[0] * {version: .[1].version} | del(.dependencies.keytar)' \
"$VSCODE_SRC_PATH/remote/package.json" \ "$VSCODE_SRC_PATH/remote/package.json" \
"$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json" "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
rsync "$VSCODE_SRC_PATH/remote/yarn.lock" "$VSCODE_OUT_PATH/yarn.lock" rsync "$VSCODE_SRC_PATH/remote/yarn.lock" "$VSCODE_OUT_PATH/yarn.lock"
if [ "$KEEP_MODULES" = 0 ]; then # Include global extension dependencies as well.
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules" rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json"
rm -Rf "$VSCODE_OUT_PATH/node_modules" rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions/yarn.lock"
fi rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs"
pushd "$VSCODE_OUT_PATH" pushd "$VSCODE_OUT_PATH"
symlink_asar symlink_asar

View File

@ -33,8 +33,8 @@ main() {
echo "USE AT YOUR OWN RISK!" echo "USE AT YOUR OWN RISK!"
fi fi
if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-14}" ]; then if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-16}" ]; then
echo "ERROR: code-server currently requires node v14." echo "ERROR: code-server currently requires node v16."
if [ -n "$FORCE_NODE_VERSION" ]; then if [ -n "$FORCE_NODE_VERSION" ]; then
echo "However, you have overrided the version check to use v$FORCE_NODE_VERSION." echo "However, you have overrided the version check to use v$FORCE_NODE_VERSION."
fi fi
@ -68,7 +68,7 @@ main() {
if ! vscode_yarn; then if ! vscode_yarn; then
echo "You may not have the required dependencies to build the native modules." echo "You may not have the required dependencies to build the native modules."
echo "Please see https://github.com/coder/code-server/blob/master/docs/npm.md" echo "Please see https://github.com/coder/code-server/blob/main/docs/npm.md"
exit 1 exit 1
fi fi
@ -92,20 +92,12 @@ symlink_asar() {
vscode_yarn() { vscode_yarn() {
echo 'Installing Code dependencies...' echo 'Installing Code dependencies...'
cd lib/vscode cd lib/vscode
yarn --production --frozen-lockfile yarn --production --frozen-lockfile --no-default-rc
symlink_asar symlink_asar
cd extensions cd extensions
yarn --production --frozen-lockfile yarn --production --frozen-lockfile
for ext in */; do
ext="${ext%/}"
echo "extensions/$ext: installing dependencies"
cd "$ext"
yarn --production --frozen-lockfile
cd "$OLDPWD"
done
} }
main "$@" main "$@"

View File

@ -81,7 +81,7 @@ main() {
read -r -p "What version of code-server do you want to update to?"$'\n' CODE_SERVER_VERSION_TO_UPDATE read -r -p "What version of code-server do you want to update to?"$'\n' CODE_SERVER_VERSION_TO_UPDATE
echo -e "Great! We'll prep a PR for updating to $CODE_SERVER_VERSION_TO_UPDATE\n" echo -e "Great! We'll prep a PR for updating to $CODE_SERVER_VERSION_TO_UPDATE\n"
$CMD rg -g '!yarn.lock' -g '!*.svg' -g '!CHANGELOG.md' --files-with-matches --fixed-strings "${CODE_SERVER_CURRENT_VERSION}" | $CMD xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE" $CMD rg -g '!yarn.lock' -g '!*.svg' -g '!CHANGELOG.md' -g '!lib/vscode/**' --files-with-matches --fixed-strings "${CODE_SERVER_CURRENT_VERSION}" | $CMD xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE"
$CMD git commit --no-verify -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE" $CMD git commit --no-verify -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"

View File

@ -7,6 +7,9 @@ install-deps() {
if [[ ${CI-} ]]; then if [[ ${CI-} ]]; then
args+=(--frozen-lockfile) args+=(--frozen-lockfile)
fi fi
if [[ "$1" == "lib/vscode" ]]; then
args+=(--no-default-rc)
fi
# If there is no package.json then yarn will look upward and end up installing # If there is no package.json then yarn will look upward and end up installing
# from the root resulting in an infinite loop (this can happen if you have not # from the root resulting in an infinite loop (this can happen if you have not
# checked out the submodule yet for example). # checked out the submodule yet for example).

View File

@ -15,9 +15,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.3.0 version: 2.5.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.2.0 appVersion: 4.4.0

View File

@ -6,7 +6,7 @@ replicaCount: 1
image: image:
repository: codercom/code-server repository: codercom/code-server
tag: '4.2.0' tag: '4.4.0'
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
@ -70,6 +70,8 @@ extraArgs: []
extraVars: [] extraVars: []
# - name: DISABLE_TELEMETRY # - name: DISABLE_TELEMETRY
# value: true # value: true
# - name: DOCKER_HOST
# value: "tcp://localhost:2375"
## ##
## Init containers parameters: ## Init containers parameters:
@ -126,6 +128,7 @@ persistence:
## Enable an Specify container in extraContainers. ## Enable an Specify container in extraContainers.
## This is meant to allow adding code-server dependencies, like docker-dind. ## This is meant to allow adding code-server dependencies, like docker-dind.
extraContainers: | extraContainers: |
# If docker-dind is used, DOCKER_HOST env is mandatory to set in "extraVars"
#- name: docker-dind #- name: docker-dind
# image: docker:19.03-dind # image: docker:19.03-dind
# imagePullPolicy: IfNotPresent # imagePullPolicy: IfNotPresent

View File

@ -1,3 +1,8 @@
# syntax=docker/dockerfile:experimental
FROM scratch AS packages
COPY release-packages/code-server*.deb /tmp/
FROM debian:11 FROM debian:11
RUN apt-get update \ RUN apt-get update \
@ -34,9 +39,12 @@ RUN ARCH="$(dpkg --print-architecture)" && \
mkdir -p /etc/fixuid && \ mkdir -p /etc/fixuid && \
printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml
COPY release-packages/code-server*.deb /tmp/
COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh
RUN dpkg -i /tmp/code-server*$(dpkg --print-architecture).deb && rm /tmp/code-server*.deb RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb
# Allow users to have scripts run on container startup to prepare workspace.
# https://github.com/coder/code-server/issues/5177
ENV ENTRYPOINTD=${HOME}/entrypoint.d
EXPOSE 8080 EXPOSE 8080
# This way, if someone sets $DOCKER_USER, docker-exec will still work as # This way, if someone sets $DOCKER_USER, docker-exec will still work as

View File

@ -15,6 +15,8 @@ target "code-server" {
tags = [ tags = [
"docker.io/codercom/code-server:latest", "docker.io/codercom/code-server:latest",
notequal("latest",VERSION) ? "docker.io/codercom/code-server:${VERSION}" : "", notequal("latest",VERSION) ? "docker.io/codercom/code-server:${VERSION}" : "",
"ghcr.io/coder/code-server:latest",
notequal("latest",VERSION) ? "ghcr.io/coder/code-server:${VERSION}" : "",
] ]
platforms = ["linux/amd64", "linux/arm64"] platforms = ["linux/amd64", "linux/arm64"]
} }

View File

@ -18,4 +18,10 @@ if [ "${DOCKER_USER-}" ]; then
fi fi
fi fi
# Allow users to have scripts run on container startup to prepare workspace.
# https://github.com/coder/code-server/issues/5177
if [ -d "${ENTRYPOINTD}" ]; then
find "${ENTRYPOINTD}" -type f -executable -print -exec {} \;
fi
exec dumb-init /usr/bin/code-server "$@" exec dumb-init /usr/bin/code-server "$@"

View File

@ -59,11 +59,11 @@ main() {
# This string is used to determine how we should tag the npm release. # This string is used to determine how we should tag the npm release.
# Environment can be one of three choices: # Environment can be one of three choices:
# "development" - this means we tag with the PR number, allowing # "development" - this means we tag with the PR number, allowing
# a developer to install this version with `npm install code-server@<pr-number>` # a developer to install this version with `yarn add code-server@<pr-number>`
# "staging" - this means we tag with `beta`, allowing # "staging" - this means we tag with `beta`, allowing
# a developer to install this version with `npm install code-server@beta` # a developer to install this version with `yarn add code-server@beta`
# "production" - this means we tag with `latest` (default), allowing # "production" - this means we tag with `latest` (default), allowing
# a developer to install this version with `npm install code-server@latest` # a developer to install this version with `yarn add code-server@latest`
if ! is_env_var_set "NPM_ENVIRONMENT"; then if ! is_env_var_set "NPM_ENVIRONMENT"; then
echo "NPM_ENVIRONMENT is not set. Determining in script based on GITHUB environment variables." echo "NPM_ENVIRONMENT is not set. Determining in script based on GITHUB environment variables."
@ -96,7 +96,7 @@ main() {
if [[ "$NPM_ENVIRONMENT" == "production" ]]; then if [[ "$NPM_ENVIRONMENT" == "production" ]]; then
NPM_VERSION="$VERSION" NPM_VERSION="$VERSION"
# This means the npm version will be published as "stable" # This means the npm version will be published as "stable"
# and installed when a user runs `npm install code-server` # and installed when a user runs `yarn install code-server`
NPM_TAG="latest" NPM_TAG="latest"
else else
COMMIT_SHA="$GITHUB_SHA" COMMIT_SHA="$GITHUB_SHA"
@ -107,7 +107,7 @@ main() {
if [[ "$NPM_ENVIRONMENT" == "staging" ]]; then if [[ "$NPM_ENVIRONMENT" == "staging" ]]; then
NPM_VERSION="$VERSION-beta-$COMMIT_SHA" NPM_VERSION="$VERSION-beta-$COMMIT_SHA"
# This means the npm version will be tagged with "beta" # This means the npm version will be tagged with "beta"
# and installed when a user runs `npm install code-server@beta` # and installed when a user runs `yarn install code-server@beta`
NPM_TAG="beta" NPM_TAG="beta"
fi fi
@ -117,7 +117,7 @@ main() {
NPM_VERSION="$VERSION-$PR_NUMBER-$COMMIT_SHA" NPM_VERSION="$VERSION-$PR_NUMBER-$COMMIT_SHA"
PACKAGE_NAME="@coder/code-server-pr" PACKAGE_NAME="@coder/code-server-pr"
# This means the npm version will be tagged with "<pr number>" # This means the npm version will be tagged with "<pr number>"
# and installed when a user runs `npm install code-server@<pr number>` # and installed when a user runs `yarn install code-server@<pr number>`
NPM_TAG="$PR_NUMBER" NPM_TAG="$PR_NUMBER"
fi fi
@ -137,7 +137,10 @@ main() {
# Use the development package name # Use the development package name
# This is so we don't clutter the code-server versions on npm # This is so we don't clutter the code-server versions on npm
# with development versions. # with development versions.
jq ".name |= \"$PACKAGE_NAME\"" package.json # jq can't edit in place so we must store in memory and echo
local contents
contents="$(jq ".name |= \"$PACKAGE_NAME\"" package.json)"
echo "${contents}" > package.json
popd popd
fi fi

View File

@ -31,7 +31,7 @@ for [VS
Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites). Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
Here is what is needed: Here is what is needed:
- `node` v14.x - `node` v16.x
- `git` v2.x or greater - `git` v2.x or greater
- [`git-lfs`](https://git-lfs.github.com) - [`git-lfs`](https://git-lfs.github.com)
- [`yarn`](https://classic.yarnpkg.com/en/) - [`yarn`](https://classic.yarnpkg.com/en/)
@ -96,10 +96,12 @@ re-apply the patches.
### Version updates to Code ### Version updates to Code
1. Update the `lib/vscode` submodule to the desired upstream version branch. 1. Update the `lib/vscode` submodule to the desired upstream version branch.
2. From the code-server **project root**, run `yarn install`. 1. `cd lib/vscode && git checkout release/1.66 && cd ../..`
3. Apply the patches (`quilt push -a`) or restore your stashed changes. At this 2. `git add lib && git commit -m "chore: update Code"`
2. Apply the patches (`quilt push -a`) or restore your stashed changes. At this
stage you may need to resolve conflicts. For example use `quilt push -f`, stage you may need to resolve conflicts. For example use `quilt push -f`,
manually apply the rejected portions, then `quilt refresh`. manually apply the rejected portions, then `quilt refresh`.
3. From the code-server **project root**, run `yarn install`.
4. Test code-server locally to make sure everything works. 4. Test code-server locally to make sure everything works.
5. Check the Node.js version that's used by Electron (which is shipped with VS 5. Check the Node.js version that's used by Electron (which is shipped with VS
Code. If necessary, update your version of Node.js to match. Code. If necessary, update your version of Node.js to match.
@ -130,11 +132,13 @@ yarn build:vscode
yarn release yarn release
``` ```
_NOTE: this does not keep `node_modules`. If you want them to be kept, use `KEEP_MODULES=1 yarn release` (if you're testing in Coder, you'll want to do this)_
Run your build: Run your build:
```shell ```shell
cd release cd release
yarn --production yarn --production # Skip if you used KEEP_MODULES=1
# Runs the built JavaScript with Node. # Runs the built JavaScript with Node.
node . node .
``` ```

View File

@ -19,7 +19,7 @@
- [Docker](#docker) - [Docker](#docker)
- [Homebrew](#homebrew) - [Homebrew](#homebrew)
- [npm](#npm) - [npm](#npm)
- [Syncing with Upstream VS Code](#syncing-with-upstream-vs-code) - [Syncing with upstream Code](#syncing-with-upstream-code)
- [Testing](#testing) - [Testing](#testing)
- [Documentation](#documentation) - [Documentation](#documentation)
- [Troubleshooting](#troubleshooting) - [Troubleshooting](#troubleshooting)
@ -164,7 +164,7 @@ If you're the current release manager, follow these steps:
### Publishing a release ### Publishing a release
1. Create a new branch called `v0.0.0` (replace 0s with actual version aka v4.2.0) 1. Create a new branch called `v0.0.0` (replace 0s with actual version aka v4.4.0)
1. Run `yarn release:prep` and type in the new version (e.g., `3.8.1`) 1. Run `yarn release:prep` and type in the new version (e.g., `3.8.1`)
1. GitHub Actions will generate the `npm-package`, `release-packages` and 1. GitHub Actions will generate the `npm-package`, `release-packages` and
`release-images` artifacts. You do not have to wait for this step to complete `release-images` artifacts. You do not have to wait for this step to complete
@ -214,18 +214,9 @@ We publish code-server as a npm package [here](https://www.npmjs.com/package/cod
This is currently automated with the release process. This is currently automated with the release process.
## Syncing with Upstream VS Code ## Syncing with upstream Code
The VS Code portion of code-server lives under [`coder/vscode`](https://github.com/coder/vscode). To update VS Code for code-server, follow these steps: Refer to the [contributing docs](https://coder.com/docs/code-server/latest/CONTRIBUTING#version-updates-to-code) for information on how to update Code within code-server.
1. `git checkout -b vscode-update` - Create a new branch locally based off `main`
2. `git fetch upstream` - Fetch upstream (VS Code)'s latest branches
3. `git merge upstream/release/1.64` - Merge it locally
1. replace `1.64` with the version you're upgrading to
1. If there are merge conflicts, commit first, then fix them locally.
4. Open a PR merging your branch (`vscode-update`) into `main` and add the code-server review team
Ideally, our fork stays as close to upstream as possible. See the differences between our fork and upstream [here](https://github.com/microsoft/vscode/compare/main...coder:main).
## Testing ## Testing

View File

@ -1,6 +1,6 @@
# code-server # code-server
[!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.com/community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) [![codecov](https://codecov.io/gh/coder/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/coder/code-server) [![See v4.2.0 docs](https://img.shields.io/static/v1?label=Docs&message=see%20v4.2.0%20&color=blue)](https://github.com/coder/code-server/tree/v4.2.0/docs) [!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.com/community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) [![codecov](https://codecov.io/gh/coder/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/coder/code-server) [![See latest](https://img.shields.io/static/v1?label=Docs&message=see%20latest&color=blue)](https://coder.com/docs/code-server/latest)
Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and
access it in the browser. access it in the browser.

View File

@ -3,7 +3,7 @@
1. Install UserLAnd from [Google Play](https://play.google.com/store/apps/details?id=tech.ula&hl=en_US&gl=US) 1. Install UserLAnd from [Google Play](https://play.google.com/store/apps/details?id=tech.ula&hl=en_US&gl=US)
2. Install an Ubuntu VM 2. Install an Ubuntu VM
3. Start app 3. Start app
4. Install Node.js, `curl` and `npm` using `sudo apt install nodejs npm curl -y` 4. Install Node.js, `curl` and `yarn` using `sudo apt install nodejs npm yarn curl -y`
5. Install `nvm`: 5. Install `nvm`:
```shell ```shell
@ -11,11 +11,11 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
``` ```
6. Exit the terminal using `exit` and then reopen the terminal 6. Exit the terminal using `exit` and then reopen the terminal
7. Install and use Node.js 14: 7. Install and use Node.js 16:
```shell ```shell
nvm install 14 nvm install 16
nvm use 14 nvm use 16
``` ```
8. Install code-server globally on device with: `npm i -g code-server` 8. Install code-server globally on device with: `npm i -g code-server`

View File

@ -60,6 +60,6 @@ As `code-server` is based on VS Code, you can follow the steps described on Duck
code-server --enable-proposed-api genuitecllc.codetogether code-server --enable-proposed-api genuitecllc.codetogether
``` ```
Another option would be to add a value in code-server's [config file](https://coder.com/docs/code-server/v4.2.0/FAQ#how-does-the-config-file-work). Another option would be to add a value in code-server's [config file](https://coder.com/docs/code-server/v4.4.0/FAQ#how-does-the-config-file-work).
3. Refresh code-server and navigate to the CodeTogether icon in the sidebar to host or join a coding session. 3. Refresh code-server and navigate to the CodeTogether icon in the sidebar to host or join a coding session.

View File

@ -126,8 +126,8 @@ access code-server on an iPad or do not want to use SSH port forwarding.
```console ```console
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/gpg/gpg.155B6D79CA56EA34.key' | sudo apt-key add - curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/setup/config.deb.txt?distro=debian&version=any-version' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update sudo apt update
sudo apt install caddy sudo apt install caddy
``` ```

View File

@ -1,6 +1,6 @@
# code-server Helm Chart # code-server Helm Chart
[![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square)](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) [![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![AppVersion: 4.2.0](https://img.shields.io/badge/AppVersion-4.2.0-informational?style=flat-square)](https://img.shields.io/badge/AppVersion-4.2.0-informational?style=flat-square) [![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square)](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) [![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![AppVersion: 4.4.0](https://img.shields.io/badge/AppVersion-4.4.0-informational?style=flat-square)](https://img.shields.io/badge/AppVersion-4.4.0-informational?style=flat-square)
[code-server](https://github.com/coder/code-server) code-server is VS Code running [code-server](https://github.com/coder/code-server) code-server is VS Code running
on a remote server, accessible through the browser. on a remote server, accessible through the browser.
@ -73,7 +73,7 @@ and their default values.
| hostnameOverride | string | `""` | | hostnameOverride | string | `""` |
| image.pullPolicy | string | `"Always"` | | image.pullPolicy | string | `"Always"` |
| image.repository | string | `"codercom/code-server"` | | image.repository | string | `"codercom/code-server"` |
| image.tag | string | `"4.2.0"` | | image.tag | string | `"4.4.0"` |
| imagePullSecrets | list | `[]` | | imagePullSecrets | list | `[]` |
| ingress.enabled | bool | `false` | | ingress.enabled | bool | `false` |
| nameOverride | string | `""` | | nameOverride | string | `""` |

View File

@ -4,7 +4,7 @@
- [install.sh](#installsh) - [install.sh](#installsh)
- [Detection reference](#detection-reference) - [Detection reference](#detection-reference)
- [npm](#npm) - [yarn, npm](#yarn-npm)
- [Standalone releases](#standalone-releases) - [Standalone releases](#standalone-releases)
- [Debian, Ubuntu](#debian-ubuntu) - [Debian, Ubuntu](#debian-ubuntu)
- [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse) - [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse)
@ -19,7 +19,7 @@
- [Uninstall](#uninstall) - [Uninstall](#uninstall)
- [install.sh](#installsh-1) - [install.sh](#installsh-1)
- [Homebrew](#homebrew) - [Homebrew](#homebrew)
- [npm](#npm-1) - [yarn, npm](#yarn-npm-1)
- [Debian, Ubuntu](#debian-ubuntu-1) - [Debian, Ubuntu](#debian-ubuntu-1)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
@ -87,16 +87,17 @@ _exact_ same commands presented in the rest of this document.
- Ensure that you add `~/.local/bin` to your `$PATH` to run code-server. - Ensure that you add `~/.local/bin` to your `$PATH` to run code-server.
- For FreeBSD, code-server will install the [npm package](#npm) with `npm`. - For FreeBSD, code-server will install the [npm package](#yarn-npm) with `yarn`
or `npm`.
- If you're installing code-server onto architecture with no releases, - If you're installing code-server onto architecture with no releases,
code-server will install the [npm package](#npm) with `npm` code-server will install the [npm package](#yarn-npm) with `yarn` or `npm`
- We currently offer releases for amd64 and arm64. - We currently offer releases for amd64 and arm64.
- The [npm package](#npm) builds the native modules on post-install. - The [npm package](#yarn-npm) builds the native modules on post-install.
## npm ## yarn, npm
We recommend installing with `npm` when: We recommend installing with `yarn` or `npm` when:
1. You aren't using a machine with `amd64` or `arm64`. 1. You aren't using a machine with `amd64` or `arm64`.
1. You are installing code-server on Windows 1. You are installing code-server on Windows
@ -106,9 +107,9 @@ We recommend installing with `npm` when:
[#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.
Installing code-server with `npm` builds native modules on install. Installing code-server with `yarn` or `npm` builds native modules on install.
This process requires C dependencies; see our guide on [installing with `npm`][./npm.md](./npm.md) for more information. This process requires C dependencies; see our guide on [installing with yarn and npm][./npm.md](./npm.md) for more information.
## Standalone releases ## Standalone releases
@ -116,7 +117,7 @@ We publish self-contained `.tar.gz` archives for every release on
[GitHub](https://github.com/coder/code-server/releases). The archives bundle the [GitHub](https://github.com/coder/code-server/releases). The archives bundle the
node binary and node modules. node binary and node modules.
We create the standalone releases using the [npm package](#npm), and we We create the standalone releases using the [npm package](#yarn-npm), and we
then create the remaining releases using the standalone version. then create the remaining releases using the standalone version.
The only requirement to use the standalone release is `glibc` >= 2.17 and The only requirement to use the standalone release is `glibc` >= 2.17 and
@ -150,7 +151,7 @@ code-server
## Debian, Ubuntu ## Debian, Ubuntu
> The standalone arm64 .deb does not support Ubuntu 16.04 or earlier. Please > The standalone arm64 .deb does not support Ubuntu 16.04 or earlier. Please
> upgrade or [build with `npm`](#npm). > upgrade or [build with yarn](#yarn-npm).
```bash ```bash
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_$VERSION_amd64.deb curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_$VERSION_amd64.deb
@ -162,7 +163,7 @@ sudo systemctl enable --now code-server@$USER
## Fedora, CentOS, RHEL, SUSE ## Fedora, CentOS, RHEL, SUSE
> The standalone arm64 .rpm does not support CentOS 7. Please upgrade or [build > The standalone arm64 .rpm does not support CentOS 7. Please upgrade or [build
> with `npm`](#npm). > with yarn](#yarn-npm).
```bash ```bash
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-amd64.rpm curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-amd64.rpm
@ -227,13 +228,14 @@ You can install code-server using the [Helm package manager](https://coder.com/d
## Windows ## Windows
We currently [do not publish Windows releases](https://github.com/coder/code-server/issues/1397). We recommend installing code-server onto Windows with [`npm`](#npm). We currently [do not publish Windows releases](https://github.com/coder/code-server/issues/1397). We recommend installing code-server onto Windows with [`yarn` or `npm`](#yarn-npm).
> Note: You will also need to [build coder/cloud-agent manually](https://github.com/coder/cloud-agent/issues/17) if you would like to use `code-server --link` on Windows. > Note: You will also need to [build coder/cloud-agent manually](https://github.com/coder/cloud-agent/issues/17) if you would like to use `code-server --link` on Windows.
## Raspberry Pi ## Raspberry Pi
We recommend installing code-server onto Raspberry Pi with [`npm`](#npm). We recommend installing code-server onto Raspberry Pi with [`yarn` or
`npm`](#yarn-npm).
## Termux ## Termux
@ -275,10 +277,16 @@ brew remove code-server
brew uninstall code-server brew uninstall code-server
``` ```
### npm ### yarn, npm
To remove the code-server global module, run: To remove the code-server global module, run:
```shell
yarn global remove code-server
```
or
```shell ```shell
npm uninstall -g code-server npm uninstall -g code-server
``` ```

View File

@ -1,7 +1,9 @@
# Using code-server on iOS with iSH # Using code-server on iOS with iSH
1. Install iSH from the [App Store](https://apps.apple.com/us/app/ish-shell/id1436902243) 1. Install iSH from the [App Store](https://apps.apple.com/us/app/ish-shell/id1436902243)
2. Install `curl` with `apk add curl` 2. Install `curl` and `nano` with `apk add curl nano`
3. Install code-server with `curl -fsSL https://code-server.dev/install.sh | sh` 3. Configure iSH to use an earlier version of NodeJS with `nano /etc/apk/repositories` and edit `v3.14` to `v3.12` on both repository links.
4. Run code-server with `code-server` 4. Install `nodejs` and `npm` with `apk add nodejs npm`
5. Access on localhost:8080 in your browser 5. Install code-server with `curl -fsSL https://code-server.dev/install.sh | sh`
6. Run code-server with `code-server`
7. Access on localhost:8080 in your browser

View File

@ -1,5 +1,5 @@
{ {
"versions": ["v4.2.0"], "versions": ["v4.4.0"],
"routes": [ "routes": [
{ {
"title": "Home", "title": "Home",
@ -21,7 +21,7 @@
"children": [ "children": [
{ {
"title": "npm", "title": "npm",
"description": "How to install code-server using npm", "description": "How to install code-server using npm or yarn",
"path": "./npm.md" "path": "./npm.md"
}, },
{ {
@ -73,7 +73,7 @@
{ {
"title": "Upgrade", "title": "Upgrade",
"description": "How to upgrade code-server.", "description": "How to upgrade code-server.",
"icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M17.8049 2.19795C17.7385 2.1311 17.6587 2.07899 17.5708 2.04504C17.4829 2.01108 17.3889 1.99604 17.2948 2.00089C7.89216 2.49153 4.4188 10.8673 4.38528 10.9517C4.33624 11.0736 4.32406 11.2071 4.35028 11.3358C4.3765 11.4645 4.43995 11.5827 4.53274 11.6756L8.32449 15.4674C8.41787 15.5606 8.53669 15.6242 8.66606 15.6502C8.79543 15.6762 8.92959 15.6634 9.05174 15.6135C9.13552 15.5793 17.4664 12.0671 17.9986 2.7087C18.0039 2.61474 17.9895 2.5207 17.9561 2.4327C17.9227 2.3447 17.8712 2.26471 17.8049 2.19795ZM12.3314 9.56427C12.1439 9.75179 11.9051 9.87951 11.645 9.93126C11.385 9.98302 11.1154 9.9565 10.8704 9.85505C10.6254 9.7536 10.4161 9.58178 10.2687 9.36131C10.1214 9.14085 10.0428 8.88166 10.0428 8.6165C10.0428 8.35135 10.1214 8.09215 10.2687 7.87169C10.4161 7.65123 10.6254 7.47941 10.8704 7.37796C11.1154 7.27651 11.385 7.24998 11.645 7.30174C11.9051 7.3535 12.1439 7.48121 12.3314 7.66873C12.5827 7.92012 12.7239 8.26104 12.7239 8.6165C12.7239 8.97197 12.5827 9.31288 12.3314 9.56427Z\"/><path d=\"M2.74602 14.5444C2.92281 14.3664 3.133 14.2251 3.36454 14.1285C3.59608 14.0319 3.8444 13.9819 4.09529 13.9815C4.34617 13.9811 4.59466 14.0.12 4.82653 14.126C5.05839 14.2218 5.26907 14.3624 5.44647 14.5398C5.62386 14.7172 5.7645 14.9279 5.86031 15.1598C5.95612 15.3916 6.00522 15.6401 6.00479 15.891C6.00437 16.1419 5.95442 16.3902 5.85782 16.6218C5.76122 16.8533 5.61987 17.0635 5.44186 17.2403C4.69719 17.985 2 18.0004 2 18.0004C2 18.0004 2 15.2884 2.74602 14.5444Z\"/><path d=\"M8.9416 3.48269C7.99688 3.31826 7.02645 3.38371 6.11237 3.67352C5.19828 3.96332 4.36741 4.46894 3.68999 5.14765C3.33153 5.50944 3.01988 5.91477 2.76233 6.35415C2.68692 6.4822 2.6562 6.63169 2.67501 6.77911C2.69381 6.92652 2.76108 7.06351 2.86623 7.16853L4.1994 8.50238C5.43822 6.53634 7.04911 4.83119 8.9416 3.48269Z\"/><path d=\"M16.5181 11.0585C16.6825 12.0033 16.6171 12.9737 16.3273 13.8878C16.0375 14.8019 15.5318 15.6327 14.8531 16.3101C14.4914 16.6686 14.086 16.9803 13.6466 17.2378C13.5186 17.3132 13.3691 17.3439 13.2217 17.3251C13.0743 17.3063 12.9373 17.2391 12.8323 17.1339L11.4984 15.8007C13.4645 14.5619 15.1696 12.951 16.5181 11.0585Z\"/></svg>", "icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M17.8049 2.19795C17.7385 2.1311 17.6587 2.07899 17.5708 2.04504C17.4829 2.01108 17.3889 1.99604 17.2948 2.00089C7.89216 2.49153 4.4188 10.8673 4.38528 10.9517C4.33624 11.0736 4.32406 11.2071 4.4.028 11.3358C4.3765 11.4645 4.43995 11.5827 4.53274 11.6756L8.32449 15.4674C8.41787 15.5606 8.53669 15.6242 8.66606 15.6502C8.79543 15.6762 8.92959 15.6634 9.05174 15.6135C9.13552 15.5793 17.4664 12.0671 17.9986 2.7087C18.0039 2.61474 17.9895 2.5207 17.9561 2.4327C17.9227 2.3447 17.8712 2.26471 17.8049 2.19795ZM12.3314 9.56427C12.1439 9.75179 11.9051 9.87951 11.645 9.93126C11.385 9.98302 11.1154 9.9565 10.8704 9.85505C10.6254 9.7536 10.4161 9.58178 10.2687 9.36131C10.1214 9.14085 10.0428 8.88166 10.0428 8.6165C10.0428 8.35135 10.1214 8.09215 10.2687 7.87169C10.4161 7.65123 10.6254 7.47941 10.8704 7.37796C11.1154 7.27651 11.385 7.24998 11.645 7.30174C11.9051 7.3535 12.1439 7.48121 12.3314 7.66873C12.5827 7.92012 12.7239 8.26104 12.7239 8.6165C12.7239 8.97197 12.5827 9.31288 12.3314 9.56427Z\"/><path d=\"M2.74602 14.5444C2.92281 14.3664 3.133 14.2251 3.36454 14.1285C3.59608 14.0319 3.8444 13.9819 4.09529 13.9815C4.34617 13.9811 4.59466 14.0.12 4.82653 14.126C5.05839 14.2218 5.26907 14.3624 5.44647 14.5398C5.62386 14.7172 5.7645 14.9279 5.86031 15.1598C5.95612 15.3916 6.00522 15.6401 6.00479 15.891C6.00437 16.1419 5.95442 16.3902 5.85782 16.6218C5.76122 16.8533 5.61987 17.0635 5.44186 17.2403C4.69719 17.985 2 18.0004 2 18.0004C2 18.0004 2 15.2884 2.74602 14.5444Z\"/><path d=\"M8.9416 3.48269C7.99688 3.31826 7.02645 3.38371 6.11237 3.67352C5.19828 3.96332 4.36741 4.46894 3.68999 5.14765C3.33153 5.50944.4.01988 5.91477 2.76233 6.35415C2.68692 6.4822 2.6562 6.63169 2.67501 6.77911C2.69381 6.92652 2.76108 7.06351 2.86623 7.16853L4.1994 8.50238C5.43822 6.53634 7.04911 4.83119 8.9416 3.48269Z\"/><path d=\"M16.5181 11.0585C16.6825 12.0033 16.6171 12.9737 16.3273 13.8878C16.0375 14.8019 15.5318 15.6327 14.8531 16.3101C14.4914 16.6686 14.086 16.9803 13.6466 17.2378C13.5186 17.3132 13.3691 17.3439 13.2217 17.3251C13.0743 17.3063 12.9373 17.2391 12.8323 17.1339L11.4984 15.8007C13.4645 14.5619 15.1696 12.951 16.5181 11.0585Z\"/></svg>",
"path": "./upgrade.md" "path": "./upgrade.md"
}, },
{ {

View File

@ -20,15 +20,10 @@ If you're installing code-server via `npm`, you'll need to install additional
dependencies required to build the native modules used by VS Code. This article dependencies required to build the native modules used by VS Code. This article
includes installing instructions based on your operating system. includes installing instructions based on your operating system.
> **WARNING**: Do not use `yarn` to install code-server. Unlike `npm`, it does not respect
> lockfiles for distributed applications. It will instead use the latest version
> available at installation time - which might not be the one used for a given
> code-server release, and [might lead to unexpected behavior](https://github.com/coder/code-server/issues/4927).
## Node.js version ## Node.js version
We use the same major version of Node.js shipped with VSCode's Electron, We use the same major version of Node.js shipped with Code's remote, which is
which is currently `14.x`. VS Code also [lists Node.js currently `16.x`. VS Code also [lists Node.js
requirements](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites). requirements](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites).
Using other versions of Node.js [may lead to unexpected Using other versions of Node.js [may lead to unexpected
@ -77,7 +72,7 @@ Proceed to [installing](#installing)
## FreeBSD ## FreeBSD
```sh ```sh
pkg install -y git python npm-node14 pkgconf pkg install -y git python npm-node16 yarn-node16 pkgconf
pkg install -y libinotify pkg install -y libinotify
``` ```
@ -90,7 +85,8 @@ Installing code-server requires all of the [prerequisites for VS Code developmen
Next, install code-server with: Next, install code-server with:
```bash ```bash
npm install -g code-server yarn global add code-server
# Or: npm install -g code-server
code-server code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
``` ```
@ -100,7 +96,8 @@ A `postinstall.sh` script will attempt to run. Select your terminal (e.g., Git b
If the `code-server` command is not found, you'll need to [add a directory to your PATH](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/). To find the directory, use the following command: If the `code-server` command is not found, you'll need to [add a directory to your PATH](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/). To find the directory, use the following command:
```shell ```shell
npm config get prefix yarn global bin
# Or: npm config get prefix
``` ```
For help and additional troubleshooting, see [#1397](https://github.com/coder/code-server/issues/1397). For help and additional troubleshooting, see [#1397](https://github.com/coder/code-server/issues/1397).
@ -110,7 +107,8 @@ For help and additional troubleshooting, see [#1397](https://github.com/coder/co
After adding the dependencies for your OS, install the code-server package globally: After adding the dependencies for your OS, install the code-server package globally:
```bash ```bash
npm install -g code-server yarn global add code-server
# Or: npm install -g code-server
code-server code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
``` ```
@ -124,7 +122,7 @@ page](https://github.com/coder/code-server/discussions).
Occasionally, you may run into issues with Node.js. Occasionally, you may run into issues with Node.js.
If you install code-server using `npm`, and you upgrade your Node.js If you install code-server using `yarn` or `npm`, and you upgrade your Node.js
version, you may need to reinstall code-server to recompile native modules. version, you may need to reinstall code-server to recompile native modules.
Sometimes, you can get around this by navigating into code-server's `lib/vscode` Sometimes, you can get around this by navigating into code-server's `lib/vscode`
directory and running `npm rebuild` to recompile the modules. directory and running `npm rebuild` to recompile the modules.
@ -138,7 +136,7 @@ A step-by-step example of how you might do this is:
### Debugging install issues with npm ### Debugging install issues with npm
To debug installation issues: `yarn` suppresses logs when running `yarn global add`, so to debug installation issues, install with `npm` instead:
```shell ```shell
# Uninstall # Uninstall

View File

@ -10,40 +10,45 @@
- [Create a new user](#create-a-new-user) - [Create a new user](#create-a-new-user)
- [Install Go](#install-go) - [Install Go](#install-go)
- [Install Python](#install-python) - [Install Python](#install-python)
- [Working with PRoot](#working-with-proot)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Install ## Install
1. Get [Termux](https://f-droid.org/en/packages/com.termux/) from **F-Droid**. 1. Get [Termux](https://f-droid.org/en/packages/com.termux/) from **F-Droid**.
2. Install Debian by running the following. 2. Install Debian by running the following:
- Run `termux-setup-storage` to allow storage access, or else code-server won't be able to read from `/sdcard`.\ - Run `termux-setup-storage` to allow storage access, or else code-server won't be able to read from `/sdcard`.\
If you used the Andronix command then you may have to edit the `start-debian.sh` script to mount `/sdcard` just as simple as uncommenting the `command+=" -b /sdcard"` line. > The following command is from [proot-distro](https://github.com/termux/proot-distro), but you can also use [Andronix](https://andronix.app/).
> The following command was extracted from [Andronix](https://andronix.app/) you can also use [proot-distro](https://github.com/termux/proot-distro).
> After Debian is installed the `~ $` will change to `root@localhost`. > After Debian is installed the `~ $` will change to `root@localhost`.
```bash ```bash
pkg update -y && pkg install wget curl proot tar -y && wget https://raw.githubusercontent.com/AndronixApp/AndronixOrigin/master/Installer/Debian/debian.sh -O debian.sh && chmod +x debian.sh && bash debian.sh pkg update -y && pkg install proot-distro -y && proot-distro install debian && proot-distro login debian
``` ```
3. Run the following commands to setup Debian. 3. Run the following commands to setup Debian:
```bash ```bash
apt update apt update && apt upgrade -y && apt-get install sudo vim git -y
apt upgrade -y
apt-get install nano vim sudo curl wget git -y
``` ```
4. Install [NVM](https://github.com/nvm-sh/nvm) by following the install guide in the README, just a curl/wget command. 4. Install [NVM](https://github.com/nvm-sh/nvm#install--update-script) by following the install guide in the README, just a curl/wget command.
5. Set up NVM for multi-user. After installing NVM it automatically adds the necessary commands for it to work, but it will only work if you are logged in as root;
5. Set up NVM for multi-user. After installing NVM it automatically adds the necessary commands for it to work, but it will only work if you are logged in as root:
- Copy the lines NVM asks you to run after running the install script. - Copy the lines NVM asks you to run after running the install script.
- Run `nano /root/.bashrc` and comment out those lines by adding a `#` at the start. - Run `nano /root/.bashrc` and comment out those lines by adding a `#` at the start.
- Run `nano /etc/profile` and paste those lines at the end and make sure to replace `$HOME` with `/root` - Run `nano /etc/profile` and paste those lines at the end of the file. Make sure to replace `$HOME` with `/root` on the first line.
- Now run `exit` and start Debain again. - Now run `exit`
- Start Debian again `proot-distro login debian`
6. After following the instructions and setting up NVM you can now install the [required node version](https://coder.com/docs/code-server/latest/npm#nodejs-version) using `nvm install version_here`. 6. After following the instructions and setting up NVM you can now install the [required node version](https://coder.com/docs/code-server/latest/npm#nodejs-version) by running:
7. To install `code-server` run the following.
```bash
nvm install v<major_version_here>
```
7. To install `code-server` run the following:
> To check the install process (Will not actually install code-server) > To check the install process (Will not actually install code-server)
> If it all looks good, you can install code-server by running the second command > If it all looks good, you can install code-server by running the second command
@ -82,11 +87,11 @@ Potential Workaround :
To create a new user follow these simple steps - To create a new user follow these simple steps -
1. Create a new user by running `useradd username -m`. 1. Create a new user by running `useradd <username> -m`.
2. Change the password by running `passwd username`. 2. Change the password by running `passwd <username>`.
3. Give your new user sudo access by runnning `visudo`, scroll down to `User privilege specification` and add the following line after root `username ALL=(ALL:ALL) ALL`. 3. Give your new user sudo access by running `visudo`, scroll down to `User privilege specification` and add the following line after root `username ALL=(ALL:ALL) ALL`.
4. Now edit the `/etc/passwd` file with your commadline editor of choice and at the end of the line that specifies your user change `/bin/sh` to `/bin/bash`. 4. Now edit the `/etc/passwd` file with your command line editor of choice and at the end of the line that specifies your user change `/bin/sh` to `/bin/bash`.
5. Now switch users, by running `su - username` 5. Now switch users by running `su - <username>`
- Remember the `-` betweeen `su` and username is required to execute `/etc/profile`,\ - Remember the `-` betweeen `su` and username is required to execute `/etc/profile`,\
since `/etc/profile` may have some necessary things to be executed you should always add a `-`. since `/etc/profile` may have some necessary things to be executed you should always add a `-`.
@ -95,7 +100,7 @@ To create a new user follow these simple steps -
> From https://golang.org/doc/install > From https://golang.org/doc/install
1. Go to https://golang.org/dl/ and copy the download link for `linux arm` and run the following. 1. Go to https://golang.org/dl/ and copy the download link for `linux arm` and run the following:
```bash ```bash
wget download_link wget download_link
@ -115,7 +120,7 @@ rm -rf /usr/local/go && tar -C /usr/local -xzf archive_name
> Run these commands as root > Run these commands as root
1. Run the following command to install required packages to build python. 1. Run the following commands to install required packages to build python:
```bash ```bash
sudo apt-get update sudo apt-get update
@ -124,13 +129,13 @@ sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
``` ```
2. Install [pyenv](https://github.com/pyenv/pyenv/) from [pyenv-installer](https://github.com/pyenv/pyenv-installer) by running. 2. Install [pyenv](https://github.com/pyenv/pyenv/) from [pyenv-installer](https://github.com/pyenv/pyenv-installer) by running:
```bash ```bash
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
``` ```
3. Run `nano /etc/profile` and add the following 3. Run `nano /etc/profile` and add the following:
```bash ```bash
export PYENV_ROOT="/root/.pyenv" export PYENV_ROOT="/root/.pyenv"
@ -139,10 +144,42 @@ eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)" eval "$(pyenv virtualenv-init -)"
``` ```
4. Exit start Debian again. 4. Exit and start Debian again.
5. Run `pyenv versions` to list all installable versions. 5. Run `pyenv versions` to list all installable versions.
6. Run `pyenv install version` to install the desired python version. 6. Run `pyenv install version` to install the desired python version.
> The build process may take some time (an hour or 2 depending on your device). > The build process may take some time (an hour or 2 depending on your device).
7. Run `touch /root/.pyenv/version && echo "your_version_here" > /root/.pyenv/version` 7. Run `touch /root/.pyenv/version && echo "your_version_here" > /root/.pyenv/version`
8. (You may have to start Debian again) Run `python3 -V` to verify if PATH works or not. 8. (You may have to start Debian again) Run `python3 -V` to verify if PATH works or not.
> If `python3` doesn't work but pyenv says that the install was successful in step 6 then try running `$PYENV_ROOT/versions/your_version/bin/python3`. > If `python3` doesn't work but pyenv says that the install was successful in step 6 then try running `$PYENV_ROOT/versions/your_version/bin/python3`.
### Working with PRoot
Debian PRoot Distro Dev Environment
- Since Node and code-server are installed in the Debian PRoot distro, your `~/.ssh/` configuration, `~/.bashrc`, git, npm packages, etc. should be setup in PRoot as well.
- The terminal accessible in code-server will bring up the filesystem and `~/.bashrc` in the Debian PRoot distro.
Accessing files in the Debian PRoot Distro
- The `/data/data/com.termux/files/home` directory in PRoot accesses the termux home directory (`~`)
- The `/sdcard` directory in PRoot accesses the Android storage directory, though there are [known issues with git and files in the `/sdcard` path](#git-wont-work-in-sdcard)
Accessing the Debian PRoot distro/Starting code-server
- Run the following command to access the Debian PRoot distro, from the termux shell:
```bash
proot-distro login debian
```
- Run the following command to start code-server directly in the Debian PRoot distro, from the termux shell:
```bash
proot-distro login debian -- code-server
```
- If you [created a new user](#create-a-new-user), you'll need to insert the `--user <username>` option between `login` and `debian` in the commands above to run as the user instead of root in PRoot.
Additional information on PRoot and Termux
- Additional information on using your Debian PRoot Distro can be [found here](https://github.com/termux/proot-distro#functionality-overview).

@ -1 +1 @@
Subproject commit f80445acd5a3dadef24aa209168452a3d97cc326 Subproject commit dfd34e8260c270da74b5c2d86d61aee4b6d56977

View File

@ -1,7 +1,7 @@
{ {
"name": "code-server", "name": "code-server",
"license": "MIT", "license": "MIT",
"version": "4.2.0", "version": "4.4.0",
"description": "Run VS Code on a remote server.", "description": "Run VS Code on a remote server.",
"homepage": "https://github.com/coder/code-server", "homepage": "https://github.com/coder/code-server",
"bugs": { "bugs": {
@ -24,6 +24,7 @@
"package": "./ci/build/build-packages.sh", "package": "./ci/build/build-packages.sh",
"postinstall": "./ci/dev/postinstall.sh", "postinstall": "./ci/dev/postinstall.sh",
"publish:npm": "./ci/steps/publish-npm.sh", "publish:npm": "./ci/steps/publish-npm.sh",
"publish:docker": "./ci/steps/docker-buildx-push.sh",
"_audit": "./ci/dev/audit.sh", "_audit": "./ci/dev/audit.sh",
"fmt": "./ci/dev/fmt.sh", "fmt": "./ci/dev/fmt.sh",
"lint": "./ci/dev/lint.sh", "lint": "./ci/dev/lint.sh",
@ -49,8 +50,8 @@
"@types/split2": "^3.2.0", "@types/split2": "^3.2.0",
"@types/trusted-types": "^2.0.2", "@types/trusted-types": "^2.0.2",
"@types/ws": "^8.0.0", "@types/ws": "^8.0.0",
"@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.0.0", "@typescript-eslint/parser": "^5.23.0",
"audit-ci": "^6.0.0", "audit-ci": "^6.0.0",
"codecov": "^3.8.3", "codecov": "^3.8.3",
"doctoc": "^2.0.0", "doctoc": "^2.0.0",
@ -61,13 +62,13 @@
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"json": "^11.0.0", "json": "^11.0.0",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"prettier-plugin-sh": "^0.8.0", "prettier-plugin-sh": "^0.11.0",
"shellcheck": "^1.0.0", "shellcheck": "^1.0.0",
"stylelint": "^13.0.0", "stylelint": "^13.0.0",
"stylelint-config-recommended": "^5.0.0", "stylelint-config-recommended": "^5.0.0",
"synp": "^1.9.10", "synp": "^1.9.10",
"ts-node": "^10.0.0", "ts-node": "^10.0.0",
"typescript": "^4.4.0-dev.20210528" "typescript": "^4.6.2"
}, },
"resolutions": { "resolutions": {
"ansi-regex": "^5.0.1", "ansi-regex": "^5.0.1",
@ -84,7 +85,7 @@
"follow-redirects": "^1.14.8", "follow-redirects": "^1.14.8",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.7",
"nanoid": "^3.1.31", "nanoid": "^3.1.31",
"minimist": "npm:minimist-lite@2.2.0" "minimist": "npm:minimist-lite@2.2.1"
}, },
"dependencies": { "dependencies": {
"@coder/logger": "1.1.16", "@coder/logger": "1.1.16",
@ -121,7 +122,7 @@
"browser-ide" "browser-ide"
], ],
"engines": { "engines": {
"node": ">= 14" "node": "16"
}, },
"jest": { "jest": {
"transform": { "transform": {

View File

@ -159,7 +159,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -252,7 +252,10 @@ export class WebClientServer { @@ -253,7 +253,10 @@ export class WebClientServer {
return res.end(); return res.end();
} }
@ -171,7 +171,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
function escapeAttribute(value: string): string { function escapeAttribute(value: string): string {
return value.replace(/"/g, '&quot;'); return value.replace(/"/g, '&quot;');
@@ -272,6 +275,8 @@ export class WebClientServer { @@ -275,6 +278,8 @@ export class WebClientServer {
accessToken: this._environmentService.args['github-auth'], accessToken: this._environmentService.args['github-auth'],
scopes: [['user:email'], ['repo']] scopes: [['user:email'], ['repo']]
} : undefined; } : undefined;
@ -180,15 +180,15 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
const data = (await util.promisify(fs.readFile)(filePath)).toString() const data = (await util.promisify(fs.readFile)(filePath)).toString()
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({ .replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({
remoteAuthority, remoteAuthority,
@@ -279,6 +284,7 @@ export class WebClientServer { @@ -285,6 +290,7 @@ export class WebClientServer {
developmentOptions: { enableSmokeTestDriver: this._environmentService.driverHandle === 'web' ? true : undefined }, folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),
productConfiguration: <Partial<IProductConfiguration>>{ productConfiguration: <Partial<IProductConfiguration>>{
+ rootEndpoint: base, + rootEndpoint: base,
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
extensionsGallery: this._webExtensionResourceUrlTemplate ? { extensionsGallery: this._webExtensionResourceUrlTemplate ? {
...this._productService.extensionsGallery, @@ -297,7 +303,9 @@ export class WebClientServer {
'resourceUrlTemplate': this._webExtensionResourceUrlTemplate.with({
@@ -289,7 +295,9 @@ export class WebClientServer {
} : undefined } : undefined
} }
}))) })))
@ -199,7 +199,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
const cspDirectives = [ const cspDirectives = [
'default-src \'self\';', 'default-src \'self\';',
@@ -368,3 +376,70 @@ export class WebClientServer { @@ -376,3 +384,70 @@ export class WebClientServer {
return res.end(data); return res.end(data);
} }
} }
@ -286,7 +286,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts --- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts +++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
@@ -504,6 +504,7 @@ function doCreateUri(path: string, query @@ -482,6 +482,7 @@ function doCreateUri(path: string, query
}); });
} }
@ -294,12 +294,33 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
return URI.parse(window.location.href).with({ path, query }); return URI.parse(window.location.href).with({ path, query });
} }
@@ -515,7 +516,7 @@ function doCreateUri(path: string, query @@ -493,7 +494,7 @@ function doCreateUri(path: string, query
if (!configElement || !configElementAttribute) { if (!configElement || !configElementAttribute) {
throw new Error('Missing web configuration element'); throw new Error('Missing web configuration element');
} }
- const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute); - const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents; workspaceUri?: UriComponents } = JSON.parse(configElementAttribute);
+ const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = { ...JSON.parse(configElementAttribute), remoteAuthority: location.host } + const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = { ...JSON.parse(configElementAttribute), remoteAuthority: location.host }
// Create workbench // Create workbench
create(document.body, { create(document.body, {
Index: code-server/lib/vscode/src/vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader.ts
+++ code-server/lib/vscode/src/vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader.ts
@@ -16,7 +16,6 @@ import { getServiceMachineId } from 'vs/
import { IStorageService } from 'vs/platform/storage/common/storage';
import { TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
import { getTelemetryLevel, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
-import { RemoteAuthorities } from 'vs/base/common/network';
export const WEB_EXTENSION_RESOURCE_END_POINT = 'web-extension-resource';
@@ -72,7 +71,7 @@ export abstract class AbstractExtensionR
public getExtensionGalleryResourceURL(galleryExtension: { publisher: string; name: string; version: string }, path?: string): URI | undefined {
if (this._extensionGalleryResourceUrlTemplate) {
const uri = URI.parse(format2(this._extensionGalleryResourceUrlTemplate, { publisher: galleryExtension.publisher, name: galleryExtension.name, version: galleryExtension.version, path: 'extension' }));
- return this._isWebExtensionResourceEndPoint(uri) ? uri.with({ scheme: RemoteAuthorities.getPreferredWebSchema() }) : uri;
+ return this._isWebExtensionResourceEndPoint(uri) ? URI.joinPath(URI.parse(window.location.href), uri.path) : uri;
}
return undefined;
}

View File

@ -4,6 +4,12 @@ This allows the backend to distinguish them. In our case we use them to count a
single "open" of Code so we need to be able to distinguish between web sockets single "open" of Code so we need to be able to distinguish between web sockets
from two instances and two web sockets used in a single instance. from two instances and two web sockets used in a single instance.
To test this,
1. Run code-server
2. Open Network tab in Browser DevTools and filter for websocket requests
3. You should see the `type=<connection-type>` in the request url
Index: code-server/lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts Index: code-server/lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts --- code-server.orig/lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts

View File

@ -0,0 +1,30 @@
Prevent builtin extensions from being updated
Updating builtin extensions from the marketplace prevents us from patching them
(for example out GitHub authentication patches).
Index: code-server/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
@@ -206,6 +206,9 @@ export class Extension implements IExten
if (!this.gallery || !this.local) {
return false;
}
+ if (this.type !== ExtensionType.User) {
+ return false;
+ }
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
return false;
}
@@ -1057,6 +1060,10 @@ export class ExtensionsWorkbenchService
// Skip if check updates only for builtin extensions and current extension is not builtin.
continue;
}
+ if (installed.type !== ExtensionType.User) {
+ // Never update builtin extensions.
+ continue;
+ }
if (installed.isBuiltin && !installed.local?.identifier.uuid) {
// Skip if the builtin extension does not have Marketplace id
continue;

View File

@ -0,0 +1,183 @@
Add option to disable file downloads via CLI
This patch adds support for a new CLI flag called `--disable-file-downloads`
which allows a user to remove the "Download..." option that shows up when you
right-click files in Code. The default value for this is `false`.
To test this, start code-server with `--disable-file-downloads`, open editor,
right-click on a file (not a folder) and you should **not** see the
"Download..." option.
Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
@@ -215,6 +215,11 @@ export interface IWorkbenchConstructionO
*/
readonly userDataPath?: string
+ /**
+ * Whether the "Download..." option is enabled for files.
+ */
+ readonly isEnabledFileDownloads?: boolean
+
//#endregion
Index: code-server/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
@@ -30,6 +30,11 @@ export interface IBrowserWorkbenchEnviro
* Options used to configure the workbench.
*/
readonly options?: IWorkbenchConstructionOptions;
+
+ /**
+ * Enable downloading files via menu actions.
+ */
+ readonly isEnabledFileDownloads?: boolean;
}
export class BrowserWorkbenchEnvironmentService implements IBrowserWorkbenchEnvironmentService {
@@ -61,6 +66,13 @@ export class BrowserWorkbenchEnvironment
return this.options.userDataPath;
}
+ get isEnabledFileDownloads(): boolean {
+ if (typeof this.options.isEnabledFileDownloads === "undefined") {
+ throw new Error('isEnabledFileDownloads was not provided to the browser');
+ }
+ return this.options.isEnabledFileDownloads;
+ }
+
@memoize
get settingsResource(): URI { return joinPath(this.userRoamingDataHome, 'settings.json'); }
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
@@ -15,6 +15,7 @@ export const serverOptions: OptionDescri
'disable-update-check': { type: 'boolean' },
'auth': { type: 'string' },
'locale': { type: 'string' },
+ 'disable-file-downloads': { type: 'boolean' },
/* ----- server setup ----- */
@@ -96,6 +97,7 @@ export interface ServerParsedArgs {
'disable-update-check'?: boolean;
'auth'?: string
'locale'?: string
+ 'disable-file-downloads'?: boolean;
/* ----- 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
@@ -293,6 +293,7 @@ export class WebClientServer {
logLevel: this._logService.getLevel(),
},
userDataPath: this._environmentService.userDataPath,
+ isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
enableWorkspaceTrust: !this._environmentService.args['disable-workspace-trust'],
folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),
Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
@@ -7,12 +7,11 @@ import { Event } from 'vs/base/common/ev
import { Disposable } from 'vs/base/common/lifecycle';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext } from 'vs/platform/contextkey/common/contextkeys';
-import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, EditorTabsVisibleContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, EditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext } from 'vs/workbench/common/contextkeys';
+import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, EditorTabsVisibleContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, EditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, IsEnabledFileDownloads } from 'vs/workbench/common/contextkeys';
import { TEXT_DIFF_EDITOR_ID, EditorInputCapabilities, SIDE_BY_SIDE_EDITOR_ID, DEFAULT_EDITOR_ASSOCIATION } from 'vs/workbench/common/editor';
import { trackFocus, addDisposableListener, EventType } from 'vs/base/browser/dom';
import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
-import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkbenchLayoutService, Parts, positionToString } from 'vs/workbench/services/layout/browser/layoutService';
@@ -24,6 +23,7 @@ import { IEditorResolverService } from '
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
import { Schemas } from 'vs/base/common/network';
import { WebFileSystemAccess } from 'vs/platform/files/browser/webFileSystemAccess';
+import { IBrowserWorkbenchEnvironmentService } from '../services/environment/browser/environmentService';
export class WorkbenchContextKeysHandler extends Disposable {
private inputFocusedContext: IContextKey<boolean>;
@@ -75,7 +75,7 @@ export class WorkbenchContextKeysHandler
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IConfigurationService private readonly configurationService: IConfigurationService,
- @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
+ @IBrowserWorkbenchEnvironmentService private readonly environmentService: IBrowserWorkbenchEnvironmentService,
@IEditorService private readonly editorService: IEditorService,
@IEditorResolverService private readonly editorResolverService: IEditorResolverService,
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
@@ -194,6 +194,9 @@ export class WorkbenchContextKeysHandler
this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService);
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(Parts.AUXILIARYBAR_PART));
+ // code-server
+ IsEnabledFileDownloads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileDownloads ?? true)
+
this.registerListeners();
}
Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
@@ -22,7 +22,7 @@ import { CLOSE_SAVED_EDITORS_COMMAND_ID,
import { AutoSaveAfterShortDelayContext } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
import { WorkbenchListDoubleSelection } from 'vs/platform/list/browser/listService';
import { Schemas } from 'vs/base/common/network';
-import { DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, WorkbenchStateContext, WorkspaceFolderCountContext, SidebarFocusContext, ActiveEditorCanRevertContext, ActiveEditorContext, ResourceContextKey } from 'vs/workbench/common/contextkeys';
+import { DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, WorkbenchStateContext, WorkspaceFolderCountContext, SidebarFocusContext, ActiveEditorCanRevertContext, ActiveEditorContext, ResourceContextKey, IsEnabledFileDownloads } from 'vs/workbench/common/contextkeys';
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
@@ -476,13 +476,16 @@ MenuRegistry.appendMenuItem(MenuId.Explo
id: DOWNLOAD_COMMAND_ID,
title: DOWNLOAD_LABEL
},
- when: ContextKeyExpr.or(
- // native: for any remote resource
- ContextKeyExpr.and(IsWebContext.toNegated(), ResourceContextKey.Scheme.notEqualsTo(Schemas.file)),
- // web: for any files
- ContextKeyExpr.and(IsWebContext, ExplorerFolderContext.toNegated(), ExplorerRootContext.toNegated()),
- // web: for any folders if file system API support is provided
- ContextKeyExpr.and(IsWebContext, HasWebFileSystemAccess)
+ when: ContextKeyExpr.and(
+ IsEnabledFileDownloads,
+ ContextKeyExpr.or(
+ // native: for any remote resource
+ ContextKeyExpr.and(IsWebContext.toNegated(), ResourceContextKey.Scheme.notEqualsTo(Schemas.file)),
+ // web: for any files
+ ContextKeyExpr.and(IsWebContext, ExplorerFolderContext.toNegated(), ExplorerRootContext.toNegated()),
+ // web: for any folders if file system API support is provided
+ ContextKeyExpr.and(IsWebContext, HasWebFileSystemAccess)
+ )
)
}));
Index: code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/common/contextkeys.ts
+++ code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts
@@ -30,6 +30,8 @@ export const IsFullscreenContext = new R
export const HasWebFileSystemAccess = new RawContextKey<boolean>('hasWebFileSystemAccess', false, true); // Support for FileSystemAccess web APIs (https://wicg.github.io/file-system-access)
+export const IsEnabledFileDownloads = new RawContextKey<boolean>('isEnabledFileDownloads', true, true);
+
//#endregion

View File

@ -6,7 +6,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverServices.ts --- code-server.orig/lib/vscode/src/vs/server/node/serverServices.ts
+++ code-server/lib/vscode/src/vs/server/node/serverServices.ts +++ code-server/lib/vscode/src/vs/server/node/serverServices.ts
@@ -198,6 +198,9 @@ export async function setupServerService @@ -192,6 +192,9 @@ export async function setupServerService
const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)); const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority));
socketServer.registerChannel('extensions', channel); socketServer.registerChannel('extensions', channel);
@ -20,7 +20,7 @@ Index: code-server/lib/vscode/src/vs/base/common/platform.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/platform.ts --- code-server.orig/lib/vscode/src/vs/base/common/platform.ts
+++ code-server/lib/vscode/src/vs/base/common/platform.ts +++ code-server/lib/vscode/src/vs/base/common/platform.ts
@@ -83,6 +83,17 @@ if (typeof navigator === 'object' && !is @@ -84,6 +84,17 @@ if (typeof navigator === 'object' && !is
_isWeb = true; _isWeb = true;
_locale = navigator.language; _locale = navigator.language;
_language = _locale; _language = _locale;
@ -79,7 +79,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
+ } catch (error) { /* Probably fine. */ } + } catch (error) { /* Probably fine. */ }
Object.keys(self.webPackagePaths).map(function (key, index) { Object.keys(self.webPackagePaths).map(function (key, index) {
self.webPackagePaths[key] = new URL( self.webPackagePaths[key] = new URL(
`{{VS_BASE}}/static/remote/web/node_modules/${key}/${self.webPackagePaths[key]}`, `{{VS_BASE}}/static/node_modules/${key}/${self.webPackagePaths[key]}`,
@@ -52,7 +76,8 @@ @@ -52,7 +76,8 @@
return value; return value;
} }
@ -94,7 +94,7 @@ Index: code-server/lib/vscode/src/vs/platform/environment/common/environmentServ
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/environment/common/environmentService.ts --- code-server.orig/lib/vscode/src/vs/platform/environment/common/environmentService.ts
+++ code-server/lib/vscode/src/vs/platform/environment/common/environmentService.ts +++ code-server/lib/vscode/src/vs/platform/environment/common/environmentService.ts
@@ -105,7 +105,7 @@ export abstract class AbstractNativeEnvi @@ -108,7 +108,7 @@ export abstract class AbstractNativeEnvi
return URI.file(join(vscodePortable, 'argv.json')); return URI.file(join(vscodePortable, 'argv.json'));
} }
@ -168,7 +168,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -26,6 +26,7 @@ import { URI } from 'vs/base/common/uri' @@ -27,6 +27,7 @@ import { URI } from 'vs/base/common/uri'
import { streamToBuffer } from 'vs/base/common/buffer'; import { streamToBuffer } from 'vs/base/common/buffer';
import { IProductConfiguration } from 'vs/base/common/product'; import { IProductConfiguration } from 'vs/base/common/product';
import { isString } from 'vs/base/common/types'; import { isString } from 'vs/base/common/types';
@ -176,7 +176,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
const textMimeType = { const textMimeType = {
'.html': 'text/html', '.html': 'text/html',
@@ -277,6 +278,8 @@ export class WebClientServer { @@ -280,6 +281,8 @@ export class WebClientServer {
} : undefined; } : undefined;
const base = relativeRoot(getOriginalUrl(req)) const base = relativeRoot(getOriginalUrl(req))
const vscodeBase = relativePath(getOriginalUrl(req)) const vscodeBase = relativePath(getOriginalUrl(req))
@ -185,7 +185,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
const data = (await util.promisify(fs.readFile)(filePath)).toString() const data = (await util.promisify(fs.readFile)(filePath)).toString()
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({ .replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({
remoteAuthority, remoteAuthority,
@@ -301,7 +304,8 @@ export class WebClientServer { @@ -309,7 +312,8 @@ export class WebClientServer {
}))) })))
.replace('{{WORKBENCH_AUTH_SESSION}}', () => authSessionInfo ? escapeAttribute(JSON.stringify(authSessionInfo)) : '') .replace('{{WORKBENCH_AUTH_SESSION}}', () => authSessionInfo ? escapeAttribute(JSON.stringify(authSessionInfo)) : '')
.replace(/{{BASE}}/g, base) .replace(/{{BASE}}/g, base)
@ -207,7 +207,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -90,6 +91,7 @@ export interface ServerParsedArgs { @@ -94,6 +95,7 @@ export interface ServerParsedArgs {
/* ----- code-server ----- */ /* ----- code-server ----- */
'disable-update-check'?: boolean; 'disable-update-check'?: boolean;
'auth'?: string 'auth'?: string
@ -252,7 +252,7 @@ Index: code-server/lib/vscode/src/vs/workbench/workbench.web.main.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/workbench.web.main.ts --- code-server.orig/lib/vscode/src/vs/workbench/workbench.web.main.ts
+++ code-server/lib/vscode/src/vs/workbench/workbench.web.main.ts +++ code-server/lib/vscode/src/vs/workbench/workbench.web.main.ts
@@ -109,6 +109,10 @@ registerSingleton(ICustomEndpointTelemet @@ -112,6 +112,10 @@ registerSingleton(IDiagnosticsService, N
//#region --- workbench contributions //#region --- workbench contributions

View File

@ -1,81 +1,69 @@
Use our own GitHub auth relay server Add the ability to provide a GitHub token
Microsoft's does not work with self-hosted instances so we run our own. To test install the GitHub PR extension and start code-server with GITHUB_TOKEN
or set github-auth in the config file. The extension should be authenticated.
Also add an extra set of scopes so that tokens provided via --github-auth will Index: code-server/lib/vscode/src/vs/platform/credentials/node/credentialsMainService.ts
work for the PR extension.
Index: code-server/lib/vscode/extensions/github-authentication/src/githubServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/extensions/github-authentication/src/githubServer.ts --- code-server.orig/lib/vscode/src/vs/platform/credentials/node/credentialsMainService.ts
+++ code-server/lib/vscode/extensions/github-authentication/src/githubServer.ts +++ code-server/lib/vscode/src/vs/platform/credentials/node/credentialsMainService.ts
@@ -17,7 +17,7 @@ const localize = nls.loadMessageBundle() @@ -5,18 +5,32 @@
const CLIENT_ID = '01ab8ac9400c4e429b23';
const NETWORK_ERROR = 'network error'; import { InMemoryCredentialsProvider } from 'vs/platform/credentials/common/credentials';
-const AUTH_RELAY_SERVER = 'vscode-auth.github.com'; import { ILogService } from 'vs/platform/log/common/log';
+const AUTH_RELAY_SERVER = 'auth.code-server.dev'; -import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
// const AUTH_RELAY_STAGING_SERVER = 'client-auth-staging-14a768b.herokuapp.com'; +import { IServerEnvironmentService } from 'vs/server/node/serverEnvironmentService';
import { IProductService } from 'vs/platform/product/common/productService';
class UriEventHandler extends vscode.EventEmitter<vscode.Uri> implements vscode.UriHandler { import { BaseCredentialsMainService, KeytarModule } from 'vs/platform/credentials/common/credentialsMainService';
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts +import { generateUuid } from 'vs/base/common/uuid';
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -274,7 +274,7 @@ export class WebClientServer {
id: generateUuid(),
providerId: 'github',
accessToken: this._environmentService.args['github-auth'],
- scopes: [['user:email'], ['repo']]
+ scopes: [['read:user', 'user:email', 'repo'], ['user:email'], ['repo']]
} : undefined;
const base = relativeRoot(getOriginalUrl(req))
const vscodeBase = relativePath(getOriginalUrl(req))
Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
@@ -17,6 +17,7 @@ import { isFolderToOpen, isWorkspaceToOp
import { create, ICredentialsProvider, IURLCallbackProvider, IWorkbenchConstructionOptions, IWorkspace, IWorkspaceProvider } from 'vs/workbench/workbench.web.main';
import { posix } from 'vs/base/common/path';
import { ltrim } from 'vs/base/common/strings';
+import { equals as arrayEquals } from 'vs/base/common/arrays'; +import { equals as arrayEquals } from 'vs/base/common/arrays';
+
interface ICredential {
service: string;
@@ -24,6 +25,13 @@ interface ICredential {
password: string;
}
+interface IToken { +interface IToken {
+ accessToken: string + accessToken: string
+ account?: { label: string } + account?: { label: string }
+ id: string + id: string
+ scopes: string[] + scopes: string[]
+} +}
+
class LocalStorageCredentialsProvider implements ICredentialsProvider {
private static readonly CREDENTIALS_STORAGE_KEY = 'credentials.provider'; export class CredentialsWebMainService extends BaseCredentialsMainService {
@@ -51,6 +59,58 @@ class LocalStorageCredentialsProvider im
scopes, constructor(
accessToken: authSessionInfo!.accessToken @ILogService logService: ILogService,
})))); - @INativeEnvironmentService private readonly environmentMainService: INativeEnvironmentService,
+ @IServerEnvironmentService private readonly environmentMainService: IServerEnvironmentService,
@IProductService private readonly productService: IProductService,
) {
super(logService);
+ if (this.environmentMainService.args["github-auth"]) {
+ this.storeGitHubToken(this.environmentMainService.args["github-auth"]).catch((error) => {
+ this.logService.error('Failed to store provided GitHub token', error)
+ })
+ }
}
// If the credentials service is running on the server, we add a suffix -server to differentiate from the location that the
@@ -45,4 +59,59 @@ export class CredentialsWebMainService e
}
return this._keytarCache;
}
+
+ private async storeGitHubToken(githubToken: string): Promise<void> {
+ const extensionId = 'vscode.github-authentication';
+ const service = `${await this.getSecretStoragePrefix()}${extensionId}`;
+ const account = 'github.auth';
+ const scopes = [['read:user', 'user:email', 'repo']]
+ +
+ // Add tokens for extensions to use. This works for extensions like the
+ // pull requests one or GitLens.
+ const extensionId = `vscode.${authSessionInfo.providerId}-authentication`;
+ const service = `${product.urlProtocol}${extensionId}`;
+ const account = `${authSessionInfo.providerId}.auth`;
+ // Oddly the scopes need to match exactly so we cannot just have one token + // Oddly the scopes need to match exactly so we cannot just have one token
+ // with all the scopes, instead we have to duplicate the token for each + // with all the scopes, instead we have to duplicate the token for each
+ // expected set of scopes. + // expected set of scopes.
+ const tokens: IToken[] = authSessionInfo.scopes.map((scopes) => ({ + const tokens: IToken[] = scopes.map((scopes) => ({
+ id: authSessionInfo!.id, + id: generateUuid(),
+ scopes: scopes.sort(), // Sort for comparing later. + scopes: scopes.sort(), // Sort for comparing later.
+ accessToken: authSessionInfo!.accessToken, + accessToken: githubToken,
+ })); + }));
+ this.getPassword(service, account).then((raw) => { +
+ const raw = await this.getPassword(service, account)
+
+ let existing: { + let existing: {
+ content: IToken[] + content: IToken[]
+ } | undefined; + } | undefined;
@ -86,7 +74,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+ json.content = JSON.parse(json.content); + json.content = JSON.parse(json.content);
+ existing = json; + existing = json;
+ } catch (error) { + } catch (error) {
+ console.log(error); + this.logService.error('Failed to parse existing GitHub credentials', error)
+ } + }
+ } + }
+ +
@ -112,7 +100,5 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+ ...(existing?.content || []), + ...(existing?.content || []),
+ ]) + ])
+ })); + }));
+ }) + }
} }
}

View File

@ -5,7 +5,12 @@ may think code-server is broken. Ideally there would be a notification at the
point where these things are used instead of this though. point where these things are used instead of this though.
To test access over something like an HTTP domain or an IP address (not To test access over something like an HTTP domain or an IP address (not
localhost). localhost). For example:
1. run code-server
2. use ngrok to expose code-server
3. access via HTTP
4. look for notification in bottom right
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
=================================================================== ===================================================================

View File

@ -7,7 +7,6 @@ Prepare Code for integration with code-server
3. Add the code-server version to the help dialog. 3. Add the code-server version to the help dialog.
4. Add ready events for use in an iframe. 4. Add ready events for use in an iframe.
5. Add our icons. 5. Add our icons.
6. Remove sourcemap host since we cannot upload ours there.
Index: code-server/lib/vscode/src/vs/server/node/server.main.ts Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
=================================================================== ===================================================================
@ -22,7 +21,7 @@ Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
import product from 'vs/platform/product/common/product'; import product from 'vs/platform/product/common/product';
import * as perf from 'vs/base/common/performance'; import * as perf from 'vs/base/common/performance';
@@ -33,37 +33,42 @@ const errorReporter: ErrorReporter = { @@ -33,38 +33,43 @@ const errorReporter: ErrorReporter = {
} }
}; };
@ -35,6 +34,7 @@ Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
-const USER_DATA_PATH = join(REMOTE_DATA_FOLDER, 'data'); -const USER_DATA_PATH = join(REMOTE_DATA_FOLDER, 'data');
-const APP_SETTINGS_HOME = join(USER_DATA_PATH, 'User'); -const APP_SETTINGS_HOME = join(USER_DATA_PATH, 'User');
-const GLOBAL_STORAGE_HOME = join(APP_SETTINGS_HOME, 'globalStorage'); -const GLOBAL_STORAGE_HOME = join(APP_SETTINGS_HOME, 'globalStorage');
-const LOCAL_HISTORY_HOME = join(APP_SETTINGS_HOME, 'History');
-const MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine'); -const MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine');
-args['user-data-dir'] = USER_DATA_PATH; -args['user-data-dir'] = USER_DATA_PATH;
-const APP_ROOT = dirname(FileAccess.asFileUri('', require).fsPath); -const APP_ROOT = dirname(FileAccess.asFileUri('', require).fsPath);
@ -42,7 +42,7 @@ Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
-args['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH; -args['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH;
-args['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions'); -args['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions');
- -
-[REMOTE_DATA_FOLDER, args['extensions-dir'], USER_DATA_PATH, APP_SETTINGS_HOME, MACHINE_SETTINGS_HOME, GLOBAL_STORAGE_HOME].forEach(f => { -[REMOTE_DATA_FOLDER, args['extensions-dir'], USER_DATA_PATH, APP_SETTINGS_HOME, MACHINE_SETTINGS_HOME, GLOBAL_STORAGE_HOME, LOCAL_HISTORY_HOME].forEach(f => {
- try { - try {
- if (!fs.existsSync(f)) { - if (!fs.existsSync(f)) {
- fs.mkdirSync(f, { mode: 0o700 }); - fs.mkdirSync(f, { mode: 0o700 });
@ -54,6 +54,7 @@ Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
+ const USER_DATA_PATH = args['user-data-dir'] || join(REMOTE_DATA_FOLDER, 'data'); + const USER_DATA_PATH = args['user-data-dir'] || join(REMOTE_DATA_FOLDER, 'data');
+ const APP_SETTINGS_HOME = join(USER_DATA_PATH, 'User'); + const APP_SETTINGS_HOME = join(USER_DATA_PATH, 'User');
+ const GLOBAL_STORAGE_HOME = join(APP_SETTINGS_HOME, 'globalStorage'); + const GLOBAL_STORAGE_HOME = join(APP_SETTINGS_HOME, 'globalStorage');
+ const LOCAL_HISTORY_HOME = join(APP_SETTINGS_HOME, 'History');
+ const MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine'); + const MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine');
+ args['user-data-dir'] = USER_DATA_PATH; + args['user-data-dir'] = USER_DATA_PATH;
+ const APP_ROOT = dirname(FileAccess.asFileUri('', require).fsPath); + const APP_ROOT = dirname(FileAccess.asFileUri('', require).fsPath);
@ -61,14 +62,14 @@ Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
+ args['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH; + args['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH;
+ args['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions'); + args['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions');
+ +
+ [REMOTE_DATA_FOLDER, args['extensions-dir'], USER_DATA_PATH, APP_SETTINGS_HOME, MACHINE_SETTINGS_HOME, GLOBAL_STORAGE_HOME].forEach(f => { + [REMOTE_DATA_FOLDER, args['extensions-dir'], USER_DATA_PATH, APP_SETTINGS_HOME, MACHINE_SETTINGS_HOME, GLOBAL_STORAGE_HOME, LOCAL_HISTORY_HOME].forEach(f => {
+ try { + try {
+ if (!fs.existsSync(f)) { + if (!fs.existsSync(f)) {
+ fs.mkdirSync(f, { mode: 0o700 }); + fs.mkdirSync(f, { mode: 0o700 });
+ } + }
+ } catch (err) { console.error(err); } + } catch (err) { console.error(err); }
+ }); + });
+ return REMOTE_DATA_FOLDER + return REMOTE_DATA_FOLDER;
+} +}
/** /**
@ -105,18 +106,22 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandl
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts +++ code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
@@ -144,11 +144,12 @@ export class BrowserDialogHandler implem @@ -143,12 +143,15 @@ export class BrowserDialogHandler implem
async about(): Promise<void> { async about(): Promise<void> {
const detailString = (useAgo: boolean): string => { const detailString = (useAgo: boolean): string => {
return localize('aboutDetail', - return localize('aboutDetail',
- "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}", - "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
+ "code-server: v{4}\nCode: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}", + return localize('aboutCodeServerDetail',
+ "code-server: {0}",
+ this.productService.codeServerVersion ? `v${this.productService.codeServerVersion}` : 'Unknown'
+ ) + '\n' + localize('aboutDetail',
+ "Code: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
this.productService.version || 'Unknown', this.productService.version || 'Unknown',
this.productService.commit || 'Unknown', this.productService.commit || 'Unknown',
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown', this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
- navigator.userAgent - navigator.userAgent
+ navigator.userAgent, + navigator.userAgent,
+ this.productService.codeServerVersion || 'Unknown'
); );
}; };
@ -175,10 +180,10 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/web.main.ts +++ code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
@@ -69,6 +69,7 @@ import { ICredentialsService } from 'vs/ @@ -69,6 +69,7 @@ import { IndexedDB } from 'vs/base/brows
import { IndexedDB } from 'vs/base/browser/indexedDB';
import { BrowserCredentialsService } from 'vs/workbench/services/credentials/browser/credentialsService'; import { BrowserCredentialsService } from 'vs/workbench/services/credentials/browser/credentialsService';
import { IWorkspace } from 'vs/workbench/services/host/browser/browserHostService'; import { IWorkspace } from 'vs/workbench/services/host/browser/browserHostService';
import { WebFileSystemAccess } from 'vs/platform/files/browser/webFileSystemAccess';
+import { CodeServerClient } from 'vs/workbench/browser/client'; +import { CodeServerClient } from 'vs/workbench/browser/client';
export class BrowserMain extends Disposable { export class BrowserMain extends Disposable {
@ -254,16 +259,15 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" /> <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="./static/out/vs/workbench/workbench.web.main.css"> <link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="./static/out/vs/workbench/workbench.web.main.css">
Index: code-server/lib/vscode/build/gulpfile.reh.js Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/build/gulpfile.reh.js --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/build/gulpfile.reh.js +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -365,7 +365,7 @@ function packageTask(type, platform, arc @@ -285,6 +285,7 @@ export class WebClientServer {
const minifyTask = task.define(`minify-vscode-${type}`, task.series( folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),
optimizeTask, workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),
util.rimraf(`out-vscode-${type}-min`), productConfiguration: <Partial<IProductConfiguration>>{
- common.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`) + codeServerVersion: this._productService.codeServerVersion,
+ common.minifyTask(`out-vscode-${type}`, ``) embedderIdentifier: 'server-distro',
)); extensionsGallery: this._webExtensionResourceUrlTemplate ? {
gulp.task(minifyTask); ...this._productService.extensionsGallery,

View File

@ -1,32 +0,0 @@
Remove last opened functionality
This conflicts with our own handling of the last opened workspace. If we wanted
to switch to this we would need to pass through the disable-last-opened flag and
respect it here then remove our own redirction code that handles this.
Our version might be better anyway since it puts the workspace in the URL.
Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
@@ -410,19 +410,6 @@ class WorkspaceProvider implements IWork
workspace = { folderUri: URI.revive(config.folderUri) };
} else if (config.workspaceUri) {
workspace = { workspaceUri: URI.revive(config.workspaceUri) };
- } else {
- workspace = (() => {
- const lastWorkspaceRaw = window.localStorage.getItem(WorkspaceProvider.LAST_WORKSPACE_STORAGE_KEY);
- if (lastWorkspaceRaw) {
- try {
- return parse(lastWorkspaceRaw); // use marshalling#parse() to revive potential URIs
- } catch (error) {
- // Ignore
- }
- }
-
- return undefined;
- })();
}
}

View File

@ -20,19 +20,19 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -289,6 +289,7 @@ export class WebClientServer { @@ -292,6 +292,7 @@ export class WebClientServer {
enableSmokeTestDriver: this._environmentService.driverHandle === 'web' ? true : undefined, enableSmokeTestDriver: this._environmentService.driverHandle === 'web' ? true : undefined,
logLevel: this._logService.getLevel(), logLevel: this._logService.getLevel(),
}, },
+ userDataPath: this._environmentService.userDataPath, + userDataPath: this._environmentService.userDataPath,
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
productConfiguration: <Partial<IProductConfiguration>>{ enableWorkspaceTrust: !this._environmentService.args['disable-workspace-trust'],
rootEndpoint: base, folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),
Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts +++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
@@ -205,6 +205,11 @@ export interface IWorkbenchConstructionO @@ -210,6 +210,11 @@ export interface IWorkbenchConstructionO
*/ */
readonly configurationDefaults?: Record<string, any>; readonly configurationDefaults?: Record<string, any>;
@ -48,11 +48,11 @@ 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
@@ -126,7 +126,14 @@ export class BrowserWorkbenchEnvironment @@ -52,7 +52,14 @@ export class BrowserWorkbenchEnvironment
get logFile(): URI { return joinPath(this.logsHome, 'window.log'); } get logFile(): URI { return joinPath(this.logsHome, 'window.log'); }
@memoize @memoize
- get userRoamingDataHome(): URI { return URI.file('/User').with({ scheme: Schemas.userData }); } - get userRoamingDataHome(): URI { return URI.file('/User').with({ scheme: Schemas.vscodeUserData }); }
+ get userRoamingDataHome(): URI { return joinPath(URI.file(this.userDataPath).with({ scheme: Schemas.vscodeRemote }), 'User'); } + get userRoamingDataHome(): URI { return joinPath(URI.file(this.userDataPath).with({ scheme: Schemas.vscodeRemote }), 'User'); }
+ +
+ get userDataPath(): string { + get userDataPath(): string {

View File

@ -7,7 +7,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -285,7 +285,10 @@ export class WebClientServer { @@ -288,7 +288,10 @@ export class WebClientServer {
remoteAuthority, remoteAuthority,
webviewEndpoint: vscodeBase + '/static/out/vs/workbench/contrib/webview/browser/pre', webviewEndpoint: vscodeBase + '/static/out/vs/workbench/contrib/webview/browser/pre',
_wrapWebWorkerExtHostInIframe, _wrapWebWorkerExtHostInIframe,
@ -17,5 +17,5 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
+ logLevel: this._logService.getLevel(), + logLevel: this._logService.getLevel(),
+ }, + },
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
productConfiguration: <Partial<IProductConfiguration>>{ enableWorkspaceTrust: !this._environmentService.args['disable-workspace-trust'],
rootEndpoint: base, folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),

View File

@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -88,6 +89,7 @@ export const serverOptions: OptionDescri @@ -92,6 +93,7 @@ export const serverOptions: OptionDescri
export interface ServerParsedArgs { export interface ServerParsedArgs {
/* ----- code-server ----- */ /* ----- code-server ----- */
'disable-update-check'?: boolean; 'disable-update-check'?: boolean;
@ -40,14 +40,14 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -287,6 +287,7 @@ export class WebClientServer { @@ -293,6 +293,7 @@ export class WebClientServer {
productConfiguration: <Partial<IProductConfiguration>>{ productConfiguration: <Partial<IProductConfiguration>>{
rootEndpoint: base, rootEndpoint: base,
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
+ logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined, + logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
extensionsGallery: { extensionsGallery: {
...this._productService.extensionsGallery,
'resourceUrlTemplate': this._webExtensionResourceUrlTemplate ? this._webExtensionResourceUrlTemplate.with({
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts

View File

@ -32,10 +32,10 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -285,14 +285,14 @@ export class WebClientServer { @@ -293,14 +293,14 @@ export class WebClientServer {
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
productConfiguration: <Partial<IProductConfiguration>>{
rootEndpoint: base, rootEndpoint: base,
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
- extensionsGallery: this._webExtensionResourceUrlTemplate ? { - extensionsGallery: this._webExtensionResourceUrlTemplate ? {
+ extensionsGallery: { + extensionsGallery: {
...this._productService.extensionsGallery, ...this._productService.extensionsGallery,

View File

@ -1,106 +0,0 @@
Patch the Node version to use the current version of Node
Previously it would use the yarnrc which results in builds that cannot run with
the version of Node they were built with because the native modules are
targeting the wrong version.
One way test this is to build in a fresh Docker container, run the build, then
try opening the built-in terminal.
Index: code-server/lib/vscode/build/gulpfile.reh.js
===================================================================
--- code-server.orig/lib/vscode/build/gulpfile.reh.js
+++ code-server/lib/vscode/build/gulpfile.reh.js
@@ -122,9 +122,7 @@ const serverWithWebEntryPoints = [
];
function getNodeVersion() {
- const yarnrc = fs.readFileSync(path.join(REPO_ROOT, 'remote', '.yarnrc'), 'utf8');
- const target = /^target "(.*)"$/m.exec(yarnrc)[1];
- return target;
+ return process.versions.node;
}
const nodeVersion = getNodeVersion();
Index: code-server/lib/vscode/build/lib/node.js
===================================================================
--- code-server.orig/lib/vscode/build/lib/node.js
+++ code-server/lib/vscode/build/lib/node.js
@@ -7,9 +7,7 @@ Object.defineProperty(exports, "__esModu
const path = require("path");
const fs = require("fs");
const root = path.dirname(path.dirname(__dirname));
-const yarnrcPath = path.join(root, 'remote', '.yarnrc');
-const yarnrc = fs.readFileSync(yarnrcPath, 'utf8');
-const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)[1];
+const version = process.versions.node;
const platform = process.platform;
const arch = platform === 'darwin' ? 'x64' : process.arch;
const node = platform === 'win32' ? 'node.exe' : 'node';
Index: code-server/lib/vscode/build/lib/node.ts
===================================================================
--- code-server.orig/lib/vscode/build/lib/node.ts
+++ code-server/lib/vscode/build/lib/node.ts
@@ -7,9 +7,7 @@ import * as path from 'path';
import * as fs from 'fs';
const root = path.dirname(path.dirname(__dirname));
-const yarnrcPath = path.join(root, 'remote', '.yarnrc');
-const yarnrc = fs.readFileSync(yarnrcPath, 'utf8');
-const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)![1];
+const version = process.versions.node;
const platform = process.platform;
const arch = platform === 'darwin' ? 'x64' : process.arch;
Index: code-server/lib/vscode/build/lib/util.js
===================================================================
--- code-server.orig/lib/vscode/build/lib/util.js
+++ code-server/lib/vscode/build/lib/util.js
@@ -298,9 +298,7 @@ function streamToPromise(stream) {
}
exports.streamToPromise = streamToPromise;
function getElectronVersion() {
- const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
- const target = /^target "(.*)"$/m.exec(yarnrc)[1];
- return target;
+ return process.versions.node;
}
exports.getElectronVersion = getElectronVersion;
function acquireWebNodePaths() {
Index: code-server/lib/vscode/build/lib/util.ts
===================================================================
--- code-server.orig/lib/vscode/build/lib/util.ts
+++ code-server/lib/vscode/build/lib/util.ts
@@ -371,9 +371,7 @@ export function streamToPromise(stream:
}
export function getElectronVersion(): string {
- const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
- const target = /^target "(.*)"$/m.exec(yarnrc)![1];
- return target;
+ return process.versions.node;
}
export function acquireWebNodePaths() {
@@ -455,4 +453,3 @@ export function buildWebNodePaths(outDir
result.taskName = 'build-web-node-paths';
return result;
}
-
Index: code-server/lib/vscode/remote/.yarnrc
===================================================================
--- code-server.orig/lib/vscode/remote/.yarnrc
+++ /dev/null
@@ -1,3 +0,0 @@
-disturl "http://nodejs.org/dist"
-target "14.16.0"
-runtime "node"
Index: code-server/lib/vscode/.yarnrc
===================================================================
--- code-server.orig/lib/vscode/.yarnrc
+++ /dev/null
@@ -1,4 +0,0 @@
-disturl "https://electronjs.org/headers"
-target "13.5.2"
-runtime "electron"
-build_from_source "true"

View File

@ -0,0 +1,24 @@
Remove parentOriginHash checko
This fixes webviews from not working properly due to a change upstream.
Upstream added a check to ensure parent authority is encoded into the webview
origin. Since our webview origin is the parent authority, we can bypass this
check.
Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js
+++ code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js
@@ -317,6 +317,12 @@ const hostMessaging = new class HostMess
const id = searchParams.get('id');
const hostname = location.hostname;
+
+ // It is safe to run if we are on the same host.
+ const parent = new URL(parentOrigin)
+ if (parent.hostname == location.hostname) {
+ return start(parentOrigin)
+ }
if (!crypto.subtle) {
// cannot validate, not running in a secure context

View File

@ -1,26 +0,0 @@
Replace rimraf with fs.rmSync in postinstall
The postinstall gets ran when you install with npm but rimraf is a development
dependency so it will not exist.
Index: code-server/lib/vscode/extensions/postinstall.js
===================================================================
--- code-server.orig/lib/vscode/extensions/postinstall.js
+++ code-server/lib/vscode/extensions/postinstall.js
@@ -8,7 +8,6 @@
const fs = require('fs');
const path = require('path');
-const rimraf = require('rimraf');
const root = path.join(__dirname, 'node_modules', 'typescript');
@@ -21,7 +20,7 @@ function processRoot() {
if (!toKeep.has(name)) {
const filePath = path.join(root, name);
console.log(`Removed ${filePath}`);
- rimraf.sync(filePath);
+ fs.rmSync(filePath, { recursive: true });
}
}
}

View File

@ -9,7 +9,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/extensions/common/abstra
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts --- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts
+++ code-server/lib/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts +++ code-server/lib/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts
@@ -1134,7 +1134,7 @@ class ProposedApiController { @@ -1471,7 +1471,7 @@ class ProposedApiController {
this._envEnabledExtensions = new Set((_environmentService.extensionEnabledProposedApi ?? []).map(id => ExtensionIdentifier.toKey(id))); this._envEnabledExtensions = new Set((_environmentService.extensionEnabledProposedApi ?? []).map(id => ExtensionIdentifier.toKey(id)));
@ -22,7 +22,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/extensions/common/extens
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts --- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts
+++ code-server/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts +++ code-server/lib/vscode/src/vs/workbench/services/extensions/common/extensions.ts
@@ -135,10 +135,7 @@ export interface IExtensionHost { @@ -163,10 +163,7 @@ export interface IExtensionHost {
} }
export function isProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): boolean { export function isProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): boolean {

View File

@ -68,14 +68,14 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -288,6 +288,7 @@ export class WebClientServer { @@ -294,6 +294,7 @@ export class WebClientServer {
rootEndpoint: base, rootEndpoint: base,
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined, logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
+ proxyEndpointTemplate: base + '/proxy/{{port}}', + proxyEndpointTemplate: base + '/proxy/{{port}}',
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
extensionsGallery: { extensionsGallery: {
...this._productService.extensionsGallery,
'resourceUrlTemplate': this._webExtensionResourceUrlTemplate ? this._webExtensionResourceUrlTemplate.with({
Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts

View File

@ -1,9 +1,9 @@
integration.diff integration.diff
node-version.diff
base-path.diff base-path.diff
proposed-api.diff proposed-api.diff
marketplace.diff marketplace.diff
webview.diff webview.diff
disable-builtin-ext-update.diff
insecure-notification.diff insecure-notification.diff
update-check.diff update-check.diff
logout.diff logout.diff
@ -12,9 +12,10 @@ proxy-uri.diff
display-language.diff display-language.diff
github-auth.diff github-auth.diff
unique-db.diff unique-db.diff
post-install.diff
log-level.diff log-level.diff
local-storage.diff local-storage.diff
service-worker.diff service-worker.diff
last-opened.diff
connection-type.diff connection-type.diff
sourcemaps.diff
disable-downloads.diff
telemetry.diff

View File

@ -21,10 +21,10 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -296,6 +296,10 @@ export class WebClientServer { @@ -304,6 +304,10 @@ export class WebClientServer {
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
proxyEndpointTemplate: base + '/proxy/{{port}}', proxyEndpointTemplate: base + '/proxy/{{port}}',
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
+ serviceWorker: { + serviceWorker: {
+ scope: vscodeBase + '/', + scope: vscodeBase + '/',
+ path: base + '/_static/out/browser/serviceWorker.js', + path: base + '/_static/out/browser/serviceWorker.js',

43
patches/sourcemaps.diff Normal file
View File

@ -0,0 +1,43 @@
Make sourcemaps self-hosted
Normally source maps get removed as part of the build process so prevent that
from happening. Also avoid using the windows.net host since obviously we can
not host our source maps there and want them to be self-hosted even if we could.
To test try debugging/browsing the source of a build in a browser.
Index: code-server/lib/vscode/build/gulpfile.reh.js
===================================================================
--- code-server.orig/lib/vscode/build/gulpfile.reh.js
+++ code-server/lib/vscode/build/gulpfile.reh.js
@@ -191,8 +191,7 @@ function packageTask(type, platform, arc
const src = gulp.src(sourceFolderName + '/**', { base: '.' })
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); }))
- .pipe(util.setExecutableBit(['**/*.sh']))
- .pipe(filter(['**', '!**/*.js.map']));
+ .pipe(util.setExecutableBit(['**/*.sh']));
const workspaceExtensionPoints = ['debuggers', 'jsonValidation'];
const isUIExtension = (manifest) => {
@@ -231,9 +230,9 @@ function packageTask(type, platform, arc
.map(name => `.build/extensions/${name}/**`);
const extensions = gulp.src(extensionPaths, { base: '.build', dot: true });
- const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true });
- const sources = es.merge(src, extensions, extensionsCommonDependencies)
+ const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true })
.pipe(filter(['**', '!**/*.js.map'], { dot: true }));
+ const sources = es.merge(src, extensions, extensionsCommonDependencies);
let version = packageJson.version;
const quality = product.quality;
@@ -368,7 +367,7 @@ function tweakProductForServerWeb(produc
const minifyTask = task.define(`minify-vscode-${type}`, task.series(
optimizeTask,
util.rimraf(`out-vscode-${type}-min`),
- common.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`)
+ common.minifyTask(`out-vscode-${type}`, '')
));
gulp.task(minifyTask);

View File

@ -3,6 +3,12 @@ Store a static reference to the IPC socket
This lets us use it to open files inside code-server from outside of This lets us use it to open files inside code-server from outside of
code-server. code-server.
To test this:
1. run code-server
2. open file outside of code-server i.e. `code-server <path-to-file`
It should open in your existing code-server instance.
Index: code-server/lib/vscode/src/vs/workbench/api/node/extHostExtensionService.ts Index: code-server/lib/vscode/src/vs/workbench/api/node/extHostExtensionService.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/api/node/extHostExtensionService.ts --- code-server.orig/lib/vscode/src/vs/workbench/api/node/extHostExtensionService.ts

212
patches/telemetry.diff Normal file
View File

@ -0,0 +1,212 @@
Add support for telemetry endpoint
Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverServices.ts
+++ code-server/lib/vscode/src/vs/server/node/serverServices.ts
@@ -68,6 +68,7 @@ import { REMOTE_TERMINAL_CHANNEL_NAME }
import { RemoteExtensionLogFileName } from 'vs/workbench/services/remote/common/remoteAgentService';
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from 'vs/workbench/services/remote/common/remoteFileSystemProviderClient';
import { ExtensionHostStatusService, IExtensionHostStatusService } from 'vs/server/node/extensionHostStatusService';
+import { TelemetryClient } from "vs/server/node/telemetryClient";
const eventPrefix = 'monacoworkbench';
@@ -120,7 +121,11 @@ export async function setupServerService
let appInsightsAppender: ITelemetryAppender = NullAppender;
const machineId = await getMachineId();
if (supportsTelemetry(productService, environmentService)) {
- if (productService.aiConfig && productService.aiConfig.asimovKey) {
+ const telemetryEndpoint = process.env.CS_TELEMETRY_URL || "https://v1.telemetry.coder.com/track";
+ if (telemetryEndpoint) {
+ appInsightsAppender = new AppInsightsAppender(eventPrefix, null, () => new TelemetryClient(telemetryEndpoint) as any);
+ disposables.add(toDisposable(() => appInsightsAppender!.flush())); // Ensure the AI appender is disposed so that it flushes remaining data
+ } else if (productService.aiConfig && productService.aiConfig.asimovKey) {
appInsightsAppender = new AppInsightsAppender(eventPrefix, null, productService.aiConfig.asimovKey);
disposables.add(toDisposable(() => appInsightsAppender!.flush())); // Ensure the AI appender is disposed so that it flushes remaining data
}
Index: code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
===================================================================
--- /dev/null
+++ code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
@@ -0,0 +1,135 @@
+import * as appInsights from 'applicationinsights';
+import * as https from 'https';
+import * as http from 'http';
+import * as os from 'os';
+
+class Channel {
+ public get _sender() {
+ throw new Error('unimplemented');
+ }
+ public get _buffer() {
+ throw new Error('unimplemented');
+ }
+
+ public setUseDiskRetryCaching(): void {
+ throw new Error('unimplemented');
+ }
+ public send(): void {
+ throw new Error('unimplemented');
+ }
+ public triggerSend(): void {
+ throw new Error('unimplemented');
+ }
+}
+
+// Unable to use implements because TypeScript tells you a private property is
+// missing but if you add it then it complains they have different private
+// properties. Uncommenting it during development can be helpful though to see
+// if anything is missing.
+export class TelemetryClient /* implements appInsights.TelemetryClient */ {
+ private _telemetryProcessors: any = undefined;
+ public context: any = undefined;
+ public commonProperties: any = undefined;
+ public config: any = {};
+ public quickPulseClient: any = undefined;
+
+ public channel: any = new Channel();
+
+ public constructor(private readonly endpoint: string) {
+ // Nothing to do.
+ }
+
+ public addTelemetryProcessor(): void {
+ throw new Error('unimplemented');
+ }
+
+ public clearTelemetryProcessors(): void {
+ if (this._telemetryProcessors) {
+ this._telemetryProcessors = undefined;
+ }
+ }
+
+ public runTelemetryProcessors(): void {
+ throw new Error('unimplemented');
+ }
+
+ public trackTrace(): void {
+ throw new Error('unimplemented');
+ }
+
+ public trackMetric(): void {
+ throw new Error('unimplemented');
+ }
+
+ public trackException(): void {
+ throw new Error('unimplemented');
+ }
+
+ public trackRequest(): void {
+ throw new Error('unimplemented');
+ }
+
+ public trackDependency(): void {
+ throw new Error('unimplemented');
+ }
+
+ public track(): void {
+ throw new Error('unimplemented');
+ }
+
+ public trackNodeHttpRequestSync(): void {
+ throw new Error('unimplemented');
+ }
+
+ public trackNodeHttpRequest(): void {
+ throw new Error('unimplemented');
+ }
+
+ public trackNodeHttpDependency(): void {
+ throw new Error('unimplemented');
+ }
+
+ public trackEvent(options: appInsights.Contracts.EventTelemetry): void {
+ if (!options.properties) {
+ options.properties = {};
+ }
+ if (!options.measurements) {
+ options.measurements = {};
+ }
+
+ try {
+ const cpus = os.cpus();
+ options.measurements.cores = cpus.length;
+ options.properties['common.cpuModel'] = cpus[0].model;
+ } catch (error) {}
+
+ try {
+ options.measurements.memoryFree = os.freemem();
+ options.measurements.memoryTotal = os.totalmem();
+ } catch (error) {}
+
+ try {
+ options.properties['common.shell'] = os.userInfo().shell;
+ options.properties['common.release'] = os.release();
+ options.properties['common.arch'] = os.arch();
+ } catch (error) {}
+
+ try {
+ const request = (/^http:/.test(this.endpoint) ? http : https).request(this.endpoint, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ });
+ request.on('error', () => { /* We don't care. */ });
+ request.write(JSON.stringify(options));
+ request.end();
+ } catch (error) {}
+ }
+
+ public flush(options: { callback: (v: string) => void }): void {
+ if (options.callback) {
+ options.callback('');
+ }
+ }
+}
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
@@ -304,6 +304,7 @@ export class WebClientServer {
logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
proxyEndpointTemplate: base + '/proxy/{{port}}',
codeServerVersion: this._productService.codeServerVersion,
+ enableTelemetry: this._productService.enableTelemetry,
embedderIdentifier: 'server-distro',
serviceWorker: {
scope: vscodeBase + '/',
Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/telemetryService.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/telemetry/browser/telemetryService.ts
+++ code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/telemetryService.ts
@@ -119,16 +119,19 @@ export class TelemetryService extends Di
) {
super();
- if (supportsTelemetry(productService, environmentService) && productService.aiConfig?.asimovKey) {
+ if (supportsTelemetry(productService, environmentService)) {
// If remote server is present send telemetry through that, else use the client side appender
- const telemetryProvider: ITelemetryAppender = remoteAgentService.getConnection() !== null ? { log: remoteAgentService.logTelemetry.bind(remoteAgentService), flush: remoteAgentService.flushTelemetry.bind(remoteAgentService) } : new WebAppInsightsAppender('monacoworkbench', productService.aiConfig?.asimovKey);
- const config: ITelemetryServiceConfig = {
- appenders: [new WebTelemetryAppender(telemetryProvider), new TelemetryLogAppender(loggerService, environmentService)],
- commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.remoteAuthority, productService.embedderIdentifier, productService.removeTelemetryMachineId, environmentService.options && environmentService.options.resolveCommonTelemetryProperties),
- sendErrorTelemetry: this.sendErrorTelemetry,
- };
-
- this.impl = this._register(new BaseTelemetryService(config, configurationService, productService));
+ const telemetryProvider: ITelemetryAppender | undefined = remoteAgentService.getConnection() !== null ? { log: remoteAgentService.logTelemetry.bind(remoteAgentService), flush: remoteAgentService.flushTelemetry.bind(remoteAgentService) } : productService.aiConfig?.asimovKey ? new WebAppInsightsAppender('monacoworkbench', productService.aiConfig?.asimovKey) : undefined;
+ if (telemetryProvider) {
+ const config: ITelemetryServiceConfig = {
+ appenders: [new WebTelemetryAppender(telemetryProvider), new TelemetryLogAppender(loggerService, environmentService)],
+ commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.remoteAuthority, productService.embedderIdentifier, productService.removeTelemetryMachineId, environmentService.options && environmentService.options.resolveCommonTelemetryProperties),
+ sendErrorTelemetry: this.sendErrorTelemetry,
+ };
+ this.impl = this._register(new BaseTelemetryService(config, configurationService, productService));
+ } else {
+ this.impl = NullTelemetryService;
+ }
} else {
this.impl = NullTelemetryService;
}

View File

@ -21,7 +21,7 @@ Index: code-server/lib/vscode/src/vs/platform/storage/browser/storageService.ts
@@ -13,6 +13,7 @@ import { InMemoryStorageDatabase, isStor @@ -13,6 +13,7 @@ import { InMemoryStorageDatabase, isStor
import { ILogService } from 'vs/platform/log/common/log'; import { ILogService } from 'vs/platform/log/common/log';
import { AbstractStorageService, IS_NEW_KEY, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { AbstractStorageService, IS_NEW_KEY, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { IWorkspaceInitializationPayload } from 'vs/platform/workspaces/common/workspaces'; import { IAnyWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
+import { hash } from 'vs/base/common/hash'; +import { hash } from 'vs/base/common/hash';
export class BrowserStorageService extends AbstractStorageService { export class BrowserStorageService extends AbstractStorageService {

View File

@ -3,6 +3,11 @@ Add a notification that lets you know when an update is out
The easiest way to test this is probably to change the version in your The easiest way to test this is probably to change the version in your
package.json and delete the last notification storage item. package.json and delete the last notification storage item.
1. change version in root `package.json`
2. Open DevTools > Application > Storage (top-level)
3. Click "Clear site data"
4. See update notification
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts
@ -100,14 +105,14 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -286,6 +286,7 @@ export class WebClientServer { @@ -292,6 +292,7 @@ export class WebClientServer {
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),
productConfiguration: <Partial<IProductConfiguration>>{ productConfiguration: <Partial<IProductConfiguration>>{
rootEndpoint: base, rootEndpoint: base,
+ updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined, + updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
codeServerVersion: this._productService.codeServerVersion,
embedderIdentifier: 'server-distro',
extensionsGallery: { extensionsGallery: {
...this._productService.extensionsGallery,
'resourceUrlTemplate': this._webExtensionResourceUrlTemplate ? this._webExtensionResourceUrlTemplate.with({
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts --- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
@ -121,7 +126,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -84,6 +86,8 @@ export const serverOptions: OptionDescri @@ -88,6 +90,8 @@ export const serverOptions: OptionDescri
}; };
export interface ServerParsedArgs { export interface ServerParsedArgs {

View File

@ -6,11 +6,25 @@ self-hosted.
When doing this CSP will block resources (for example when viewing images) so When doing this CSP will block resources (for example when viewing images) so
add 'self' to the CSP to fix that. add 'self' to the CSP to fix that.
Additionally the service worker defaults to handling *all* requests made to the
current host but when self-hosting the webview this will end up including the
webview HTML itself which means these requests will fail since the communication
channel between the webview and the main thread has not been set up yet as the
webview itself is not ready yet (it has no HTML and therefore no script either).
Since this code exists only for the authentication case we can just skip it when
it is served from the current host as authentication is not a problem if the
request is not cross-origin.
There is also an origin check we bypass (this seems to be related to how the
webview host is separate by default but we serve on the same host).
To test, open a few types of webviews (images, markdown, extension details, etc).
Index: code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts Index: code-server/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.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
@@ -240,7 +240,7 @@ export class BrowserWorkbenchEnvironment @@ -179,7 +179,7 @@ export class BrowserWorkbenchEnvironment
@memoize @memoize
get webviewExternalEndpoint(): string { get webviewExternalEndpoint(): string {
@ -23,7 +37,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -280,6 +280,7 @@ export class WebClientServer { @@ -283,6 +283,7 @@ export class WebClientServer {
const data = (await util.promisify(fs.readFile)(filePath)).toString() const data = (await util.promisify(fs.readFile)(filePath)).toString()
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({ .replace('{{WORKBENCH_WEB_CONFIGURATION}}', escapeAttribute(JSON.stringify({
remoteAuthority, remoteAuthority,
@ -31,11 +45,11 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
_wrapWebWorkerExtHostInIframe, _wrapWebWorkerExtHostInIframe,
developmentOptions: { enableSmokeTestDriver: this._environmentService.driverHandle === 'web' ? true : undefined }, developmentOptions: { enableSmokeTestDriver: this._environmentService.driverHandle === 'web' ? true : undefined },
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
Index: code-server/lib/vscode/src/vs/workbench/api/common/shared/webview.ts Index: code-server/lib/vscode/src/vs/workbench/common/webview.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/api/common/shared/webview.ts --- code-server.orig/lib/vscode/src/vs/workbench/common/webview.ts
+++ code-server/lib/vscode/src/vs/workbench/api/common/shared/webview.ts +++ code-server/lib/vscode/src/vs/workbench/common/webview.ts
@@ -25,7 +25,7 @@ export const webviewResourceBaseHost = ' @@ -22,7 +22,7 @@ export const webviewResourceBaseHost = '
export const webviewRootResourceAuthority = `vscode-resource.${webviewResourceBaseHost}`; export const webviewRootResourceAuthority = `vscode-resource.${webviewResourceBaseHost}`;
@ -44,3 +58,39 @@ Index: code-server/lib/vscode/src/vs/workbench/api/common/shared/webview.ts
/** /**
* Construct a uri that can load resources inside a webview * Construct a uri that can load resources inside a webview
Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/service-worker.js
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/service-worker.js
+++ code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/service-worker.js
@@ -188,9 +188,11 @@ sw.addEventListener('fetch', (event) =>
}
}
- // If we're making a request against the remote authority, we want to go
- // back through VS Code itself so that we are authenticated properly
- if (requestUrl.host === remoteAuthority) {
+ // If we're making a request against the remote authority, we want to go back
+ // through VS Code itself so that we are authenticated properly. If the
+ // service worker is hosted on the same origin we will have cookies and
+ // authentication will not be an issue.
+ if (requestUrl.origin !== sw.origin && requestUrl.host === remoteAuthority) {
switch (event.request.method) {
case 'GET':
case 'HEAD':
Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js
+++ code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js
@@ -318,6 +318,12 @@ const hostMessaging = new class HostMess
const hostname = location.hostname;
+ // It is safe to run if we are on the same host.
+ const parent = new URL(parentOrigin)
+ if (parent.hostname === location.hostname) {
+ return start(parentOrigin)
+ }
+
if (!crypto.subtle) {
// cannot validate, not running in a secure context
throw new Error(`Cannot validate in current context!`);

View File

@ -10,5 +10,6 @@
], ],
"vulnerabilityAlerts": { "vulnerabilityAlerts": {
"enabled": "true" "enabled": "true"
} },
"ignoreDeps": ["express"]
} }

View File

@ -1,12 +1,3 @@
/**
* Split a string up to the delimiter. If the delimiter doesn't exist the first
* item will have all the text and the second item will be an empty string.
*/
export const split = (str: string, delimiter: string): [string, string] => {
const index = str.indexOf(delimiter)
return index !== -1 ? [str.substring(0, index).trim(), str.substring(index + 1)] : [str, ""]
}
/** /**
* Appends an 's' to the provided string if count is greater than one; * Appends an 's' to the provided string if count is greater than one;
* otherwise the string is returned * otherwise the string is returned
@ -34,27 +25,6 @@ export const normalize = (url: string, keepTrailing = false): string => {
return url.replace(/\/\/+/g, "/").replace(/\/+$/, keepTrailing ? "/" : "") return url.replace(/\/\/+/g, "/").replace(/\/+$/, keepTrailing ? "/" : "")
} }
/**
* Remove leading and trailing slashes.
*/
export const trimSlashes = (url: string): string => {
return url.replace(/^\/+|\/+$/g, "")
}
/**
* Wrap the value in an array if it's not already an array. If the value is
* undefined return an empty array.
*/
export const arrayify = <T>(value?: T | T[]): T[] => {
if (Array.isArray(value)) {
return value
}
if (typeof value === "undefined") {
return []
}
return [value]
}
// TODO: Might make sense to add Error handling to the logger itself. // TODO: Might make sense to add Error handling to the logger itself.
export function logError(logger: { error: (msg: string) => void }, prefix: string, err: unknown): void { export function logError(logger: { error: (msg: string) => void }, prefix: string, err: unknown): void {
if (err instanceof Error) { if (err instanceof Error) {

View File

@ -94,36 +94,14 @@ export const ensureAddress = (server: http.Server, protocol: string): URL | stri
} }
if (typeof addr !== "string") { if (typeof addr !== "string") {
return new URL(`${protocol}://${addr.address}:${addr.port}`) const host = addr.family === "IPv6" ? `[${addr.address}]` : addr.address
return new URL(`${protocol}://${host}:${addr.port}`)
} }
// If this is a string then it is a pipe or Unix socket. // If this is a string then it is a pipe or Unix socket.
return addr return addr
} }
/**
* Handles error events from the server.
*
* If the outlying Promise didn't resolve
* then we reject with the error.
*
* Otherwise, we log the error.
*
* We extracted into a function so that we could
* test this logic more easily.
*/
export const handleServerError = (resolved: boolean, err: Error, reject: (err: Error) => void) => {
// Promise didn't resolve earlier so this means it's an error
// that occurs before the server can successfully listen.
// Possibly triggered by listening on an invalid port or socket.
if (!resolved) {
reject(err)
} else {
// Promise resolved earlier so this is an unrelated error.
util.logError(logger, "http server error", err)
}
}
/** /**
* Handles the error that occurs in the catch block * Handles the error that occurs in the catch block
* after we try fs.unlink(args.socket). * after we try fs.unlink(args.socket).

View File

@ -49,6 +49,7 @@ export interface UserProvidedCodeArgs {
category?: string category?: string
"github-auth"?: string "github-auth"?: string
"disable-update-check"?: boolean "disable-update-check"?: boolean
"disable-file-downloads"?: boolean
} }
/** /**
@ -157,6 +158,11 @@ export const options: Options<Required<UserProvidedArgs>> = {
"Disable update check. Without this flag, code-server checks every 6 hours against the latest github release and \n" + "Disable update check. Without this flag, code-server checks every 6 hours against the latest github release and \n" +
"then notifies you once every week that a new release is available.", "then notifies you once every week that a new release is available.",
}, },
"disable-file-downloads": {
type: "boolean",
description:
"Disable file downloads from Code. This can also be set with CS_DISABLE_FILE_DOWNLOADS set to 'true' or '1'.",
},
// --enable can be used to enable experimental features. These features // --enable can be used to enable experimental features. These features
// provide no guarantees. // provide no guarantees.
enable: { type: "string[]" }, enable: { type: "string[]" },
@ -537,6 +543,10 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
args.password = process.env.PASSWORD args.password = process.env.PASSWORD
} }
if (process.env.CS_DISABLE_FILE_DOWNLOADS?.match(/^(1|true)$/)) {
args["disable-file-downloads"] = true
}
const usingEnvHashedPassword = !!process.env.HASHED_PASSWORD const usingEnvHashedPassword = !!process.env.HASHED_PASSWORD
if (process.env.HASHED_PASSWORD) { if (process.env.HASHED_PASSWORD) {
args["hashed-password"] = process.env.HASHED_PASSWORD args["hashed-password"] = process.env.HASHED_PASSWORD

View File

@ -3,8 +3,6 @@ import type { JSONSchemaForNPMPackageJsonFiles } from "@schemastore/package"
import * as os from "os" import * as os from "os"
import * as path from "path" import * as path from "path"
export const WORKBENCH_WEB_CONFIG_ID = "vscode-workbench-web-configuration"
export function getPackageJson(relativePath: string): JSONSchemaForNPMPackageJsonFiles { export function getPackageJson(relativePath: string): JSONSchemaForNPMPackageJsonFiles {
let pkg = {} let pkg = {}
try { try {
@ -21,7 +19,6 @@ export const vsRootPath = path.join(rootPath, "lib/vscode")
const PACKAGE_JSON = "package.json" const PACKAGE_JSON = "package.json"
const pkg = getPackageJson(`${rootPath}/${PACKAGE_JSON}`) const pkg = getPackageJson(`${rootPath}/${PACKAGE_JSON}`)
const codePkg = getPackageJson(`${vsRootPath}/${PACKAGE_JSON}`) || { version: "0.0.0" } const codePkg = getPackageJson(`${vsRootPath}/${PACKAGE_JSON}`) || { version: "0.0.0" }
export const pkgName = pkg.name || "code-server"
export const version = pkg.version || "development" export const version = pkg.version || "development"
export const commit = pkg.commit || "development" export const commit = pkg.commit || "development"
export const codeVersion = codePkg.version || "development" export const codeVersion = codePkg.version || "development"

View File

@ -9,7 +9,10 @@ export class Heart {
private heartbeatInterval = 60000 private heartbeatInterval = 60000
public lastHeartbeat = 0 public lastHeartbeat = 0
public constructor(private readonly heartbeatPath: string, private readonly isActive: () => Promise<boolean>) {} public constructor(private readonly heartbeatPath: string, private readonly isActive: () => Promise<boolean>) {
this.beat = this.beat.bind(this)
this.alive = this.alive.bind(this)
}
public alive(): boolean { public alive(): boolean {
const now = Date.now() const now = Date.now()
@ -20,30 +23,22 @@ export class Heart {
* timeout and start or reset a timer that keeps running as long as there is * timeout and start or reset a timer that keeps running as long as there is
* activity. Failures are logged as warnings. * activity. Failures are logged as warnings.
*/ */
public beat(): void { public async beat(): Promise<void> {
if (this.alive()) { if (this.alive()) {
return return
} }
logger.trace("heartbeat") logger.trace("heartbeat")
fs.writeFile(this.heartbeatPath, "").catch((error) => {
logger.warn(error.message)
})
this.lastHeartbeat = Date.now() this.lastHeartbeat = Date.now()
if (typeof this.heartbeatTimer !== "undefined") { if (typeof this.heartbeatTimer !== "undefined") {
clearTimeout(this.heartbeatTimer) clearTimeout(this.heartbeatTimer)
} }
this.heartbeatTimer = setTimeout(() => { this.heartbeatTimer = setTimeout(() => heartbeatTimer(this.isActive, this.beat), this.heartbeatInterval)
this.isActive() try {
.then((active) => { return await fs.writeFile(this.heartbeatPath, "")
if (active) { } catch (error: any) {
this.beat()
}
})
.catch((error) => {
logger.warn(error.message) logger.warn(error.message)
}) }
}, this.heartbeatInterval)
} }
/** /**
@ -55,3 +50,20 @@ export class Heart {
} }
} }
} }
/**
* Helper function for the heartbeatTimer.
*
* If heartbeat is active, call beat. Otherwise do nothing.
*
* Extracted to make it easier to test.
*/
export async function heartbeatTimer(isActive: Heart["isActive"], beat: Heart["beat"]) {
try {
if (await isActive()) {
beat()
}
} catch (error: unknown) {
logger.warn((error as Error).message)
}
}

View File

@ -56,6 +56,8 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
// /healthz|/healthz/ needs to be excluded otherwise health checks will make // /healthz|/healthz/ needs to be excluded otherwise health checks will make
// it look like code-server is always in use. // it look like code-server is always in use.
if (!/^\/healthz\/?$/.test(req.url)) { if (!/^\/healthz\/?$/.test(req.url)) {
// NOTE@jsjoeio - intentionally not awaiting the .beat() call here because
// we don't want to slow down the request.
heart.beat() heart.beat()
} }

View File

@ -77,7 +77,7 @@ export class SocketProxyProvider {
this.proxyPipe = pipe this.proxyPipe = pipe
return Promise.all([ return Promise.all([
fs.mkdir(path.dirname(this.proxyPipe), { recursive: true }), fs.mkdir(path.dirname(this.proxyPipe), { recursive: true }),
fs.rmdir(this.proxyPipe, { recursive: true }), fs.rm(this.proxyPipe, { force: true, recursive: true }),
]) ])
}) })
.then(() => { .then(() => {

View File

@ -414,31 +414,6 @@ export const open = async (address: URL | string): Promise<void> => {
}) })
} }
/**
* For iterating over an enum's values.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const enumToArray = (t: any): string[] => {
const values = [] as string[]
for (const k in t) {
values.push(t[k])
}
return values
}
/**
* For displaying all allowed options in an enum.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const buildAllowedMessage = (t: any): string => {
const values = enumToArray(t)
return `Allowed value${values.length === 1 ? " is" : "s are"} ${values.map((t) => `'${t}'`).join(", ")}`
}
export const isObject = <T extends object>(obj: T): obj is T => {
return !Array.isArray(obj) && typeof obj === "object" && obj !== null
}
/** /**
* Return a promise that resolves with whether the socket path is active. * Return a promise that resolves with whether the socket path is active.
*/ */

View File

@ -203,8 +203,9 @@ class ChildProcess extends Process {
/** /**
* Parent process wrapper that spawns the child process and performs a handshake * Parent process wrapper that spawns the child process and performs a handshake
* with it. Will relaunch the child if it receives a SIGUSR1 or is asked to by * with it. Will relaunch the child if it receives a SIGUSR1 or SIGUSR2 or is
* the child. If the child otherwise exits the parent will also exit. * asked to by the child. If the child otherwise exits the parent will also
* exit.
*/ */
export class ParentProcess extends Process { export class ParentProcess extends Process {
public logger = logger.named(`parent:${process.pid}`) public logger = logger.named(`parent:${process.pid}`)
@ -227,6 +228,11 @@ export class ParentProcess extends Process {
this.relaunch() this.relaunch()
}) })
process.on("SIGUSR2", async () => {
this.logger.info("Received SIGUSR2; hotswapping")
this.relaunch()
})
const opts = { const opts = {
size: "10M", size: "10M",
maxFiles: 10, maxFiles: 10,

View File

@ -0,0 +1,48 @@
import { promises as fs } from "fs"
import * as path from "path"
import { clean } from "../utils/helpers"
import { describe, test, expect } from "./baseFixture"
describe("Downloads (enabled)", true, [], {}, async () => {
const testName = "downloads-enabled"
test.beforeAll(async () => {
await clean(testName)
})
test("should see the 'Download...' option", async ({ codeServerPage }) => {
// Setup
const workspaceDir = await codeServerPage.workspaceDir
const tmpFilePath = path.join(workspaceDir, "unique-file.txt")
await fs.writeFile(tmpFilePath, "hello world")
// Action
const fileInExplorer = await codeServerPage.page.waitForSelector("text=unique-file.txt")
await fileInExplorer.click({
button: "right",
})
expect(await codeServerPage.page.isVisible("text=Download...")).toBe(true)
})
})
describe("Downloads (disabled)", true, ["--disable-file-downloads"], {}, async () => {
const testName = "downloads-disabled"
test.beforeAll(async () => {
await clean(testName)
})
test("should not see the 'Download...' option", async ({ codeServerPage }) => {
// Setup
const workspaceDir = await codeServerPage.workspaceDir
const tmpFilePath = path.join(workspaceDir, "unique-file.txt")
await fs.writeFile(tmpFilePath, "hello world")
// Action
const fileInExplorer = await codeServerPage.page.waitForSelector("text=unique-file.txt")
await fileInExplorer.click({
button: "right",
})
expect(await codeServerPage.page.isVisible("text=Download...")).toBe(false)
})
})

View File

@ -81,6 +81,9 @@ export class CodeServer {
path.join(dir, "User/settings.json"), path.join(dir, "User/settings.json"),
JSON.stringify({ JSON.stringify({
"workbench.startupEditor": "none", "workbench.startupEditor": "none",
// NOTE@jsjoeio - needed to prevent Trust Policy prompt
// in end-to-end tests.
"security.workspace.trust.enabled": false,
}), }),
"utf8", "utf8",
) )
@ -134,7 +137,7 @@ export class CodeServer {
}) })
proc.on("close", (code) => { proc.on("close", (code) => {
const error = new Error("code-server closed unexpectedly") const error = new Error("code-server closed unexpectedly. Try running with LOG_LEVEL=debug to see more info.")
if (!this.closed) { if (!this.closed) {
this.logger.error(error.message, field("code", code)) this.logger.error(error.message, field("code", code))
} }

View File

@ -1,3 +1,4 @@
import { version } from "../../src/node/constants"
import { describe, test, expect } from "./baseFixture" import { describe, test, expect } from "./baseFixture"
describe("Open Help > About", true, [], {}, () => { describe("Open Help > About", true, [], {}, () => {
@ -5,8 +6,12 @@ describe("Open Help > About", true, [], {}, () => {
// Open using the menu. // Open using the menu.
await codeServerPage.navigateMenus(["Help", "About"]) await codeServerPage.navigateMenus(["Help", "About"])
const isDevMode = process.env.VSCODE_DEV === "1"
// Look for code-server info div. // Look for code-server info div.
const element = await codeServerPage.page.waitForSelector('div[role="dialog"] >> text=code-server') const element = await codeServerPage.page.waitForSelector(
`div[role="dialog"] >> text=code-server: ${isDevMode ? "Unknown" : "v" + version}`,
)
expect(element).not.toBeNull() expect(element).not.toBeNull()
}) })
}) })

View File

@ -24,16 +24,6 @@ describe("util", () => {
}) })
}) })
describe("split", () => {
it("should split at a comma", () => {
expect(util.split("Hello,world", ",")).toStrictEqual(["Hello", "world"])
})
it("shouldn't split if the delimiter doesn't exist", () => {
expect(util.split("Hello world", ",")).toStrictEqual(["Hello world", ""])
})
})
describe("plural", () => { describe("plural", () => {
it("should add an s if count is greater than 1", () => { it("should add an s if count is greater than 1", () => {
expect(util.plural(2, "dog")).toBe("dogs") expect(util.plural(2, "dog")).toBe("dogs")
@ -57,43 +47,6 @@ describe("util", () => {
}) })
}) })
describe("trimSlashes", () => {
it("should remove leading slashes", () => {
expect(util.trimSlashes("/hello-world")).toBe("hello-world")
})
it("should remove trailing slashes", () => {
expect(util.trimSlashes("hello-world/")).toBe("hello-world")
})
it("should remove both leading and trailing slashes", () => {
expect(util.trimSlashes("/hello-world/")).toBe("hello-world")
})
it("should remove multiple leading and trailing slashes", () => {
expect(util.trimSlashes("///hello-world////")).toBe("hello-world")
})
})
describe("arrayify", () => {
it("should return value it's already an array", () => {
expect(util.arrayify(["hello", "world"])).toStrictEqual(["hello", "world"])
})
it("should wrap the value in an array if not an array", () => {
expect(
util.arrayify({
name: "Coder",
version: "3.8",
}),
).toStrictEqual([{ name: "Coder", version: "3.8" }])
})
it("should return an empty array if the value is undefined", () => {
expect(util.arrayify(undefined)).toStrictEqual([])
})
})
describe("logError", () => { describe("logError", () => {
beforeAll(() => { beforeAll(() => {
mockLogger() mockLogger()

View File

@ -3,7 +3,7 @@ import { promises } from "fs"
import * as http from "http" import * as http from "http"
import * as https from "https" import * as https from "https"
import * as path from "path" import * as path from "path"
import { createApp, ensureAddress, handleArgsSocketCatchError, handleServerError, listen } from "../../../src/node/app" import { createApp, ensureAddress, handleArgsSocketCatchError, listen } from "../../../src/node/app"
import { OptionalString, setDefaults } from "../../../src/node/cli" import { OptionalString, setDefaults } from "../../../src/node/cli"
import { generateCertificate } from "../../../src/node/util" import { generateCertificate } from "../../../src/node/util"
import { clean, mockLogger, getAvailablePort, tmpdir } from "../../utils/helpers" import { clean, mockLogger, getAvailablePort, tmpdir } from "../../utils/helpers"
@ -152,42 +152,20 @@ describe("ensureAddress", () => {
it("should throw and error if no address", () => { it("should throw and error if no address", () => {
expect(() => ensureAddress(mockServer, "http")).toThrow("Server has no address") expect(() => ensureAddress(mockServer, "http")).toThrow("Server has no address")
}) })
it("should return the address if it exists", async () => { it("should return the address if it's a string", async () => {
mockServer.address = () => "http://localhost:8080/" mockServer.address = () => "/path/to/unix.sock"
const address = ensureAddress(mockServer, "http") const address = ensureAddress(mockServer, "http")
expect(address.toString()).toBe(`http://localhost:8080/`) expect(address.toString()).toBe(`/path/to/unix.sock`)
}) })
it("should construct URL with an IPv4 address", async () => {
mockServer.address = () => ({ address: "1.2.3.4", port: 5678, family: "IPv4" })
const address = ensureAddress(mockServer, "http")
expect(address.toString()).toBe(`http://1.2.3.4:5678/`)
}) })
it("should construct URL with an IPv6 address", async () => {
describe("handleServerError", () => { mockServer.address = () => ({ address: "a:b:c:d::1234", port: 5678, family: "IPv6" })
beforeAll(() => { const address = ensureAddress(mockServer, "http")
mockLogger() expect(address.toString()).toBe(`http://[a:b:c:d::1234]:5678/`)
})
afterEach(() => {
jest.clearAllMocks()
})
it("should call reject if resolved is false", async () => {
const resolved = false
const reject = jest.fn((err: Error) => undefined)
const error = new Error("handleServerError Error")
handleServerError(resolved, error, reject)
expect(reject).toHaveBeenCalledTimes(1)
expect(reject).toHaveBeenCalledWith(error)
})
it("should log an error if resolved is true", async () => {
const resolved = true
const reject = jest.fn((err: Error) => undefined)
const error = new Error("handleServerError Error")
handleServerError(resolved, error, reject)
expect(logger.error).toHaveBeenCalledTimes(1)
expect(logger.error).toHaveBeenCalledWith(`http server error: ${error.message} ${error.stack}`)
}) })
}) })

View File

@ -42,6 +42,7 @@ describe("parser", () => {
beforeEach(() => { beforeEach(() => {
delete process.env.LOG_LEVEL delete process.env.LOG_LEVEL
delete process.env.PASSWORD delete process.env.PASSWORD
delete process.env.CS_DISABLE_FILE_DOWNLOADS
console.log = jest.fn() console.log = jest.fn()
}) })
@ -92,6 +93,8 @@ describe("parser", () => {
"--port=8081", "--port=8081",
"--disable-file-downloads",
["--host", "0.0.0.0"], ["--host", "0.0.0.0"],
"4", "4",
"--", "--",
@ -108,6 +111,7 @@ describe("parser", () => {
cert: { cert: {
value: path.resolve("path/to/cert"), value: path.resolve("path/to/cert"),
}, },
"disable-file-downloads": true,
enable: ["feature1", "feature2"], enable: ["feature1", "feature2"],
help: true, help: true,
host: "0.0.0.0", host: "0.0.0.0",
@ -346,6 +350,30 @@ describe("parser", () => {
expect(process.env.GITHUB_TOKEN).toBe(undefined) expect(process.env.GITHUB_TOKEN).toBe(undefined)
}) })
it("should use env var CS_DISABLE_FILE_DOWNLOADS", async () => {
process.env.CS_DISABLE_FILE_DOWNLOADS = "1"
const args = parse([])
expect(args).toEqual({})
const defaultArgs = await setDefaults(args)
expect(defaultArgs).toEqual({
...defaults,
"disable-file-downloads": true,
})
})
it("should use env var CS_DISABLE_FILE_DOWNLOADS set to true", async () => {
process.env.CS_DISABLE_FILE_DOWNLOADS = "true"
const args = parse([])
expect(args).toEqual({})
const defaultArgs = await setDefaults(args)
expect(defaultArgs).toEqual({
...defaults,
"disable-file-downloads": true,
})
})
it("should error if password passed in", () => { it("should error if password passed in", () => {
expect(() => parse(["--password", "supersecret123"])).toThrowError( expect(() => parse(["--password", "supersecret123"])).toThrowError(
"--password can only be set in the config file or passed in via $PASSWORD", "--password can only be set in the config file or passed in via $PASSWORD",
@ -430,7 +458,7 @@ describe("cli", () => {
beforeEach(async () => { beforeEach(async () => {
delete process.env.VSCODE_IPC_HOOK_CLI delete process.env.VSCODE_IPC_HOOK_CLI
await fs.rmdir(vscodeIpcPath, { recursive: true }) await fs.rm(vscodeIpcPath, { force: true, recursive: true })
}) })
it("should use existing if inside code-server", async () => { it("should use existing if inside code-server", async () => {

View File

@ -34,10 +34,6 @@ describe("constants", () => {
jest.resetModules() jest.resetModules()
}) })
it("should provide the package name", () => {
expect(constants.pkgName).toBe(mockPackageJson.name)
})
it("should provide the commit", () => { it("should provide the commit", () => {
expect(constants.commit).toBe(mockPackageJson.commit) expect(constants.commit).toBe(mockPackageJson.commit)
}) })

View File

@ -0,0 +1,112 @@
import { logger } from "@coder/logger"
import { readFile, writeFile, stat, utimes } from "fs/promises"
import { Heart, heartbeatTimer } from "../../../src/node/heart"
import { clean, mockLogger, tmpdir } from "../../utils/helpers"
const mockIsActive = (resolveTo: boolean) => jest.fn().mockResolvedValue(resolveTo)
describe("Heart", () => {
const testName = "heartTests"
let testDir = ""
let heart: Heart
beforeAll(async () => {
mockLogger()
await clean(testName)
testDir = await tmpdir(testName)
})
beforeEach(() => {
heart = new Heart(`${testDir}/shutdown.txt`, mockIsActive(true))
})
afterAll(() => {
jest.restoreAllMocks()
})
afterEach(() => {
jest.resetAllMocks()
jest.useRealTimers()
if (heart) {
heart.dispose()
}
})
it("should write to a file when given a valid file path", async () => {
// Set up heartbeat file with contents
const text = "test"
const pathToFile = `${testDir}/file.txt`
await writeFile(pathToFile, text)
const fileContents = await readFile(pathToFile, { encoding: "utf8" })
// Explicitly set the modified time to 0 so that we can check
// that the file was indeed modified after calling heart.beat().
// This works around any potential race conditions.
// Docs: https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime
await utimes(pathToFile, 0, 0)
expect(fileContents).toBe(text)
heart = new Heart(pathToFile, mockIsActive(true))
await heart.beat()
// Check that the heart wrote to the heartbeatFilePath and overwrote our text
const fileContentsAfterBeat = await readFile(pathToFile, { encoding: "utf8" })
expect(fileContentsAfterBeat).not.toBe(text)
// Make sure the modified timestamp was updated.
const fileStatusAfterEdit = await stat(pathToFile)
expect(fileStatusAfterEdit.mtimeMs).toBeGreaterThan(0)
})
it("should log a warning when given an invalid file path", async () => {
heart = new Heart(`fakeDir/fake.txt`, mockIsActive(false))
await heart.beat()
expect(logger.warn).toHaveBeenCalled()
})
it("should be active after calling beat", async () => {
await heart.beat()
const isAlive = heart.alive()
expect(isAlive).toBe(true)
})
it("should not be active after dispose is called", () => {
heart.dispose()
const isAlive = heart.alive()
expect(isAlive).toBe(false)
})
it("should beat twice without warnings", async () => {
// Use fake timers so we can speed up setTimeout
jest.useFakeTimers()
heart = new Heart(`${testDir}/hello.txt`, mockIsActive(true))
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()
expect(logger.warn).not.toHaveBeenCalled()
})
})
describe("heartbeatTimer", () => {
beforeAll(() => {
mockLogger()
})
afterAll(() => {
jest.restoreAllMocks()
})
afterEach(() => {
jest.resetAllMocks()
})
it("should call beat when isActive resolves to true", async () => {
const isActive = true
const mockIsActive = jest.fn().mockResolvedValue(isActive)
const mockBeatFn = jest.fn()
await heartbeatTimer(mockIsActive, mockBeatFn)
expect(mockIsActive).toHaveBeenCalled()
expect(mockBeatFn).toHaveBeenCalled()
})
it("should log a warning when isActive rejects", async () => {
const errorMsg = "oh no"
const error = new Error(errorMsg)
const mockIsActive = jest.fn().mockRejectedValue(error)
const mockBeatFn = jest.fn()
await heartbeatTimer(mockIsActive, mockBeatFn)
expect(mockIsActive).toHaveBeenCalled()
expect(mockBeatFn).not.toHaveBeenCalled()
expect(logger.warn).toHaveBeenCalledWith(errorMsg)
})
})

View File

@ -38,6 +38,7 @@ describe("plugin", () => {
"proxy-domain": [], "proxy-domain": [],
config: "~/.config/code-server/config.yaml", config: "~/.config/code-server/config.yaml",
verbose: false, verbose: false,
"disable-file-downloads": false,
usingEnvPassword: false, usingEnvPassword: false,
usingEnvHashedPassword: false, usingEnvHashedPassword: false,
"extensions-dir": "", "extensions-dir": "",

View File

@ -53,7 +53,7 @@ describe("SocketProxyProvider", () => {
await fs.mkdir(path.join(tmpdir, "tests"), { recursive: true }) await fs.mkdir(path.join(tmpdir, "tests"), { recursive: true })
const socketPath = await provider.findFreeSocketPath(path.join(tmpdir, "tests/tls-socket-proxy")) const socketPath = await provider.findFreeSocketPath(path.join(tmpdir, "tests/tls-socket-proxy"))
await fs.rmdir(socketPath, { recursive: true }) await fs.rm(socketPath, { force: true, recursive: true })
return new Promise<void>((_resolve) => { return new Promise<void>((_resolve) => {
const resolved: { [key: string]: boolean } = { client: false, server: false } const resolved: { [key: string]: boolean } = { client: false, server: false }

View File

@ -131,7 +131,8 @@ describe("update", () => {
await expect(settings().read()).resolves.toEqual({ update }) await expect(settings().read()).resolves.toEqual({ update })
expect(isNaN(update.checked)).toEqual(false) expect(isNaN(update.checked)).toEqual(false)
expect(update.checked < Date.now() && update.checked >= now).toEqual(true) expect(update.checked).toBeGreaterThanOrEqual(now)
expect(update.checked).toBeLessThanOrEqual(Date.now())
expect(update.version).toStrictEqual("2.1.0") expect(update.version).toStrictEqual("2.1.0")
expect(spy).toEqual(["/latest"]) expect(spy).toEqual(["/latest"])
}) })
@ -145,7 +146,7 @@ describe("update", () => {
await expect(settings().read()).resolves.toEqual({ update }) await expect(settings().read()).resolves.toEqual({ update })
expect(isNaN(update.checked)).toStrictEqual(false) expect(isNaN(update.checked)).toStrictEqual(false)
expect(update.checked < now).toBe(true) expect(update.checked).toBeLessThanOrEqual(now)
expect(update.version).toStrictEqual("2.1.0") expect(update.version).toStrictEqual("2.1.0")
expect(spy).toEqual([]) expect(spy).toEqual([])
}) })
@ -159,7 +160,8 @@ describe("update", () => {
await expect(settings().read()).resolves.toEqual({ update }) await expect(settings().read()).resolves.toEqual({ update })
expect(isNaN(update.checked)).toStrictEqual(false) expect(isNaN(update.checked)).toStrictEqual(false)
expect(update.checked < Date.now() && update.checked >= now).toStrictEqual(true) expect(update.checked).toBeGreaterThanOrEqual(now)
expect(update.checked).toBeLessThanOrEqual(Date.now())
expect(update.version).toStrictEqual("4.1.1") expect(update.version).toStrictEqual("4.1.1")
expect(spy).toStrictEqual(["/latest"]) expect(spy).toStrictEqual(["/latest"])
}) })
@ -204,14 +206,16 @@ describe("update", () => {
let now = Date.now() let now = Date.now()
let update = await provider.getUpdate(true) let update = await provider.getUpdate(true)
expect(isNaN(update.checked)).toStrictEqual(false) expect(isNaN(update.checked)).toStrictEqual(false)
expect(update.checked < Date.now() && update.checked >= now).toEqual(true) expect(update.checked).toBeGreaterThanOrEqual(now)
expect(update.checked).toBeLessThanOrEqual(Date.now())
expect(update.version).toStrictEqual("unknown") expect(update.version).toStrictEqual("unknown")
provider = new UpdateProvider("http://probably.invalid.dev.localhost/latest", settings()) provider = new UpdateProvider("http://probably.invalid.dev.localhost/latest", settings())
now = Date.now() now = Date.now()
update = await provider.getUpdate(true) update = await provider.getUpdate(true)
expect(isNaN(update.checked)).toStrictEqual(false) expect(isNaN(update.checked)).toStrictEqual(false)
expect(update.checked < Date.now() && update.checked >= now).toEqual(true) expect(update.checked).toBeGreaterThanOrEqual(now)
expect(update.checked).toBeLessThanOrEqual(Date.now())
expect(update.version).toStrictEqual("unknown") expect(update.version).toStrictEqual("unknown")
}) })

View File

@ -446,6 +446,9 @@ describe("isFile", () => {
it("should return true if is file", async () => { it("should return true if is file", async () => {
expect(await util.isFile(pathToFile)).toBe(true) expect(await util.isFile(pathToFile)).toBe(true)
}) })
it("should return false if error", async () => {
expect(await util.isFile("fakefile.txt")).toBe(false)
})
}) })
describe("humanPath", () => { describe("humanPath", () => {

View File

@ -29,7 +29,7 @@ export function mockLogger() {
*/ */
export async function clean(testName: string): Promise<void> { export async function clean(testName: string): Promise<void> {
const dir = path.join(os.tmpdir(), `code-server/tests/${testName}`) const dir = path.join(os.tmpdir(), `code-server/tests/${testName}`)
await fs.rmdir(dir, { recursive: true }) await fs.rm(dir, { force: true, recursive: true })
} }
/** /**

138
yarn.lock
View File

@ -507,13 +507,14 @@
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@typescript-eslint/eslint-plugin@^5.0.0": "@typescript-eslint/eslint-plugin@^5.23.0":
version "5.2.0" version "5.23.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.2.0.tgz#2bdb247cc2e2afce7efbce09afb9a6f0a8a08434" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.23.0.tgz#bc4cbcf91fbbcc2e47e534774781b82ae25cc3d8"
integrity sha512-qQwg7sqYkBF4CIQSyRQyqsYvP+g/J0To9ZPVNJpfxfekl5RmdvQnFFTVVwpRtaUDFNvjfe/34TgY/dpc3MgNTw== integrity sha512-hEcSmG4XodSLiAp1uxv/OQSGsDY6QN3TcRU32gANp+19wGE1QQZLRS8/GV58VRUoXhnkuJ3ZxNQ3T6Z6zM59DA==
dependencies: dependencies:
"@typescript-eslint/experimental-utils" "5.2.0" "@typescript-eslint/scope-manager" "5.23.0"
"@typescript-eslint/scope-manager" "5.2.0" "@typescript-eslint/type-utils" "5.23.0"
"@typescript-eslint/utils" "5.23.0"
debug "^4.3.2" debug "^4.3.2"
functional-red-black-tree "^1.0.1" functional-red-black-tree "^1.0.1"
ignore "^5.1.8" ignore "^5.1.8"
@ -521,60 +522,69 @@
semver "^7.3.5" semver "^7.3.5"
tsutils "^3.21.0" tsutils "^3.21.0"
"@typescript-eslint/experimental-utils@5.2.0": "@typescript-eslint/parser@^5.23.0":
version "5.2.0" version "5.23.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.2.0.tgz#e3b2cb9cd0aff9b50f68d9a414c299fd26b067e6" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.23.0.tgz#443778e1afc9a8ff180f91b5e260ac3bec5e2de1"
integrity sha512-fWyT3Agf7n7HuZZRpvUYdFYbPk3iDCq6fgu3ulia4c7yxmPnwVBovdSOX7RL+k8u6hLbrXcdAehlWUVpGh6IEw== integrity sha512-V06cYUkqcGqpFjb8ttVgzNF53tgbB/KoQT/iB++DOIExKmzI9vBJKjZKt/6FuV9c+zrDsvJKbJ2DOCYwX91cbw==
dependencies: dependencies:
"@types/json-schema" "^7.0.9" "@typescript-eslint/scope-manager" "5.23.0"
"@typescript-eslint/scope-manager" "5.2.0" "@typescript-eslint/types" "5.23.0"
"@typescript-eslint/types" "5.2.0" "@typescript-eslint/typescript-estree" "5.23.0"
"@typescript-eslint/typescript-estree" "5.2.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
"@typescript-eslint/parser@^5.0.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.2.0.tgz#dc081aa89de16b5676b10215519af3aa7b58fb72"
integrity sha512-Uyy4TjJBlh3NuA8/4yIQptyJb95Qz5PX//6p8n7zG0QnN4o3NF9Je3JHbVU7fxf5ncSXTmnvMtd/LDQWDk0YqA==
dependencies:
"@typescript-eslint/scope-manager" "5.2.0"
"@typescript-eslint/types" "5.2.0"
"@typescript-eslint/typescript-estree" "5.2.0"
debug "^4.3.2" debug "^4.3.2"
"@typescript-eslint/scope-manager@5.2.0": "@typescript-eslint/scope-manager@5.23.0":
version "5.2.0" version "5.23.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.2.0.tgz#7ce8e4ab2baaa0ad5282913ea8e13ce03ec6a12a" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.23.0.tgz#4305e61c2c8e3cfa3787d30f54e79430cc17ce1b"
integrity sha512-RW+wowZqPzQw8MUFltfKYZfKXqA2qgyi6oi/31J1zfXJRpOn6tCaZtd9b5u9ubnDG2n/EMvQLeZrsLNPpaUiFQ== integrity sha512-EhjaFELQHCRb5wTwlGsNMvzK9b8Oco4aYNleeDlNuL6qXWDF47ch4EhVNPh8Rdhf9tmqbN4sWDk/8g+Z/J8JVw==
dependencies: dependencies:
"@typescript-eslint/types" "5.2.0" "@typescript-eslint/types" "5.23.0"
"@typescript-eslint/visitor-keys" "5.2.0" "@typescript-eslint/visitor-keys" "5.23.0"
"@typescript-eslint/types@5.2.0": "@typescript-eslint/type-utils@5.23.0":
version "5.2.0" version "5.23.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.2.0.tgz#7ad32d15abddb0ee968a330f0ea182ea544ef7cf" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.23.0.tgz#f852252f2fc27620d5bb279d8fed2a13d2e3685e"
integrity sha512-cTk6x08qqosps6sPyP2j7NxyFPlCNsJwSDasqPNjEQ8JMD5xxj2NHxcLin5AJQ8pAVwpQ8BMI3bTxR0zxmK9qQ== integrity sha512-iuI05JsJl/SUnOTXA9f4oI+/4qS/Zcgk+s2ir+lRmXI+80D8GaGwoUqs4p+X+4AxDolPpEpVUdlEH4ADxFy4gw==
"@typescript-eslint/typescript-estree@5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.2.0.tgz#c22e0ff6f8a4a3f78504a80ebd686fe2870a68ae"
integrity sha512-RsdXq2XmVgKbm9nLsE3mjNUM7BTr/K4DYR9WfFVMUuozHWtH5gMpiNZmtrMG8GR385EOSQ3kC9HiEMJWimxd/g==
dependencies: dependencies:
"@typescript-eslint/types" "5.2.0" "@typescript-eslint/utils" "5.23.0"
"@typescript-eslint/visitor-keys" "5.2.0" debug "^4.3.2"
tsutils "^3.21.0"
"@typescript-eslint/types@5.23.0":
version "5.23.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.23.0.tgz#8733de0f58ae0ed318dbdd8f09868cdbf9f9ad09"
integrity sha512-NfBsV/h4dir/8mJwdZz7JFibaKC3E/QdeMEDJhiAE3/eMkoniZ7MjbEMCGXw6MZnZDMN3G9S0mH/6WUIj91dmw==
"@typescript-eslint/typescript-estree@5.23.0":
version "5.23.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.23.0.tgz#dca5f10a0a85226db0796e8ad86addc9aee52065"
integrity sha512-xE9e0lrHhI647SlGMl+m+3E3CKPF1wzvvOEWnuE3CCjjT7UiRnDGJxmAcVKJIlFgK6DY9RB98eLr1OPigPEOGg==
dependencies:
"@typescript-eslint/types" "5.23.0"
"@typescript-eslint/visitor-keys" "5.23.0"
debug "^4.3.2" debug "^4.3.2"
globby "^11.0.4" globby "^11.0.4"
is-glob "^4.0.3" is-glob "^4.0.3"
semver "^7.3.5" semver "^7.3.5"
tsutils "^3.21.0" tsutils "^3.21.0"
"@typescript-eslint/visitor-keys@5.2.0": "@typescript-eslint/utils@5.23.0":
version "5.2.0" version "5.23.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.2.0.tgz#03522d35df98474f08e0357171a7d1b259a88f55" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.23.0.tgz#4691c3d1b414da2c53d8943310df36ab1c50648a"
integrity sha512-Nk7HizaXWWCUBfLA/rPNKMzXzWS8Wg9qHMuGtT+v2/YpPij4nVXrVJc24N/r5WrrmqK31jCrZxeHqIgqRzs0Xg== integrity sha512-dbgaKN21drqpkbbedGMNPCtRPZo1IOUr5EI9Jrrh99r5UW5Q0dz46RKXeSBoPV+56R6dFKpbrdhgUNSJsDDRZA==
dependencies: dependencies:
"@typescript-eslint/types" "5.2.0" "@types/json-schema" "^7.0.9"
"@typescript-eslint/scope-manager" "5.23.0"
"@typescript-eslint/types" "5.23.0"
"@typescript-eslint/typescript-estree" "5.23.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
"@typescript-eslint/visitor-keys@5.23.0":
version "5.23.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.23.0.tgz#057c60a7ca64667a39f991473059377a8067c87b"
integrity sha512-Vd4mFNchU62sJB8pX19ZSPog05B0Y0CE2UxAZPT5k4iqhRYjPnqyY3woMxCd0++t9OTqkgjST+1ydLBi7e2Fvg==
dependencies:
"@typescript-eslint/types" "5.23.0"
eslint-visitor-keys "^3.0.0" eslint-visitor-keys "^3.0.0"
"@yarnpkg/lockfile@^1.1.0": "@yarnpkg/lockfile@^1.1.0":
@ -2926,10 +2936,10 @@ minimist-options@4.1.0:
is-plain-obj "^1.1.0" is-plain-obj "^1.1.0"
kind-of "^6.0.3" kind-of "^6.0.3"
minimist@^1.2.0, minimist@^1.2.5, "minimist@npm:minimist-lite@2.2.0", minimist@~1.2.5: minimist@^1.2.0, minimist@^1.2.5, "minimist@npm:minimist-lite@2.2.1", minimist@~1.2.5:
version "2.2.0" version "2.2.1"
resolved "https://registry.yarnpkg.com/minimist-lite/-/minimist-lite-2.2.0.tgz#43992acac6bb17e78acb6eee784d1da2f7cc3216" resolved "https://registry.yarnpkg.com/minimist-lite/-/minimist-lite-2.2.1.tgz#abb71db2c9b454d7cf4496868c03e9802de9934d"
integrity sha512-o9M0Iz5ELqCT4NzeaZHBBlV4+ruOGGWV6lVxFoghC6Wvp4W6ECbBBpmDRHdk72O/sMh3QT0c/0XDKhtGlztRZw== integrity sha512-RSrWIRWGYoM2TDe102s7aIyeSipXMIXKb1fSHYx1tAbxAV0z4g2xR6ra3oPzkTqFb0EIUz1H3A/qvYYeDd+/qQ==
minipass@^3.0.0: minipass@^3.0.0:
version "3.1.3" version "3.1.3"
@ -2971,10 +2981,10 @@ ms@^2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
mvdan-sh@^0.5.0: mvdan-sh@^0.10.1:
version "0.5.0" version "0.10.1"
resolved "https://registry.yarnpkg.com/mvdan-sh/-/mvdan-sh-0.5.0.tgz#fa76f611a103595ad0f04f5d18e582892c46e87c" resolved "https://registry.yarnpkg.com/mvdan-sh/-/mvdan-sh-0.10.1.tgz#5b3a4462a89cf20739b12d851589342c875f4d1f"
integrity sha512-UWbdl4LHd2fUnaEcOUFVWRdWGLkNoV12cKVIPiirYd8qM5VkCoCTXErlDubevrkEG7kGohvjRxAlTQmOqG80tw== integrity sha512-kMbrH0EObaKmK3nVRKUIIya1dpASHIEusM13S4V1ViHFuxuNxCo+arxoa6j/dbV22YBGjl7UKJm9QQKJ2Crzhg==
nanoid@^3.1.23, nanoid@^3.1.31: nanoid@^3.1.23, nanoid@^3.1.31:
version "3.2.0" version "3.2.0"
@ -3444,12 +3454,12 @@ prettier-linter-helpers@^1.0.0:
dependencies: dependencies:
fast-diff "^1.1.2" fast-diff "^1.1.2"
prettier-plugin-sh@^0.8.0: prettier-plugin-sh@^0.11.0:
version "0.8.1" version "0.11.0"
resolved "https://registry.yarnpkg.com/prettier-plugin-sh/-/prettier-plugin-sh-0.8.1.tgz#50698d95f2006c1b3eae570d430c3c1c05a31327" resolved "https://registry.yarnpkg.com/prettier-plugin-sh/-/prettier-plugin-sh-0.11.0.tgz#b65974d49d93d7f303c3513e218741f2d4820e98"
integrity sha512-tz0g6y+ZaJF0PWaa1F7vhCv4nLgYYl2zYzYU4XJFD1McoY0oHI+l2osvXqv1s5yQdtjdlzKszN6VY7WTaw2Gqw== integrity sha512-YwuWGYuf6UiF80BZ3Lrby2yot0zRcktcBl+VD/xSLoPrmiH/yXcopz3RBtNMNcBeP13ALim9N/LtlTCmvUziVQ==
dependencies: dependencies:
mvdan-sh "^0.5.0" mvdan-sh "^0.10.1"
prettier@^2.2.1: prettier@^2.2.1:
version "2.3.2" version "2.3.2"
@ -4401,10 +4411,10 @@ typedarray-to-buffer@^3.1.5:
dependencies: dependencies:
is-typedarray "^1.0.0" is-typedarray "^1.0.0"
typescript@^4.4.0-dev.20210528: typescript@^4.6.2:
version "4.4.2" version "4.6.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9"
integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ== integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==
unbox-primitive@^1.0.0: unbox-primitive@^1.0.0:
version "1.0.1" version "1.0.1"