We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 780991b commit 4fdd243Copy full SHA for 4fdd243
.gitignore
@@ -12,6 +12,7 @@ vendor/modules
12
node-*
13
/plugins
14
/lib/coder-cloud-agent
15
+/lib/linkup
16
.home
17
coverage
18
**/.DS_Store
ci/build/build-code-server.sh
@@ -15,20 +15,29 @@ main() {
chmod +x out/node/entry.js
fi
+ # for arch; we do not use OS from lib.sh and get our own.
19
+ # lib.sh normalizes macos to darwin - but cloud-agent's binaries do not
20
+ source ./ci/lib.sh
21
+ OS="$(uname | tr '[:upper:]' '[:lower:]')"
22
+
23
if ! [ -f ./lib/coder-cloud-agent ]; then
24
echo "Downloading the cloud agent..."
25
- # 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:]')"
-
26
set +e
27
curl -fsSL "https://github.com/cdr/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent
28
chmod +x ./lib/coder-cloud-agent
29
set -e
30
31
32
+ if ! [ -f ./lib/linkup ]; then
33
+ echo "Downloading Link agent..."
34
35
+ set +e
36
+ curl -fsSL "https://storage.googleapis.com/coder-link-releases/latest/linkup-$OS-$ARCH" -o ./lib/linkup
37
+ chmod +x ./lib/linkup
38
+ set -e
39
+ fi
40
41
yarn browserify out/browser/register.js -o out/browser/register.browserified.js
42
yarn browserify out/browser/pages/login.js -o out/browser/pages/login.browserified.js
43
yarn browserify out/browser/pages/vscode.js -o out/browser/pages/vscode.browserified.js
ci/build/build-release.sh
@@ -61,6 +61,7 @@ EOF
61
rsync node_modules/ "$RELEASE_PATH/node_modules"
62
mkdir -p "$RELEASE_PATH/lib"
63
rsync ./lib/coder-cloud-agent "$RELEASE_PATH/lib"
64
+ rsync ./lib/linkup "$RELEASE_PATH/lib"
65
66
}
67
ci/build/npm-postinstall.sh
@@ -63,6 +63,12 @@ main() {
echo "Failed to download cloud agent; --link will not work"
+ if curl -fsSL "https://storage.googleapis.com/coder-link-releases/latest/linkup-$OS-$ARCH" -o ./lib/linkup; then
68
+ else
69
+ echo "Failed to download Link agent; the Link extension will not work"
70
71
72
if ! vscode_yarn; then
73
echo "You may not have the required dependencies to build the native modules."
74
echo "Please see https://github.com/cdr/code-server/blob/master/docs/npm.md"
src/node/link.ts
@@ -0,0 +1,22 @@
1
+import { logger } from "@coder/logger"
2
+import { spawn } from "child_process"
3
+import path from "path"
4
5
+export function startLink(port: number): Promise<void> {
6
+ logger.debug(`running link targetting ${port}`)
7
8
+ const agent = spawn(path.resolve(__dirname, "../../lib/linkup"), ["--devurl", `code:${port}:code-server`], {
9
+ shell: false,
10
+ })
11
+ return new Promise((res, rej) => {
+ agent.on("error", rej)
+ agent.on("close", (code) => {
+ if (code !== 0) {
+ return rej({
+ message: `Link exited with ${code}`,
+ }
+ res()
+}
src/node/main.ts
@@ -8,6 +8,7 @@ import { createApp, ensureAddress } from "./app"
import { AuthType, DefaultedArgs, Feature } from "./cli"
import { coderCloudBind } from "./coder_cloud"
import { commit, version } from "./constants"
+import { startLink } from "./link"
import { register } from "./routes"
import { humanPath, isFile, open } from "./util"
@@ -129,6 +130,15 @@ export const runCodeServer = async (args: DefaultedArgs): Promise<http.Server> =
129
130
logger.info(" - Connected to cloud agent")
131
132
133
+ try {
134
+ const port = parseInt(serverAddress.split(":").pop() as string, 10)
135
+ startLink(port).catch((ex) => {
136
+ logger.debug("Link daemon exited!", field("error", ex))
137
138
+ } catch (ex) {
139
+ logger.debug("Failed to start link daemon!", ex)
140
141
142
if (args.enable && args.enable.length > 0) {
143
logger.info("Enabling the following experimental features:")
144
args.enable.forEach((feature) => {
vendor/package.json
@@ -7,6 +7,6 @@
"postinstall": "./postinstall.sh"
},
"devDependencies": {
- "code-oss-dev": "cdr/vscode#96a09a7846538c3bbedb6a2aeca729537bb8202b"
+ "code-oss-dev": "cdr/vscode#17834274b6acc63582c1150fc621c243373ddeb9"
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments