Extracted host detection into a separate function to avoid multiple log
lines on each return and went with a thrown error to consolidate the
common log text.
* Move splitOnFirstEquals to util
I will be making use of this to parse the forwarded header.
* Type splitOnFirstEquals with two items
Also add some test cases.
* Check origin header on web sockets
* Update changelog with origin check
* Fix web sockets not closing with error code
* feat: add i18n in login page
* fix: add word space and put the app name into the title
* fix: remove duplicate replace title
* fix: prettier format code
* fix: fix typescript check warning
* fix: add zh-cn locale file code owner
* fix: use existing flag locale to the login page
Co-authored-by: Joe Previte <jjprevite@gmail.com>
* chore: upgrade Code to 1.74.1
* chore: remove require in integration.diff
I don't know what the impact of this is but in 192c67db71
they removed the usage of `require` in `server.main.ts`.
More details in PR: https://github.com/microsoft/vscode/pull/165831
* chore: update marketplace.diff
* chore: update sha hash in webview.diff
* chore: update disable-builtin-ext-update.diff
If my logic is right, then this patch is now simplified thanks to this:
https://github.com/microsoft/vscode/blob/1.74.1/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts#L1238
* chore: refresh proxy-uri patch
* chore: refresh local-storage.diff
* chore: refresh sourcemaps.diff
* chore: refresh disable-downloads.diff
* chore: refresh display-language.diff
* chore: refresh getting-started.diff
* docs: update testing notes for cli-window-open
* docs: update telemetry testing instructions
* fix: add GITHUB_TOKEN to build code-server job
Downloading @vscode/ripgrep is failing only in CI so adding this
environment variable to see if it increases the rate limit.
Ref: https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
* refactor: use own cache key build code-server job
* temp: disable vscode test
* refactor: delete wrapper test
* Revert "refactor: delete wrapper test"
This reverts commit 3999279b73.
* refactor: move vscode tests to e2e (#5911)
* wip: migrate vscode tests to e2e
* feat: add codeWorkspace to global setup
* refactor: only use dir in spawn when we should
* wip: migrate more tests
* refactor: move all vscode tests to e2e
* refactor(ci): move unit to own job
* fixup: add codecov to unit test step
* Update test/e2e/models/CodeServer.ts
* Update test/e2e/models/CodeServer.ts
* docs: add note about intercept requests
* refactor: rm unused clean() calls
* refactor: delete duplicate test
* refactor: update 'should not redirect' test
* refactor: rm unused imports
* refactor: rm unnecessary navigate call in test
* fixup: formatting
* wip: update test
* refactor: modify assertion for proxy
* fixup: use REVERSE_PROXY_BASE_PATH
* refactor: add helper fn getMaybeProxiedPathname
* fixup: formatting
* fixup: rm unused import
* chore: increase playwright timeout
* Revert "chore: increase playwright timeout"
This reverts commit a059129252.
* chore: rm timeout
* wip: changelog
* fixup
* fix: add +x to product.json in build-vscode
While testing a pre-release, there seems to be a bug with the file
permissions for `product.json`. Adding `chmod +x` to see if that fixes
it.
* chore: increase timeout
* fix: keep product.json file permissions in release
When we added the change to modify the `package.json` version using `mv`
and `jq` we didn't account for lost file permissions.
This caused a bug only happening in CI.
This should fix it by giving it 755 via `chmod`.
* trigger ci
* chore: update package.json bust cache
* fixup!: fix: keep product.json file permissions in release
* Revert "fix: add +x to product.json in build-vscode"
This reverts commit fc4d2b532f.
* chore: pin ubuntu runner in build code-server
* chore: update prettierignore
* chore: add notes to changelog
* chore: use ubuntu-22.04 for e2e
* chore: pin all jobs in build to ubuntu 20.04
* feat(wrapper): add tests for isChild
* fixup: include description ts-expect-error comment
* chore: update CHANGELOG
* chore: update Helm chart
* fixup: use our childProcess
* Update CHANGELOG.md
Co-authored-by: Asher <ash@coder.com>
Co-authored-by: Asher <ash@coder.com>
* chore: upgrade Code to 1.73.0
This upgrades Code to 1.73.0 via the tag.
* chore: refresh integration patch
* chore: clean up base-path patch
Only change here was they moved
lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
so I had to update it. Code still looks the same though.
* chore: refresh proposed-api patch
* chore: update marketplace patch
Simlar to a previous patch, the location of
lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
changed so I had to update this patch.
No changes to code itself.
* chore: update hash in webview patch
I believe there was only one to update but I may have missed one.
* chore: refresh disable-builtin-ext-update.diff
* chore: refresh update-check
quilt couldn't apply it so I had to add one change in manually to
lib/vscode/src/vs/server/node/serverEnvironmentService.ts
* chore: refresh logout patch
* chore: refresh proxy-uri patch
* chore: refresh local-storage patch
* chore: refresh sourcemaps patch
* chore: refresh disable-downloads patch
* chore: refresh telemetry patch
* refactor: re-apply display-language patch
This kinda got removed but I added it back in.
* refactor: drop exec-argv patch
This was accepted upstream! :tada
* chore: refresh getting-started patch
* fixup: add missing slash in marketplace
* fixup: update notes proposed-api patch
* fixup: support this.args.log as string
Seems like upstream now uses a string[] for this. For now, support
string.
See
2b50ab06b1
* Revert "fixup: support this.args.log as string"
This reverts commit 78c02a1f13.
* fixup!: add log to toCodeArgs
This was changed upstream from `string` to `string[]` so now we convert
to an array in `toCodeArgs`.
See 78c02a1f13
* fixup: update telemetry description
* 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
* 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
* 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>
* 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>
* refactor: remove stylelint
* refactor: move shellcheck to separate job
* refactor: add helm script and job
* refactor: add eslint job and yarn script
* fix(test/tsconfig): exclude test-plugin
* refactor: delete lint, add typecheck job
* refactor: remove prebuild
* wip: add notes about unit test refactor
* refactor: delete buggy socket test
This test was really added to in get cover specific lines but it's buggy
and only passes sometimes locally. I think it's okay to remove because:
- it's an implementation detail (not user facing)
- not preventing any specific regressions
* refactor: move test-plugin to integration suite
This seems more appropriate given this tests how a plugin might work
within code-server.
* wip
* wip: refactor vscode integration tests
* refactor: move unit tests to separate job
* fix: formatting
* Revert "wip: refactor vscode integration tests"
This reverts commit 13286bf4c9.
* Revert "refactor: move unit tests to separate job"
This reverts commit 6c87b540b4.
* feat: collect codecov integration tests
* fixup! feat: collect codecov integration tests
* fixup! feat: collect codecov integration tests
* fixup!: move helm step
* fixup!: update ids for caching
* trigger ci
* trigger ci
* chore: clean up names in security.yaml
* fixup!: remove .tsx
* fixup!: change to src/**"
* fixup!: move helm cmd to yaml
* fixup!: always build test plugin
* fixup!: fix plugin typings
* fixup! add back flakey test
* fixup!: only install helm deps if changes
* fixup!: revert node mod caching
* dont keep, test for asher
* fixup!: add make to centos
* refactor: add test:native
This adds a new script to run native tests (i.e. --help which should run
in ci on all platforms).
* try updating glibc
* try 2.25
* Revert "refactor: move test-plugin to integration suite"
This reverts commit bc02005dc0.
I couldn't get past some GLIBC errors in CI so moving back to unit
tests.
* Revert "try updating glibc"
This reverts commit 02ed560f22.
* fixup!
* asher: again
* try this for ts changes
* fixup
* refactor: scripts.yml -> scripts.yaml
* fixup!: move lint-sh to scripts.yaml
* fixup!: use apk for lint scripts
* fixup! fixup!: use apk for lint scripts
* fixup!: remove typecheck step
* fix: pattern for lint ts files
* test: lint should fail
* fixup! fixup!: use apk for lint scripts
* Revert "test: lint should fail"
This reverts commit 158c64db04.
* fixup!: skip cancel workflow on forks
Looks like the cancel action workflow can't run on forks due to secrets.
See https://github.com/andymckay/cancel-action/issues/4
* fixup: remove cancel-workflow
* fixup! fixup! fixup!: use apk for lint scripts
* fixup! fixup! fixup!: use apk for lint scripts
* fixup!: fix yarn key
* fixup!: add fetch-depth 0
* docs: update MAINTAINING
* refactor: use branch name in release-prep
This makes a minor improvement to the `release-prep.sh` script to grab
the version to update to from the branch name.
* chore(release): bump version to 4.7.0
* fixup: bump version
* docs: use latest instead of version
* fixup: bump Chart version
* chore: update CHANGELOG
* chore: add license to test package.json
* chore: bump @coder/logging to 3.0.0
* fix: change level to Warn
* Update Node types to 16
* Update Express core types
Fixes a number of conflicts it has with Node 16.
* Fix websocket router types
It seems req was `any` before so now we have to handle the types. Also
it seems the socket is of type `stream.Duplex`, not `net.Socket`.
The ws types had to be updated to support the new type.
Unfortunately Code still uses the old type so cast for now.
In the web socket router just use a cast for the extra properties we
add. We could add the types to the Express namespace but I am not sure
we really want these commonly accessible so keep with the casts for now.
Likely we should use Express's `locals` or something instead.
* Add missing return
Not sure why it only just now started complaining though.
Co-authored-by: Asher <ash@coder.com>
* chore: update Code to 1.67
Was able to remove our changes to common/webview.ts since they are
upstream now.
Other than that no serious changes, just context diffs.
* chore: update Code to 1.68
- Upstream moved the web socket endpoint so change the Express route
from / to *. That will let web sockets work at any endpoint.
- Everything in the workbench config is basically the same but
de-indented (upstream extracted it into a separate object which
resulted in a de-indent), the ordering is slightly different, and
instead of vscodeBase we now need vscodeBase + this._staticRoute since
everything is served from a sub-path now.
- Move manifest link back to the root since that is where we host our
manifest.
- Change RemoteAuthoritiesImpl to use the same path building method as
in other places (+ instead of using URI.parse/join).
- Use existing host/port in RemoteAuthoritiesImpl and
BrowserSocketFactory instead of patching them to use window.location
(these are set from window.location to begin with so it should be the
same result but with less patching).
- Since BrowserSocketFactory includes a sub-path now (endpoints were
changed upstream to serve from /quality/commit instead of from the
root) the patch there has changed to prepend the base to that
path (instead of using the base directly).
- The workbench HTML now natively supports a base URL in the form of
WORKBENCH_WEB_BASE_URL so no need for VS_BASE patches there anymore.
- Upstream added type="image/x-icon" so I did as well.
- Move the language patch to the end of the series so it is easier to
eventually remove.
- Remove the existing NLS config in favor of one that supports
extensions.
- Upstream deleted webview main.js and inlined it into the HTML so move
that code (the parent origin check) into both those HTML files
(index.html and index-no-csp.html).
- The remaining diff is from changes to the surrounding context or a
line was changed slightly by upstream (for example renamed files or
new arguments like to the remote authority resolver).
* fix: modify product.json before building
Code injects this into the client during the build process so it needs
to be updated before we build.
* fix: update inline script nonces
* Update HTML base path test
* fix: missing commit
Code overrides it with nothing.
The date is also already injected.
* fix: web extensions breaking when the commit changes
By just using the marketplace directly instead of going through the
backend. I am not sure what the point is when searching extensions
already goes directly to the marketplace anyway.
But also remove the prefix that breaks this as well because otherwise
existing installations will break.
* refactor: fix type annotations in open
There was no clear reason as to why we needed to use type assertions
when initializing both `args` and `options` in `open` so I refactored
them both.
* refactor: create constructOpenOptions
* refactor: add urlSearch and remove options
* feat: add tests for constructOpenOptions
* feat: set up new test for beat twice
* refactor: make Heart.beat() async
This allows us to properly await heart.beat() in our tests and remove
the HACK I added before.
* refactor: bind heart methods .beat and .alive
This allows the functions to maintain access to the Heart instance (or
`this`) even when they are passed to other functions. We do this because
we pass both `isActive` and `beat` to `heartbeatTimer`.
* feat(heart): add test to ensure no warnings called
* fixup!: revert setTimeout for heartbeatTimer
* fixup!: return promise in beat
* chore: upgrade Code to 1.66
* docs: update docs for Code upgrades
* fixup!: docs
* chore: update vscode submodule
* chore: update integration patch
* chore: update node-version patch
* chore: update github-auth patch
They completely changed how auth is handled for GitHub in
https://github.com/microsoft/vscode/pull/145424 so our patch may not
work. Will need to test and revisit.
* refactor: remove postinstall patch
It appears they renamed postinstall.js to postinstall.mjs and removed
the use of `rimraf` which means our patch is no longer needed! 🎉b0e8554cce
* chore: refresh local-storage patch
* chore: refresh service-worker patch
* chore: bulk refresh patches
* fixup!: docs formatting
* refactor: remove unused last-opened patch
* fixup!: formatting docs
* fixup!: formatting docs
* refactor: remove rsync postinstall
* Revert "refactor: remove rsync postinstall"
This reverts commit 8d6b613e9d.
* refactor: update postinstall.js to .mjs
* feat(patches): add parent-origin bypass
* docs(patches): add notes for testing store-socket
* docs(patches): update testing info for node-version
* refactor(patches): delete github-auth.diff patch
* docs(patches): add notes for testing connection-type
* fixup!: delete github-auth patch
* fixup!: update connection type testing
* docs(patches): add notes to insecure-notification.diff
* docs(patches): add nots for update-check.diff
* fixup!: remove comma in integration patch
* fix(e2e): disable workspace trust
* refactor: add --no-default-rc for yarn install
* feat(patches): remove yarnrc in presinstall
* fixup!: silly mistake
* docs: add note about KEEP_MODULES=1
* docs(patches): add testing notes for node-version
* refactor(patches): remove node-version
It appears this is no longer needed due to the `remote/package.json` now which
targets node rather than electron.
* fixup!: add cd ../.. to code upgrade instructions
* fixup!: add note to yarn --production flag
* fixup!: make parent-origin easier to upstream
* Revert "refactor(patches): delete github-auth.diff patch"
This reverts commit 31a354a343.
* Revert "fixup!: delete github-auth patch"
This reverts commit bdeb5212e8.
* Merge webview origin patch into webview patch
* Remove unused post-install patch
* Prevent builtin extensions from updating
* Refresh sourcemaps patch
* Update Node to v16
This matches the version in ./lib/vscode/remote/.yarnrc.
I changed the engine to exactly 16 since if you use any different
version it will just not work since the modules will have been built for
16 (due to the .yarnrc).
* Replace fs.rmdir with fs.rm
Node is showing a deprecation warning about it.
* Update github-auth patch
The local credentials provider is no longer used when there is a remote
so this code moved into the backend web credential provider.
* Prevent fs.rm from erroring about non-existent files
We were using fs.rmdir which presumably did not have the same behavior
in v14 (in v16 fs.rmdir also errors).
* Install Python 3 in CentOS CI container
Co-authored-by: Asher <ash@coder.com>
After some feedback, we realized it is more intuitive to disable file
downloads by setting the environment variable
`CS_DISABLE_FILE_DOWNLOADS` to `true` than `1`. This commit adds support
for both.
* refactor: add timeout for race condition in heart test
* fixup!: set mtime to 0 and check for update
* fixup!: use utimes directly instead of file open
* fixup!: remove import
* refactor(heart): extract logic into heartbeatTimer fn
To make it easier to test, I extract heartbeatTimer into it's own
function.
* feat(testing): add tests for heart.ts
* fixup
* fixup!: remove unneeded heart call
* Update src/node/heart.ts
Co-authored-by: Asher <ash@coder.com>
* fixup!: use mockResolvedValue everywhere
* fixup!: add stat test for timestamp check
Co-authored-by: Asher <ash@coder.com>
* Move integration types into code-server
This will be easier to maintain than to have it as a patch.
* Disable connection token
Using a flag means we will not need to patch it out. I think this is
new from 1.64?
* Add product.json to build process
This way we do not have to patch it.
* Ship with remote agent package.json
Instead of the root one. This contains fewer dependencies.
* Let Code handle errors
This way we will not have to patch Code to make this work and I think it
makes sense to let Code handle the request.
If we do want to handle errors we can do it cleanly by patching their
error handler to throw instead.
* Move manifest override into code-server
This way we will not have to patch it.
* Move to patches
- Switch submodule to track upstream
- Add quilt to the process
- Add patches
The node-* ignore was ignoring one of the diffs so I removed it. This
was added when we were curling Node as node-v{version}-darwin-x64 for
the macOS build but this no longer happens (we use the Node action to
install a specific version now so we just use the system-wide Node).
* Use pre-packaged Code
* Move Code to a submodule
Closes#4901.
* Base Code cache on hash and re-enable node_modules cache
The current setup appears to only rebuild VS Code if the dependencies
change but we need to rebuild it if anything changes.
I also re-enabled the commented out node_modules caches. They look like
they should work to me with the submodule method. I think the problem
occurred because Code itself was being installed in the yarn step.
* refactor: remove folder/workspace from vsCodeCliArgs
Since we handle this in the vscode.ts route, we no longer need to pass it to VS
Code as a CLI arg since it's deprecated on that side.
* feat(vscode): redirect to folder from cli
* Update src/node/routes/vscode.ts
Co-authored-by: Asher <ash@coder.com>
* fixup!: update _: type
* fixup!: move vars to lower if block
* fixup!: share redirect block
* fixup!: mmove req.query.ew block into if
* fixup!: refactor vscode tests
* refactor: make vscode.ts logic easier to read
* fixup!: fix broken tests and clean up logic
* chore: upgrade vscode version
* fixup!: delete unnecessary if closed block
* Update src/node/routes/vscode.ts
Co-authored-by: Asher <ash@coder.com>
* fixup!: rename to FOLDER_OR_WORKSPACE_WAS_CLOSED
Co-authored-by: Asher <ash@coder.com>
* feat: github-auth flag
This will allow injecting credentials into code-server if you already
have them.
* Update Code
Contains the GitHub auth changes.
* Add e2e test for GitHub token
Show the bundled version of Code OSS in the text-based output
for --version and --help, in addition to the JSON output
(--version --json)
Closes: #4874
* refactor(http): extract logic into constructRedirectPath
This allows us to easily test our redirect path construction logic where we get
the relative path, the query string and construct a redirect path.
By extracting this from `redirect`, we can easily test this logic in a unit
test.
I did this so we could test some logic where slashes in query strings should be
made human-friendly for users.
* feat(testing): add tests for constructRedirectPath
Co-authored-by: Asher <ash@coder.com>
Introduce helper functions for getting human- and machine-readable
version strings from the constants package, and cover it in unit
tests.
This is a first step to resolving #4874.