mirror of https://git.tuxpa.in/a/code-server.git
Format and lint
This commit is contained in:
parent
80b1b1b672
commit
4aa15401c3
|
@ -1,13 +1,13 @@
|
|||
name: ci
|
||||
on: [push, pull_request]
|
||||
on: [push, pull_request, release]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
fmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: get yarn cache directory path
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
|
@ -18,7 +18,49 @@ jobs:
|
|||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: yarn lint
|
||||
- name: Run yarn fmt
|
||||
uses: ./ci/image
|
||||
with:
|
||||
args: yarn && yarn fmt
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Run yarn lint
|
||||
uses: ./ci/image
|
||||
with:
|
||||
args: yarn && yarn lint
|
||||
|
||||
release-amd64:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Run release.sh
|
||||
uses: ./ci/image
|
||||
with:
|
||||
args: yarn && yarn vscode && ./ci/release.sh
|
||||
|
|
|
@ -74,6 +74,7 @@ reset VS Code then run `yarn patch:apply`.
|
|||
## Security
|
||||
|
||||
### Authentication
|
||||
|
||||
By default `code-server` enables password authentication using a randomly
|
||||
generated password. You can set the `PASSWORD` environment variable to use your
|
||||
own instead or use `--auth none` to disable password authentication.
|
||||
|
@ -82,6 +83,7 @@ Do not expose `code-server` to the open internet without some form of
|
|||
authentication.
|
||||
|
||||
### Encrypting traffic with HTTPS
|
||||
|
||||
If you aren't doing SSL termination elsewhere you can directly give
|
||||
`code-server` a certificate with `code-server --cert` followed by the path to
|
||||
your certificate. Additionally, you can use certificate keys with `--cert-key`
|
||||
|
|
12
ci/build.ts
12
ci/build.ts
|
@ -26,7 +26,7 @@ class Builder {
|
|||
this.ensureArgument("rootPath", this.rootPath)
|
||||
this.codeServerVersion = this.ensureArgument(
|
||||
"codeServerVersion",
|
||||
process.env.VERSION || require(path.join(this.rootPath, "package.json")).version
|
||||
process.env.VERSION || require(path.join(this.rootPath, "package.json")).version,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ class Builder {
|
|||
await Promise.all([
|
||||
fs.move(
|
||||
path.join(this.vscodeSourcePath, `out-vscode${process.env.MINIFY ? "-min" : ""}`),
|
||||
path.join(vscodeBuildPath, "out")
|
||||
path.join(vscodeBuildPath, "out"),
|
||||
),
|
||||
fs.copy(path.join(this.vscodeSourcePath, ".build/extensions"), path.join(vscodeBuildPath, "extensions")),
|
||||
])
|
||||
|
@ -225,7 +225,7 @@ class Builder {
|
|||
return Promise.all(
|
||||
["node_modules", "package.json", "yarn.lock"].map((fileName) => {
|
||||
return fs.copy(path.join(sourcePath, fileName), path.join(buildPath, fileName))
|
||||
})
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -240,8 +240,8 @@ class Builder {
|
|||
...merge,
|
||||
},
|
||||
null,
|
||||
2
|
||||
)
|
||||
2,
|
||||
),
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -290,7 +290,7 @@ class Builder {
|
|||
await fs.copyFile(path.join(this.vscodeSourcePath, "LICENSE.txt"), path.join(archivePath, "LICENSE.txt"))
|
||||
await fs.copyFile(
|
||||
path.join(this.vscodeSourcePath, "ThirdPartyNotices.txt"),
|
||||
path.join(archivePath, "ThirdPartyNotices.txt")
|
||||
path.join(archivePath, "ThirdPartyNotices.txt"),
|
||||
)
|
||||
|
||||
if ((await this.target()) === "darwin") {
|
||||
|
|
28
ci/fmt.sh
28
ci/fmt.sh
|
@ -3,13 +3,33 @@
|
|||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
shfmt -i 2 -w -s -sr $$(git ls-files "*.sh")
|
||||
prettier --write --loglevel=warn $$(git ls-files "*.js" "*.ts" "*.tsx" "*.html" "*.json" "*.css" "*.md" "*.toml" "*.yaml" "*.yml")
|
||||
if [[ "$CI" != "" && $$(git ls-files --other --modified --exclude-standard) != "" ]]; then
|
||||
if [[ ${CI-} ]]; then
|
||||
cd "$(dirname "$0")/.."
|
||||
./ci/vscode.sh
|
||||
fi
|
||||
|
||||
shfmt -i 2 -w -s -sr $(git ls-files "*.sh")
|
||||
|
||||
local prettierExts
|
||||
prettierExts=(
|
||||
"*.js"
|
||||
"*.ts"
|
||||
"*.tsx"
|
||||
"*.html"
|
||||
"*.json"
|
||||
"*.css"
|
||||
"*.md"
|
||||
"*.toml"
|
||||
"*.yaml"
|
||||
"*.yml"
|
||||
)
|
||||
prettier --write --loglevel=warn $(git ls-files "${prettierExts[@]}")
|
||||
|
||||
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
|
||||
echo "Files need generation or are formatted incorrectly:"
|
||||
git -c color.ui=always status | grep --color=no '\[31m'
|
||||
echo "Please run the following locally:"
|
||||
echo " make fmt"
|
||||
echo " yarn fmt"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -9,4 +9,7 @@ RUN curl -L https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_li
|
|||
|
||||
COPY entrypoint.sh /bin/entrypoint.sh
|
||||
|
||||
ENV PAGER=cat
|
||||
ENV CI=true
|
||||
|
||||
ENTRYPOINT ["dumb-init", "/bin/entrypoint.sh"]
|
||||
|
|
10
ci/lint.sh
10
ci/lint.sh
|
@ -3,8 +3,14 @@
|
|||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
eslint --max-warnings=0 --fix $$(git ls-files "*.ts" "*.tsx" "*.js")
|
||||
stylelint --fix $$(git ls-files "*.css")
|
||||
if [[ ${CI-} ]]; then
|
||||
cd "$(dirname "$0")/.."
|
||||
./ci/vscode.sh
|
||||
fi
|
||||
|
||||
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js")
|
||||
stylelint --fix $(git ls-files "*.css")
|
||||
tsc --noEmit
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -8,7 +8,7 @@ function main() {
|
|||
cd "$(dirname "${0}")/.."
|
||||
|
||||
local code_server_version=${VERSION:-${TRAVIS_TAG:-${DRONE_TAG:-}}}
|
||||
if [[ -z $code_server_version ]] ; then
|
||||
if [[ -z $code_server_version ]]; then
|
||||
code_server_version=$(grep version ./package.json | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[:space:]')
|
||||
fi
|
||||
export VERSION=$code_server_version
|
||||
|
@ -17,33 +17,33 @@ function main() {
|
|||
export YARN_CACHE_FOLDER
|
||||
|
||||
# Always minify and package on tags since that's when releases are pushed.
|
||||
if [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]] ; then
|
||||
if [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]]; then
|
||||
export MINIFY="true"
|
||||
export PACKAGE="true"
|
||||
fi
|
||||
|
||||
yarn build
|
||||
yarn binary
|
||||
if [[ -n ${PACKAGE:-} ]] ; then
|
||||
if [[ -n ${PACKAGE:-} ]]; then
|
||||
yarn package
|
||||
fi
|
||||
|
||||
cd binaries
|
||||
|
||||
if [[ -n ${STRIP_BIN_TARGET:-} ]] ; then
|
||||
if [[ -n ${STRIP_BIN_TARGET:-} ]]; then
|
||||
# In this case provide plainly named binaries.
|
||||
for binary in code-server* ; do
|
||||
for binary in code-server*; do
|
||||
echo "Moving $binary to code-server"
|
||||
mv "$binary" code-server
|
||||
done
|
||||
elif [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]] ; then
|
||||
elif [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]]; then
|
||||
# Prepare directory for uploading binaries on release.
|
||||
for binary in code-server* ; do
|
||||
for binary in code-server*; do
|
||||
mkdir -p "../binary-upload"
|
||||
|
||||
local prefix="code-server-$code_server_version-"
|
||||
local target="${binary#$prefix}"
|
||||
if [[ $target == "linux-x86_64" ]] ; then
|
||||
if [[ $target == "linux-x86_64" ]]; then
|
||||
echo "Copying $binary to ../binary-upload/latest-linux"
|
||||
cp "$binary" "../binary-upload/latest-linux"
|
||||
fi
|
|
@ -1,6 +1,4 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": [
|
||||
"./**/*.ts"
|
||||
]
|
||||
"include": ["./**/*.ts"]
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ main() {
|
|||
git submodule update --init
|
||||
|
||||
# If the patch fails to apply, then it's likely already applied
|
||||
yarn vscode:patch &>/dev/null || true
|
||||
yarn vscode:patch &> /dev/null || true
|
||||
|
||||
# Install VS Code dependencies.
|
||||
(cd lib/vscode && yarn)
|
||||
|
|
|
@ -7,12 +7,9 @@
|
|||
"vscode": "ci/vscode.sh",
|
||||
"vscode:patch": "cd ./lib/vscode && git apply ../../ci/vscode.patch",
|
||||
"vscode:diff": "cd ./lib/vscode && git diff HEAD > ../../ci/vscode.patch",
|
||||
|
||||
"test": "mocha -r ts-node/register ./test/*.test.ts",
|
||||
|
||||
"lint": "ci/lint.sh",
|
||||
"fmt": "ci/fmt.sh",
|
||||
|
||||
"runner": "cd ./scripts && NODE_OPTIONS=--max_old_space_size=32384 ts-node ./build.ts",
|
||||
"build": "yarn runner build",
|
||||
"watch": "yarn runner watch",
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
"display": "fullscreen",
|
||||
"background-color": "#fff",
|
||||
"description": "Run editors on a remote server.",
|
||||
"icons": [{
|
||||
"icons": [
|
||||
{
|
||||
"src": "./code-server.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png"
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2,14 +2,21 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;">
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;" />
|
||||
<title>code-server — {{APP_NAME}}</title>
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link
|
||||
rel="manifest"
|
||||
href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json"
|
||||
crossorigin="use-credentials"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
|
||||
<meta id="coder-options" data-settings="{{OPTIONS}}">
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet" />
|
||||
<meta id="coder-options" data-settings="{{OPTIONS}}" />
|
||||
</head>
|
||||
<body>
|
||||
<script src="{{BASE}}/static-{{COMMIT}}/dist/app.js"></script>
|
||||
|
|
|
@ -2,13 +2,20 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;">
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;" />
|
||||
<title>code-server {{ERROR_TITLE}}</title>
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link
|
||||
rel="manifest"
|
||||
href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json"
|
||||
crossorigin="use-credentials"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="center-container">
|
||||
|
@ -18,7 +25,7 @@
|
|||
{{ERROR_BODY}}
|
||||
</div>
|
||||
<div class="links">
|
||||
<a class="link" href="{{BASE}}">go home</a
|
||||
<a class="link" href="{{BASE}}">go home</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,17 @@ body {
|
|||
background: #272727;
|
||||
color: #f4f4f4;
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-family:
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
"Segoe UI",
|
||||
Roboto,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif,
|
||||
"Apple Color Emoji",
|
||||
"Segoe UI Emoji",
|
||||
"Segoe UI Symbol";
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,14 +2,21 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;">
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;" />
|
||||
<title>code-server</title>
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link
|
||||
rel="manifest"
|
||||
href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json"
|
||||
crossorigin="use-credentials"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
|
||||
<meta id="coder-options" data-settings="{{OPTIONS}}">
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet" />
|
||||
<meta id="coder-options" data-settings="{{OPTIONS}}" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="center-container">
|
||||
|
|
|
@ -2,13 +2,23 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; script-src 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:;">
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="style-src 'self'; script-src 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:;"
|
||||
/>
|
||||
<title>code-server login</title>
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link
|
||||
rel="manifest"
|
||||
href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json"
|
||||
crossorigin="use-credentials"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="center-container">
|
||||
|
@ -22,7 +32,8 @@
|
|||
<div class="field">
|
||||
<!-- The onfocus code places the cursor at the end of the value. -->
|
||||
<input
|
||||
required autofocus
|
||||
required
|
||||
autofocus
|
||||
value="{{VALUE}}"
|
||||
onfocus="const value=this.value;this.value='';this.value=value;"
|
||||
class="password"
|
||||
|
|
|
@ -4,28 +4,38 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<meta http-equiv="Content-Security-Policy" content="font-src 'self'; connect-src 'self' https:; default-src ws: wss: 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; manifest-src 'self'; img-src 'self' data:;">
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="font-src 'self'; connect-src 'self' https:; default-src ws: wss: 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; manifest-src 'self'; img-src 'self' data:;"
|
||||
/>
|
||||
|
||||
<!-- Disable pinch zooming -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
|
||||
<!-- Workbench Configuration -->
|
||||
<meta id="vscode-workbench-web-configuration" data-settings="{{WORKBENCH_WEB_CONFIGURATION}}">
|
||||
<meta id="vscode-workbench-web-configuration" data-settings="{{WORKBENCH_WEB_CONFIGURATION}}" />
|
||||
|
||||
<!-- Workarounds/Hacks (remote user data uri) -->
|
||||
<meta id="vscode-remote-user-data-uri" data-settings="{{REMOTE_USER_DATA_URI}}">
|
||||
<meta id="vscode-remote-commit" data-settings="{{COMMIT}}">
|
||||
<meta id="vscode-remote-product-configuration" data-settings="{{PRODUCT_CONFIGURATION}}">
|
||||
<meta id="vscode-remote-nls-configuration" data-settings="{{NLS_CONFIGURATION}}">
|
||||
<meta id="vscode-remote-user-data-uri" data-settings="{{REMOTE_USER_DATA_URI}}" />
|
||||
<meta id="vscode-remote-commit" data-settings="{{COMMIT}}" />
|
||||
<meta id="vscode-remote-product-configuration" data-settings="{{PRODUCT_CONFIGURATION}}" />
|
||||
<meta id="vscode-remote-nls-configuration" data-settings="{{NLS_CONFIGURATION}}" />
|
||||
|
||||
<!-- Workbench Icon/Manifest/CSS -->
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link
|
||||
rel="manifest"
|
||||
href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json"
|
||||
crossorigin="use-credentials"
|
||||
/>
|
||||
<!-- PROD_ONLY
|
||||
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="{{VS_BASE}}/static-{{COMMIT}}/out/vs/workbench/workbench.web.api.css">
|
||||
END_PROD_ONLY -->
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
|
||||
<!-- Prefetch to avoid waterfall -->
|
||||
<!-- PROD_ONLY
|
||||
|
@ -33,53 +43,53 @@
|
|||
END_PROD_ONLY -->
|
||||
</head>
|
||||
|
||||
<body aria-label="">
|
||||
</body>
|
||||
<body aria-label=""></body>
|
||||
|
||||
<!-- Startup (do not modify order of script tags!) -->
|
||||
<script>
|
||||
const parts = window.location.pathname.replace(/^\//g, "").split("/")
|
||||
parts[parts.length - 1] = "{{VS_BASE}}"
|
||||
const url = new URL(window.location.origin + "/" + parts.join("/"))
|
||||
const el = document.getElementById('vscode-remote-commit');
|
||||
const commit = el ? el.getAttribute('data-settings') : "";
|
||||
const staticBase = url.href + '/static-' + commit;
|
||||
let nlsConfig;
|
||||
const el = document.getElementById("vscode-remote-commit")
|
||||
const commit = el ? el.getAttribute("data-settings") : ""
|
||||
const staticBase = url.href + "/static-" + commit
|
||||
let nlsConfig
|
||||
try {
|
||||
nlsConfig = JSON.parse(document.getElementById('vscode-remote-nls-configuration').getAttribute('data-settings'));
|
||||
nlsConfig = JSON.parse(document.getElementById("vscode-remote-nls-configuration").getAttribute("data-settings"))
|
||||
if (nlsConfig._resolvedLanguagePackCoreLocation) {
|
||||
const bundles = Object.create(null);
|
||||
const bundles = Object.create(null)
|
||||
nlsConfig.loadBundle = (bundle, language, cb) => {
|
||||
let result = bundles[bundle];
|
||||
let result = bundles[bundle]
|
||||
if (result) {
|
||||
return cb(undefined, result);
|
||||
return cb(undefined, result)
|
||||
}
|
||||
// FIXME: Only works if path separators are /.
|
||||
const path = nlsConfig._resolvedLanguagePackCoreLocation
|
||||
+ '/' + bundle.replace(/\//g, '!') + '.nls.json';
|
||||
const path = nlsConfig._resolvedLanguagePackCoreLocation + "/" + bundle.replace(/\//g, "!") + ".nls.json"
|
||||
fetch(`${url.href}/resource/?path=${encodeURIComponent(path)}`)
|
||||
.then((response) => response.json())
|
||||
.then((json) => {
|
||||
bundles[bundle] = json;
|
||||
cb(undefined, json);
|
||||
bundles[bundle] = json
|
||||
cb(undefined, json)
|
||||
})
|
||||
.catch(cb);
|
||||
};
|
||||
.catch(cb)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
/* Probably fine. */
|
||||
}
|
||||
} catch (error) { /* Probably fine. */ }
|
||||
self.require = {
|
||||
baseUrl: `${staticBase}/out`,
|
||||
paths: {
|
||||
'vscode-textmate': `${staticBase}/node_modules/vscode-textmate/release/main`,
|
||||
'onigasm-umd': `${staticBase}/node_modules/onigasm-umd/release/main`,
|
||||
'xterm': `${staticBase}/node_modules/xterm/lib/xterm.js`,
|
||||
'xterm-addon-search': `${staticBase}/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
|
||||
'xterm-addon-web-links': `${staticBase}/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
|
||||
'xterm-addon-webgl': `${staticBase}/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
|
||||
'semver-umd': `${staticBase}/node_modules/semver-umd/lib/semver-umd.js`,
|
||||
"vscode-textmate": `${staticBase}/node_modules/vscode-textmate/release/main`,
|
||||
"onigasm-umd": `${staticBase}/node_modules/onigasm-umd/release/main`,
|
||||
xterm: `${staticBase}/node_modules/xterm/lib/xterm.js`,
|
||||
"xterm-addon-search": `${staticBase}/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
|
||||
"xterm-addon-web-links": `${staticBase}/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
|
||||
"xterm-addon-webgl": `${staticBase}/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
|
||||
"semver-umd": `${staticBase}/node_modules/semver-umd/lib/semver-umd.js`,
|
||||
},
|
||||
'vs/nls': nlsConfig,
|
||||
};
|
||||
"vs/nls": nlsConfig,
|
||||
}
|
||||
</script>
|
||||
<script src="{{VS_BASE}}/static-{{COMMIT}}/out/vs/loader.js"></script>
|
||||
<!-- PROD_ONLY
|
||||
|
@ -87,6 +97,6 @@
|
|||
<script src="{{VS_BASE}}/static-{{COMMIT}}/out/vs/workbench/workbench.web.api.js"></script>
|
||||
END_PROD_ONLY -->
|
||||
<script>
|
||||
require(['vs/code/browser/workbench/workbench'], function() {});
|
||||
require(["vs/code/browser/workbench/workbench"], function() {})
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
@ -159,7 +159,7 @@ export class ReconnectingSocket {
|
|||
const socket = new WebSocket(
|
||||
`${location.protocol === "https:" ? "wss" : "ws"}://${location.host}${this.customPath || location.pathname}${
|
||||
location.search ? `?${location.search}` : ""
|
||||
}`
|
||||
}`,
|
||||
)
|
||||
|
||||
const reject = (): void => {
|
||||
|
|
|
@ -68,7 +68,7 @@ export class ApiHttpProvider extends HttpProvider {
|
|||
route: Route,
|
||||
request: http.IncomingMessage,
|
||||
socket: net.Socket,
|
||||
head: Buffer
|
||||
head: Buffer,
|
||||
): Promise<true | undefined> {
|
||||
if (!this.authenticated(request)) {
|
||||
throw new Error("not authenticated")
|
||||
|
@ -120,7 +120,7 @@ export class ApiHttpProvider extends HttpProvider {
|
|||
route: Route,
|
||||
request: http.IncomingMessage,
|
||||
socket: net.Socket,
|
||||
head: Buffer
|
||||
head: Buffer,
|
||||
): Promise<true> {
|
||||
const sessionId = route.requestPath.replace(/^\//, "")
|
||||
logger.debug("connecting session", field("sessionId", sessionId))
|
||||
|
@ -149,8 +149,8 @@ export class ApiHttpProvider extends HttpProvider {
|
|||
Buffer.from(
|
||||
JSON.stringify({
|
||||
protocol: "TODO",
|
||||
})
|
||||
)
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
||||
return true
|
||||
|
|
|
@ -63,7 +63,7 @@ export class MainHttpProvider extends HttpProvider {
|
|||
base: this.base(route),
|
||||
logLevel: logger.level,
|
||||
},
|
||||
(app && app.name) || ""
|
||||
(app && app.name) || "",
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -80,11 +80,11 @@ export class MainHttpProvider extends HttpProvider {
|
|||
.replace(/{{APP_LIST:RUNNING}}/g, this.getAppRows(recent.running))
|
||||
.replace(
|
||||
/{{APP_LIST:EDITORS}}/g,
|
||||
this.getAppRows(apps.filter((app) => app.categories && app.categories.includes("Editor")))
|
||||
this.getAppRows(apps.filter((app) => app.categories && app.categories.includes("Editor"))),
|
||||
)
|
||||
.replace(
|
||||
/{{APP_LIST:OTHER}}/g,
|
||||
this.getAppRows(apps.filter((app) => !app.categories || !app.categories.includes("Editor")))
|
||||
this.getAppRows(apps.filter((app) => !app.categories || !app.categories.includes("Editor"))),
|
||||
)
|
||||
return response
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ export class LoginHttpProvider extends HttpProvider {
|
|||
remoteAddress: request.connection.remoteAddress,
|
||||
userAgent: request.headers["user-agent"],
|
||||
timestamp: Math.floor(new Date().getTime() / 1000),
|
||||
})
|
||||
}),
|
||||
)
|
||||
|
||||
throw new Error("Incorrect password")
|
||||
|
|
|
@ -102,7 +102,7 @@ export class VscodeHttpProvider extends HttpProvider {
|
|||
"Upgrade: websocket",
|
||||
"Connection: Upgrade",
|
||||
`Sec-WebSocket-Accept: ${reply}`,
|
||||
].join("\r\n") + "\r\n\r\n"
|
||||
].join("\r\n") + "\r\n\r\n",
|
||||
)
|
||||
|
||||
const vscode = await this._vscode
|
||||
|
@ -146,7 +146,7 @@ export class VscodeHttpProvider extends HttpProvider {
|
|||
const response = await this.getUtf8Resource(this.vsRootPath, route.requestPath)
|
||||
response.content = response.content.replace(
|
||||
/{{COMMIT}}/g,
|
||||
this.workbenchOptions ? this.workbenchOptions.commit : ""
|
||||
this.workbenchOptions ? this.workbenchOptions.commit : "",
|
||||
)
|
||||
response.cache = true
|
||||
return response
|
||||
|
@ -186,7 +186,7 @@ export class VscodeHttpProvider extends HttpProvider {
|
|||
settings.lastVisited,
|
||||
this.args._ && this.args._.length > 0 ? { url: this.args._[0] } : undefined,
|
||||
],
|
||||
remoteAuthority
|
||||
remoteAuthority,
|
||||
)
|
||||
const [response, options] = await Promise.all([
|
||||
await this.getUtf8Resource(this.rootPath, "src/browser/pages/vscode.html"),
|
||||
|
@ -229,7 +229,7 @@ export class VscodeHttpProvider extends HttpProvider {
|
|||
*/
|
||||
private async getFirstValidPath(
|
||||
startPaths: Array<{ url?: string | string[]; workspace?: boolean } | undefined>,
|
||||
remoteAuthority: string
|
||||
remoteAuthority: string,
|
||||
): Promise<StartPath | undefined> {
|
||||
for (let i = 0; i < startPaths.length; ++i) {
|
||||
const startPath = startPaths[i]
|
||||
|
|
|
@ -92,13 +92,13 @@ export const optionDescriptions = (): string[] => {
|
|||
long: k.length > prev.long ? k.length : prev.long,
|
||||
short: v.short && v.short.length > prev.short ? v.short.length : prev.short,
|
||||
}),
|
||||
{ short: 0, long: 0 }
|
||||
{ short: 0, long: 0 },
|
||||
)
|
||||
return entries.map(
|
||||
([k, v]) =>
|
||||
`${" ".repeat(widths.short - (v.short ? v.short.length : 0))}${v.short ? `-${v.short}` : " "} --${k}${" ".repeat(
|
||||
widths.long - k.length
|
||||
)} ${v.description}${typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : ""}`
|
||||
widths.long - k.length,
|
||||
)} ${v.description}${typeof v.type === "object" ? ` [${Object.values(v.type).join(", ")}]` : ""}`,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ const main = async (args: Args): Promise<void> => {
|
|||
logger.info(
|
||||
typeof args.cert === "string"
|
||||
? ` - Using provided certificate${args["cert-key"] ? " and key" : ""} for HTTPS`
|
||||
: ` - Using generated certificate and key for HTTPS`
|
||||
: ` - Using generated certificate and key for HTTPS`,
|
||||
)
|
||||
} else {
|
||||
logger.info(" - Not serving HTTPS")
|
||||
|
|
|
@ -142,7 +142,7 @@ export abstract class HttpProvider {
|
|||
route: Route,
|
||||
request: http.IncomingMessage,
|
||||
socket: net.Socket,
|
||||
head: Buffer
|
||||
head: Buffer,
|
||||
): Promise<true | undefined>
|
||||
|
||||
/**
|
||||
|
@ -380,7 +380,7 @@ export class HttpServer {
|
|||
cert: this.options.cert && fs.readFileSync(this.options.cert),
|
||||
key: this.options.certKey && fs.readFileSync(this.options.certKey),
|
||||
},
|
||||
this.onRequest
|
||||
this.onRequest,
|
||||
)
|
||||
} else {
|
||||
this.server = http.createServer(this.onRequest)
|
||||
|
@ -420,7 +420,7 @@ export class HttpServer {
|
|||
commit: this.options.commit,
|
||||
password: this.options.password,
|
||||
},
|
||||
a1
|
||||
a1,
|
||||
)
|
||||
this.providers.set(`/${endpoint}`, p)
|
||||
return p
|
||||
|
|
|
@ -14,7 +14,7 @@ const getXdgDataDir = (): string => {
|
|||
case "darwin":
|
||||
return path.join(
|
||||
process.env.XDG_DATA_HOME || path.join(os.homedir(), "Library/Application Support"),
|
||||
"code-server"
|
||||
"code-server",
|
||||
)
|
||||
default:
|
||||
return path.join(process.env.XDG_DATA_HOME || path.join(os.homedir(), ".local/share"), "code-server")
|
||||
|
|
|
@ -76,7 +76,7 @@ export class IpcMain {
|
|||
`${child ? "wrapper" : "inner process"} ${process.pid} received message from ${
|
||||
child ? child.pid : this.parentPid
|
||||
}`,
|
||||
field("message", message)
|
||||
field("message", message),
|
||||
)
|
||||
if (message.type === "handshake") {
|
||||
target.removeListener("message", onMessage)
|
||||
|
@ -122,7 +122,7 @@ export const ipcMain = (): IpcMain => {
|
|||
_ipcMain = new IpcMain(
|
||||
typeof process.env.CODE_SERVER_PARENT_PID !== "undefined"
|
||||
? parseInt(process.env.CODE_SERVER_PARENT_PID)
|
||||
: undefined
|
||||
: undefined,
|
||||
)
|
||||
}
|
||||
return _ipcMain
|
||||
|
|
|
@ -73,7 +73,7 @@ describe("cli", () => {
|
|||
"user-data-dir": path.resolve("bar"),
|
||||
verbose: true,
|
||||
version: true,
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
|
|
|
@ -20,8 +20,5 @@
|
|||
"rootDir": "./src",
|
||||
"typeRoots": ["./node_modules/@types", "./typings"]
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*.ts",
|
||||
"./src/**/*.tsx"
|
||||
]
|
||||
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ declare module "httpolyglot" {
|
|||
function createServer(requestListener?: (req: http.IncomingMessage, res: http.ServerResponse) => void): http.Server
|
||||
function createServer(
|
||||
options: https.ServerOptions,
|
||||
requestListener?: (req: http.IncomingMessage, res: http.ServerResponse) => void
|
||||
requestListener?: (req: http.IncomingMessage, res: http.ServerResponse) => void,
|
||||
): https.Server
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue