Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
布及
code-server
提交
21d3062b
C
code-server
项目概览
布及
/
code-server
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
21d3062b
编写于
7月 28, 2021
作者:
T
Teffen Ellis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Touch up names.
上级
fbe15f7a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
5 deletion
+12
-5
src/node/provider.ts
src/node/provider.ts
+5
-0
src/node/routes/vscode.ts
src/node/routes/vscode.ts
+7
-5
未找到文件。
src/node/
vscode
.ts
→
src/node/
provider
.ts
浏览文件 @
21d3062b
...
...
@@ -10,6 +10,11 @@ import { SocketProxyProvider } from "./socket"
import
{
isFile
}
from
"
./util
"
import
{
onMessage
,
wrapper
}
from
"
./wrapper
"
/**
* Provides an interface to manage a child VS Code process.
*
* @remark This shouldn't be confused with the actual child process.
*/
export
class
VscodeProvider
{
public
readonly
serverRootPath
:
string
public
readonly
vsRootPath
:
string
...
...
src/node/routes/vscode.ts
浏览文件 @
21d3062b
...
...
@@ -10,13 +10,13 @@ import { getFirstString } from "../../common/util"
import
{
Feature
}
from
"
../cli
"
import
{
isDevMode
,
rootPath
,
version
}
from
"
../constants
"
import
{
authenticated
,
ensureAuthenticated
,
redirect
,
replaceTemplates
}
from
"
../http
"
import
{
VscodeProvider
}
from
"
../provider
"
import
{
getMediaMime
,
pathToFsPath
}
from
"
../util
"
import
{
VscodeProvider
}
from
"
../vscode
"
import
{
Router
as
WsRouter
}
from
"
../wsRouter
"
export
const
router
=
Router
()
const
vscode
=
new
VscodeProvider
()
const
vscode
Provider
=
new
VscodeProvider
()
router
.
get
(
"
/
"
,
async
(
req
,
res
)
=>
{
const
isAuthenticated
=
await
authenticated
(
req
)
...
...
@@ -31,7 +31,7 @@ router.get("/", async (req, res) => {
await
fs
.
readFile
(
path
.
join
(
rootPath
,
"
src/browser/pages/vscode.html
"
),
"
utf8
"
),
(
async
()
=>
{
try
{
return
await
vscode
.
initialize
({
args
:
req
.
args
,
remoteAuthority
:
req
.
headers
.
host
||
""
},
req
.
query
)
return
await
vscode
Provider
.
initialize
({
args
:
req
.
args
,
remoteAuthority
:
req
.
headers
.
host
||
""
},
req
.
query
)
}
catch
(
error
)
{
const
devMessage
=
isDevMode
?
"
It might not have finished compiling.
"
:
""
throw
new
Error
(
`VS Code failed to load.
${
devMessage
}
${
error
.
message
}
`
)
...
...
@@ -91,7 +91,9 @@ router.get("/webview/*", ensureAuthenticated, async (req, res) => {
return
res
.
send
(
await
fs
.
readFile
(
req
.
params
[
0
].
replace
(
/^vscode-resource
(\/
file
)?
/
,
""
)))
}
return
res
.
send
(
await
fs
.
readFile
(
path
.
join
(
vscode
.
vsRootPath
,
"
out/vs/workbench/contrib/webview/browser/pre
"
,
req
.
params
[
0
])),
await
fs
.
readFile
(
path
.
join
(
vscodeProvider
.
vsRootPath
,
"
out/vs/workbench/contrib/webview/browser/pre
"
,
req
.
params
[
0
]),
),
)
})
...
...
@@ -228,5 +230,5 @@ wsRouter.ws("/", ensureAuthenticated, async (req) => {
req
.
ws
.
write
(
responseHeaders
.
join
(
"
\r\n
"
)
+
"
\r\n\r\n
"
)
await
vscode
.
sendWebsocket
(
req
.
ws
,
req
.
query
,
useCompression
)
await
vscode
Provider
.
sendWebsocket
(
req
.
ws
,
req
.
query
,
useCompression
)
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录