Merge branch 'main' into link

This commit is contained in:
Kyle Carberry 2021-09-10 12:51:06 -05:00
commit a815d60ecb
10 changed files with 74 additions and 56 deletions

View File

@ -5,7 +5,7 @@
Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and
access it in the browser.
![Screenshot](./assets/screenshot.svg)
![Screenshot](./assets/screenshot.png)
## Highlights

BIN
docs/assets/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -96,6 +96,9 @@
"@types/node-fetch": "^2.5.7",
"@types/uuid": "8.0.0"
},
"resolutions": {
"axios": "^0.21.2"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"

View File

@ -55,12 +55,12 @@ asynckit@^0.4.0:
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
axios@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
axios@^0.21.1, axios@^0.21.2:
version "0.21.4"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575"
integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==
dependencies:
follow-redirects "^1.10.0"
follow-redirects "^1.14.0"
cls-hooked@^4.2.2:
version "4.2.2"
@ -110,10 +110,10 @@ emitter-listener@^1.0.1, emitter-listener@^1.1.1:
dependencies:
shimmer "^1.2.0"
follow-redirects@^1.10.0:
version "1.13.3"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.3.tgz#e5598ad50174c1bc4e872301e82ac2cd97f90267"
integrity sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==
follow-redirects@^1.14.0:
version "1.14.3"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.3.tgz#6ada78118d8d24caee595595accdc0ac6abd022e"
integrity sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==
form-data@^3.0.0:
version "3.0.0"

View File

@ -219,6 +219,9 @@
"nwmatcher": "^1.4.4",
"chrome-remote-interface": "^0.30.0",
"glob-parent": "^5.1.2",
"tar": "^6.1.9"
"tar": "^6.1.9",
"pac-resolver": "^5.0.0",
"path-parse": "^1.0.7",
"yargs-parser": "^13.1.2"
}
}

View File

@ -24,7 +24,10 @@ export const webviewResourceBaseHost = 'vscode-webview.net';
export const webviewRootResourceAuthority = `vscode-resource.${webviewResourceBaseHost}`;
export const webviewGenericCspSource = `https://*.${webviewResourceBaseHost}`;
// NOTE@coder: This is a temporary change to include ":*"
// due to the patch we had to make for webview resources.
// See PR#3895 and https://github.com/cdr/code-server/issues/3936 for more details.
export const webviewGenericCspSource = `https://*.${webviewResourceBaseHost}:*`;
/**
* Construct a uri that can load resources inside a webview

View File

@ -2466,14 +2466,15 @@ define-property@^2.0.2:
is-descriptor "^1.0.2"
isobject "^3.0.1"
degenerator@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/degenerator/-/degenerator-2.2.0.tgz#49e98c11fa0293c5b26edfbb52f15729afcdb254"
integrity sha512-aiQcQowF01RxFI4ZLFMpzyotbQonhNpBao6dkI8JPk5a+hmSjR5ErHp2CQySmQe8os3VBqLCIh87nDBgZXvsmg==
degenerator@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/degenerator/-/degenerator-3.0.1.tgz#7ef78ec0c8577a544477308ddf1d2d6e88d51f5b"
integrity sha512-LFsIFEeLPlKvAKXu7j3ssIG6RT0TbI7/GhsqrI0DnHASEQjXQ0LUSYcjJteGgRGmZbl1TnMSxpNQIAiJ7Du5TQ==
dependencies:
ast-types "^0.13.2"
escodegen "^1.8.1"
esprima "^4.0.0"
vm2 "^3.9.3"
delayed-stream@~1.0.0:
version "1.0.0"
@ -5901,7 +5902,7 @@ object-visit@^1.0.0:
dependencies:
isobject "^3.0.0"
object.assign@^4.0.4, object.assign@^4.1.0, object.assign@^4.1.1:
object.assign@^4.0.4, object.assign@^4.1.1:
version "4.1.2"
resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940"
integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==
@ -6131,12 +6132,12 @@ pac-proxy-agent@^4.1.0:
raw-body "^2.2.0"
socks-proxy-agent "5"
pac-resolver@^4.1.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/pac-resolver/-/pac-resolver-4.2.0.tgz#b82bcb9992d48166920bc83c7542abb454bd9bdd"
integrity sha512-rPACZdUyuxT5Io/gFKUeeZFfE5T7ve7cAkE5TUZRRfuKP0u5Hocwe48X7ZEm6mYB+bTB0Qf+xlVlA/RM/i6RCQ==
pac-resolver@^4.1.0, pac-resolver@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/pac-resolver/-/pac-resolver-5.0.0.tgz#1d717a127b3d7a9407a16d6e1b012b13b9ba8dc0"
integrity sha512-H+/A6KitiHNNW+bxBKREk2MCGSxljfqRX76NjummWEYIat7ldVXRU3dhRIE3iXZ0nvGBk6smv3nntxKkzRL8NA==
dependencies:
degenerator "^2.2.0"
degenerator "^3.0.1"
ip "^1.1.5"
netmask "^2.0.1"
@ -6263,10 +6264,10 @@ path-key@^2.0.0, path-key@^2.0.1:
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
path-parse@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
path-parse@^1.0.6, path-parse@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
path-root-regex@^0.1.0:
version "0.1.2"
@ -8640,6 +8641,11 @@ vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
vm2@^3.9.3:
version "3.9.3"
resolved "https://registry.yarnpkg.com/vm2/-/vm2-3.9.3.tgz#29917f6cc081cc43a3f580c26c5b553fd3c91f40"
integrity sha512-smLS+18RjXYMl9joyJxMNI9l4w7biW8ilSDaVRvFBDwOH8P0BK1ognFQTpg0wyQ6wIKLTblHJvROW692L/E53Q==
vscode-debugprotocol@1.47.0:
version "1.47.0"
resolved "https://registry.yarnpkg.com/vscode-debugprotocol/-/vscode-debugprotocol-1.47.0.tgz#700055bea38633a9530a5a552fb3ea314d76b73f"
@ -9049,7 +9055,7 @@ yaml@^1.10.0:
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==
yargs-parser@13.1.2, yargs-parser@^13.1.2:
yargs-parser@13.1.2, yargs-parser@5.0.0-security.0, yargs-parser@^13.1.0, yargs-parser@^13.1.2:
version "13.1.2"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38"
integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==
@ -9057,22 +9063,6 @@ yargs-parser@13.1.2, yargs-parser@^13.1.2:
camelcase "^5.0.0"
decamelize "^1.2.0"
yargs-parser@5.0.0-security.0:
version "5.0.0-security.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0-security.0.tgz#4ff7271d25f90ac15643b86076a2ab499ec9ee24"
integrity sha512-T69y4Ps64LNesYxeYGYPvfoMTt/7y1XtfpIslUeK4um+9Hu7hlGoRtaDLvdXb7+/tfq4opVa2HRY5xGip022rQ==
dependencies:
camelcase "^3.0.0"
object.assign "^4.1.0"
yargs-parser@^13.1.0:
version "13.1.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0"
integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==
dependencies:
camelcase "^5.0.0"
decamelize "^1.2.0"
yargs-unparser@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb"

View File

@ -69,10 +69,10 @@ export const createApp = async (args: DefaultedArgs): Promise<[Express, Express,
export const ensureAddress = (server: http.Server): string => {
const addr = server.address()
if (!addr) {
throw new Error("server has no address")
throw new Error("server has no address") // NOTE@jsjoeio test this line
}
if (typeof addr !== "string") {
return `http://${addr.address}:${addr.port}`
}
return addr
return addr // NOTE@jsjoeio test this line
}

View File

@ -0,0 +1,30 @@
import * as http from "http"
import { ensureAddress } from "../../../src/node/app"
import { getAvailablePort } from "../../utils/helpers"
describe("ensureAddress", () => {
let mockServer: http.Server
beforeEach(() => {
mockServer = http.createServer()
})
afterEach(() => {
mockServer.close()
})
it("should throw and error if no address", () => {
expect(() => ensureAddress(mockServer)).toThrow("server has no address")
})
it("should return the address if it exists and not a string", async () => {
const port = await getAvailablePort()
mockServer.listen(port)
const address = ensureAddress(mockServer)
expect(address).toBe(`http://:::${port}`)
})
it("should return the address if it exists", async () => {
mockServer.address = () => "http://localhost:8080"
const address = ensureAddress(mockServer)
expect(address).toBe(`http://localhost:8080`)
})
})