From c56830022148ebbc1d7b01385f88c79c8ff8c592 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 29 Apr 2021 15:47:14 -0700 Subject: [PATCH 01/24] chore: clean up yarn.lock --- yarn.lock | 5 ----- 1 file changed, 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index e5d6da78..f21e2f45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3141,11 +3141,6 @@ eslint-plugin-import@^2.18.2: resolve "^1.17.0" tsconfig-paths "^3.9.0" -eslint-plugin-jest-playwright@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest-playwright/-/eslint-plugin-jest-playwright-0.2.1.tgz#8778fee9d5915132a03d94370d3eea0a7ddd08f3" - integrity sha512-BicKUJUpVPsLbHN8c5hYaZn6pv8PCMjBGHXUfvlY1p75fh4APVfX2gTK14HuiR8/Bv3fKBQu5MTaqCro4E3OHg== - eslint-plugin-prettier@^3.1.0: version "3.4.0" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz#cdbad3bf1dbd2b177e9825737fe63b476a08f0c7" From 17f4c4c330e3e72548d7d448d88e812146570bd9 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 29 Apr 2021 16:22:21 -0700 Subject: [PATCH 02/24] fix(e2e): remove quotes from terminal type command --- test/e2e/terminal.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/terminal.test.ts b/test/e2e/terminal.test.ts index c4bb45b1..f92419c6 100644 --- a/test/e2e/terminal.test.ts +++ b/test/e2e/terminal.test.ts @@ -50,7 +50,7 @@ test.describe("Integrated Terminal", () => { await codeServer.focusTerminal() await page.waitForLoadState("load") - await page.keyboard.type(`echo '${testString}' > '${tmpFile}'`) + await page.keyboard.type(`echo ${testString} > ${tmpFile}`) await page.keyboard.press("Enter") // It may take a second to process await page.waitForTimeout(1000) From 7309ea9d10a09672f5d653e765751beb18579938 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 29 Apr 2021 16:27:19 -0700 Subject: [PATCH 03/24] fix(e2e): use one worker to reduce flakiness --- test/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/config.ts b/test/config.ts index 6df0324e..53b592b7 100644 --- a/test/config.ts +++ b/test/config.ts @@ -52,6 +52,7 @@ const config: Config = { testDir: path.join(__dirname, "e2e"), // Search for tests in this directory. timeout: 60000, // Each test is given 60 seconds. retries: 3, // Retry failing tests 2 times + workers: 1, } if (process.env.CI) { From 2cb499385a0e36d60161618b3360c25408671e10 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 30 Apr 2021 12:33:20 -0700 Subject: [PATCH 04/24] feat: add isConnected method to CodeServer model --- test/e2e/codeServer.test.ts | 4 ++++ test/e2e/models/CodeServer.ts | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/test/e2e/codeServer.test.ts b/test/e2e/codeServer.test.ts index 4b20f69f..7cd74fa7 100644 --- a/test/e2e/codeServer.test.ts +++ b/test/e2e/codeServer.test.ts @@ -38,6 +38,10 @@ test.describe("CodeServer", () => { expect(await codeServer.isEditorVisible()).toBe(true) }) + test.only("should always have a connection", options, async ({ page }) => { + expect(await codeServer.isConnected()).toBe(true) + }) + test("should show the Integrated Terminal", options, async ({ page }) => { await codeServer.focusTerminal() expect(await page.isVisible("#terminal")).toBe(true) diff --git a/test/e2e/models/CodeServer.ts b/test/e2e/models/CodeServer.ts index b833cc7e..6142ce25 100644 --- a/test/e2e/models/CodeServer.ts +++ b/test/e2e/models/CodeServer.ts @@ -56,6 +56,25 @@ export class CodeServer { return await this.page.isVisible(this.editorSelector) } + /** + * Checks if the editor is visible + */ + async isConnected() { + await this.page.waitForLoadState("networkidle") + + // See [aria-label="Remote Host"] + const hostElement = await this.page.$(`[aria-label="Remote Host"]`) + // Returns something like " localhost:8080" + const host = await hostElement?.innerText() + + // Check if host (localhost:8080) is in the CODE_SERVER_ADDRESS + // if it is, we're connected! + // if not, we may need to reload the page + // Make sure to trim whitespace too + const isEditorConnected = host ? CODE_SERVER_ADDRESS.includes(host.trim()) : false + return isEditorConnected + } + /** * Focuses Integrated Terminal * by using "Terminal: Focus Terminal" From cde30579c400f84fdacd6e27f63205f4ec6803be Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 30 Apr 2021 13:26:25 -0700 Subject: [PATCH 05/24] refactor: change to reloadUntilEditorIsReady --- test/e2e/codeServer.test.ts | 2 +- test/e2e/login.test.ts | 2 +- test/e2e/logout.test.ts | 2 +- test/e2e/models/CodeServer.ts | 31 ++++++++++++++----------------- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/test/e2e/codeServer.test.ts b/test/e2e/codeServer.test.ts index 7cd74fa7..d7a9a8b6 100644 --- a/test/e2e/codeServer.test.ts +++ b/test/e2e/codeServer.test.ts @@ -38,7 +38,7 @@ test.describe("CodeServer", () => { expect(await codeServer.isEditorVisible()).toBe(true) }) - test.only("should always have a connection", options, async ({ page }) => { + test("should always have a connection", options, async ({ page }) => { expect(await codeServer.isConnected()).toBe(true) }) diff --git a/test/e2e/login.test.ts b/test/e2e/login.test.ts index 9e2f3da3..4fe4347b 100644 --- a/test/e2e/login.test.ts +++ b/test/e2e/login.test.ts @@ -30,7 +30,7 @@ test.describe("login", () => { await page.waitForLoadState("networkidle") // We do this because occassionally code-server doesn't load on Firefox // but loads if you reload once or twice - await codeServer.reloadUntilEditorIsVisible() + await codeServer.reloadUntilEditorIsReady() // Make sure the editor actually loaded expect(await codeServer.isEditorVisible()).toBe(true) }) diff --git a/test/e2e/logout.test.ts b/test/e2e/logout.test.ts index 5e9dc8f9..54119774 100644 --- a/test/e2e/logout.test.ts +++ b/test/e2e/logout.test.ts @@ -25,7 +25,7 @@ test.describe("logout", () => { await page.waitForLoadState("networkidle") // We do this because occassionally code-server doesn't load on Firefox // but loads if you reload once or twice - await codeServer.reloadUntilEditorIsVisible() + await codeServer.reloadUntilEditorIsReady() // Make sure the editor actually loaded expect(await codeServer.isEditorVisible()).toBe(true) diff --git a/test/e2e/models/CodeServer.ts b/test/e2e/models/CodeServer.ts index 6142ce25..b7cc093f 100644 --- a/test/e2e/models/CodeServer.ts +++ b/test/e2e/models/CodeServer.ts @@ -20,17 +20,20 @@ export class CodeServer { /** * Checks if the editor is visible - * and reloads until it is + * and that we are connected to the host + * + * Reload until both checks pass */ - async reloadUntilEditorIsVisible() { + async reloadUntilEditorIsReady() { const editorIsVisible = await this.isEditorVisible() + const editorIsConnected = await this.isConnected() let reloadCount = 0 // Occassionally code-server timeouts in Firefox // we're not sure why // but usually a reload or two fixes it // TODO@jsjoeio @oxy look into Firefox reconnection/timeout issues - while (!editorIsVisible) { + while (!editorIsVisible && !editorIsConnected) { // When a reload happens, we want to wait for all resources to be // loaded completely. Hence why we use that instead of DOMContentLoaded // Read more: https://thisthat.dev/dom-content-loaded-vs-load/ @@ -38,8 +41,8 @@ export class CodeServer { // Give it an extra second just in case it's feeling extra slow await this.page.waitForTimeout(1000) reloadCount += 1 - if (await this.isEditorVisible()) { - console.log(` Editor became visible after ${reloadCount} reloads`) + if ((await this.isEditorVisible()) && (await this.isConnected)) { + console.log(` Editor became ready after ${reloadCount} reloads`) break } await this.page.reload() @@ -62,17 +65,11 @@ export class CodeServer { async isConnected() { await this.page.waitForLoadState("networkidle") - // See [aria-label="Remote Host"] - const hostElement = await this.page.$(`[aria-label="Remote Host"]`) - // Returns something like " localhost:8080" - const host = await hostElement?.innerText() + const host = new URL(CODE_SERVER_ADDRESS).host + const hostSelector = `[title="Editing on ${host}"]` + await this.page.waitForSelector(hostSelector) - // Check if host (localhost:8080) is in the CODE_SERVER_ADDRESS - // if it is, we're connected! - // if not, we may need to reload the page - // Make sure to trim whitespace too - const isEditorConnected = host ? CODE_SERVER_ADDRESS.includes(host.trim()) : false - return isEditorConnected + return await this.page.isVisible(hostSelector) } /** @@ -109,12 +106,12 @@ export class CodeServer { /** * Navigates to CODE_SERVER_ADDRESS - * and reloads until the editor is visible + * and reloads until the editor is ready * * Helpful for running before tests */ async setup() { await this.navigate() - await this.reloadUntilEditorIsVisible() + await this.reloadUntilEditorIsReady() } } From 9fe459a0f32e9f1654221ba2445942b6eae79b50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 May 2021 17:54:33 +0530 Subject: [PATCH 06/24] chore(deps-dev): bump stylelint from 13.13.0 to 13.13.1 (#3276) Bumps [stylelint](https://github.com/stylelint/stylelint) from 13.13.0 to 13.13.1. - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint/compare/13.13.0...13.13.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index f21e2f45..31f34f7e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2056,10 +2056,10 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4 escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== +chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad" + integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== dependencies: ansi-styles "^4.1.0" supports-color "^7.1.0" @@ -7412,15 +7412,15 @@ stylelint-config-recommended@^5.0.0: integrity sha512-c8aubuARSu5A3vEHLBeOSJt1udOdS+1iue7BmJDTSXoCBmfEQmmWX+59vYIj3NQdJBY6a/QRv1ozVFpaB9jaqA== stylelint@^13.0.0: - version "13.13.0" - resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.13.0.tgz#1a33bffde765920ac985f16ae6250ff914b27804" - integrity sha512-jvkM1iuH88vAvjdKPwPm6abiMP2/D/1chbfb+4GVONddOOskHuCXc0loyrLdxO1AwwH6jdnjYskkTKHQD7cXwQ== + version "13.13.1" + resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.13.1.tgz#fca9c9f5de7990ab26a00f167b8978f083a18f3c" + integrity sha512-Mv+BQr5XTUrKqAXmpqm6Ddli6Ief+AiPZkRsIrAoUKFuq/ElkUh9ZMYxXD0iQNZ5ADghZKLOWz1h7hTClB7zgQ== dependencies: "@stylelint/postcss-css-in-js" "^0.37.2" "@stylelint/postcss-markdown" "^0.36.2" autoprefixer "^9.8.6" balanced-match "^2.0.0" - chalk "^4.1.0" + chalk "^4.1.1" cosmiconfig "^7.0.0" debug "^4.3.1" execall "^2.0.0" @@ -7461,7 +7461,7 @@ stylelint@^13.0.0: style-search "^0.1.0" sugarss "^2.0.0" svg-tags "^1.0.0" - table "^6.5.1" + table "^6.6.0" v8-compile-cache "^2.3.0" write-file-atomic "^3.0.3" @@ -7534,10 +7534,10 @@ symbol-tree@^3.2.2: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== -table@^6.0.4, table@^6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/table/-/table-6.5.1.tgz#930885a7430f15f8766b35cd1e36de40793db523" - integrity sha512-xGDXWTBJxahkzPQCsn1S9ESHEenU7TbMD5Iv4FeopXv/XwJyWatFjfbor+6ipI10/MNPXBYUamYukOrbPZ9L/w== +table@^6.0.4, table@^6.6.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/table/-/table-6.6.0.tgz#905654b79df98d9e9a973de1dd58682532c40e8e" + integrity sha512-iZMtp5tUvcnAdtHpZTWLPF0M7AgiQsURR2DwmxnJwSy8I3+cY+ozzVvYha3BOLG2TB+L0CqjIz+91htuj6yCXg== dependencies: ajv "^8.0.1" lodash.clonedeep "^4.5.0" From e7a527514a3da29d5c495cf1954b6d106b60d588 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 3 May 2021 15:00:54 -0500 Subject: [PATCH 07/24] Add authed context key --- lib/vscode/src/vs/server/browser/client.ts | 5 +++++ src/node/routes/vscode.ts | 4 +++- typings/ipc.d.ts | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/vscode/src/vs/server/browser/client.ts b/lib/vscode/src/vs/server/browser/client.ts index 26b709fa..47a2c72d 100644 --- a/lib/vscode/src/vs/server/browser/client.ts +++ b/lib/vscode/src/vs/server/browser/client.ts @@ -3,6 +3,7 @@ import { URI } from 'vs/base/common/uri'; import { Options } from 'vs/ipc'; import { localize } from 'vs/nls'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ILogService } from 'vs/platform/log/common/log'; @@ -173,6 +174,10 @@ export const initialize = async (services: ServiceCollection): Promise => if (theme) { localStorage.setItem('colorThemeData', theme); } + + // Use to show or hide logout commands and menu options. + const contextKeyService = (services.get(IContextKeyService) as IContextKeyService); + contextKeyService.createKey('code-server.authed', options.authed); }; export interface Query { diff --git a/src/node/routes/vscode.ts b/src/node/routes/vscode.ts index aee4cacd..0d9c6309 100644 --- a/src/node/routes/vscode.ts +++ b/src/node/routes/vscode.ts @@ -3,6 +3,7 @@ import { Request, Router } from "express" import { promises as fs } from "fs" import * as path from "path" import qs from "qs" +import * as ipc from "../../../typings/ipc" import { Emitter } from "../../common/emitter" import { HttpCode, HttpError } from "../../common/http" import { getFirstString } from "../../common/util" @@ -39,12 +40,13 @@ router.get("/", async (req, res) => { options.productConfiguration.codeServerVersion = version res.send( - replaceTemplates( + replaceTemplates( req, // Uncomment prod blocks if not in development. TODO: Would this be // better as a build step? Or maintain two HTML files again? commit !== "development" ? content.replace(//g, "") : content, { + authed: req.args.auth !== "none", disableTelemetry: !!req.args["disable-telemetry"], disableUpdateCheck: !!req.args["disable-update-check"], }, diff --git a/typings/ipc.d.ts b/typings/ipc.d.ts index f31e1d45..c54004f2 100644 --- a/typings/ipc.d.ts +++ b/typings/ipc.d.ts @@ -6,6 +6,7 @@ * The second is a symlink to the first. */ export interface Options { + authed: boolean base: string disableTelemetry: boolean disableUpdateCheck: boolean From 6d74330a33d14c63fa950079f0a35a3151fa8869 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 20:31:23 +0530 Subject: [PATCH 08/24] chore(deps-dev): bump @typescript-eslint/eslint-plugin (#3282) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.22.0 to 4.22.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.22.1/packages/eslint-plugin) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 58 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index 31f34f7e..dbc1450a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1210,12 +1210,12 @@ integrity sha512-kdBHgE9+M1Os7UqWZtiLhKye5reFl8cPBYyCsP2fatwZRz7F7GdIxIHZ20Kkc0hYBfbXE+lzPOTUU1I0qgjtHA== "@typescript-eslint/eslint-plugin@^4.7.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.22.0.tgz#3d5f29bb59e61a9dba1513d491b059e536e16dbc" - integrity sha512-U8SP9VOs275iDXaL08Ln1Fa/wLXfj5aTr/1c0t0j6CdbOnxh+TruXu1p4I0NAvdPBQgoPjHsgKn28mOi0FzfoA== + version "4.22.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.22.1.tgz#6bcdbaa4548553ab861b4e5f34936ead1349a543" + integrity sha512-kVTAghWDDhsvQ602tHBc6WmQkdaYbkcTwZu+7l24jtJiYvm9l+/y/b2BZANEezxPDiX5MK2ZecE+9BFi/YJryw== dependencies: - "@typescript-eslint/experimental-utils" "4.22.0" - "@typescript-eslint/scope-manager" "4.22.0" + "@typescript-eslint/experimental-utils" "4.22.1" + "@typescript-eslint/scope-manager" "4.22.1" debug "^4.1.1" functional-red-black-tree "^1.0.1" lodash "^4.17.15" @@ -1223,15 +1223,15 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.22.0.tgz#68765167cca531178e7b650a53456e6e0bef3b1f" - integrity sha512-xJXHHl6TuAxB5AWiVrGhvbGL8/hbiCQ8FiWwObO3r0fnvBdrbWEDy1hlvGQOAWc6qsCWuWMKdVWlLAEMpxnddg== +"@typescript-eslint/experimental-utils@4.22.1": + version "4.22.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.22.1.tgz#3938a5c89b27dc9a39b5de63a62ab1623ab27497" + integrity sha512-svYlHecSMCQGDO2qN1v477ax/IDQwWhc7PRBiwAdAMJE7GXk5stF4Z9R/8wbRkuX/5e9dHqbIWxjeOjckK3wLQ== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.22.0" - "@typescript-eslint/types" "4.22.0" - "@typescript-eslint/typescript-estree" "4.22.0" + "@typescript-eslint/scope-manager" "4.22.1" + "@typescript-eslint/types" "4.22.1" + "@typescript-eslint/typescript-estree" "4.22.1" eslint-scope "^5.0.0" eslint-utils "^2.0.0" @@ -1253,11 +1253,24 @@ "@typescript-eslint/types" "4.22.0" "@typescript-eslint/visitor-keys" "4.22.0" +"@typescript-eslint/scope-manager@4.22.1": + version "4.22.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.22.1.tgz#5bb357f94f9cd8b94e6be43dd637eb73b8f355b4" + integrity sha512-d5bAiPBiessSmNi8Amq/RuLslvcumxLmyhf1/Xa9IuaoFJ0YtshlJKxhlbY7l2JdEk3wS0EnmnfeJWSvADOe0g== + dependencies: + "@typescript-eslint/types" "4.22.1" + "@typescript-eslint/visitor-keys" "4.22.1" + "@typescript-eslint/types@4.22.0": version "4.22.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.22.0.tgz#0ca6fde5b68daf6dba133f30959cc0688c8dd0b6" integrity sha512-sW/BiXmmyMqDPO2kpOhSy2Py5w6KvRRsKZnV0c4+0nr4GIcedJwXAq+RHNK4lLVEZAJYFltnnk1tJSlbeS9lYA== +"@typescript-eslint/types@4.22.1": + version "4.22.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.22.1.tgz#bf99c6cec0b4a23d53a61894816927f2adad856a" + integrity sha512-2HTkbkdAeI3OOcWbqA8hWf/7z9c6gkmnWNGz0dKSLYLWywUlkOAQ2XcjhlKLj5xBFDf8FgAOF5aQbnLRvgNbCw== + "@typescript-eslint/typescript-estree@4.22.0": version "4.22.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.0.tgz#b5d95d6d366ff3b72f5168c75775a3e46250d05c" @@ -1271,6 +1284,19 @@ semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/typescript-estree@4.22.1": + version "4.22.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.1.tgz#dca379eead8cdfd4edc04805e83af6d148c164f9" + integrity sha512-p3We0pAPacT+onSGM+sPR+M9CblVqdA9F1JEdIqRVlxK5Qth4ochXQgIyb9daBomyQKAXbygxp1aXQRV0GC79A== + dependencies: + "@typescript-eslint/types" "4.22.1" + "@typescript-eslint/visitor-keys" "4.22.1" + debug "^4.1.1" + globby "^11.0.1" + is-glob "^4.0.1" + semver "^7.3.2" + tsutils "^3.17.1" + "@typescript-eslint/visitor-keys@4.22.0": version "4.22.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.0.tgz#169dae26d3c122935da7528c839f42a8a42f6e47" @@ -1279,6 +1305,14 @@ "@typescript-eslint/types" "4.22.0" eslint-visitor-keys "^2.0.0" +"@typescript-eslint/visitor-keys@4.22.1": + version "4.22.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.1.tgz#6045ae25a11662c671f90b3a403d682dfca0b7a6" + integrity sha512-WPkOrIRm+WCLZxXQHCi+WG8T2MMTUFR70rWjdWYddLT7cEfb2P4a3O/J2U1FBVsSFTocXLCoXWY6MZGejeStvQ== + dependencies: + "@typescript-eslint/types" "4.22.1" + eslint-visitor-keys "^2.0.0" + JSONStream@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" From 7b88e09fd8b3f79e68db90358e0b447d20ade857 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 20:32:29 +0530 Subject: [PATCH 09/24] chore(deps-dev): bump @typescript-eslint/parser from 4.22.0 to 4.22.1 (#3281) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.22.0 to 4.22.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.22.1/packages/parser) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index dbc1450a..746f9ec4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1236,13 +1236,13 @@ eslint-utils "^2.0.0" "@typescript-eslint/parser@^4.7.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.22.0.tgz#e1637327fcf796c641fe55f73530e90b16ac8fe8" - integrity sha512-z/bGdBJJZJN76nvAY9DkJANYgK3nlRstRRi74WHm3jjgf2I8AglrSY+6l7ogxOmn55YJ6oKZCLLy+6PW70z15Q== + version "4.22.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.22.1.tgz#a95bda0fd01d994a15fc3e99dc984294f25c19cc" + integrity sha512-l+sUJFInWhuMxA6rtirzjooh8cM/AATAe3amvIkqKFeMzkn85V+eLzb1RyuXkHak4dLfYzOmF6DXPyflJvjQnw== dependencies: - "@typescript-eslint/scope-manager" "4.22.0" - "@typescript-eslint/types" "4.22.0" - "@typescript-eslint/typescript-estree" "4.22.0" + "@typescript-eslint/scope-manager" "4.22.1" + "@typescript-eslint/types" "4.22.1" + "@typescript-eslint/typescript-estree" "4.22.1" debug "^4.1.1" "@typescript-eslint/scope-manager@4.22.0": From 220de76e8c04047acdebef51f275b4528ccf93e0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 20:32:52 +0530 Subject: [PATCH 10/24] chore(deps-dev): bump codecov from 3.8.1 to 3.8.2 (#3280) Bumps [codecov](https://github.com/codecov/codecov-node) from 3.8.1 to 3.8.2. - [Release notes](https://github.com/codecov/codecov-node/releases) - [Changelog](https://github.com/codecov/codecov-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-node/compare/v3.8.1...v3.8.2) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 54 +++++++++++++++++++----------------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/yarn.lock b/yarn.lock index 746f9ec4..11e014ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1362,11 +1362,6 @@ acorn@^7.1.1, acorn@^7.4.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -agent-base@5: - version "5.1.1" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c" - integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g== - agent-base@6, agent-base@^6.0.0: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -2208,14 +2203,14 @@ coa@^2.0.2: q "^1.1.2" codecov@^3.8.1: - version "3.8.1" - resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.8.1.tgz#06fe026b75525ed1ce864d4a34f1010c52c51546" - integrity sha512-Qm7ltx1pzLPsliZY81jyaQ80dcNR4/JpcX0IHCIWrHBXgseySqbdbYfkdiXd7o/xmzQpGRVCKGYeTrHUpn6Dcw== + version "3.8.2" + resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.8.2.tgz#ab24f18783998c39e809ea210af899f8dbcc790e" + integrity sha512-6w/kt/xvmPsWMfDFPE/T054txA9RTgcJEw36PNa6MYX+YV29jCHCRFXwbQ3QZBTOgnex1J2WP8bo2AT8TWWz9g== dependencies: argv "0.0.2" ignore-walk "3.0.3" - js-yaml "3.14.0" - teeny-request "6.0.1" + js-yaml "3.14.1" + teeny-request "7.0.1" urlgrey "0.4.4" collapse-white-space@^1.0.2: @@ -4123,14 +4118,6 @@ https-proxy-agent@5, https-proxy-agent@^5.0.0: agent-base "6" debug "4" -https-proxy-agent@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz#702b71fb5520a132a66de1f67541d9e62154d82b" - integrity sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg== - dependencies: - agent-base "5" - debug "4" - iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -4585,15 +4572,7 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.14.0: - version "3.14.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" - integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -js-yaml@^3.10.0, js-yaml@^3.13.1: +js-yaml@3.14.1, js-yaml@^3.10.0, js-yaml@^3.13.1: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -5232,7 +5211,7 @@ node-addon-api@^1.7.1: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.7.2.tgz#3df30b95720b53c24e59948b49532b662444f54d" integrity sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg== -node-fetch@^2.2.0, node-fetch@^2.6.1: +node-fetch@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== @@ -7602,16 +7581,16 @@ tar-stream@^2.1.4, tar-stream@^2.2.0: inherits "^2.0.3" readable-stream "^3.1.1" -teeny-request@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/teeny-request/-/teeny-request-6.0.1.tgz#9b1f512cef152945827ba7e34f62523a4ce2c5b0" - integrity sha512-TAK0c9a00ELOqLrZ49cFxvPVogMUFaWY8dUsQc/0CuQPGF+BOxOQzXfE413BAk2kLomwNplvdtMpeaeGWmoc2g== +teeny-request@7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/teeny-request/-/teeny-request-7.0.1.tgz#bdd41fdffea5f8fbc0d29392cb47bec4f66b2b4c" + integrity sha512-sasJmQ37klOlplL4Ia/786M5YlOcoLGQyq2TE4WHSRupbAuDaQW0PfVxV4MtdBtRJ4ngzS+1qim8zP6Zp35qCw== dependencies: http-proxy-agent "^4.0.0" - https-proxy-agent "^4.0.0" - node-fetch "^2.2.0" + https-proxy-agent "^5.0.0" + node-fetch "^2.6.1" stream-events "^1.0.5" - uuid "^3.3.2" + uuid "^8.0.0" terser@^3.7.3: version "3.17.0" @@ -8138,6 +8117,11 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^8.0.0: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + v8-compile-cache@^2.0.0, v8-compile-cache@^2.0.3, v8-compile-cache@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" From f8d8ad38c166d74332fb71adbce5f08c14bfc7e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 20:34:28 +0530 Subject: [PATCH 11/24] chore(deps-dev): bump audit-ci from 3.2.0 to 4.0.0 (#3283) Bumps [audit-ci](https://github.com/IBM/audit-ci) from 3.2.0 to 4.0.0. - [Release notes](https://github.com/IBM/audit-ci/releases) - [Commits](https://github.com/IBM/audit-ci/compare/v3.2.0...v4.0.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8748f359..3b99a571 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@types/wtfnode": "^0.7.0", "@typescript-eslint/eslint-plugin": "^4.7.0", "@typescript-eslint/parser": "^4.7.0", - "audit-ci": "^3.1.1", + "audit-ci": "^4.0.0", "codecov": "^3.8.1", "doctoc": "^2.0.0", "eslint": "^7.7.0", diff --git a/yarn.lock b/yarn.lock index 11e014ea..b001839d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1601,10 +1601,10 @@ atob@^2.1.2: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -audit-ci@^3.1.1: - version "3.2.0" - resolved "https://registry.yarnpkg.com/audit-ci/-/audit-ci-3.2.0.tgz#5a42e3e31dbd9d259f7f417803b80a2bd50ef73d" - integrity sha512-kRFfl/AdmyCrnuc/M4T3l/G/Hy8U4JsgnyRJgGq1532bCwh62ZGeL5rEk2Snk8Umyd3CRgY4V+mVI/LzQoN/Rg== +audit-ci@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/audit-ci/-/audit-ci-4.0.0.tgz#d3223d001042cb478377b6536e73c3bc9f7627f9" + integrity sha512-8+wcRoHoZ47jP2EdvDpNU9Nb7rnNij7bmEmfiFn+L/hMHvD6rYdO6ji94sVoOmVXEDwnuib+YNHsKDUY9V/hnA== dependencies: JSONStream "^1.3.5" cross-spawn "^7.0.3" From bea13dd63086160329b19f48340c135adddea2c0 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 3 May 2021 14:00:08 -0500 Subject: [PATCH 12/24] Add logout command and menu options --- lib/vscode/src/vs/server/browser/client.ts | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/vscode/src/vs/server/browser/client.ts b/lib/vscode/src/vs/server/browser/client.ts index 47a2c72d..7a7af981 100644 --- a/lib/vscode/src/vs/server/browser/client.ts +++ b/lib/vscode/src/vs/server/browser/client.ts @@ -2,8 +2,10 @@ import * as path from 'vs/base/common/path'; import { URI } from 'vs/base/common/uri'; import { Options } from 'vs/ipc'; import { localize } from 'vs/nls'; +import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; -import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ILogService } from 'vs/platform/log/common/log'; @@ -178,6 +180,34 @@ export const initialize = async (services: ServiceCollection): Promise => // Use to show or hide logout commands and menu options. const contextKeyService = (services.get(IContextKeyService) as IContextKeyService); contextKeyService.createKey('code-server.authed', options.authed); + + // Add a logout command. + const logoutEndpoint = path.join(options.base, '/logout') + `?base=${options.base}`; + const LOGOUT_COMMAND_ID = 'code-server.logout'; + CommandsRegistry.registerCommand( + LOGOUT_COMMAND_ID, + () => { + window.location.href = logoutEndpoint; + }, + ); + + // Add logout to command palette. + MenuRegistry.appendMenuItem(MenuId.CommandPalette, { + command: { + id: LOGOUT_COMMAND_ID, + title: localize('logout', "Log out") + }, + when: ContextKeyExpr.has('code-server.authed') + }); + + // Add logout to the (web-only) home menu. + MenuRegistry.appendMenuItem(MenuId.MenubarHomeMenu, { + command: { + id: LOGOUT_COMMAND_ID, + title: localize('logout', "Log out") + }, + when: ContextKeyExpr.has('code-server.authed') + }); }; export interface Query { From eee637a1045e6d2c7fae36dafb5d5c0f3c1ff7cd Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 3 May 2021 13:41:17 -0500 Subject: [PATCH 13/24] Remove dead client code --- lib/vscode/src/vs/server/browser/client.ts | 35 ---------------------- 1 file changed, 35 deletions(-) diff --git a/lib/vscode/src/vs/server/browser/client.ts b/lib/vscode/src/vs/server/browser/client.ts index 7a7af981..16a82b0b 100644 --- a/lib/vscode/src/vs/server/browser/client.ts +++ b/lib/vscode/src/vs/server/browser/client.ts @@ -1,5 +1,4 @@ import * as path from 'vs/base/common/path'; -import { URI } from 'vs/base/common/uri'; import { Options } from 'vs/ipc'; import { localize } from 'vs/nls'; import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; @@ -209,37 +208,3 @@ export const initialize = async (services: ServiceCollection): Promise => when: ContextKeyExpr.has('code-server.authed') }); }; - -export interface Query { - [key: string]: string | undefined; -} - -/** - * Split a string up to the delimiter. If the delimiter doesn't exist the first - * item will have all the text and the second item will be an empty string. - */ -export const split = (str: string, delimiter: string): [string, string] => { - const index = str.indexOf(delimiter); - return index !== -1 ? [str.substring(0, index).trim(), str.substring(index + 1)] : [str, '']; -}; - -/** - * Return the URL modified with the specified query variables. It's pretty - * stupid so it probably doesn't cover any edge cases. Undefined values will - * unset existing values. Doesn't allow duplicates. - */ -export const withQuery = (url: string, replace: Query): string => { - const uri = URI.parse(url); - const query = { ...replace }; - uri.query.split('&').forEach((kv) => { - const [key, value] = split(kv, '='); - if (!(key in query)) { - query[key] = value; - } - }); - return uri.with({ - query: Object.keys(query) - .filter((k) => typeof query[k] !== 'undefined') - .map((k) => `${k}=${query[k]}`).join('&'), - }).toString(true); -}; From 08ab0afdb029eab6c7ecf330a65a5421f42e766f Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 3 May 2021 14:04:33 -0500 Subject: [PATCH 14/24] Revert old logout code This reverts commit 947dd8561bfd211400d9ed0ab92490b570d37018, reversing changes made to 24dc2080f963e2abe833f466e5a74a9c69c79c25. --- lib/vscode/src/vs/server/common/cookie.ts | 3 -- .../browser/parts/titlebar/menubarControl.ts | 29 ++----------------- 2 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 lib/vscode/src/vs/server/common/cookie.ts diff --git a/lib/vscode/src/vs/server/common/cookie.ts b/lib/vscode/src/vs/server/common/cookie.ts deleted file mode 100644 index e2720a04..00000000 --- a/lib/vscode/src/vs/server/common/cookie.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum Cookie { - Key = 'key', -} diff --git a/lib/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/lib/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 397211f0..bc20eca2 100644 --- a/lib/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/lib/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -9,7 +9,7 @@ import { registerThemingParticipant, IThemeService } from 'vs/platform/theme/com import { MenuBarVisibility, getTitleBarStyle, IWindowOpenable, getMenuBarVisibility } from 'vs/platform/windows/common/windows'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IAction, Action, SubmenuAction, Separator } from 'vs/base/common/actions'; -import { addDisposableListener, Dimension, EventType, getCookieValue } from 'vs/base/browser/dom'; +import { addDisposableListener, Dimension, EventType } from 'vs/base/browser/dom'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { isMacintosh, isWeb, isIOS, isNative } from 'vs/base/common/platform'; import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; @@ -38,8 +38,6 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { ILogService } from 'vs/platform/log/common/log'; -import { Cookie } from 'vs/server/common/cookie'; export type IOpenRecentAction = IAction & { uri: URI, remoteAuthority?: string }; @@ -318,8 +316,7 @@ export class CustomMenubarControl extends MenubarControl { @IThemeService private readonly themeService: IThemeService, @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, @IHostService protected readonly hostService: IHostService, - @ICommandService commandService: ICommandService, - @ILogService private readonly logService: ILogService + @ICommandService commandService: ICommandService ) { super(menuService, workspacesService, contextKeyService, keybindingService, configurationService, labelService, updateService, storageService, notificationService, preferencesService, environmentService, accessibilityService, hostService, commandService); @@ -721,28 +718,6 @@ export class CustomMenubarControl extends MenubarControl { webNavigationActions.pop(); } - webNavigationActions.push(new Action('logout', localize('logout', "Log out"), undefined, true, - async (event?: MouseEvent) => { - const COOKIE_KEY = Cookie.Key; - const loginCookie = getCookieValue(COOKIE_KEY); - - this.logService.info('Logging out of code-server'); - - if(loginCookie) { - this.logService.info(`Removing cookie under ${COOKIE_KEY}`); - - if (document && document.cookie) { - // We delete the cookie by setting the expiration to a date/time in the past - document.cookie = COOKIE_KEY +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; - window.location.href = '/login'; - } else { - this.logService.warn('Could not delete cookie because document and/or document.cookie is undefined'); - } - } else { - this.logService.warn('Could not log out because we could not find cookie'); - } - })); - return webNavigationActions; } From 49c26f70f75f7e265a3ddd0eadd8307210049374 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 3 May 2021 14:22:29 -0500 Subject: [PATCH 15/24] Add logout route --- src/node/routes/index.ts | 7 ++++--- src/node/routes/logout.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 src/node/routes/logout.ts diff --git a/src/node/routes/index.ts b/src/node/routes/index.ts index 5bc9f10b..c183b42b 100644 --- a/src/node/routes/index.ts +++ b/src/node/routes/index.ts @@ -20,6 +20,7 @@ import * as apps from "./apps" import * as domainProxy from "./domainProxy" import * as health from "./health" import * as login from "./login" +import * as logout from "./logout" import * as pathProxy from "./pathProxy" // static is a reserved keyword. import * as _static from "./static" @@ -136,10 +137,10 @@ export const register = async ( if (args.auth === AuthType.Password) { app.use("/login", login.router) + app.use("/logout", logout.router) } else { - app.all("/login", (req, res) => { - redirect(req, res, "/", {}) - }) + app.all("/login", (req, res) => redirect(req, res, "/", {})) + app.all("/logout", (req, res) => redirect(req, res, "/", {})) } app.use("/static", _static.router) diff --git a/src/node/routes/logout.ts b/src/node/routes/logout.ts new file mode 100644 index 00000000..e42789b4 --- /dev/null +++ b/src/node/routes/logout.ts @@ -0,0 +1,17 @@ +import { Router } from "express" +import { getCookieDomain, redirect } from "../http" +import { Cookie } from "./login" + +export const router = Router() + +router.get("/", async (req, res) => { + // Must use the *identical* properties used to set the cookie. + res.clearCookie(Cookie.Key, { + domain: getCookieDomain(req.headers.host || "", req.args["proxy-domain"]), + path: req.body.base || "/", + sameSite: "lax", + }) + + const to = (typeof req.query.to === "string" && req.query.to) || "/" + return redirect(req, res, to, { to: undefined, base: undefined }) +}) From a48ac5080bc8e0ada8c5d5de395c601f02fb4c91 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 3 May 2021 14:42:24 -0500 Subject: [PATCH 16/24] Share common util code with VS Code This lets us re-use the normalized base path so when we expire/clear the cookie we use the same base path. --- lib/vscode/.eslintignore | 1 + lib/vscode/src/vs/server/browser/client.ts | 28 +++++++--------------- lib/vscode/src/vs/server/common/util.ts | 1 + src/browser/register.ts | 5 +++- src/common/util.ts | 17 ++++++++----- src/node/app.ts | 2 +- test/unit/util.test.ts | 7 ++---- test/utils/httpserver.ts | 3 ++- typings/ipc.d.ts | 2 ++ 9 files changed, 32 insertions(+), 34 deletions(-) create mode 120000 lib/vscode/src/vs/server/common/util.ts diff --git a/lib/vscode/.eslintignore b/lib/vscode/.eslintignore index be2d47d3..b67a8161 100644 --- a/lib/vscode/.eslintignore +++ b/lib/vscode/.eslintignore @@ -19,3 +19,4 @@ # These are code-server code symlinks. src/vs/base/node/proxy_agent.ts src/vs/ipc.d.ts +src/vs/server/common/util.ts diff --git a/lib/vscode/src/vs/server/browser/client.ts b/lib/vscode/src/vs/server/browser/client.ts index 16a82b0b..c1c5b450 100644 --- a/lib/vscode/src/vs/server/browser/client.ts +++ b/lib/vscode/src/vs/server/browser/client.ts @@ -13,10 +13,18 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { TelemetryChannelClient } from 'vs/server/common/telemetry'; +import { getOptions } from 'vs/server/common/util'; import 'vs/workbench/contrib/localizations/browser/localizations.contribution'; import 'vs/workbench/services/localizations/browser/localizationsService'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; +/** + * All client-side customization to VS Code should live in this file when + * possible. + */ + +const options = getOptions(); + class TelemetryService extends TelemetryChannelClient { public constructor( @IRemoteAgentService remoteAgentService: IRemoteAgentService, @@ -25,26 +33,6 @@ class TelemetryService extends TelemetryChannelClient { } } -/** - * Remove extra slashes in a URL. - */ -export const normalize = (url: string, keepTrailing = false): string => { - return url.replace(/\/\/+/g, '/').replace(/\/+$/, keepTrailing ? '/' : ''); -}; - -/** - * Get options embedded in the HTML. - */ -export const getOptions = (): T => { - try { - return JSON.parse(document.getElementById('coder-options')!.getAttribute('data-settings')!); - } catch (error) { - return {} as T; - } -}; - -const options = getOptions(); - const TELEMETRY_SECTION_ID = 'telemetry'; Registry.as(Extensions.Configuration).registerConfiguration({ 'id': TELEMETRY_SECTION_ID, diff --git a/lib/vscode/src/vs/server/common/util.ts b/lib/vscode/src/vs/server/common/util.ts new file mode 120000 index 00000000..625cfa1c --- /dev/null +++ b/lib/vscode/src/vs/server/common/util.ts @@ -0,0 +1 @@ +../../../../../../src/common/util.ts \ No newline at end of file diff --git a/src/browser/register.ts b/src/browser/register.ts index e99d64c6..00411110 100644 --- a/src/browser/register.ts +++ b/src/browser/register.ts @@ -1,3 +1,4 @@ +import { logger } from "@coder/logger" import { getOptions, normalize, logError } from "../common/util" import "./pages/error.css" @@ -6,6 +7,8 @@ import "./pages/login.css" export async function registerServiceWorker(): Promise { const options = getOptions() + logger.level = options.logLevel + const path = normalize(`${options.csStaticBase}/dist/serviceWorker.js`) try { await navigator.serviceWorker.register(path, { @@ -13,7 +16,7 @@ export async function registerServiceWorker(): Promise { }) console.log("[Service Worker] registered") } catch (error) { - logError(`[Service Worker] registration`, error) + logError(logger, `[Service Worker] registration`, error) } } diff --git a/src/common/util.ts b/src/common/util.ts index 87ca6f59..122cd176 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -1,5 +1,13 @@ -import { logger, field } from "@coder/logger" +/* + * This file exists in two locations: + * - src/common/util.ts + * - lib/vscode/src/vs/server/common/util.ts + * The second is a symlink to the first. + */ +/** + * Base options included on every page. + */ export interface Options { base: string csStaticBase: string @@ -78,13 +86,9 @@ export const getOptions = (): T => { } } - logger.level = options.logLevel - options.base = resolveBase(options.base) options.csStaticBase = resolveBase(options.csStaticBase) - logger.debug("got options", field("options", options)) - return options } @@ -113,7 +117,8 @@ export const getFirstString = (value: string | string[] | object | undefined): s return typeof value === "string" ? value : undefined } -export function logError(prefix: string, err: any): void { +// TODO: Might make sense to add Error handling to the logger itself. +export function logError(logger: { error: (msg: string) => void }, prefix: string, err: Error | string): void { if (err instanceof Error) { logger.error(`${prefix}: ${err.message} ${err.stack}`) } else { diff --git a/src/node/app.ts b/src/node/app.ts index b487dd8f..97ad62c3 100644 --- a/src/node/app.ts +++ b/src/node/app.ts @@ -37,7 +37,7 @@ export const createApp = async (args: DefaultedArgs): Promise<[Express, Express, reject(err) } else { // Promise resolved earlier so this is an unrelated error. - util.logError("http server error", err) + util.logError(logger, "http server error", err) } }) diff --git a/test/unit/util.test.ts b/test/unit/util.test.ts index e4d6349a..66ea0ce2 100644 --- a/test/unit/util.test.ts +++ b/test/unit/util.test.ts @@ -18,9 +18,6 @@ global.document = dom.window.document export type LocationLike = Pick -// jest.mock is hoisted above the imports so we must use `require` here. -jest.mock("@coder/logger", () => require("../utils/helpers").loggerModule) - describe("util", () => { describe("normalize", () => { it("should remove multiple slashes", () => { @@ -236,14 +233,14 @@ describe("util", () => { const message = "You don't have access to that folder." const error = new Error(message) - logError("ui", error) + logError(loggerModule.logger, "ui", error) expect(loggerModule.logger.error).toHaveBeenCalled() expect(loggerModule.logger.error).toHaveBeenCalledWith(`ui: ${error.message} ${error.stack}`) }) it("should log an error, even if not an instance of error", () => { - logError("api", "oh no") + logError(loggerModule.logger, "api", "oh no") expect(loggerModule.logger.error).toHaveBeenCalled() expect(loggerModule.logger.error).toHaveBeenCalledWith("api: oh no") diff --git a/test/utils/httpserver.ts b/test/utils/httpserver.ts index a66bbbff..bbd25a6c 100644 --- a/test/utils/httpserver.ts +++ b/test/utils/httpserver.ts @@ -1,3 +1,4 @@ +import { logger } from "@coder/logger" import * as express from "express" import * as http from "http" import * as net from "net" @@ -45,7 +46,7 @@ export class HttpServer { rej(err) } else { // Promise resolved earlier so this is some other error. - util.logError("http server error", err) + util.logError(logger, "http server error", err) } }) }) diff --git a/typings/ipc.d.ts b/typings/ipc.d.ts index c54004f2..e93e3ab1 100644 --- a/typings/ipc.d.ts +++ b/typings/ipc.d.ts @@ -8,8 +8,10 @@ export interface Options { authed: boolean base: string + csStaticBase: string disableTelemetry: boolean disableUpdateCheck: boolean + logLevel: number } export interface InitMessage { From 10babb4a0c380095e79bca99737130b33c61eb7c Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 3 May 2021 15:56:53 -0500 Subject: [PATCH 17/24] Replace console with logger in sw register --- src/browser/register.ts | 4 ++-- test/unit/register.test.ts | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/browser/register.ts b/src/browser/register.ts index 00411110..b4f4dc6c 100644 --- a/src/browser/register.ts +++ b/src/browser/register.ts @@ -14,7 +14,7 @@ export async function registerServiceWorker(): Promise { await navigator.serviceWorker.register(path, { scope: options.base + "/", }) - console.log("[Service Worker] registered") + logger.info(`[Service Worker] registered`) } catch (error) { logError(logger, `[Service Worker] registration`, error) } @@ -23,5 +23,5 @@ export async function registerServiceWorker(): Promise { if (typeof navigator !== "undefined" && "serviceWorker" in navigator) { registerServiceWorker() } else { - console.error(`[Service Worker] navigator is undefined`) + logger.error(`[Service Worker] navigator is undefined`) } diff --git a/test/unit/register.test.ts b/test/unit/register.test.ts index 106b9487..4aa2006f 100644 --- a/test/unit/register.test.ts +++ b/test/unit/register.test.ts @@ -22,11 +22,11 @@ describe("register", () => { }) beforeEach(() => { + jest.clearAllMocks() jest.mock("@coder/logger", () => loggerModule) }) afterEach(() => { - mockRegisterFn.mockClear() jest.resetModules() }) @@ -39,6 +39,7 @@ describe("register", () => { global.navigator = (undefined as unknown) as Navigator & typeof globalThis global.location = (undefined as unknown) as Location & typeof globalThis }) + it("test should have access to browser globals from beforeAll", () => { expect(typeof global.window).not.toBeFalsy() expect(typeof global.document).not.toBeFalsy() @@ -74,24 +75,24 @@ describe("register", () => { }) describe("when navigator and serviceWorker are NOT defined", () => { - let spy: jest.SpyInstance - beforeEach(() => { - spy = jest.spyOn(console, "error") + jest.clearAllMocks() + jest.mock("@coder/logger", () => loggerModule) }) afterAll(() => { jest.restoreAllMocks() }) - it("should log an error to the console", () => { + it("should log an error", () => { // Load service worker like you would in the browser require("../../src/browser/register") - expect(spy).toHaveBeenCalled() - expect(spy).toHaveBeenCalledTimes(1) - expect(spy).toHaveBeenCalledWith("[Service Worker] navigator is undefined") + expect(loggerModule.logger.error).toHaveBeenCalled() + expect(loggerModule.logger.error).toHaveBeenCalledTimes(1) + expect(loggerModule.logger.error).toHaveBeenCalledWith("[Service Worker] navigator is undefined") }) }) + describe("registerServiceWorker", () => { let serviceWorkerPath: string let serviceWorkerScope: string From 8b2c78c4a445b04079307b2a21bed481de439484 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 3 May 2021 17:39:59 -0500 Subject: [PATCH 18/24] Re-enable update tests --- src/common/util.ts | 3 +++ test/unit/update.test.ts | 39 +++++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/common/util.ts b/src/common/util.ts index 122cd176..4e4f23cf 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -77,6 +77,9 @@ export const getOptions = (): T => { options = {} as T } + // You can also pass options in stringified form to the options query + // variable. Options provided here will override the ones in the options + // element. const params = new URLSearchParams(location.search) const queryOpts = params.get("options") if (queryOpts) { diff --git a/test/unit/update.test.ts b/test/unit/update.test.ts index 39437120..e76c87d3 100644 --- a/test/unit/update.test.ts +++ b/test/unit/update.test.ts @@ -5,7 +5,7 @@ import { tmpdir } from "../../src/node/constants" import { SettingsProvider, UpdateSettings } from "../../src/node/settings" import { LatestResponse, UpdateProvider } from "../../src/node/update" -describe.skip("update", () => { +describe("update", () => { let version = "1.0.0" let spy: string[] = [] const server = http.createServer((request: http.IncomingMessage, response: http.ServerResponse) => { @@ -75,7 +75,7 @@ describe.skip("update", () => { await expect(settings.read()).resolves.toEqual({ update }) expect(isNaN(update.checked)).toEqual(false) expect(update.checked < Date.now() && update.checked >= now).toEqual(true) - expect(update.version).toBe("2.1.0") + expect(update.version).toStrictEqual("2.1.0") expect(spy).toEqual(["/latest"]) }) @@ -87,9 +87,9 @@ describe.skip("update", () => { const update = await p.getUpdate() await expect(settings.read()).resolves.toEqual({ update }) - expect(isNaN(update.checked)).toBe(false) + expect(isNaN(update.checked)).toStrictEqual(false) expect(update.checked < now).toBe(true) - expect(update.version).toBe("2.1.0") + expect(update.version).toStrictEqual("2.1.0") expect(spy).toEqual([]) }) @@ -101,10 +101,10 @@ describe.skip("update", () => { const update = await p.getUpdate(true) await expect(settings.read()).resolves.toEqual({ update }) - expect(isNaN(update.checked)).toBe(false) - expect(update.checked < Date.now() && update.checked >= now).toBe(true) - expect(update.version).toBe("4.1.1") - expect(spy).toBe(["/latest"]) + expect(isNaN(update.checked)).toStrictEqual(false) + expect(update.checked < Date.now() && update.checked >= now).toStrictEqual(true) + expect(update.version).toStrictEqual("4.1.1") + expect(spy).toStrictEqual(["/latest"]) }) it("should get latest after interval passes", async () => { @@ -121,8 +121,8 @@ describe.skip("update", () => { await settings.write({ update: { checked, version } }) const update = await p.getUpdate() - expect(update.checked).not.toBe(checked) - expect(spy).toBe(["/latest"]) + expect(update.checked).not.toStrictEqual(checked) + expect(spy).toStrictEqual(["/latest"]) }) it("should check if it's the current version", async () => { @@ -130,24 +130,31 @@ describe.skip("update", () => { const p = provider() let update = await p.getUpdate(true) - expect(p.isLatestVersion(update)).toBe(false) + expect(p.isLatestVersion(update)).toStrictEqual(false) version = "0.0.0" update = await p.getUpdate(true) - expect(p.isLatestVersion(update)).toBe(true) + expect(p.isLatestVersion(update)).toStrictEqual(true) // Old version format; make sure it doesn't report as being later. version = "999999.9999-invalid999.99.9" update = await p.getUpdate(true) - expect(p.isLatestVersion(update)).toBe(true) + expect(p.isLatestVersion(update)).toStrictEqual(true) }) it("should not reject if unable to fetch", async () => { - expect.assertions(2) let provider = new UpdateProvider("invalid", settings) - await expect(() => provider.getUpdate(true)).resolves.toBe(undefined) + let now = Date.now() + let update = await provider.getUpdate(true) + expect(isNaN(update.checked)).toStrictEqual(false) + expect(update.checked < Date.now() && update.checked >= now).toEqual(true) + expect(update.version).toStrictEqual("unknown") provider = new UpdateProvider("http://probably.invalid.dev.localhost/latest", settings) - await expect(() => provider.getUpdate(true)).resolves.toBe(undefined) + now = Date.now() + update = await provider.getUpdate(true) + expect(isNaN(update.checked)).toStrictEqual(false) + expect(update.checked < Date.now() && update.checked >= now).toEqual(true) + expect(update.version).toStrictEqual("unknown") }) }) From 6d5c60387ce56be13188f11627058b2d07f2915b Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 29 Apr 2021 12:12:03 -0700 Subject: [PATCH 19/24] feat(ci): add trivy scans to workflow This adds both a trivy scan for the repo and a trivy scan for our Docker image. --- .github/workflows/ci.yaml | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d38f1e3a..8e6344db 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -406,3 +406,61 @@ jobs: with: name: release-images path: ./release-images + + trivy-scan-image: + runs-on: ubuntu-20.04 + needs: docker-amd64 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Download release images + uses: actions/download-artifact@v2 + with: + name: release-images + path: ./release-images + + - name: Run Trivy vulnerability scanner in image mode + # Commit SHA for v0.0.14 + uses: aquasecurity/trivy-action@b38389f8efef9798810fe0c5b5096ac198cffd54 + with: + input: "./release-images/code-server-amd64-*.tar" + scan-type: "image" + ignore-unfixed: true + format: "template" + template: "@/contrib/sarif.tpl" + output: "trivy-image-results.sarif" + severity: "HIGH,CRITICAL" + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v1 + with: + sarif_file: "trivy-image-results.sarif" + + # We have to use two trivy jobs + # because GitHub only allows + # codeql/upload-sarif action per job + trivy-scan-repo: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Run Trivy vulnerability scanner in repo mode + # Commit SHA for v0.0.14 + uses: aquasecurity/trivy-action@b38389f8efef9798810fe0c5b5096ac198cffd54 + with: + scan-type: "fs" + scan-ref: "." + ignore-unfixed: true + format: "template" + template: "@/contrib/sarif.tpl" + output: "trivy-repo-results.sarif" + severity: "HIGH,CRITICAL" + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v1 + with: + sarif_file: "trivy-repo-results.sarif" From 1c9156c5045071d6c1133fcedf93f9ea59129169 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Tue, 4 May 2021 11:57:00 -0700 Subject: [PATCH 20/24] docs(maintaining): add triage to workflow --- docs/MAINTAINING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/MAINTAINING.md b/docs/MAINTAINING.md index 13a1abe6..69337f8a 100644 --- a/docs/MAINTAINING.md +++ b/docs/MAINTAINING.md @@ -5,6 +5,7 @@ - [Maintaining](#maintaining) - [Workflow](#workflow) - [Milestones](#milestones) + - [Triage](#triage) - [Project Boards](#project-boards) @@ -36,6 +37,18 @@ Here are the milestones we use and how we use them: With this flow, any un-assigned issues are essentially in triage state and once triaged are either "Backlog" or "Backlog Candidates". They will eventually move to "On Deck" (or be closed). Lastly, they will end up on a version milestone where they will be worked on. +### Triage + +We use the following process for triaging GitHub issues: + +1. a submitter creates an issue +1. add appropriate labels + 1. if we need to look into it further, add "needs-investigation" +1. add to milestone + 1. if it should be fixed soon, add to version milestone or "On Deck" + 1. if not urgent, add to "Backlog" + 1. otherwise, add to "Backlog Candidate" if it should be considered + ### Project Boards We use project boards for projects or goals that span multiple milestones. From 5f989dc9f000043817fb31195cebf5014388183a Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Tue, 4 May 2021 15:08:04 -0700 Subject: [PATCH 21/24] docs(maintaining): add versioning --- docs/MAINTAINING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/MAINTAINING.md b/docs/MAINTAINING.md index 69337f8a..eb2be4af 100644 --- a/docs/MAINTAINING.md +++ b/docs/MAINTAINING.md @@ -7,6 +7,7 @@ - [Milestones](#milestones) - [Triage](#triage) - [Project Boards](#project-boards) + - [Versioning](#versioning) @@ -56,3 +57,9 @@ We use project boards for projects or goals that span multiple milestones. Think of this as a place to put miscellaneous things (like testing, clean up stuff, etc). As a maintainer, random todos may come up here and there. This gives you a place to add notes temporarily before opening a new issue. Given that our release milestones function off of issues, we believe tasks should have dedicated issues. It also gives us a way to separate the issue triage from bigger-picture, long-term work. + +## Versioning + +`` + +The code-server project follows traditional [semantic versioning](ttps://semver.org/), with the objective of minimizing major changes that break backward compatibility. We increment the patch level for all releases, except when the upstream Visual Studio Code project increments its minor version or we change the plugin API in a backward-compatible manner. In those cases, we increment the minor version rather than the patch level. From 40033cd259ee382dcba2d1f24500efceebf8b49c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 May 2021 18:04:35 +0530 Subject: [PATCH 22/24] chore(deps-dev): bump @types/split2 from 2.1.6 to 3.2.0 (#3291) Bumps [@types/split2](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/split2) from 2.1.6 to 3.2.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/split2) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 42 ++++-------------------------------------- 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index 3b99a571..300b49e5 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@types/proxy-from-env": "^1.0.1", "@types/safe-compare": "^1.1.0", "@types/semver": "^7.1.0", - "@types/split2": "^2.1.6", + "@types/split2": "^3.2.0", "@types/tar-fs": "^2.0.0", "@types/tar-stream": "^2.1.0", "@types/ws": "^7.2.6", diff --git a/yarn.lock b/yarn.lock index b001839d..1c1e2a5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1170,10 +1170,10 @@ "@types/mime" "^1" "@types/node" "*" -"@types/split2@^2.1.6": - version "2.1.6" - resolved "https://registry.yarnpkg.com/@types/split2/-/split2-2.1.6.tgz#b095c9e064853824b22c67993d99b066777402b1" - integrity sha512-ddaFSOMuy2Rp97l6q/LEteQygvTQJuEZ+SRhxFKR0uXGsdbFDqX/QF2xoGcOqLQ8XV91v01SnAv2vpgihNgW/Q== +"@types/split2@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@types/split2/-/split2-3.2.0.tgz#a14f5acb1719aca5e6bcd3706f0df5c5b986802b" + integrity sha512-Wb9kp2BW5Qs38oyAS36t+wDN9eE6bFt8fpJ0DpYX6R5Og5tY003m8v1H2cEv8bpF9vLpPXago5pgsCgPka8BVQ== dependencies: "@types/node" "*" @@ -1245,14 +1245,6 @@ "@typescript-eslint/typescript-estree" "4.22.1" debug "^4.1.1" -"@typescript-eslint/scope-manager@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.22.0.tgz#ed411545e61161a8d702e703a4b7d96ec065b09a" - integrity sha512-OcCO7LTdk6ukawUM40wo61WdeoA7NM/zaoq1/2cs13M7GyiF+T4rxuA4xM+6LeHWjWbss7hkGXjFDRcKD4O04Q== - dependencies: - "@typescript-eslint/types" "4.22.0" - "@typescript-eslint/visitor-keys" "4.22.0" - "@typescript-eslint/scope-manager@4.22.1": version "4.22.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.22.1.tgz#5bb357f94f9cd8b94e6be43dd637eb73b8f355b4" @@ -1261,29 +1253,11 @@ "@typescript-eslint/types" "4.22.1" "@typescript-eslint/visitor-keys" "4.22.1" -"@typescript-eslint/types@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.22.0.tgz#0ca6fde5b68daf6dba133f30959cc0688c8dd0b6" - integrity sha512-sW/BiXmmyMqDPO2kpOhSy2Py5w6KvRRsKZnV0c4+0nr4GIcedJwXAq+RHNK4lLVEZAJYFltnnk1tJSlbeS9lYA== - "@typescript-eslint/types@4.22.1": version "4.22.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.22.1.tgz#bf99c6cec0b4a23d53a61894816927f2adad856a" integrity sha512-2HTkbkdAeI3OOcWbqA8hWf/7z9c6gkmnWNGz0dKSLYLWywUlkOAQ2XcjhlKLj5xBFDf8FgAOF5aQbnLRvgNbCw== -"@typescript-eslint/typescript-estree@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.0.tgz#b5d95d6d366ff3b72f5168c75775a3e46250d05c" - integrity sha512-TkIFeu5JEeSs5ze/4NID+PIcVjgoU3cUQUIZnH3Sb1cEn1lBo7StSV5bwPuJQuoxKXlzAObjYTilOEKRuhR5yg== - dependencies: - "@typescript-eslint/types" "4.22.0" - "@typescript-eslint/visitor-keys" "4.22.0" - debug "^4.1.1" - globby "^11.0.1" - is-glob "^4.0.1" - semver "^7.3.2" - tsutils "^3.17.1" - "@typescript-eslint/typescript-estree@4.22.1": version "4.22.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.1.tgz#dca379eead8cdfd4edc04805e83af6d148c164f9" @@ -1297,14 +1271,6 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@4.22.0": - version "4.22.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.0.tgz#169dae26d3c122935da7528c839f42a8a42f6e47" - integrity sha512-nnMu4F+s4o0sll6cBSsTeVsT4cwxB7zECK3dFxzEjPBii9xLpq4yqqsy/FU5zMfan6G60DKZSCXAa3sHJZrcYw== - dependencies: - "@typescript-eslint/types" "4.22.0" - eslint-visitor-keys "^2.0.0" - "@typescript-eslint/visitor-keys@4.22.1": version "4.22.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.1.tgz#6045ae25a11662c671f90b3a403d682dfca0b7a6" From 1c0f0eb60c8d16081a7634c161ad196f0e48a7f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 May 2021 18:05:04 +0530 Subject: [PATCH 23/24] chore(deps-dev): bump @types/node from 12.20.11 to 12.20.12 (#3292) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.20.11 to 12.20.12. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 1c1e2a5d..dd4d8a25 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1102,9 +1102,9 @@ integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg== "@types/node@*", "@types/node@~12.20.7": - version "12.20.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.11.tgz#980832cd56efafff8c18aa148c4085eb02a483f4" - integrity sha512-gema+apZ6qLQK7k7F0dGkGCWQYsL0qqKORWOQO6tq46q+x+1C0vbOiOqOwRVlh4RAdbQwV/j/ryr3u5NOG1fPQ== + version "12.20.12" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.12.tgz#fd9c1c2cfab536a2383ed1ef70f94adea743a226" + integrity sha512-KQZ1al2hKOONAs2MFv+yTQP1LkDWMrRJ9YCVRalXltOfXsBmH5IownLxQaiq0lnAHwAViLnh2aTYqrPcRGEbgg== "@types/normalize-package-data@^2.4.0": version "2.4.0" From fa461ff8f1f01e11a9a6045ca8b7f0354b5567e6 Mon Sep 17 00:00:00 2001 From: Akash Satheesan Date: Wed, 5 May 2021 21:53:30 +0530 Subject: [PATCH 24/24] feat(ci/build): support arm64 for cloud-agent (#3294) --- ci/build/build-code-server.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/build/build-code-server.sh b/ci/build/build-code-server.sh index 1ede7a88..c465f7e4 100755 --- a/ci/build/build-code-server.sh +++ b/ci/build/build-code-server.sh @@ -19,9 +19,15 @@ main() { fi if ! [ -f ./lib/coder-cloud-agent ]; then + echo "Downloading the cloud agent..." + + # for arch; we do not use OS from lib.sh and get our own. + # lib.sh normalizes macos to darwin - but cloud-agent's binaries do not + source ./ci/lib.sh OS="$(uname | tr '[:upper:]' '[:lower:]')" + set +e - curl -fsSL "https://storage.googleapis.com/coder-cloud-releases/agent/latest/$OS/cloud-agent" -o ./lib/coder-cloud-agent + curl -fsSL "https://github.com/cdr/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent chmod +x ./lib/coder-cloud-agent set -e fi