Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
m0_70161158
code-server
提交
2504f6fc
C
code-server
项目概览
m0_70161158
/
code-server
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2504f6fc
编写于
9月 15, 2021
作者:
T
Teffen Ellis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add linkup command to improve link functionality
上级
6eda7ae8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
54 addition
and
5 deletion
+54
-5
.gitignore
.gitignore
+1
-0
ci/build/build-code-server.sh
ci/build/build-code-server.sh
+14
-5
ci/build/build-release.sh
ci/build/build-release.sh
+1
-0
ci/build/npm-postinstall.sh
ci/build/npm-postinstall.sh
+6
-0
src/node/link.ts
src/node/link.ts
+22
-0
src/node/main.ts
src/node/main.ts
+10
-0
未找到文件。
.gitignore
浏览文件 @
2504f6fc
...
...
@@ -12,6 +12,7 @@ vendor/modules
node-*
/plugins
/lib/coder-cloud-agent
/lib/linkup
.home
coverage
**/.DS_Store
...
...
ci/build/build-code-server.sh
浏览文件 @
2504f6fc
...
...
@@ -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.
# lib.sh normalizes macos to darwin - but cloud-agent's binaries do not
source
./ci/lib.sh
OS
=
"
$(
uname
|
tr
'[:upper:]'
'[:lower:]'
)
"
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://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
if
!
[
-f
./lib/linkup
]
;
then
echo
"Downloading Link agent..."
set
+e
curl
-fsSL
"https://storage.googleapis.com/coder-link-releases/latest/linkup-
$OS
-
$ARCH
"
-o
./lib/linkup
chmod
+x ./lib/linkup
set
-e
fi
yarn browserify out/browser/register.js
-o
out/browser/register.browserified.js
yarn browserify out/browser/pages/login.js
-o
out/browser/pages/login.browserified.js
yarn browserify out/browser/pages/vscode.js
-o
out/browser/pages/vscode.browserified.js
...
...
ci/build/build-release.sh
浏览文件 @
2504f6fc
...
...
@@ -61,6 +61,7 @@ EOF
rsync node_modules/
"
$RELEASE_PATH
/node_modules"
mkdir
-p
"
$RELEASE_PATH
/lib"
rsync ./lib/coder-cloud-agent
"
$RELEASE_PATH
/lib"
rsync ./lib/linkup
"
$RELEASE_PATH
/lib"
fi
}
...
...
ci/build/npm-postinstall.sh
浏览文件 @
2504f6fc
...
...
@@ -63,6 +63,12 @@ main() {
echo
"Failed to download cloud agent; --link will not work"
fi
if
curl
-fsSL
"https://storage.googleapis.com/coder-link-releases/latest/linkup-
$OS
-
$ARCH
"
-o
./lib/linkup
;
then
chmod
+x ./lib/linkup
else
echo
"Failed to download Link agent; the Link extension will not work"
fi
if
!
vscode_yarn
;
then
echo
"You may not have the required dependencies to build the native modules."
echo
"Please see https://github.com/cdr/code-server/blob/master/docs/npm.md"
...
...
src/node/link.ts
0 → 100644
浏览文件 @
2504f6fc
import
{
logger
}
from
"
@coder/logger
"
import
{
spawn
}
from
"
child_process
"
import
path
from
"
path
"
export
function
startLink
(
port
:
number
):
Promise
<
void
>
{
logger
.
debug
(
`running link targetting
${
port
}
`
)
const
agent
=
spawn
(
path
.
resolve
(
__dirname
,
"
../../lib/linkup
"
),
[
"
--devurl
"
,
`code:
${
port
}
:code-server`
],
{
shell
:
false
,
})
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
浏览文件 @
2504f6fc
...
...
@@ -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> =
logger
.
info
(
"
- Connected to cloud agent
"
)
}
try
{
const
port
=
parseInt
(
serverAddress
.
split
(
"
:
"
).
pop
()
as
string
,
10
)
startLink
(
port
).
catch
((
ex
)
=>
{
logger
.
debug
(
"
Link daemon exited!
"
,
field
(
"
error
"
,
ex
))
})
}
catch
(
ex
)
{
logger
.
debug
(
"
Failed to start link daemon!
"
,
ex
)
}
if
(
args
.
enable
&&
args
.
enable
.
length
>
0
)
{
logger
.
info
(
"
Enabling the following experimental features:
"
)
args
.
enable
.
forEach
((
feature
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录