Compare commits

...

40 Commits

Author SHA1 Message Date
Joe Previte
fa2f887c6e chore: bump version 4.8.2 2022-11-02 14:10:08 -07:00
Joe Previte
3736cffdca refactor: warn plugin range incompatibble 2022-11-01 11:08:35 -07:00
Joe Previte
26c46beab8 Merge branch 'main' into release/v4.8.2 2022-11-01 10:50:14 -07:00
Joe Previte
a432a0d697 docs: update faq for getting started (#5731) 2022-11-01 17:48:32 +00:00
Joe Previte
428e21dfdf docs: add release candidate notes 2022-11-01 10:42:02 -07:00
Joe Previte
c37d9c5cbe fixup: use 4.8.2-rc.1 2022-11-01 10:41:52 -07:00
Joe Previte
7db7c81a58 Revert "chore: bump version to 4.8.2"
This reverts commit 5d70994f22.
2022-11-01 10:35:18 -07:00
Joe Previte
2988146593 docs: add back line in publishing release
See https://github.com/coder/code-server/pull/5732#discussion_r1010685933
2022-11-01 10:17:48 -07:00
Joe Previte
3949927d5c chore: update CHANGELOG 2022-11-01 10:17:19 -07:00
Joe Previte
5d70994f22 chore: bump version to 4.8.2 2022-11-01 10:17:19 -07:00
Joe Previte
505f07a9bc fix: minor fixes related to release (#5732)
* fix: use * for test plugin engines

This removes the need to update this version with every version change.

* refactor: use npm-package in release assets

This adds a new job to `release.yaml` to upload the `npm-package` to the
release assets which will also allow us to download it in the
`publish.yaml` workflow.

* docs: update release instructions

* fixup!: use package.tar.gz
2022-11-01 10:16:30 -07:00
Joe Previte
ee47293cf6 Revert "Test branch (#5733)" (#5734)
This reverts commit 5c751f26ee.
2022-10-28 13:48:36 -07:00
Joe Previte
5c751f26ee Test branch (#5733)
* fix: use * for test plugin engines

This removes the need to update this version with every version change.

* refactor: use npm-package in release assets

This adds a new job to `release.yaml` to upload the `npm-package` to the
release assets which will also allow us to download it in the
`publish.yaml` workflow.

* docs: update release instructions
2022-10-28 13:43:21 -07:00
Joe Previte
7c0c0b0c29 fix: merge in master from coder/code-server-aur (#5730)
This ensures that the branch is up-to-date with coder/code-server-aur
before opening a PR.
2022-10-28 10:44:00 -07:00
Joe Previte
649985af8e feat: customize getting started page (#5707)
* feat: add getting-started patch

This modifies the text on the Getting Started page to promote
coder/coder.

* feat: add --disable-getting-started-override

This adds a new CLI flag to code-server called
`--disable-getting-started` which will be used in Code to not use
Coder's custom Getting Started text.

* refactor: conditionally show coder getting started

This modifies the getting started patch changes to work with the new
`--disable-getting-started-override`.

The flag is false by default meaning the Coder getting started is shown.
By passing the flag to code-server, it will not be shown.

* docs: update faq for getting started override

* docs: update getting-started patch description

* fixup!: update patch

* fixup!: unit test

* feat: add more tests

* fixup!: use correct env var in tests

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-10-28 16:59:24 +00:00
Joe Previte
ca182b9fb5 chore: prettierignore updates and setup-helm upgrade (#5721)
* chore: update prettierignore

* chore: upgrade setup-helm 3.4
2022-10-28 16:15:19 +00:00
Joe Previte
cc8ce3b3c6 release: 4.8.1 (#5722)
* chore(release): bump version to 4.8.1

* chore: bump helm-chart

* chore: update CHANGELOG
2022-10-28 08:55:45 -07:00
Joe Previte
ba44f6cc97 release: 4.8.1-rc.1 (#5713)
* chore(release): bump version to 4.8.1

* fixup

* revert: don't change to 4.8.1
2022-10-26 18:50:08 +00:00
Joe Previte
e6d2d72f9c fix: CSP and webview errors (#5712)
* fix: update hashes in webview patch

We missed a hash update and also had the wrong hash for another HTML
file which caused issues in 4.8.0.

* refactor: move parent-origin into webview
2022-10-26 11:20:11 -07:00
Joe Previte
005fa87699 chore(deps): downgrade argon2 to 0.29.0 (#5704)
Not sure why but we were seeing argon2/node-gyp issues after this
upgrade while running `yarn release:standalone`. For now, downgrading to
0.29.0 seems to fix the issue when testing locally.

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-10-25 16:56:13 +00:00
Joe Previte
b19996176e chore(deps): update prettier and eslint (#5700)
* chore(deps): update eslint/prettier deps

* refactor(cli): only import load from js-yaml

* chore(deps): remove minimatch resolution

* fixup! update yarn lock
2022-10-25 16:39:06 +00:00
Joe Previte
1134ee1c79 fix: pin helm to v3.10.1 (#5703)
Due to https://github.com/Azure/setup-helm/issues/99, this pins the
version to v3.10.1 as a temporary fix.
2022-10-25 16:24:53 +00:00
renovate[bot]
606811fbfd chore(deps): update aquasecurity/trivy-action digest to e55de85 (#5702)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-10-25 08:32:55 -07:00
Joe Previte
2f583b082e release: 4.8.0 (#5698)
* chore(release): bump version to 4.8.0

* chore: update changelog

* chore: bump helm chart

* Update CHANGELOG.md

Co-authored-by: Asher <ash@coder.com>

* Update CHANGELOG.md

Co-authored-by: Asher <ash@coder.com>

* fixup!: cleanup changelog

Co-authored-by: Asher <ash@coder.com>
2022-10-24 16:23:03 -07:00
Joe Previte
59ef715d8b chore: update minimatch (#5697) 2022-10-24 13:55:54 -07:00
Wei HU
bbf18cc6b0 feat: add docker image release for Ubuntu based image (#5688) 2022-10-24 18:41:19 +00:00
Joe Previte
031e903979 feat: enable forwarded ports using built-in proxy (#5673)
* feat: enable ports panel in proxy-uri patch

This makes the forwarded ports panel enabled by default.

* feat: add tunnelProvider in proxy-uri patch

This adds a `tunnelProvider` along with a `tunnelFactory` so that ports
are forwarded and use code-server's built-in proxy.

* fixup!: update import

* fix: skip uri modification if authority host match

This adds a check in our `resolveExternalUri` patch to skip modifying if
the `authority` and the `location.host` match to prevent
`localhost:<port>/proxy/<port>` from being modified.

* fixup!: refresh patch

* fixup!: move authority check up

* fixup!: remove comment

* fixup!: add trailing slash
2022-10-24 18:11:44 +00:00
Kyle Carberry
430b567e69 fix: Enable the BROWSER environment variable (#5695)
This was breaking the automatic opening of links in GIT_ASKPASS
on a git clone. I've tried to execute this script manually, and
it does indeed work!
2022-10-24 11:26:36 -05:00
Joe Previte
efce00582b chore: update Code to 1.72.2 (#5650)
* chore: update Code to 1.72.2

* chore: refresh integration patch

* chore: refresh base-path

* chore: refresh proposed-api patch

* chore: refresh marketplace patch

* chore: refresh webview patch

* chore: refresh disable-builtin patch

* chore: refresh logout, update-check patches

* chor: refresh proxy-uri patch

* fix: delete unique-db patch

This was supposed to be removed in https://github.com/coder/code-server/pull/5519

Looks like I didn't update the series or actually delete the patch.

* fix: drop log-level patch

This was merged upstream!

* chore: refresh local-storage patch

* chore: refresh service-worker patch

* chore: refresh sourcemaps patch

* chore: refresh disable-downloads patch

* chore: refresh telemetry patch

* chore: refresh language patch

* chore: refresh cli-window-open patch

* Revert "fix: delete unique-db patch"

This reverts commit ca0506c5f6.

* fixup!: rm extra spaces integration patch

* fixup: space

* fixup! update unique-db patch

* fixup!: update hash in webview patch

* fixup! update marketplace patch

* fixup!: remove comma
2022-10-17 16:30:39 -07:00
renovate[bot]
4a06d97f84 chore(deps): update dependency doctoc to v2.2.1 (#5648)
* chore(deps): update dependency doctoc to v2.2.1

* chore: update doctoc version in build.yaml

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Joe Previte <jjprevite@gmail.com>
2022-10-14 22:59:21 +00:00
renovate[bot]
514dbf315e chore(deps): update dependency normalize-package-data to v5 (#5649)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-10-14 09:36:56 -07:00
Joe Previte
690e0aff45 fix: add handle for resolveExternalUri (#5624)
* fix: add handle for resolveExternalUri

This adds a fix to properly handle `resolveExternalUri` which is used by
extensions like Tabnine.

* fixup!: update patch

* fixup!: force update proxy patch

* fixup!: use proxyEndpointTemplate else manually add

* fixup!: throw error if productConfiguration missing

* feat(testing): add asExternalUri

This modifies the test extension used in e2e test by registering a new
command for testing `asExternalUri`.

* feat: add e2e test for asExternalUri

* docs: update playwright setup comments

* feat: add support for VSCODE_PROXY_URI

* chore: refresh patches

* feat: add test for VSCODE_PROXY_URI

* chore: add metadata to lang extension

* fixup!: fix part of service-worker patch

* fixup!: remove e2e test, update patch notes

* fixup!: refresh disable-downloads

* fixup!: formatting
2022-10-14 16:08:58 +00:00
Alwin Lohrie
714afe0cc7 feat: add customization options for the login page (#5633)
* add customization options for the login page

* add unit tests

* add test for correct welcome text when none is set but app-name is

Signed-off-by: niwla23 <46248939+niwla23@users.noreply.github.com>

* add test for no app-name set and check in title too

Signed-off-by: niwla23 <46248939+niwla23@users.noreply.github.com>

Signed-off-by: niwla23 <46248939+niwla23@users.noreply.github.com>
Co-authored-by: Joe Previte <jjprevite@gmail.com>
2022-10-13 22:32:20 +00:00
Joe Previte
71a127a62b refactor: update prettier and doctoc (#5605)
* docs: add toc to CODE OF CONDUCT

* chore: add prettier ignore blocks to docs

* chore: update styles for Dockerfile

* refactor: separate prettier, doctoc

This does a couple things:
- update `.prettierignore`
- split `prettier` and `doctoc` commands. you can still run with `yarn
  fmt`
- delete `fmt.sh` and add `doctoc.sh`

By doing so, we can run tasks in parallel in CI and we should also have
less false positives than before with `yarn fmt` locally.

* refactor: update prettier job, add doctoc

This modifies the prettier job to use actionsx/prettier. It also adds a
job for `doctoc`.

* chore: upgrade to prettier 2.7.1

* chore: pin doctoc to 2.0.0

* fixup!: add .pc to prettierignore

* feat: add --cache to prettier cmd
2022-10-13 22:16:55 +00:00
renovate[bot]
d4707d1d24 fix(deps): update dependency argon2 to ^0.30.0 (#5647)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Joe Previte <jjprevite@gmail.com>
2022-10-13 20:10:23 +00:00
kotborealis
f61ec4a41c add CLI argument --disable-workspace-trust (#5638)
Add CLI flag to disable workspace trust feature, as
described in documentation:
https://code.visualstudio.com/docs/editor/workspace-trust

Add test for workspace trust argument.
2022-10-13 19:57:04 +00:00
Merith
ba68656353 fix potential typo for "installing with npm" (#5630)
the link for installing with NPM on line 103 was written as

[installing with npm][./npm.md](./npm.md) `[installing with npm][./npm.md](./npm.md)`
I fixed it to look like
[installing with npm](./npm.md) `[installing with npm](./npm.md)`
2022-10-10 17:55:56 +00:00
Möbius
b2f043ab41 Update guide.md (#5614)
Co-authored-by: Mobius <ELXIAGHT@outlook.com>
Co-authored-by: Joe Previte <jjprevite@gmail.com>
2022-10-07 18:04:22 +00:00
Daniil Gentili
b562d4a880 Allow opening files at a specific line and column (fixes #5619) (#5620)
* Allow opening files at a specific line and column (fixes #5619)

* Add isDirectory test
2022-10-06 11:12:21 -07:00
unknowndevQwQ
3a9eb312b1 feat: add doas support (#5600)
Some people may have some reason to drop sudo and switch to doas
2022-10-04 16:45:25 +00:00
74 changed files with 1862 additions and 1154 deletions

View File

@@ -22,7 +22,7 @@ concurrency:
# will skip running `yarn install` if it successfully fetched from cache # will skip running `yarn install` if it successfully fetched from cache
jobs: jobs:
fmt: prettier:
name: Format with Prettier name: Format with Prettier
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 5 timeout-minutes: 5
@@ -30,26 +30,39 @@ jobs:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Run prettier with actionsx/prettier
uses: actionsx/prettier@v2
with:
args: --check --loglevel=warn .
doctoc:
name: Doctoc markdown files
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v26.1
with:
files: |
docs/**
- name: Install Node.js v16 - name: Install Node.js v16
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "16" node-version: "16"
cache: "yarn"
- name: Fetch dependencies from cache - name: Install doctoc
id: cache-node-modules run: yarn global add doctoc@2.2.1
uses: actions/cache@v3
with:
path: "**/node_modules"
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-build-
- name: Install dependencies - name: Run doctoc
if: steps.cache-node-modules.outputs.cache-hit != 'true' if: steps.changed-files.outputs.any_changed == 'true'
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile run: yarn doctoc
- name: Format files with Prettier
run: yarn fmt
lint-helm: lint-helm:
name: Lint Helm chart name: Lint Helm chart
@@ -70,7 +83,7 @@ jobs:
- name: Install helm - name: Install helm
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.any_changed == 'true'
uses: azure/setup-helm@v3.3 uses: azure/setup-helm@v3.4
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -28,15 +28,13 @@ jobs:
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 npm package from release artifacts
uses: dawidd6/action-download-artifact@v2 uses: robinraju/release-downloader@v1.5
id: download
with: with:
branch: release/v${{ steps.version.outputs.version }} repository: "coder/code-server"
workflow: build.yaml tag: v${{ steps.version.outputs.version }}
workflow_conclusion: completed fileName: "package.tar.gz"
name: "npm-package" out-file-path: "release-npm-package"
path: release-npm-package
- name: Publish npm package and tag with "latest" - name: Publish npm package and tag with "latest"
run: yarn publish:npm run: yarn publish:npm
@@ -97,6 +95,12 @@ jobs:
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
ref: "master" ref: "master"
- name: Merge in master
run: |
git remote add upstream https://github.com/coder/code-server-aur.git
git fetch upstream
git merge upstream/master
- name: Configure git - name: Configure git
run: | run: |
git config --global user.name cdrci git config --global user.name cdrci

View File

@@ -249,3 +249,24 @@ jobs:
draft: true draft: true
discussion_category_name: "📣 Announcements" discussion_category_name: "📣 Announcements"
files: ./release-packages/* files: ./release-packages/*
npm-package:
name: Upload npm package
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
id: download
with:
branch: ${{ github.ref }}
workflow: build.yaml
workflow_conclusion: completed
check_artifacts: true
name: npm-package
- uses: softprops/action-gh-release@v1
with:
draft: true
discussion_category_name: "📣 Announcements"
files: ./package.tar.gz

View File

@@ -65,7 +65,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@d63413b0a4a4482237085319f7f4a1ce99a8f2ac uses: aquasecurity/trivy-action@e55de85beea5fcec743de6bb6bc56943a0af3c33
with: with:
scan-type: "fs" scan-type: "fs"
scan-ref: "." scan-ref: "."

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@d63413b0a4a4482237085319f7f4a1ce99a8f2ac uses: aquasecurity/trivy-action@e55de85beea5fcec743de6bb6bc56943a0af3c33
with: with:
image-ref: "docker.io/codercom/code-server:latest" image-ref: "docker.io/codercom/code-server:latest"
ignore-unfixed: true ignore-unfixed: true

View File

@@ -1 +1,8 @@
lib/vscode lib/vscode
lib/vscode-reh-web-linux-x64
release-standalone
release
helm-chart
test/scripts
test/e2e/extensions/test-extension
.pc

View File

@@ -20,6 +20,52 @@ Code v99.99.999
--> -->
## [4.8.2](https://github.com/coder/code-server/releases/tag/v4.8.2) - 2022-11-02
Code v1.72.1
### Added
- New text in the Getting Started page with info about
`coder/coder`. This is enabled by default but can be disabled by passing the CLI
flag `--disable-getting-started-override` or setting
`CS_DISABLE_GETTING_STARTED_OVERRIDE=1` or
`CS_DISABLE_GETTING_STARTED_OVERRIDE=true`.
## [4.8.1](https://github.com/coder/code-server/releases/tag/v4.8.1) - 2022-10-28
Code v1.72.1
### Fixed
- Fixed CSP error introduced in 4.8.0 that caused issues with webviews and most
extensions.
## [4.8.0](https://github.com/coder/code-server/releases/tag/v4.8.0) - 2022-10-24
Code v1.72.1
### Added
- Support for the Ports panel which leverages code-server's built-in proxy. It
also uses `VSCODE_PROXY_URI` where `{{port}}` is replace when forwarding a port.
Example: `VSCODE_PROXY_URI=https://{{port}}.kyle.dev` would forward an
application running on localhost:3000 to https://3000.kyle.dev
- Support for `--disable-workspace-trust` CLI flag
- Support for `--goto` flag to open file @ line:column
- Added Ubuntu-based images for Docker releases. If you run into issues with
`PATH` being overwritten in Docker please try the Ubuntu image as this is a
problem in the Debian base image.
### Changed
- Updated Code to 1.72.1
### Fixed
- Enabled `BROWSER` environment variable
- Patched `asExternalUri` to work so now extensions run inside code-server can use it
## [4.7.1](https://github.com/coder/code-server/releases/tag/v4.7.1) - 2022-09-30 ## [4.7.1](https://github.com/coder/code-server/releases/tag/v4.7.1) - 2022-09-30
Code v1.71.2 Code v1.71.2

View File

@@ -4,24 +4,6 @@ set -euo pipefail
main() { main() {
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
local prettierExts
prettierExts=(
"*.js"
"*.ts"
"*.tsx"
"*.html"
"*.json"
"*.css"
"*.md"
"*.toml"
"*.yaml"
"*.yml"
"*.sh"
)
prettier --write --loglevel=warn $(
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart'
)
doctoc --title '# FAQ' docs/FAQ.md > /dev/null doctoc --title '# FAQ' docs/FAQ.md > /dev/null
doctoc --title '# Setup Guide' docs/guide.md > /dev/null doctoc --title '# Setup Guide' docs/guide.md > /dev/null
doctoc --title '# Install' docs/install.md > /dev/null doctoc --title '# Install' docs/install.md > /dev/null
@@ -32,12 +14,11 @@ main() {
doctoc --title '# iPad' docs/ipad.md > /dev/null doctoc --title '# iPad' docs/ipad.md > /dev/null
doctoc --title '# Termux' docs/termux.md > /dev/null doctoc --title '# Termux' docs/termux.md > /dev/null
# TODO: replace with a method that generates fewer false positives.
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
echo "Files need generation or are formatted incorrectly:" echo "Files need generation or are formatted incorrectly:"
git -c color.ui=always status | grep --color=no '\[31m' git -c color.ui=always status | grep --color=no '\[31m'
echo "Please run the following locally:" echo "Please run the following locally:"
echo " yarn fmt" echo " yarn doctoc"
exit 1 exit 1
fi fi
} }

View File

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

View File

@@ -6,7 +6,7 @@ replicaCount: 1
image: image:
repository: codercom/code-server repository: codercom/code-server
tag: '4.7.1' tag: '4.8.2'
pullPolicy: Always pullPolicy: Always
# Specifies one or more secrets to be used when pulling images from a # Specifies one or more secrets to be used when pulling images from a

View File

@@ -1,12 +1,13 @@
# syntax=docker/dockerfile:experimental # syntax=docker/dockerfile:experimental
ARG BASE=debian:11
FROM scratch AS packages FROM scratch AS packages
COPY release-packages/code-server*.deb /tmp/ COPY release-packages/code-server*.deb /tmp/
FROM debian:11 FROM $BASE
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y \ && apt-get install -y \
curl \ curl \
dumb-init \ dumb-init \
zsh \ zsh \
@@ -29,15 +30,15 @@ RUN sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen \
&& locale-gen && locale-gen
ENV LANG=en_US.UTF-8 ENV LANG=en_US.UTF-8
RUN adduser --gecos '' --disabled-password coder && \ RUN adduser --gecos '' --disabled-password coder \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
RUN ARCH="$(dpkg --print-architecture)" && \ RUN ARCH="$(dpkg --print-architecture)" \
curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid-0.5-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - && \ && curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.5/fixuid-0.5-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - \
chown root:root /usr/local/bin/fixuid && \ && chown root:root /usr/local/bin/fixuid \
chmod 4755 /usr/local/bin/fixuid && \ && chmod 4755 /usr/local/bin/fixuid \
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 ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh COPY ci/release-image/entrypoint.sh /usr/bin/entrypoint.sh
RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dpkg -i /tmp/packages/code-server*$(dpkg --print-architecture).deb

View File

@@ -6,17 +6,63 @@ variable "VERSION" {
default = "latest" default = "latest"
} }
group "default" { variable "DOCKER_REGISTRY" {
targets = ["code-server"] default = "docker.io/codercom/code-server"
} }
target "code-server" { variable "GITHUB_REGISTRY" {
dockerfile = "ci/release-image/Dockerfile" default = "ghcr.io/coder/code-server"
tags = [ }
"docker.io/codercom/code-server:latest",
notequal("latest",VERSION) ? "docker.io/codercom/code-server:${VERSION}" : "", group "default" {
"ghcr.io/coder/code-server:latest", targets = [
notequal("latest",VERSION) ? "ghcr.io/coder/code-server:${VERSION}" : "", "code-server-debian-11",
"code-server-ubuntu-focal",
] ]
}
function "prepend_hyphen_if_not_null" {
params = [tag]
result = notequal("","${tag}") ? "-${tag}" : "${tag}"
}
# use empty tag (tag="") to generate default tags
function "gen_tags" {
params = [registry, tag]
result = notequal("","${registry}") ? [
notequal("", "${tag}") ? "${registry}:${tag}" : "${registry}:latest",
notequal("latest",VERSION) ? "${registry}:${VERSION}${prepend_hyphen_if_not_null(tag)}" : "",
] : []
}
# helper function to generate tags for docker registry and github registry.
# set (DOCKER|GITHUB)_REGISTRY="" to disable corresponding registry
function "gen_tags_for_docker_and_ghcr" {
params = [tag]
result = concat(
gen_tags("${DOCKER_REGISTRY}", "${tag}"),
gen_tags("${GITHUB_REGISTRY}", "${tag}"),
)
}
target "code-server-debian-11" {
dockerfile = "ci/release-image/Dockerfile"
tags = concat(
gen_tags_for_docker_and_ghcr(""),
gen_tags_for_docker_and_ghcr("debian"),
gen_tags_for_docker_and_ghcr("bullseye"),
)
platforms = ["linux/amd64", "linux/arm64"]
}
target "code-server-ubuntu-focal" {
dockerfile = "ci/release-image/Dockerfile"
tags = concat(
gen_tags_for_docker_and_ghcr("ubuntu"),
gen_tags_for_docker_and_ghcr("focal"),
)
args = {
BASE = "ubuntu:focal"
}
platforms = ["linux/amd64", "linux/arm64"] platforms = ["linux/amd64", "linux/arm64"]
} }

View File

@@ -1,5 +1,18 @@
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# Contributor Covenant Code of Conduct
- [Contributor Covenant Code of Conduct](#contributor-covenant-code-of-conduct)
- [Our Pledge](#our-pledge)
- [Our Standards](#our-standards)
- [Our Responsibilities](#our-responsibilities)
- [Scope](#scope)
- [Enforcement](#enforcement)
- [Attribution](#attribution)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end -->
# Contributor Covenant Code of Conduct # Contributor Covenant Code of Conduct

View File

@@ -1,3 +1,4 @@
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# Contributing # Contributing
@@ -24,6 +25,7 @@
- [Currently Known Issues](#currently-known-issues) - [Currently Known Issues](#currently-known-issues)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end -->
- [Detailed CI and build process docs](../ci) - [Detailed CI and build process docs](../ci)

View File

@@ -1,3 +1,4 @@
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# FAQ # FAQ
@@ -31,8 +32,10 @@
- [Does code-server have any security login validation?](#does-code-server-have-any-security-login-validation) - [Does code-server have any security login validation?](#does-code-server-have-any-security-login-validation)
- [Are there community projects involving code-server?](#are-there-community-projects-involving-code-server) - [Are there community projects involving code-server?](#are-there-community-projects-involving-code-server)
- [How do I change the port?](#how-do-i-change-the-port) - [How do I change the port?](#how-do-i-change-the-port)
- [How do I hide the coder/coder promotion in Help: Getting Started?](#how-do-i-hide-the-codercoder-promotion-in-help-getting-started)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end -->
## Questions? ## Questions?
@@ -416,3 +419,9 @@ There are two ways to change the port on which code-server runs:
1. with an environment variable e.g. `PORT=3000 code-server` 1. with an environment variable e.g. `PORT=3000 code-server`
2. using the flag `--bind-addr` e.g. `code-server --bind-addr localhost:3000` 2. using the flag `--bind-addr` e.g. `code-server --bind-addr localhost:3000`
## How do I hide the coder/coder promotion in Help: Getting Started?
You can pass the flag `--disable-getting-started-override` to `code-server` or
you can set the environment variable `CS_DISABLE_GETTING_STARTED_OVERRIDE=1` or
`CS_DISABLE_GETTING_STARTED_OVERRIDE=true`.

View File

@@ -1,3 +1,4 @@
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# Maintaining # Maintaining
@@ -14,6 +15,7 @@
- [Changelog](#changelog) - [Changelog](#changelog)
- [Releases](#releases) - [Releases](#releases)
- [Publishing a release](#publishing-a-release) - [Publishing a release](#publishing-a-release)
- [Release Candidates](#release-candidates)
- [AUR](#aur) - [AUR](#aur)
- [Docker](#docker) - [Docker](#docker)
- [Homebrew](#homebrew) - [Homebrew](#homebrew)
@@ -24,6 +26,7 @@
- [Troubleshooting](#troubleshooting) - [Troubleshooting](#troubleshooting)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end -->
This document is meant to serve current and future maintainers of code-server, This document is meant to serve current and future maintainers of code-server,
as well as share our workflow for maintaining the project. as well as share our workflow for maintaining the project.
@@ -140,7 +143,6 @@ changelog](https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS).
### Publishing a release ### Publishing a release
1. Create a new branch called `release/v0.0.0` (replace 0s with actual version aka v4.5.0) 1. Create a new branch called `release/v0.0.0` (replace 0s with actual version aka v4.5.0)
1. If you don't do this, the `npm-brew` GitHub workflow will fail. It looks for the release artifacts under the branch pattern.
1. Run `yarn release:prep` 1. Run `yarn release:prep`
1. Bump chart version in `Chart.yaml`. 1. Bump chart version in `Chart.yaml`.
1. Summarize the major changes in the `CHANGELOG.md` 1. Summarize the major changes in the `CHANGELOG.md`
@@ -151,6 +153,14 @@ changelog](https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS).
artifacts, publish the NPM package from `npm-package`, and publish the Docker artifacts, publish the NPM package from `npm-package`, and publish the Docker
Hub image from `release-images`. Hub image from `release-images`.
#### Release Candidates
We prefer to do release candidates so the community can test things before a full-blown release. To do this follow the same steps as above but:
1. Only bump version in `package.json`
1. use `0.0.0-rc.0`
1. When you publish the release, select "pre-release"
#### AUR #### AUR
We publish to AUR as a package [here](https://aur.archlinux.org/packages/code-server/). This process is manual and can be done by following the steps in [this repo](https://github.com/coder/code-server-aur). We publish to AUR as a package [here](https://aur.archlinux.org/packages/code-server/). This process is manual and can be done by following the steps in [this repo](https://github.com/coder/code-server-aur).

View File

@@ -1,3 +1,4 @@
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# Setup Guide # Setup Guide
@@ -22,6 +23,7 @@
- [Option 2: ngrok tunnel](#option-2-ngrok-tunnel) - [Option 2: ngrok tunnel](#option-2-ngrok-tunnel)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end -->
This article will walk you through exposing code-server securely once you've This article will walk you through exposing code-server securely once you've
completed the [installation process](install.md). completed the [installation process](install.md).
@@ -89,11 +91,10 @@ we recommend using another method, such as [Let's Encrypt](#let-encrypt) instead
using [mutagen](https://mutagen.io/documentation/introduction/installation) using [mutagen](https://mutagen.io/documentation/introduction/installation)
to do so. Once you've installed mutagen, you can port forward as follows: to do so. Once you've installed mutagen, you can port forward as follows:
```console ```shell
# This is the same as the above SSH command, but it runs in the background # This is the same as the above SSH command, but it runs in the background
# continuously. Be sure to add `mutagen daemon start` to your ~/.bashrc to # continuously. Be sure to add `mutagen daemon start` to your ~/.bashrc to
# start the mutagen daemon when you open a shell. # start the mutagen daemon when you open a shell.
mutagen forward create --name=code-server tcp:127.0.0.1:8080 < instance-ip > :tcp:127.0.0.1:8080 mutagen forward create --name=code-server tcp:127.0.0.1:8080 < instance-ip > :tcp:127.0.0.1:8080
``` ```
@@ -417,20 +418,20 @@ sudo passwd {user} # replace user with your code-server user
[![Cloudflared](https://img.shields.io/badge/Cloudflared-E4863B?style=for-the-badge&logo=cloudflare&logoColor=ffffff)](https://github.com/cloudflare/cloudflared) [![Cloudflared](https://img.shields.io/badge/Cloudflared-E4863B?style=for-the-badge&logo=cloudflare&logoColor=ffffff)](https://github.com/cloudflare/cloudflared)
1. Install [cloudflared](https://github.com/cloudflare/cloudflared#installing-cloudflared) on your local computer 1. Install [cloudflared](https://github.com/cloudflare/cloudflared#installing-cloudflared) on your local computer and remote server
2. Then go to `~/.ssh/config` and add the following: 2. Then go to `~/.ssh/config` and add the following on your local computer:
```shell ```shell
Host *.trycloudflare.com Host *.trycloudflare.com
HostName %h HostName %h
User root User user
Port 22 Port 22
ProxyCommand "cloudflared location" access ssh --hostname %h ProxyCommand "cloudflared location" access ssh --hostname %h
``` ```
3. Run `cloudflared tunnel --url ssh://localhost:22` on the remote server 3. Run `cloudflared tunnel --url ssh://localhost:22` on the remote server
4. Finally on VS Code or any IDE that supports SSH, run `ssh coder@https://your-link.trycloudflare.com` or `ssh coder@your-link.trycloudflare.com` 4. Finally on VS Code or any IDE that supports SSH, run `ssh user@https://your-link.trycloudflare.com` or `ssh user@your-link.trycloudflare.com`
### Option 2: ngrok tunnel ### Option 2: ngrok tunnel

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.7.1](https://img.shields.io/badge/AppVersion-4.7.1-informational?style=flat-square)](https://img.shields.io/badge/AppVersion-4.7.1-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.8.0](https://img.shields.io/badge/AppVersion-4.8.0-informational?style=flat-square)](https://img.shields.io/badge/AppVersion-4.8.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.7.1"` | | image.tag | string | `"4.8.0"` |
| imagePullSecrets | list | `[]` | | imagePullSecrets | list | `[]` |
| ingress.enabled | bool | `false` | | ingress.enabled | bool | `false` |
| nameOverride | string | `""` | | nameOverride | string | `""` |

View File

@@ -1,3 +1,4 @@
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# Install # Install
@@ -24,6 +25,7 @@
- [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 -->
<!-- prettier-ignore-end -->
This document demonstrates how to install `code-server` on various distros and This document demonstrates how to install `code-server` on various distros and
operating systems. operating systems.

View File

@@ -1,3 +1,4 @@
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# iPad # iPad
@@ -13,6 +14,7 @@
- [Sharing a self-signed certificate with an iPad](#sharing-a-self-signed-certificate-with-an-ipad) - [Sharing a self-signed certificate with an iPad](#sharing-a-self-signed-certificate-with-an-ipad)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end -->
Once you've installed code-server, you can access it from an iPad. Once you've installed code-server, you can access it from an iPad.

View File

@@ -1,5 +1,5 @@
{ {
"versions": ["v4.7.1"], "versions": ["v4.8.0"],
"routes": [ "routes": [
{ {
"title": "Home", "title": "Home",

View File

@@ -1,3 +1,4 @@
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# npm Install Requirements # npm Install Requirements
@@ -15,6 +16,7 @@
- [Debugging install issues with npm](#debugging-install-issues-with-npm) - [Debugging install issues with npm](#debugging-install-issues-with-npm)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end -->
If you're installing code-server via `npm`, you'll need to install additional 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

View File

@@ -1,3 +1,4 @@
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# Termux # Termux
@@ -14,6 +15,7 @@
- [Working with PRoot](#working-with-proot) - [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 -->
<!-- prettier-ignore-end -->
## Install ## Install
@@ -100,7 +102,7 @@ node -v
you will get node version `v16.15.0` you will get node version `v16.15.0`
5. Now install code-server following our guide on [installing with npm][./npm.md](./npm.md) 5. Now install code-server following our guide on [installing with npm](./npm.md)
6. Congratulation code-server is installed on your device using the following command. 6. Congratulation code-server is installed on your device using the following command.

View File

@@ -553,6 +553,8 @@ sh_c() {
sudo_sh_c() { sudo_sh_c() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
sh_c "$@" sh_c "$@"
elif command_exists doas; then
sh_c "doas $*"
elif command_exists sudo; then elif command_exists sudo; then
sh_c "sudo $*" sh_c "sudo $*"
elif command_exists su; then elif command_exists su; then
@@ -561,7 +563,7 @@ sudo_sh_c() {
echoh echoh
echoerr "This script needs to run the following command as root." echoerr "This script needs to run the following command as root."
echoerr " $*" echoerr " $*"
echoerr "Please install sudo or su." echoerr "Please install doas, sudo, or su."
exit 1 exit 1
fi fi
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "code-server", "name": "code-server",
"license": "MIT", "license": "MIT",
"version": "4.7.1", "version": "4.8.2",
"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": {
@@ -12,6 +12,7 @@
"clean": "./ci/build/clean.sh", "clean": "./ci/build/clean.sh",
"build": "./ci/build/build-code-server.sh", "build": "./ci/build/build-code-server.sh",
"build:vscode": "./ci/build/build-vscode.sh", "build:vscode": "./ci/build/build-vscode.sh",
"doctoc": "./ci/dev/doctoc.sh",
"release": "./ci/build/build-release.sh", "release": "./ci/build/build-release.sh",
"release:standalone": "./ci/build/build-standalone-release.sh", "release:standalone": "./ci/build/build-standalone-release.sh",
"release:prep": "./ci/build/release-prep.sh", "release:prep": "./ci/build/release-prep.sh",
@@ -22,11 +23,12 @@
"test:native": "./ci/dev/test-native.sh", "test:native": "./ci/dev/test-native.sh",
"test:scripts": "./ci/dev/test-scripts.sh", "test:scripts": "./ci/dev/test-scripts.sh",
"package": "./ci/build/build-packages.sh", "package": "./ci/build/build-packages.sh",
"prettier": "prettier --write --loglevel=warn --cache .",
"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", "publish:docker": "./ci/steps/docker-buildx-push.sh",
"_audit": "./ci/dev/audit.sh", "_audit": "./ci/dev/audit.sh",
"fmt": "./ci/dev/fmt.sh", "fmt": "yarn prettier && ./ci/dev/doctoc.sh",
"lint:scripts": "./ci/dev/lint-scripts.sh", "lint:scripts": "./ci/dev/lint-scripts.sh",
"lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.js' | grep -v 'lib/vscode')", "lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.js' | grep -v 'lib/vscode')",
"test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1", "test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1",
@@ -50,23 +52,23 @@
"@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.5.3", "@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.23.0", "@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.23.0", "@typescript-eslint/parser": "^5.41.0",
"audit-ci": "^6.0.0", "audit-ci": "^6.0.0",
"doctoc": "^2.0.0", "doctoc": "2.2.1",
"eslint": "^7.7.0", "eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^2.5.0", "eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.18.2", "eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.2.1", "prettier": "2.7.1",
"prettier-plugin-sh": "^0.12.0", "prettier-plugin-sh": "^0.12.8",
"ts-node": "^10.0.0", "ts-node": "^10.0.0",
"typescript": "^4.6.2" "typescript": "^4.6.2"
}, },
"resolutions": { "resolutions": {
"ansi-regex": "^5.0.1", "ansi-regex": "^5.0.1",
"normalize-package-data": "^4.0.0", "normalize-package-data": "^5.0.0",
"doctoc/underscore": "^1.13.1", "doctoc/underscore": "^1.13.1",
"doctoc/**/trim": "^1.0.0", "doctoc/**/trim": "^1.0.0",
"postcss": "^8.2.1", "postcss": "^8.2.1",
@@ -85,7 +87,7 @@
}, },
"dependencies": { "dependencies": {
"@coder/logger": "^3.0.0", "@coder/logger": "^3.0.0",
"argon2": "^0.29.0", "argon2": "0.29.0",
"compression": "^1.7.4", "compression": "^1.7.4",
"cookie-parser": "^1.4.5", "cookie-parser": "^1.4.5",
"env-paths": "^2.2.0", "env-paths": "^2.2.0",

View File

@@ -104,7 +104,7 @@ Index: code-server/lib/vscode/src/vs/platform/remote/browser/browserSocketFactor
connect(host: string, port: number, path: string, query: string, debugLabel: string, callback: IConnectCallback): void { connect(host: string, port: number, path: string, query: string, debugLabel: string, callback: IConnectCallback): void {
const webSocketSchema = (/^https:/.test(window.location.href) ? 'wss' : 'ws'); const webSocketSchema = (/^https:/.test(window.location.href) ? 'wss' : 'ws');
+ path = (window.location.pathname + "/" + path).replace(/\/\/+/g, "/") + path = (window.location.pathname + "/" + path).replace(/\/\/+/g, "/")
const socket = this._webSocketFactory.create(`${webSocketSchema}://${/:/.test(host) ? `[${host}]` : host}:${port}${path}?${query}&skipWebSocketFrames=false`, debugLabel); const socket = this._webSocketFactory.create(`${webSocketSchema}://${(/:/.test(host) && !/\[/.test(host)) ? `[${host}]` : host}:${port}${path}?${query}&skipWebSocketFrames=false`, debugLabel);
const errorListener = socket.onError((err) => callback(err, undefined)); const errorListener = socket.onError((err) => callback(err, undefined));
socket.onOpen(() => { socket.onOpen(() => {
@@ -282,6 +283,3 @@ export class BrowserSocketFactory implem @@ -282,6 +283,3 @@ export class BrowserSocketFactory implem
@@ -262,7 +262,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
@@ -485,6 +485,7 @@ function doCreateUri(path: string, query @@ -489,6 +489,7 @@ function doCreateUri(path: string, query
}); });
} }
@@ -270,7 +270,7 @@ 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 });
} }
@@ -496,7 +497,7 @@ function doCreateUri(path: string, query @@ -500,7 +501,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');
} }

View File

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

View File

@@ -7,7 +7,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts --- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
@@ -236,6 +236,10 @@ export class Extension implements IExten @@ -237,6 +237,10 @@ export class Extension implements IExten
if (this.type === ExtensionType.System && this.productService.quality === 'stable') { if (this.type === ExtensionType.System && this.productService.quality === 'stable') {
return false; return false;
} }
@@ -18,7 +18,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) { if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
return false; return false;
} }
@@ -1121,6 +1125,10 @@ export class ExtensionsWorkbenchService @@ -1234,6 +1238,10 @@ export class ExtensionsWorkbenchService
// Skip if check updates only for builtin extensions and current extension is not builtin. // Skip if check updates only for builtin extensions and current extension is not builtin.
continue; continue;
} }

View File

@@ -12,7 +12,7 @@ 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
@@ -267,6 +267,11 @@ export interface IWorkbenchConstructionO @@ -271,6 +271,11 @@ export interface IWorkbenchConstructionO
*/ */
readonly userDataPath?: string readonly userDataPath?: string
@@ -66,7 +66,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -95,6 +96,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
@@ -84,8 +84,8 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
userDataPath: this._environmentService.userDataPath, userDataPath: this._environmentService.userDataPath,
+ isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'], + isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
_wrapWebWorkerExtHostInIframe, _wrapWebWorkerExtHostInIframe,
developmentOptions: { developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() },
enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts --- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts
@@ -93,16 +93,16 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
@@ -7,12 +7,11 @@ import { Event } from 'vs/base/common/ev @@ -7,12 +7,11 @@ import { Event } from 'vs/base/common/ev
import { Disposable } from 'vs/base/common/lifecycle'; import { Disposable } from 'vs/base/common/lifecycle';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext } from 'vs/platform/contextkey/common/contextkeys'; import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext, IsMobileContext } 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, TemporaryWorkspaceContext } 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 { 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, TemporaryWorkspaceContext, 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 { 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 { trackFocus, addDisposableListener, EventType } from 'vs/base/browser/dom';
import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
-import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { WorkbenchState, IWorkspaceContextService, isTemporaryWorkspace } from 'vs/platform/workspace/common/workspace';
import { IWorkbenchLayoutService, Parts, positionToString } from 'vs/workbench/services/layout/browser/layoutService'; import { IWorkbenchLayoutService, Parts, positionToString } from 'vs/workbench/services/layout/browser/layoutService';
@@ -25,6 +24,7 @@ import { IPaneCompositePartService } fro @@ -25,6 +24,7 @@ import { IPaneCompositePartService } fro
import { Schemas } from 'vs/base/common/network'; import { Schemas } from 'vs/base/common/network';
@@ -112,7 +112,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
export class WorkbenchContextKeysHandler extends Disposable { export class WorkbenchContextKeysHandler extends Disposable {
private inputFocusedContext: IContextKey<boolean>; private inputFocusedContext: IContextKey<boolean>;
@@ -76,7 +76,7 @@ export class WorkbenchContextKeysHandler @@ -77,7 +77,7 @@ export class WorkbenchContextKeysHandler
@IContextKeyService private readonly contextKeyService: IContextKeyService, @IContextKeyService private readonly contextKeyService: IContextKeyService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService, @IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IConfigurationService private readonly configurationService: IConfigurationService, @IConfigurationService private readonly configurationService: IConfigurationService,
@@ -121,7 +121,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
@IProductService private readonly productService: IProductService, @IProductService private readonly productService: IProductService,
@IEditorService private readonly editorService: IEditorService, @IEditorService private readonly editorService: IEditorService,
@IEditorResolverService private readonly editorResolverService: IEditorResolverService, @IEditorResolverService private readonly editorResolverService: IEditorResolverService,
@@ -199,6 +199,9 @@ export class WorkbenchContextKeysHandler @@ -202,6 +202,9 @@ export class WorkbenchContextKeysHandler
this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService); this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService);
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(Parts.AUXILIARYBAR_PART)); this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(Parts.AUXILIARYBAR_PART));
@@ -172,7 +172,7 @@ Index: code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/common/contextkeys.ts --- code-server.orig/lib/vscode/src/vs/workbench/common/contextkeys.ts
+++ code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts +++ code-server/lib/vscode/src/vs/workbench/common/contextkeys.ts
@@ -30,6 +30,8 @@ export const IsFullscreenContext = new R @@ -32,6 +32,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 HasWebFileSystemAccess = new RawContextKey<boolean>('hasWebFileSystemAccess', false, true); // Support for FileSystemAccess web APIs (https://wicg.github.io/file-system-access)

View File

@@ -19,7 +19,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
@@ -212,6 +212,9 @@ export async function setupServerService @@ -209,6 +209,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);
@@ -39,11 +39,11 @@ Index: code-server/lib/vscode/src/vs/base/common/platform.ts
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
-import * as nls from 'vs/nls'; -import * as nls from 'vs/nls';
- -
const LANGUAGE_DEFAULT = 'en'; export const LANGUAGE_DEFAULT = 'en';
let _isWindows = false; let _isWindows = false;
@@ -81,17 +79,19 @@ if (typeof navigator === 'object' && !is @@ -83,17 +81,19 @@ if (typeof navigator === 'object' && !is
_isLinux = _userAgent.indexOf('Linux') >= 0; _isMobile = _userAgent?.indexOf('Mobi') >= 0;
_isWeb = true; _isWeb = true;
- const configuredLocale = nls.getConfiguredDefaultLocale( - const configuredLocale = nls.getConfiguredDefaultLocale(
@@ -216,7 +216,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
const workbenchWebConfiguration = { const workbenchWebConfiguration = {
remoteAuthority, remoteAuthority,
@@ -339,6 +342,7 @@ export class WebClientServer { @@ -336,6 +339,7 @@ export class WebClientServer {
WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : ''), WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : ''),
BASE: base, BASE: base,
VS_BASE: vscodeBase, VS_BASE: vscodeBase,
@@ -236,7 +236,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -97,6 +98,7 @@ export interface ServerParsedArgs { @@ -96,6 +97,7 @@ export interface ServerParsedArgs {
'disable-update-check'?: boolean; 'disable-update-check'?: boolean;
'auth'?: string 'auth'?: string
'disable-file-downloads'?: boolean; 'disable-file-downloads'?: boolean;
@@ -248,7 +248,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
@@ -122,8 +122,9 @@ import 'vs/workbench/contrib/logs/browse @@ -123,8 +123,9 @@ import 'vs/workbench/contrib/logs/browse
// Explorer // Explorer
import 'vs/workbench/contrib/files/browser/files.web.contribution'; import 'vs/workbench/contrib/files/browser/files.web.contribution';
@@ -314,19 +314,3 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/localization/electron-san
await this.jsonEditingService.write(this.environmentService.argvResource, [{ path: ['locale'], value: locale }], true); await this.jsonEditingService.write(this.environmentService.argvResource, [{ path: ['locale'], value: locale }], true);
return true; return true;
} }
Index: code-server/lib/vscode/src/vs/base/node/languagePacks.js
===================================================================
--- code-server.orig/lib/vscode/src/vs/base/node/languagePacks.js
+++ code-server/lib/vscode/src/vs/base/node/languagePacks.js
@@ -73,7 +73,10 @@
function getLanguagePackConfigurations(userDataPath) {
const configFile = path.join(userDataPath, 'languagepacks.json');
try {
- return nodeRequire(configFile);
+ // This must not use Node's require otherwise it will be cached forever.
+ // Code can get away with this since the process actually restarts but
+ // that is not currently the case with code-server.
+ return JSON.parse(fs.readFileSync(configFile, "utf8"));
} catch (err) {
// Do nothing. If we can't read the file we have no
// language pack config.

View File

@@ -0,0 +1,178 @@
Modify Help: Getting Started
This modifies some text on the Getting Started page and adds text about using
code-server on a team.
It is enabled by default but can be overriden using the cli flag
`--disable-getting-started-override`.
Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
@@ -62,7 +62,7 @@ import { GettingStartedIndexList } from
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
import { getTelemetryLevel } from 'vs/platform/telemetry/common/telemetryUtils';
-import { WorkbenchStateContext } from 'vs/workbench/common/contextkeys';
+import { IsEnabledCoderGettingStarted, WorkbenchStateContext } from 'vs/workbench/common/contextkeys';
import { OpenFolderViaWorkspaceAction } from 'vs/workbench/browser/actions/workspaceActions';
import { OpenRecentAction } from 'vs/workbench/browser/actions/windowActions';
import { Toggle } from 'vs/base/browser/ui/toggle/toggle';
@@ -753,11 +753,24 @@ export class GettingStartedPage extends
onShowOnStartupChanged();
}));
- const header = $('.header', {},
+ let header = $('.header', {},
$('h1.product-name.caption', {}, this.productService.nameLong),
$('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved"))
);
+ if (this.contextService.contextMatchesRules(IsEnabledCoderGettingStarted)) {
+ header = $('.header', {},
+ $('h1.product-name.caption', {}, this.productService.nameLong),
+ $('p.subtitle.description.coder', {},
+ "Using code-server on a team?",
+ ),
+ $('p.subtitle.description.coder-coder', {},
+ "Check out: ",
+ $('a', { href: "https://github.com/coder/coder" }, "coder/coder")
+ ),
+ );
+ }
+
const leftColumn = $('.categories-column.categories-column-left', {},);
const rightColumn = $('.categories-column.categories-column-right', {},);
Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css
+++ code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css
@@ -60,6 +60,15 @@
display: block;
}
+.monaco-workbench .part.editor > .content .gettingStartedContainer .coder {
+ margin-bottom: 0.2em;
+}
+
+.monaco-workbench .part.editor>.content .gettingStartedContainer .coder-coder {
+ font-size: 1em;
+ margin-top: 0.2em;
+}
+
.monaco-workbench.hc-black .part.editor>.content .gettingStartedContainer .subtitle,
.monaco-workbench.hc-light .part.editor>.content .gettingStartedContainer .subtitle {
font-weight: 200;
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
@@ -276,6 +276,11 @@ export interface IWorkbenchConstructionO
*/
readonly isEnabledFileDownloads?: boolean
+ /**
+ * Whether to use Coder's custom Getting Started text.
+ */
+ readonly isEnabledCoderGettingStarted?: 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
@@ -36,6 +36,11 @@ export interface IBrowserWorkbenchEnviro
* Enable downloading files via menu actions.
*/
readonly isEnabledFileDownloads?: boolean;
+
+ /**
+ * Enable Coder's custom getting started text.
+ */
+ readonly isEnabledCoderGettingStarted?: boolean;
}
export class BrowserWorkbenchEnvironmentService implements IBrowserWorkbenchEnvironmentService {
@@ -74,6 +79,13 @@ export class BrowserWorkbenchEnvironment
return this.options.isEnabledFileDownloads;
}
+ get isEnabledCoderGettingStarted(): boolean {
+ if (typeof this.options.isEnabledCoderGettingStarted === "undefined") {
+ throw new Error('isEnabledCoderGettingStarted was not provided to the browser');
+ }
+ return this.options.isEnabledCoderGettingStarted;
+ }
+
@memoize
get argvResource(): URI { return joinPath(this.userRoamingDataHome, 'argv.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
@@ -16,6 +16,7 @@ export const serverOptions: OptionDescri
'auth': { type: 'string' },
'disable-file-downloads': { type: 'boolean' },
'locale': { type: 'string' },
+ 'disable-getting-started-override': { type: 'boolean' },
/* ----- server setup ----- */
@@ -98,6 +99,7 @@ export interface ServerParsedArgs {
'auth'?: string
'disable-file-downloads'?: boolean;
'locale'?: string
+ 'disable-getting-started-override'?: 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
@@ -308,6 +308,7 @@ export class WebClientServer {
webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
userDataPath: this._environmentService.userDataPath,
isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
+ isEnabledCoderGettingStarted: !this._environmentService.args['disable-getting-started-override'],
_wrapWebWorkerExtHostInIframe,
developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() },
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
@@ -7,7 +7,7 @@ import { Event } from '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, ProductQualityContext, IsMobileContext } 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, TemporaryWorkspaceContext, IsEnabledFileDownloads } 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, TemporaryWorkspaceContext, IsEnabledFileDownloads, IsEnabledCoderGettingStarted } 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';
@@ -204,6 +204,7 @@ export class WorkbenchContextKeysHandler
// code-server
IsEnabledFileDownloads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileDownloads ?? true)
+ IsEnabledCoderGettingStarted.bindTo(this.contextKeyService).set(this.environmentService.isEnabledCoderGettingStarted ?? true)
this.registerListeners();
}
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
@@ -33,6 +33,7 @@ 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);
+export const IsEnabledCoderGettingStarted = new RawContextKey<boolean>('isEnabledCoderGettingStarted', true, true);
//#endregion

View File

@@ -221,12 +221,13 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench-dev.html
<!-- Disable pinch zooming --> <!-- Disable pinch zooming -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
@@ -26,8 +27,9 @@ @@ -26,9 +27,9 @@
<meta id="vscode-workbench-builtin-extensions" data-settings="{{WORKBENCH_BUILTIN_EXTENSIONS}}"> <meta id="vscode-workbench-builtin-extensions" data-settings="{{WORKBENCH_BUILTIN_EXTENSIONS}}">
<!-- Workbench Icon/Manifest/CSS --> <!-- Workbench Icon/Manifest/CSS -->
- <link rel="icon" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/favicon.ico" type="image/x-icon" /> - <link rel="icon" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/favicon.ico" type="image/x-icon" />
- <link rel="manifest" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/manifest.json" crossorigin="use-credentials" /> - <link rel="manifest" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/manifest.json" crossorigin="use-credentials" />
-
+ <link rel="icon" href="/_static/src/browser/media/favicon-dark-support.svg" /> + <link rel="icon" href="/_static/src/browser/media/favicon-dark-support.svg" />
+ <link rel="alternate icon" href="/_static/src/browser/media/favicon.ico" type="image/x-icon" /> + <link rel="alternate icon" href="/_static/src/browser/media/favicon.ico" type="image/x-icon" />
+ <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" /> + <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />

View File

@@ -26,13 +26,13 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
+ userDataPath: this._environmentService.userDataPath, + userDataPath: this._environmentService.userDataPath,
_wrapWebWorkerExtHostInIframe, _wrapWebWorkerExtHostInIframe,
developmentOptions: { developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() },
enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
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
@@ -262,6 +262,11 @@ export interface IWorkbenchConstructionO @@ -266,6 +266,11 @@ export interface IWorkbenchConstructionO
*/ */
readonly configurationDefaults?: Record<string, any>; readonly configurationDefaults?: Record<string, any>;

View File

@@ -1,21 +0,0 @@
Propagate the log level to the client
This can be tested by using `--log trace`. You should see plenty of debug and
trace logs in the console.
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,7 +304,10 @@ export class WebClientServer {
remoteAuthority,
webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
_wrapWebWorkerExtHostInIframe,
- developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined },
+ developmentOptions: {
+ enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined,
+ logLevel: this._logService.getLevel(),
+ },
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']),

View File

@@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -93,6 +94,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;

View File

@@ -19,22 +19,23 @@ Index: code-server/lib/vscode/src/vs/platform/product/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts --- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts
+++ code-server/lib/vscode/src/vs/platform/product/common/product.ts +++ code-server/lib/vscode/src/vs/platform/product/common/product.ts
@@ -45,7 +45,14 @@ else if (typeof require?.__$__nodeRequir @@ -53,6 +53,16 @@ else if (typeof require?.__$__nodeRequir
version: pkg.version
});
} }
+
Object.assign(product, { + Object.assign(product, {
- version: pkg.version
+ version: pkg.version,
+ extensionsGallery: env.EXTENSIONS_GALLERY ? JSON.parse(env.EXTENSIONS_GALLERY) : (product.extensionsGallery || { + extensionsGallery: env.EXTENSIONS_GALLERY ? JSON.parse(env.EXTENSIONS_GALLERY) : (product.extensionsGallery || {
+ serviceUrl: "https://open-vsx.org/vscode/gallery", + serviceUrl: "https://open-vsx.org/vscode/gallery",
+ itemUrl: "https://open-vsx.org/vscode/item", + itemUrl: "https://open-vsx.org/vscode/item",
+ resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}", + resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",
+ controlUrl: "", + controlUrl: "",
+ recommendationsUrl: "", + recommendationsUrl: "",
+ }), + })
}); + });
} }
// Web environment or unknown
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts

View File

@@ -1,24 +0,0 @@
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

@@ -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
@@ -1458,7 +1458,7 @@ class ProposedApiController { @@ -1462,7 +1462,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)));

View File

@@ -10,6 +10,22 @@ extensions, use --extensions-dir, or symlink it).
This has e2e tests. This has e2e tests.
For the `asExternalUri` changes, you'll need to test manually by:
1. running code-server with the test extension
2. Command Palette > code-server: asExternalUri test
3. input a url like http://localhost:3000
4. it should show a notification and show output as <code-server>/proxy/3000
Do the same thing but set `VSCODE_PROXY_URI: "https://{{port}}-main-workspace-name-user-name.coder.com"`
and the output should replace `{{port}}` with port used in input url.
This also enables the forwared ports view panel by default.
Lastly, it adds a tunnelProvider so that ports are forwarded using code-server's
built-in proxy. You can test this by starting a server i.e. `python3 -m
http.server` and it should show a notification and show up in the ports panel
using the /proxy/port.
Index: code-server/lib/vscode/src/vs/base/common/product.ts Index: code-server/lib/vscode/src/vs/base/common/product.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts --- code-server.orig/lib/vscode/src/vs/base/common/product.ts
@@ -68,7 +84,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
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'] && this._environmentService.args['auth'] !== "none" ? base + '/logout' : undefined, logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? base + '/logout' : undefined,
+ proxyEndpointTemplate: base + '/proxy/{{port}}', + proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? base + '/proxy/{{port}}/',
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
}, },
@@ -89,7 +105,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalE
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts --- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts
@@ -388,7 +388,7 @@ export async function createTerminalEnvi @@ -392,7 +392,7 @@ export async function createTerminalEnvi
// Sanitize the environment, removing any undesirable VS Code and Electron environment // Sanitize the environment, removing any undesirable VS Code and Electron environment
// variables // variables
@@ -98,3 +114,68 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/terminalE
// Merge config (settings) and ShellLaunchConfig environments // Merge config (settings) and ShellLaunchConfig environments
mergeEnvironments(env, allowedEnvFromConfig); mergeEnvironments(env, allowedEnvFromConfig);
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
@@ -21,6 +21,7 @@ import type { ICredentialsProvider } fro
import type { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService';
import type { IWorkbenchConstructionOptions } from 'vs/workbench/browser/web.api';
import type { IWorkspace, IWorkspaceProvider } from 'vs/workbench/services/host/browser/browserHostService';
+import { extractLocalHostUriMetaDataForPortMapping, TunnelOptions, TunnelCreationOptions } from 'vs/platform/tunnel/common/tunnel';
interface ICredential {
service: string;
@@ -511,6 +512,38 @@ function doCreateUri(path: string, query
} : undefined,
workspaceProvider: WorkspaceProvider.create(config),
urlCallbackProvider: new LocalStorageURLCallbackProvider(config.callbackRoute),
- credentialsProvider: config.remoteAuthority ? undefined : new LocalStorageCredentialsProvider() // with a remote, we don't use a local credentials provider
+ credentialsProvider: config.remoteAuthority ? undefined : new LocalStorageCredentialsProvider(), // with a remote, we don't use a local credentials provider
+ resolveExternalUri: (uri: URI): Promise<URI> => {
+ let resolvedUri = uri
+ const localhostMatch = extractLocalHostUriMetaDataForPortMapping(resolvedUri)
+
+ if (localhostMatch && resolvedUri.authority !== location.host) {
+ if (config.productConfiguration && config.productConfiguration.proxyEndpointTemplate) {
+ resolvedUri = URI.parse(new URL(config.productConfiguration.proxyEndpointTemplate.replace('{{port}}', localhostMatch.port.toString()), window.location.href).toString())
+ } else {
+ throw new Error(`Failed to resolve external URI: ${uri.toString()}. Could not determine base url because productConfiguration missing.`)
+ }
+ }
+
+ // If not localhost, return unmodified
+ return Promise.resolve(resolvedUri)
+ },
+ tunnelProvider: {
+ tunnelFactory: (tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions) => {
+ const onDidDispose: Emitter<void> = new Emitter();
+ let isDisposed = false;
+ return Promise.resolve({
+ remoteAddress: tunnelOptions.remoteAddress,
+ localAddress: `localhost:${tunnelOptions.remoteAddress.port}`,
+ onDidDispose: onDidDispose.event,
+ dispose: () => {
+ if (!isDisposed) {
+ isDisposed = true;
+ onDidDispose.fire();
+ }
+ }
+ })
+ }
+ }
});
})();
Index: code-server/lib/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts
@@ -73,7 +73,7 @@ export class ForwardedPortsView extends
this.contextKeyListener = undefined;
}
- const viewEnabled: boolean = !!forwardedPortsViewEnabled.getValue(this.contextKeyService);
+ const viewEnabled: boolean = true;
if (this.environmentService.remoteAuthority && viewEnabled) {
const viewContainer = await this.getViewContainer();

View File

@@ -11,7 +11,6 @@ store-socket.diff
proxy-uri.diff proxy-uri.diff
github-auth.diff github-auth.diff
unique-db.diff unique-db.diff
log-level.diff
local-storage.diff local-storage.diff
service-worker.diff service-worker.diff
sourcemaps.diff sourcemaps.diff
@@ -20,3 +19,4 @@ telemetry.diff
display-language.diff display-language.diff
cli-window-open.diff cli-window-open.diff
exec-argv.diff exec-argv.diff
getting-started.diff

View File

@@ -17,21 +17,6 @@ Index: code-server/lib/vscode/src/vs/base/common/product.ts
readonly version: string; readonly version: string;
readonly date?: string; readonly date?: string;
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
@@ -319,6 +319,10 @@ export class WebClientServer {
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? base + '/logout' : undefined,
proxyEndpointTemplate: base + '/proxy/{{port}}',
+ serviceWorker: {
+ scope: vscodeBase + '/',
+ path: base + '/_static/out/browser/serviceWorker.js',
+ },
embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery,
},
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
@@ -65,3 +50,18 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
+ } + }
+ } + }
} }
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -316,6 +316,10 @@ export class WebClientServer {
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? base + '/logout' : undefined,
proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? base + '/proxy/{{port}}/',
+ serviceWorker: {
+ scope: vscodeBase + '/',
+ path: base + '/_static/out/browser/serviceWorker.js',
+ },
embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery,
},

View File

@@ -10,7 +10,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/build/gulpfile.reh.js --- code-server.orig/lib/vscode/build/gulpfile.reh.js
+++ code-server/lib/vscode/build/gulpfile.reh.js +++ code-server/lib/vscode/build/gulpfile.reh.js
@@ -196,8 +196,7 @@ function packageTask(type, platform, arc @@ -191,8 +191,7 @@ function packageTask(type, platform, arc
const src = gulp.src(sourceFolderName + '/**', { base: '.' }) const src = gulp.src(sourceFolderName + '/**', { base: '.' })
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); })) .pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); }))
@@ -20,7 +20,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js
const workspaceExtensionPoints = ['debuggers', 'jsonValidation']; const workspaceExtensionPoints = ['debuggers', 'jsonValidation'];
const isUIExtension = (manifest) => { const isUIExtension = (manifest) => {
@@ -236,9 +235,9 @@ function packageTask(type, platform, arc @@ -231,9 +230,9 @@ function packageTask(type, platform, arc
.map(name => `.build/extensions/${name}/**`); .map(name => `.build/extensions/${name}/**`);
const extensions = gulp.src(extensionPaths, { base: '.build', dot: true }); const extensions = gulp.src(extensionPaths, { base: '.build', dot: true });
@@ -32,12 +32,12 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js
let version = packageJson.version; let version = packageJson.version;
const quality = product.quality; const quality = product.quality;
@@ -373,7 +372,7 @@ function tweakProductForServerWeb(produc @@ -387,7 +386,7 @@ function tweakProductForServerWeb(produc
const minifyTask = task.define(`minify-vscode-${type}`, task.series( const minifyTask = task.define(`minify-vscode-${type}`, task.series(
optimizeTask, optimizeTask,
util.rimraf(`out-vscode-${type}-min`), util.rimraf(`out-vscode-${type}-min`),
- common.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`) - optimize.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`)
+ common.minifyTask(`out-vscode-${type}`, '') + optimize.minifyTask(`out-vscode-${type}`, ``)
)); ));
gulp.task(minifyTask); gulp.task(minifyTask);

View File

@@ -3,7 +3,7 @@ Add support for telemetry endpoint
To test: To test:
1. Create a RequestBin - https://requestbin.io/ 1. Create a RequestBin - https://requestbin.io/
2. Run code-server with `CS_TELEMETRY_URL` set: 2. Run code-server with `CS_TELEMETRY_URL` set:
i.e. `CS_TELEMETRY_URL="https://requestbin.io/1ebub9z1" ./code-server-4.7.1-macos-amd64/bin/code-server` i.e. `CS_TELEMETRY_URL="https://requestbin.io/1ebub9z1" ./code-server-<version>-macos-amd64/bin/code-server`
3. Load code-server in browser an do things (i.e. open a file) 3. Load code-server in browser an do things (i.e. open a file)
4. Refresh RequestBin and you should see logs 4. Refresh RequestBin and you should see logs
@@ -93,7 +93,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
@@ -324,6 +324,7 @@ export class WebClientServer { @@ -321,6 +321,7 @@ export class WebClientServer {
scope: vscodeBase + '/', scope: vscodeBase + '/',
path: base + '/_static/out/browser/serviceWorker.js', path: base + '/_static/out/browser/serviceWorker.js',
}, },

View File

@@ -14,23 +14,23 @@ Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageS
--- code-server.orig/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts --- code-server.orig/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
+++ code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts +++ code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
@@ -17,6 +17,7 @@ import { AbstractStorageService, isProfi @@ -17,6 +17,7 @@ import { AbstractStorageService, isProfi
import { IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile'; import { isUserDataProfile, IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile';
import { IAnyWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace'; import { IAnyWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
+import { hash } from 'vs/base/common/hash'; +import { hash } from 'vs/base/common/hash';
export class BrowserStorageService extends AbstractStorageService { export class BrowserStorageService extends AbstractStorageService {
@@ -67,7 +68,11 @@ export class BrowserStorageService exten @@ -297,7 +298,11 @@ export class IndexedDBStorageDatabase ex
return `global-${this.profileStorageProfile.id}`;
}
case StorageScope.WORKSPACE:
- return this.payload.id;
+ // Add a unique ID based on the current path for per-workspace databases.
+ // This prevents workspaces on different machines that share the same domain
+ // and file path from colliding (since it does not appear IndexedDB can be
+ // scoped to a path) as long as they are hosted on different paths.
+ return this.payload.id + '-' + hash(location.pathname.toString().replace(/\/$/, "")).toString(16);
}
} }
static async createWorkspaceStorage(workspaceId: string, logService: ILogService): Promise<IIndexedDBStorageDatabase> {
- return IndexedDBStorageDatabase.create({ id: workspaceId }, logService);
+ // Add a unique ID based on the current path for per-workspace databases.
+ // This prevents workspaces on different machines that share the same domain
+ // and file path from colliding (since it does not appear IndexedDB can be
+ // scoped to a path) as long as they are hosted on different paths.
+ return IndexedDBStorageDatabase.create({ id: workspaceId + '-' + hash(location.pathname.toString().replace(/\/$/, "")).toString(16) }, logService);
}
static async create(options: IndexedDBStorageDatabaseOptions, logService: ILogService): Promise<IIndexedDBStorageDatabase> {

View File

@@ -126,7 +126,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
/* ----- server setup ----- */ /* ----- server setup ----- */
@@ -89,6 +91,8 @@ export const serverOptions: OptionDescri @@ -88,6 +90,8 @@ export const serverOptions: OptionDescri
}; };
export interface ServerParsedArgs { export interface ServerParsedArgs {

View File

@@ -20,6 +20,23 @@ 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). To test, open a few types of webviews (images, markdown, extension details, etc).
Make sure to update the hash. To do so:
1. run code-server
2. open any webview (i.e. preview Markdown)
3. see error in console and copy hash
That will test the hash change in pre/index.html
Double-check the console to make sure there are no console errors for the webWorkerExtensionHostIframe
which also requires a hash change.
parentOriginHash changes
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/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
@@ -43,7 +60,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
remoteAuthority, remoteAuthority,
+ webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', + webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
_wrapWebWorkerExtHostInIframe, _wrapWebWorkerExtHostInIframe,
developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined }, developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, 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,
Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index.html Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index.html
=================================================================== ===================================================================
@@ -53,8 +70,8 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" <meta http-equiv="Content-Security-Policy"
- content="default-src 'none'; script-src 'sha256-JpX/ganPoxpavjxWCz9DUZgwVZ59o2lwSYTQrziPsdU=' 'self'; frame-src 'self'; style-src 'unsafe-inline';"> - content="default-src 'none'; script-src 'sha256-wwaDxsm1+SKIUb5YJXiZlYMyV7QPB8+zd6HPcTjigZs=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
+ content="default-src 'none'; script-src 'sha256-BRi/ZOLWtsisl3jAheglVzKmoA1T6n2Mmf2NM4UnIXE=' 'self'; frame-src 'self'; style-src 'unsafe-inline';"> + content="default-src 'none'; script-src 'sha256-IZkGO4jZeUn7pzM6pBZCZc9bUYm8oVNV3z8zEa8gxlk=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
<!-- Disable pinch zooming --> <!-- Disable pinch zooming -->
<meta name="viewport" <meta name="viewport"
@@ -70,7 +87,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
+ +
if (!crypto.subtle) { if (!crypto.subtle) {
// cannot validate, not running in a secure context // cannot validate, not running in a secure context
throw new Error(`Cannot validate in current context!`); throw new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);
Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html --- code-server.orig/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
@@ -87,7 +104,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
+ +
if (!crypto.subtle) { if (!crypto.subtle) {
// cannot validate, not running in a secure context // cannot validate, not running in a secure context
throw new Error(`Cannot validate in current context!`); throw new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);
Index: code-server/lib/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html Index: code-server/lib/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html --- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html

View File

@@ -10,7 +10,7 @@
http-equiv="Content-Security-Policy" http-equiv="Content-Security-Policy"
content="style-src 'self'; script-src 'self' 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;" content="style-src 'self'; script-src 'self' 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;"
/> />
<title>code-server login</title> <title>{{APP_NAME}} login</title>
<link rel="icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon-dark-support.svg" /> <link rel="icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon-dark-support.svg" />
<link rel="alternate icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon.ico" /> <link rel="alternate icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon.ico" />
<link rel="manifest" href="{{BASE}}/manifest.json" crossorigin="use-credentials" /> <link rel="manifest" href="{{BASE}}/manifest.json" crossorigin="use-credentials" />
@@ -24,7 +24,7 @@
<div class="center-container"> <div class="center-container">
<div class="card-box"> <div class="card-box">
<div class="header"> <div class="header">
<h1 class="main">Welcome to code-server</h1> <h1 class="main">{{WELCOME_TEXT}}</h1>
<div class="sub">Please log in below. {{PASSWORD_MSG}}</div> <div class="sub">Please log in below. {{PASSWORD_MSG}}</div>
</div> </div>
<div class="content"> <div class="content">

View File

@@ -1,6 +1,6 @@
import { field, Level, logger } from "@coder/logger" import { field, Level, logger } from "@coder/logger"
import { promises as fs } from "fs" import { promises as fs } from "fs"
import yaml from "js-yaml" import { load } from "js-yaml"
import * as os from "os" import * as os from "os"
import * as path from "path" import * as path from "path"
import { canConnect, generateCertificate, generatePassword, humanPath, paths, isNodeJSErrnoException } from "./util" import { canConnect, generateCertificate, generatePassword, humanPath, paths, isNodeJSErrnoException } from "./util"
@@ -50,6 +50,8 @@ export interface UserProvidedCodeArgs {
"github-auth"?: string "github-auth"?: string
"disable-update-check"?: boolean "disable-update-check"?: boolean
"disable-file-downloads"?: boolean "disable-file-downloads"?: boolean
"disable-workspace-trust"?: boolean
"disable-getting-started-override"?: boolean
} }
/** /**
@@ -84,6 +86,8 @@ export interface UserProvidedArgs extends UserProvidedCodeArgs {
"ignore-last-opened"?: boolean "ignore-last-opened"?: boolean
link?: OptionalString link?: OptionalString
verbose?: boolean verbose?: boolean
"app-name"?: string
"welcome-text"?: string
/* Positional arguments. */ /* Positional arguments. */
_?: string[] _?: string[]
} }
@@ -163,6 +167,14 @@ export const options: Options<Required<UserProvidedArgs>> = {
description: description:
"Disable file downloads from Code. This can also be set with CS_DISABLE_FILE_DOWNLOADS set to 'true' or '1'.", "Disable file downloads from Code. This can also be set with CS_DISABLE_FILE_DOWNLOADS set to 'true' or '1'.",
}, },
"disable-workspace-trust": {
type: "boolean",
description: "Disable Workspace Trust feature. This switch only affects the current session.",
},
"disable-getting-started-override": {
type: "boolean",
description: "Disable the coder/coder override in the Help: Getting Started page.",
},
// --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[]" },
@@ -233,7 +245,16 @@ export const options: Options<Required<UserProvidedArgs>> = {
log: { type: LogLevel }, log: { type: LogLevel },
verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." }, verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." },
"app-name": {
type: "string",
short: "an",
description: "The name to use in branding. Will be shown in titlebar and welcome message",
},
"welcome-text": {
type: "string",
short: "w",
description: "Text to show on login page",
},
link: { link: {
type: OptionalString, type: OptionalString,
description: ` description: `
@@ -547,6 +568,10 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
args["disable-file-downloads"] = true args["disable-file-downloads"] = true
} }
if (process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE?.match(/^(1|true)$/)) {
args["disable-getting-started-override"] = 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
@@ -641,7 +666,7 @@ export function parseConfigFile(configFile: string, configPath: string): ConfigA
return { config: configPath } return { config: configPath }
} }
const config = yaml.load(configFile, { const config = load(configFile, {
filename: configPath, filename: configPath,
}) })
if (!config || typeof config === "string") { if (!config || typeof config === "string") {

View File

@@ -9,7 +9,7 @@ import { AuthType, DefaultedArgs, Feature, SpawnCodeCli, toCodeArgs, UserProvide
import { coderCloudBind } from "./coder_cloud" import { coderCloudBind } from "./coder_cloud"
import { commit, version } from "./constants" import { commit, version } from "./constants"
import { register } from "./routes" import { register } from "./routes"
import { humanPath, isFile, loadAMDModule, open } from "./util" import { humanPath, isDirectory, loadAMDModule, open } from "./util"
/** /**
* Return true if the user passed an extension-related VS Code flag. * Return true if the user passed an extension-related VS Code flag.
@@ -69,14 +69,15 @@ export const openInExistingInstance = async (args: DefaultedArgs, socketPath: st
fileURIs: [], fileURIs: [],
forceReuseWindow: args["reuse-window"], forceReuseWindow: args["reuse-window"],
forceNewWindow: args["new-window"], forceNewWindow: args["new-window"],
gotoLineMode: true,
} }
const paths = args._ || [] const paths = args._ || []
for (let i = 0; i < paths.length; i++) { for (let i = 0; i < paths.length; i++) {
const fp = path.resolve(paths[i]) const fp = path.resolve(paths[i])
if (await isFile(fp)) { if (await isDirectory(fp)) {
pipeArgs.fileURIs.push(fp)
} else {
pipeArgs.folderURIs.push(fp) pipeArgs.folderURIs.push(fp)
} else {
pipeArgs.fileURIs.push(fp)
} }
} }
if (pipeArgs.forceNewWindow && pipeArgs.fileURIs.length > 0) { if (pipeArgs.forceNewWindow && pipeArgs.fileURIs.length > 0) {

View File

@@ -227,7 +227,7 @@ export class PluginAPI {
`) `)
} }
if (!semver.satisfies(version, packageJSON.engines["code-server"])) { if (!semver.satisfies(version, packageJSON.engines["code-server"])) {
throw new Error( this.logger.warn(
`plugin range ${q(packageJSON.engines["code-server"])} incompatible` + ` with code-server version ${version}`, `plugin range ${q(packageJSON.engines["code-server"])} incompatible` + ` with code-server version ${version}`,
) )
} }

View File

@@ -28,6 +28,8 @@ export class RateLimiter {
const getRoot = async (req: Request, error?: Error): Promise<string> => { const getRoot = async (req: Request, error?: Error): Promise<string> => {
const content = await fs.readFile(path.join(rootPath, "src/browser/pages/login.html"), "utf8") const content = await fs.readFile(path.join(rootPath, "src/browser/pages/login.html"), "utf8")
const appName = req.args["app-name"] || "code-server"
const welcomeText = req.args["welcome-text"] || `Welcome to ${appName}`
let passwordMsg = `Check the config file at ${humanPath(os.homedir(), req.args.config)} for the password.` let passwordMsg = `Check the config file at ${humanPath(os.homedir(), req.args.config)} for the password.`
if (req.args.usingEnvPassword) { if (req.args.usingEnvPassword) {
passwordMsg = "Password was set from $PASSWORD." passwordMsg = "Password was set from $PASSWORD."
@@ -38,6 +40,8 @@ const getRoot = async (req: Request, error?: Error): Promise<string> => {
return replaceTemplates( return replaceTemplates(
req, req,
content content
.replace(/{{APP_NAME}}/g, appName)
.replace(/{{WELCOME_TEXT}}/g, welcomeText)
.replace(/{{PASSWORD_MSG}}/g, passwordMsg) .replace(/{{PASSWORD_MSG}}/g, passwordMsg)
.replace(/{{ERROR}}/, error ? `<div class="error">${escapeHtml(error.message)}</div>` : ""), .replace(/{{ERROR}}/, error ? `<div class="error">${escapeHtml(error.message)}</div>` : ""),
) )

View File

@@ -156,9 +156,7 @@ export class CodeServerRouteWrapper {
try { try {
this._codeServerMain = await createVSServer(null, { this._codeServerMain = await createVSServer(null, {
...(await toCodeArgs(args)), ...(await toCodeArgs(args)),
// TODO: Make the browser helper script work.
"without-connection-token": true, "without-connection-token": true,
"without-browser-env-var": true,
}) })
} catch (error) { } catch (error) {
logError(logger, "CodeServerRouteWrapper", error) logError(logger, "CodeServerRouteWrapper", error)

View File

@@ -482,6 +482,15 @@ export const isFile = async (path: string): Promise<boolean> => {
} }
} }
export const isDirectory = async (path: string): Promise<boolean> => {
try {
const stat = await fs.stat(path)
return stat.isDirectory()
} catch (error) {
return false
}
}
/** /**
* Escapes any HTML string special characters, like &, <, >, ", and '. * Escapes any HTML string special characters, like &, <, >, ", and '.
* *

View File

@@ -4,7 +4,7 @@ import { getMaybeProxiedCodeServer } from "../utils/helpers"
import { describe, test, expect } from "./baseFixture" import { describe, test, expect } from "./baseFixture"
import { CodeServer } from "./models/CodeServer" import { CodeServer } from "./models/CodeServer"
describe("code-server", [], {}, () => { describe("code-server", ["--disable-workspace-trust"], {}, () => {
// TODO@asher: Generalize this? Could be nice if we were to ever need // TODO@asher: Generalize this? Could be nice if we were to ever need
// multiple migration tests in other suites. // multiple migration tests in other suites.
const instances = new Map<string, CodeServer>() const instances = new Map<string, CodeServer>()

View File

@@ -3,12 +3,17 @@ import { describe, test, expect } from "./baseFixture"
// Given a code-server environment with Spanish Language Pack extension installed // Given a code-server environment with Spanish Language Pack extension installed
// and a languagepacks.json in the data-dir // and a languagepacks.json in the data-dir
describe("--locale es", ["--extensions-dir", path.join(__dirname, "./extensions"), "--locale", "es"], {}, () => { describe(
test("should load code-server in Spanish", async ({ codeServerPage }) => { "--locale es",
// When ["--disable-workspace-trust", "--extensions-dir", path.join(__dirname, "./extensions"), "--locale", "es"],
const visible = await codeServerPage.page.isVisible("text=Explorador") {},
() => {
test("should load code-server in Spanish", async ({ codeServerPage }) => {
// When
const visible = await codeServerPage.page.isVisible("text=Explorador")
// Then // Then
expect(visible).toBe(true) expect(visible).toBe(true)
}) })
}) },
)

View File

@@ -3,7 +3,7 @@ import * as path from "path"
import { clean } from "../utils/helpers" import { clean } from "../utils/helpers"
import { describe, test, expect } from "./baseFixture" import { describe, test, expect } from "./baseFixture"
describe("Downloads (enabled)", [], {}, async () => { describe("Downloads (enabled)", ["--disable-workspace-trust"], {}, async () => {
const testName = "downloads-enabled" const testName = "downloads-enabled"
test.beforeAll(async () => { test.beforeAll(async () => {
await clean(testName) await clean(testName)
@@ -25,7 +25,7 @@ describe("Downloads (enabled)", [], {}, async () => {
}) })
}) })
describe("Downloads (disabled)", ["--disable-file-downloads"], {}, async () => { describe("Downloads (disabled)", ["--disable-workspace-trust", "--disable-file-downloads"], {}, async () => {
const testName = "downloads-disabled" const testName = "downloads-disabled"
test.beforeAll(async () => { test.beforeAll(async () => {
await clean(testName) await clean(testName)

View File

@@ -15,11 +15,11 @@ function runTestExtensionTests() {
const text = await codeServerPage.page.locator("text=proxyUri").first().textContent() const text = await codeServerPage.page.locator("text=proxyUri").first().textContent()
// Remove end slash in address // Remove end slash in address
const normalizedAddress = address.replace(/\/+$/, "") const normalizedAddress = address.replace(/\/+$/, "")
expect(text).toBe(`Info: proxyUri: ${normalizedAddress}/proxy/{{port}}`) expect(text).toBe(`Info: proxyUri: ${normalizedAddress}/proxy/{{port}}/`)
}) })
} }
const flags = ["--extensions-dir", path.join(__dirname, "./extensions")] const flags = ["--disable-workspace-trust", "--extensions-dir", path.join(__dirname, "./extensions")]
describe("Extensions", flags, {}, () => { describe("Extensions", flags, {}, () => {
runTestExtensionTests() runTestExtensionTests()

View File

@@ -28,5 +28,11 @@
] ]
} }
] ]
},
"__metadata": {
"id": "47e020a1-33db-4cc0-a1b4-42f97781749a",
"publisherDisplayName": "MS-CEINTL",
"publisherId": "0b0882c3-aee3-4d7c-b5f9-872f9be0a115",
"isPreReleaseVersion": false
} }
} }

View File

@@ -2,6 +2,7 @@ import * as vscode from "vscode"
export function activate(context: vscode.ExtensionContext) { export function activate(context: vscode.ExtensionContext) {
vscode.window.showInformationMessage("test extension loaded") vscode.window.showInformationMessage("test extension loaded")
// Test extension
context.subscriptions.push( context.subscriptions.push(
vscode.commands.registerCommand("codeServerTest.proxyUri", () => { vscode.commands.registerCommand("codeServerTest.proxyUri", () => {
if (process.env.VSCODE_PROXY_URI) { if (process.env.VSCODE_PROXY_URI) {
@@ -11,4 +12,20 @@ export function activate(context: vscode.ExtensionContext) {
} }
}), }),
) )
// asExternalUri extension
context.subscriptions.push(
vscode.commands.registerCommand("codeServerTest.asExternalUri", async () => {
const input = await vscode.window.showInputBox({
prompt: "URL to pass through to asExternalUri",
})
if (input) {
const output = await vscode.env.asExternalUri(vscode.Uri.parse(input))
vscode.window.showInformationMessage(`input: ${input} output: ${output}`)
} else {
vscode.window.showErrorMessage(`Failed to run test case. No input provided.`)
}
}),
)
} }

View File

@@ -17,6 +17,11 @@
"command": "codeServerTest.proxyUri", "command": "codeServerTest.proxyUri",
"title": "Get proxy URI", "title": "Get proxy URI",
"category": "code-server" "category": "code-server"
},
{
"command": "codeServerTest.asExternalUri",
"title": "asExternalUri test",
"category": "code-server"
} }
] ]
}, },

View File

@@ -2,7 +2,7 @@ import { test as base } from "@playwright/test"
import { describe, expect, test } from "./baseFixture" import { describe, expect, test } from "./baseFixture"
if (process.env.GITHUB_TOKEN) { if (process.env.GITHUB_TOKEN) {
describe("GitHub token", [], {}, () => { describe("GitHub token", ["--disable-workspace-trust"], {}, () => {
test("should be logged in to pull requests extension", async ({ codeServerPage }) => { test("should be logged in to pull requests extension", async ({ codeServerPage }) => {
await codeServerPage.exec("git init") await codeServerPage.exec("git init")
await codeServerPage.exec("git remote add origin https://github.com/coder/code-server") await codeServerPage.exec("git remote add origin https://github.com/coder/code-server")
@@ -16,7 +16,7 @@ if (process.env.GITHUB_TOKEN) {
}) })
}) })
describe("No GitHub token", [], { GITHUB_TOKEN: "" }, () => { describe("No GitHub token", ["--disable-workspace-trust"], { GITHUB_TOKEN: "" }, () => {
test("should not be logged in to pull requests extension", async ({ codeServerPage }) => { test("should not be logged in to pull requests extension", async ({ codeServerPage }) => {
await codeServerPage.exec("git init") await codeServerPage.exec("git init")
await codeServerPage.exec("git remote add origin https://github.com/coder/code-server") await codeServerPage.exec("git remote add origin https://github.com/coder/code-server")

View File

@@ -1,7 +1,7 @@
import { PASSWORD } from "../utils/constants" import { PASSWORD } from "../utils/constants"
import { describe, test, expect } from "./baseFixture" import { describe, test, expect } from "./baseFixture"
describe("login", ["--auth", "password"], {}, () => { describe("login", ["--disable-workspace-trust", "--auth", "password"], {}, () => {
test("should see the login page", async ({ codeServerPage }) => { test("should see the login page", async ({ codeServerPage }) => {
// It should send us to the login page // It should send us to the login page
expect(await codeServerPage.page.title()).toBe("code-server login") expect(await codeServerPage.page.title()).toBe("code-server login")

View File

@@ -1,7 +1,7 @@
// NOTE@jsjoeio commenting out until we can figure out what's wrong // NOTE@jsjoeio commenting out until we can figure out what's wrong
// import { describe, test, expect } from "./baseFixture" // import { describe, test, expect } from "./baseFixture"
// describe("logout", true, [], {}, () => { // describe("logout", true, ["--disable-workspace-trust"], {}, () => {
// test("should be able logout", async ({ codeServerPage }) => { // test("should be able logout", async ({ codeServerPage }) => {
// // Recommended by Playwright for async navigation // // Recommended by Playwright for async navigation
// // https://github.com/microsoft/playwright/issues/1987#issuecomment-620182151 // // https://github.com/microsoft/playwright/issues/1987#issuecomment-620182151

View File

@@ -82,9 +82,6 @@ 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",
) )

View File

@@ -1,7 +1,7 @@
import { version } from "../../src/node/constants" import { version } from "../../src/node/constants"
import { describe, test, expect } from "./baseFixture" import { describe, test, expect } from "./baseFixture"
describe("Open Help > About", [], {}, () => { describe("Open Help > About", ["--disable-workspace-trust"], {}, () => {
test("should see code-server version in about dialog", async ({ codeServerPage }) => { test("should see code-server version in about dialog", async ({ codeServerPage }) => {
// Open using the menu. // Open using the menu.
await codeServerPage.navigateMenus(["Help", "About"]) await codeServerPage.navigateMenus(["Help", "About"])

View File

@@ -5,7 +5,7 @@ import util from "util"
import { clean, getMaybeProxiedCodeServer, tmpdir } from "../utils/helpers" import { clean, getMaybeProxiedCodeServer, tmpdir } from "../utils/helpers"
import { describe, expect, test } from "./baseFixture" import { describe, expect, test } from "./baseFixture"
describe("Integrated Terminal", [], {}, () => { describe("Integrated Terminal", ["--disable-workspace-trust"], {}, () => {
const testName = "integrated-terminal" const testName = "integrated-terminal"
test.beforeAll(async () => { test.beforeAll(async () => {
await clean(testName) await clean(testName)

13
test/e2e/trust.test.ts Normal file
View File

@@ -0,0 +1,13 @@
import { describe, test, expect } from "./baseFixture"
describe("Workspace trust (enabled)", [], {}, async () => {
test("should see the 'I Trust...' option", async ({ codeServerPage }) => {
expect(await codeServerPage.page.isVisible("text=Yes, I trust")).toBe(true)
})
})
describe("Workspace trust (disabled)", ["--disable-workspace-trust"], {}, async () => {
test("should not see the 'I Trust...' option", async ({ codeServerPage }) => {
expect(await codeServerPage.page.isVisible("text=Yes, I trust")).toBe(false)
})
})

View File

@@ -8,6 +8,7 @@ import path from "path"
// yarn test:e2e --workers 1 # Run with one worker // yarn test:e2e --workers 1 # Run with one worker
// yarn test:e2e --project Chromium # Only run on Chromium // yarn test:e2e --project Chromium # Only run on Chromium
// yarn test:e2e --grep login # Run tests matching "login" // yarn test:e2e --grep login # Run tests matching "login"
// PWDEBUG=1 yarn test:e2e # Run Playwright inspector
const config: PlaywrightTestConfig = { const config: PlaywrightTestConfig = {
testDir: path.join(__dirname, "e2e"), // Search for tests in this directory. testDir: path.join(__dirname, "e2e"), // Search for tests in this directory.
timeout: 60000, // Each test is given 60 seconds. timeout: 60000, // Each test is given 60 seconds.

View File

@@ -43,6 +43,7 @@ describe("parser", () => {
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 delete process.env.CS_DISABLE_FILE_DOWNLOADS
delete process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE
console.log = jest.fn() console.log = jest.fn()
}) })
@@ -67,6 +68,8 @@ describe("parser", () => {
"1", "1",
"--verbose", "--verbose",
["--app-name", "custom instance name"],
["--welcome-text", "welcome to code"],
"2", "2",
["--locale", "ja"], ["--locale", "ja"],
@@ -95,6 +98,8 @@ describe("parser", () => {
"--disable-file-downloads", "--disable-file-downloads",
"--disable-getting-started-override",
["--host", "0.0.0.0"], ["--host", "0.0.0.0"],
"4", "4",
"--", "--",
@@ -112,6 +117,7 @@ describe("parser", () => {
value: path.resolve("path/to/cert"), value: path.resolve("path/to/cert"),
}, },
"disable-file-downloads": true, "disable-file-downloads": true,
"disable-getting-started-override": true,
enable: ["feature1", "feature2"], enable: ["feature1", "feature2"],
help: true, help: true,
host: "0.0.0.0", host: "0.0.0.0",
@@ -123,6 +129,8 @@ describe("parser", () => {
socket: path.resolve("mumble"), socket: path.resolve("mumble"),
"socket-mode": "777", "socket-mode": "777",
verbose: true, verbose: true,
"app-name": "custom instance name",
"welcome-text": "welcome to code",
version: true, version: true,
"bind-addr": "192.169.0.1:8080", "bind-addr": "192.169.0.1:8080",
}) })
@@ -374,6 +382,30 @@ describe("parser", () => {
}) })
}) })
it("should use env var CS_DISABLE_GETTING_STARTED_OVERRIDE", async () => {
process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE = "1"
const args = parse([])
expect(args).toEqual({})
const defaultArgs = await setDefaults(args)
expect(defaultArgs).toEqual({
...defaults,
"disable-getting-started-override": true,
})
})
it("should use env var CS_DISABLE_GETTING_STARTED_OVERRIDE set to true", async () => {
process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE = "true"
const args = parse([])
expect(args).toEqual({})
const defaultArgs = await setDefaults(args)
expect(defaultArgs).toEqual({
...defaults,
"disable-getting-started-override": 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",

View File

@@ -92,5 +92,51 @@ describe("login", () => {
expect(htmlContent).toContain("Incorrect password") expect(htmlContent).toContain("Incorrect password")
}) })
it("should return correct app-name", async () => {
process.env.PASSWORD = previousEnvPassword
const appName = "testnäme"
const codeServer = await integration.setup([`--app-name=${appName}`], "")
const resp = await codeServer.fetch("/login", { method: "GET" })
const htmlContent = await resp.text()
expect(resp.status).toBe(200)
expect(htmlContent).toContain(`${appName}</h1>`)
expect(htmlContent).toContain(`<title>${appName} login</title>`)
})
it("should return correct app-name when unset", async () => {
process.env.PASSWORD = previousEnvPassword
const appName = "code-server"
const codeServer = await integration.setup([], "")
const resp = await codeServer.fetch("/login", { method: "GET" })
const htmlContent = await resp.text()
expect(resp.status).toBe(200)
expect(htmlContent).toContain(`${appName}</h1>`)
expect(htmlContent).toContain(`<title>${appName} login</title>`)
})
it("should return correct welcome text", async () => {
process.env.PASSWORD = previousEnvPassword
const welcomeText = "Welcome to your code workspace! öäü🔐"
const codeServer = await integration.setup([`--welcome-text=${welcomeText}`], "")
const resp = await codeServer.fetch("/login", { method: "GET" })
const htmlContent = await resp.text()
expect(resp.status).toBe(200)
expect(htmlContent).toContain(welcomeText)
})
it("should return correct welcome text when none is set but app-name is", async () => {
process.env.PASSWORD = previousEnvPassword
const appName = "testnäme"
const codeServer = await integration.setup([`--app-name=${appName}`], "")
const resp = await codeServer.fetch("/login", { method: "GET" })
const htmlContent = await resp.text()
expect(resp.status).toBe(200)
expect(htmlContent).toContain(`Welcome to ${appName}`)
})
}) })
}) })

View File

@@ -3,7 +3,7 @@
"name": "test-plugin", "name": "test-plugin",
"version": "1.0.0", "version": "1.0.0",
"engines": { "engines": {
"code-server": "^4.7.1" "code-server": "*"
}, },
"main": "out/index.js", "main": "out/index.js",
"devDependencies": { "devDependencies": {

View File

@@ -457,17 +457,40 @@ describe("isFile", () => {
afterEach(async () => { afterEach(async () => {
await fs.rm(testDir, { recursive: true, force: true }) await fs.rm(testDir, { recursive: true, force: true })
}) })
it("should return false if the path doesn't exist", async () => { it("should return false if is directory", async () => {
expect(await util.isFile(testDir)).toBe(false) expect(await util.isFile(testDir)).toBe(false)
}) })
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 () => { it("should return false if the path doesn't exist", async () => {
expect(await util.isFile("fakefile.txt")).toBe(false) expect(await util.isFile("fakefile.txt")).toBe(false)
}) })
}) })
describe("isDirectory", () => {
const testDir = path.join(tmpdir, "tests", "isDirectory")
let pathToFile = ""
beforeEach(async () => {
pathToFile = path.join(testDir, "foo.txt")
await fs.mkdir(testDir, { recursive: true })
await fs.writeFile(pathToFile, "hello")
})
afterEach(async () => {
await fs.rm(testDir, { recursive: true, force: true })
})
it("should return false if is a file", async () => {
expect(await util.isDirectory(pathToFile)).toBe(false)
})
it("should return true if is directory", async () => {
expect(await util.isDirectory(testDir)).toBe(true)
})
it("should return false if the path doesn't exist", async () => {
expect(await util.isDirectory("fakefile.txt")).toBe(false)
})
})
describe("humanPath", () => { describe("humanPath", () => {
it("should return an empty string if no path provided", () => { it("should return an empty string if no path provided", () => {
const mockHomedir = "/home/coder" const mockHomedir = "/home/coder"

1905
yarn.lock

File diff suppressed because it is too large Load Diff